]> jfr.im git - irc/znc/znc.git/blob - make-tarball.sh
Update translations from Crowdin for de_DE es_ES pt_BR
[irc/znc/znc.git] / make-tarball.sh
1 #!/bin/sh
2 set -e
3
4 TMPDIR=`mktemp -d`
5 TMPDIR2=`mktemp -d`
6 trap 'rm -rf $TMPDIR $TMPDIR2' EXIT
7
8 if [ ! -f include/znc/main.h ] ; then
9 echo "Can't find source!"
10 exit -1
11 fi
12
13 if [ "x$1" = "x--nightly" ]; then
14 # e.g. ./make-tarball.sh --nightly znc-git-2014-04-21 path/to/output/znc-foo.tar.gz
15 ZNCDIR=$2
16 TARGZ=$3
17 SIGN=0
18 DESC=-nightly-`date +%Y%m%d`-`git $GITDIR rev-parse HEAD | cut -b-8`
19 else
20 VERSION=$1
21 if [ "x$VERSION" = "x" ] ; then
22 AWK_ARG='/#define VERSION_MAJOR/ { maj = $3 }
23 /#define VERSION_MINOR/ { min = $3 }
24 END { printf "%.1f", (maj + min / 10) }'
25 VERSION=$(awk "$AWK_ARG" include/znc/main.h)
26 fi
27 if [ "x$VERSION" = "x" ] ; then
28 echo "Couldn't get version number"
29 exit -1
30 fi
31
32 ZNCDIR=znc-$VERSION
33 TARGZ=$ZNCDIR.tar.gz
34 SIGN=1
35 DESC="$(sed -En 's/set\(alpha_version "(.*)"\).*/\1/p' CMakeLists.txt)"
36 fi
37
38 TARGZ=`readlink -f -- $TARGZ`
39
40 echo "Exporting . to $TMPDIR/$ZNCDIR..."
41 git checkout-index --all --prefix=$TMPDIR/$ZNCDIR/
42 mkdir -p --mode=0755 $TMPDIR/$ZNCDIR/third_party/Csocket
43 cp -p third_party/Csocket/Csocket.cc third_party/Csocket/Csocket.h $TMPDIR/$ZNCDIR/third_party/Csocket/
44 (
45 cd $TMPDIR2
46 cmake $TMPDIR/$ZNCDIR -DWANT_PERL=yes -DWANT_PYTHON=yes
47 make modperl_dist modpython_dist
48 )
49 (
50 cd $TMPDIR/$ZNCDIR
51 AUTOMAKE_FLAGS="--add-missing --copy" ./autogen.sh
52 rm -r autom4te.cache/
53 rm -rf .travis* .appveyor* .ci/
54 rm make-tarball.sh
55 # For autoconf
56 sed -e "s/THIS_IS_NOT_TARBALL//" -i Makefile.in
57 echo '#include <znc/version.h>' > src/version.cpp
58 echo "const char* ZNC_VERSION_EXTRA = VERSION_EXTRA \"$DESC\";" >> src/version.cpp
59 # For cmake
60 if [ "x$DESC" != "x" ]; then
61 echo $DESC > .nightly
62 fi
63 )
64 (
65 cd $TMPDIR
66 echo "Creating tarball"
67 env GZIP=-9 tar -czf $TARGZ $ZNCDIR
68 )
69 echo "Done"
70
71 if [ $SIGN = 1 ]; then
72 echo "Signing $TARGZ..."
73 gpg --detach-sig $TARGZ
74 echo "Created $TARGZ and $TARGZ.sig"
75 fi