]> jfr.im git - irc/evilnet/znc.git/blob - make-tarball.sh
Initial commit for evilnet modifications to znc 1.6.2
[irc/evilnet/znc.git] / make-tarball.sh
1 #!/bin/sh
2 set -e
3
4 TMPDIR=`mktemp -d`
5 trap 'rm -rf $TMPDIR' EXIT
6
7 if [ ! -f include/znc/main.h ] ; then
8 echo "Can't find source!"
9 exit -1
10 fi
11
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"
36 fi
37
38 TARGZ=`realpath $TARGZ`
39
40 echo "Exporting . to $TMPDIR/$ZNCDIR..."
41 git checkout-index --all --prefix=$TMPDIR/$ZNCDIR/
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
44 (
45 cd $TMPDIR/$ZNCDIR
46 echo "Generating configure"
47 AUTOMAKE_FLAGS="--add-missing --copy" ./autogen.sh
48 rm -r autom4te.cache/
49 mkdir -p modules/.depend
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`
52 rm -rf modules/.depend
53 rm .travis*
54 rm make-tarball.sh
55 sed -e "s/THIS_IS_NOT_TARBALL//" -i Makefile.in
56 echo '#include <znc/version.h>' > src/version.cpp
57 echo "const char* ZNC_VERSION_EXTRA = VERSION_EXTRA \"$DESC\";" >> src/version.cpp
58 )
59 (
60 cd $TMPDIR
61 echo "Creating tarball"
62 env GZIP=-9 tar -czf $TARGZ $ZNCDIR
63 )
64 echo "Done"
65
66 if [ $SIGN = 1 ]; then
67 echo "Signing $TARGZ..."
68 gpg --detach-sig $TARGZ
69 echo "Created $TARGZ and $TARGZ.sig"
70 fi