-
Notifications
You must be signed in to change notification settings - Fork 15
/
makedist
executable file
·44 lines (34 loc) · 1.34 KB
/
makedist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /bin/bash
set -e
[ -f "Makefile" ] || { echo "error: makefile not found"; exit 1; }
[ -f "configure.ac" ] || { echo "error: configure.ac not found"; exit 1; }
LZMA=0
if [ -n "$1" ]
then
if [ "$1" == lzma ]
then
LZMA=1
else
echo "error: unknown arg $1" > /dev/stderr;
exit 1;
fi
fi
BASE_NAME=$(head -n 50 configure.ac | grep "m4_define(\[library_base_name\], \[.*\])" | sed "s/m4_define(\[library_base_name\], \[\(.*\)\])/\1/")
API_VERSION=$(head -n 50 configure.ac | grep "m4_define(\[api_version\], \[.*\])" | sed "s/m4_define(\[api_version\], \[\(.*\)\])/\1/")
NAME="lib${BASE_NAME}-${API_VERSION}"
MAJOR_VER=$(head -n 50 configure.ac | grep "m4_define(\[package_major_version\], \[.*\])" | sed "s/m4_define(\[package_major_version\], \[\(.*\)\])/\1/")
MINOR_VER=$(head -n 50 configure.ac | grep "m4_define(\[package_minor_version\], \[.*\])" | sed "s/m4_define(\[package_minor_version\], \[\(.*\)\])/\1/")
MICRO_VER=$(head -n 50 configure.ac | grep "m4_define(\[package_micro_version\], \[.*\])" | sed "s/m4_define(\[package_micro_version\], \[\(.*\)\])/\1/")
PACKAGE_NAME="${NAME}-${MAJOR_VER}.${MINOR_VER}.${MICRO_VER}"
TAR_NAME="${PACKAGE_NAME}.tar"
TGZ_NAME="${TAR_NAME}.gz"
TBZ2_NAME="${TAR_NAME}.bz2"
TLZMA_NAME="${TAR_NAME}.lzma"
make distcheck
gunzip "${TGZ_NAME}"
if [[ $LZMA == 1 ]]
then
lzma "${TAR_NAME}"
else
bzip2 "${TAR_NAME}"
fi