-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathautogen.sh
executable file
·96 lines (79 loc) · 2.63 KB
/
autogen.sh
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
# special params:
# - po update .pot & po files
# - linguas update LINGUAS and POTFILES.in
# - release create release tarball
#===========================================================================
if test "$1" = "po" ; then
# Before creating a release you might want to update the po files
test -d "po/" || exit
#git clean -dfx
test -f ./configure || ./autogen.sh
test -f ./po/Makefile || ./configure
find po -name '*.pot' -delete # updates don't happen if pot files already exist...
make -C po update-po
# cleanup
rm -f po/*.po~
#sed -i '/#~ /d' po/*.po
#git clean -dfx
exit
fi
if test "$1" = "linguas" ; then
./po/Makefile.in.gen
exit $?
fi
#===========================================================================
if test "$1" == "release" || test "$1" == "--release" ; then
pkg="$(grep -m 1 AC_INIT configure.ac | cut -f 2 -d '[' | cut -f 1 -d ']')"
ver="$(grep -m 1 AC_INIT configure.ac | cut -f 3 -d '[' | cut -f 1 -d ']')"
ver=$(echo $ver)
dir=${pkg}-${ver}
rm -rf ../$dir
mkdir -p ../$dir
cp -rf $PWD/* ../$dir
( cd ../$dir ; ./autogen.sh )
cd ..
tar -Jcf ${dir}.tar.xz $dir
exit
fi
#===========================================================================
# autogen.sh [--verbose]
#===========================================================================
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
cd $srcdir
test -z "$AUTOMAKE" && AUTOMAKE=automake
test -z "$ACLOCAL" && ACLOCAL=aclocal
test -z "$AUTOCONF" && AUTOCONF=autoconf
test -z "$AUTOHEADER" && AUTOHEADER=autoheader
test -z "$LIBTOOLIZE" && LIBTOOLIZE=$(which libtoolize glibtoolize 2>/dev/null | head -1)
test -z "$LIBTOOLIZE" && LIBTOOLIZE=libtoolize #paranoid precaution
if test "$1" == "verbose" || test "$1" == "--verbose" ; then
set -x
verbose='--verbose'
verbose2='--debug'
fi
# pre-create some dirs / files
auxdir='.'
if grep -q "AC_CONFIG_AUX_DIR" configure.ac ; then
auxdir="$(grep AC_CONFIG_AUX_DIR configure.ac | cut -f 2 -d '[' | cut -f 1 -d ']')"
fi
mkdir -p ${auxdir}
touch ${auxdir}/config.rpath
m4dir="$(grep AC_CONFIG_MACRO_DIR configure.ac | cut -f 2 -d '[' | cut -f 1 -d ']')"
if test -n "$m4dir" ; then
mkdir -p ${m4dir}
fi
# Get all required m4 macros required for configure
if grep -q LT_INIT configure.ac ; then
$LIBTOOLIZE ${verbose} --copy --force || exit 1
fi
$ACLOCAL ${verbose} || exit 1
# Generate config.h.in
$AUTOHEADER ${verbose} --force || exit 1
# Generate Makefile.in's
$AUTOMAKE ${verbose} --add-missing --copy --force || exit 1
# generate configure
$AUTOCONF ${verbose} --force || exit 1
rm -rf autom4te.cache