]>
Commit | Line | Data |
---|---|---|
bb9905e9 AS |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TMPDIR=`mktemp -d` | |
bb9905e9 AS |
5 | trap 'rm -rf $TMPDIR' EXIT |
6 | ||
7 | if [ ! -f include/znc/main.h ] ; then | |
9166e6ed | 8 | echo "Can't find source!" |
bb9905e9 AS |
9 | exit -1 |
10 | fi | |
11 | ||
90b4c882 AS |
12 | if [ "x$1" = "x--nightly" ]; then |
13 | # e.g. ./make-tarball.sh --nightly znc-git-2014-04-21 path/to/output/znc-foo.tar.gz | |
14 | ZNCDIR=$2 | |
15 | TARGZ=$3 | |
16 | SIGN=0 | |
17 | DESC=-nightly-`date +%Y%m%d`-`git $GITDIR rev-parse HEAD | cut -b-8` | |
18 | else | |
19 | VERSION=$1 | |
20 | if [ "x$VERSION" = "x" ] ; then | |
21 | AWK_ARG='/#define VERSION_MAJOR/ { maj = $3 } | |
22 | /#define VERSION_MINOR/ { min = $3 } | |
23 | END { printf "%.1f", (maj + min / 10) }' | |
24 | VERSION=$(awk "$AWK_ARG" include/znc/main.h) | |
25 | fi | |
26 | if [ "x$VERSION" = "x" ] ; then | |
27 | echo "Couldn't get version number" | |
28 | exit -1 | |
29 | fi | |
30 | ||
31 | ZNCDIR=znc-$VERSION | |
32 | TARGZ=$ZNCDIR.tar.gz | |
33 | SIGN=1 | |
34 | DESC="" | |
35 | # DESC="-rc1" | |
bb9905e9 AS |
36 | fi |
37 | ||
90b4c882 | 38 | TARGZ=`realpath $TARGZ` |
bb9905e9 | 39 | |
90b4c882 AS |
40 | echo "Exporting . to $TMPDIR/$ZNCDIR..." |
41 | git checkout-index --all --prefix=$TMPDIR/$ZNCDIR/ | |
9166e6ed AS |
42 | sed -e 's:#include "Csocket.h":#include <znc/Csocket.h>:' third_party/Csocket/Csocket.cc > $TMPDIR/$ZNCDIR/src/Csocket.cpp |
43 | sed -e 's:#include "defines.h":#include <znc/defines.h>:' third_party/Csocket/Csocket.h > $TMPDIR/$ZNCDIR/include/znc/Csocket.h | |
bb9905e9 | 44 | ( |
90b4c882 | 45 | cd $TMPDIR/$ZNCDIR |
bb9905e9 AS |
46 | echo "Generating configure" |
47 | AUTOMAKE_FLAGS="--add-missing --copy" ./autogen.sh | |
48 | rm -r autom4te.cache/ | |
9166e6ed | 49 | mkdir -p modules/.depend |
f66acf9d AS |
50 | make -C modules -f modperl/Makefile.gen srcdir=. SWIG=`which swig` PERL=`which perl` |
51 | make -C modules -f modpython/Makefile.gen srcdir=. SWIG=`which swig` PERL=`which perl` | |
9166e6ed | 52 | rm -rf modules/.depend |
4acc2925 | 53 | rm .travis* |
bb9905e9 | 54 | rm make-tarball.sh |
90b4c882 | 55 | sed -e "s/THIS_IS_NOT_TARBALL//" -i Makefile.in |
cc279666 | 56 | echo '#include <znc/version.h>' > src/version.cpp |
baa798ce | 57 | echo "const char* ZNC_VERSION_EXTRA = VERSION_EXTRA \"$DESC\";" >> src/version.cpp |
bb9905e9 AS |
58 | ) |
59 | ( | |
60 | cd $TMPDIR | |
61 | echo "Creating tarball" | |
90b4c882 | 62 | env GZIP=-9 tar -czf $TARGZ $ZNCDIR |
bb9905e9 AS |
63 | ) |
64 | echo "Done" | |
90b4c882 AS |
65 | |
66 | if [ $SIGN = 1 ]; then | |
67 | echo "Signing $TARGZ..." | |
68 | gpg --detach-sig $TARGZ | |
69 | echo "Created $TARGZ and $TARGZ.sig" | |
70 | fi |