Make sure IncompleteMessageID is -1 when invalid (bug #1540)
[gammu.git] / admin / make-release
bloba7677e30f9052aea6afe6fc045f5f0296bd65620
1 #!/bin/sh
2 # vim: expandtab sw=4 ts=4 sts=4:
4 # Usage: make-release [branch]
6 set -e
8 repo=gammu
9 #toolchain=cmake/Toolchain-mingw32msvc.cmake
10 toolchain=cmake/Toolchain-mingw32.cmake
11 toolchain64=cmake/Toolchain-mingw64.cmake
13 version=`sed -n 's/set (GAMMU_VERSION "\([^"]*\)".*)/\1/p' CMakeLists.txt`
15 srcdir=`pwd`
16 if [ -f ~/.id/codesigning.spc -a "x$NO_SIGN" = "x" ] ; then
17 sign_passwd=`gk-get --user=nijel --object=codesign || true`
18 if [ -z "$sign_passwd" ] ; then
19 echo -n "Enter sign password: "
20 read sign_passwd
24 signexe() {
25 if [ ! -f ~/.id/codesigning.spc ] ; then
26 echo 'Skipping signing, no certificates!'
27 return 0
29 if [ "x$NO_SIGN" != "x" ] ; then
30 echo 'Skipping signing, disabled!'
31 return 0
33 echo "$sign_passwd" | signcode \
34 -spc ~/.id/codesigning.spc \
35 -v ~/.id/codesigning.pvk \
36 -a sha1 \
37 -$ individual \
38 -n "$2" \
39 -t http://timestamp.verisign.com/scripts/timstamp.dll \
40 -i http://cihar.com/ \
41 "$1"
42 rm "$1.bak"
45 checkexe() {
46 # Disabled for now because we don't build Python binaries
47 return
48 if /usr/i*mingw*/bin/objdump -x "$1" | grep -qi 'DLL Name.*msvcrt.dll' ; then
49 echo "Program $1 is linked to msvcrt.dll!"
50 exit 1
55 CMAKE_EXTRA=""
56 if [ "x$1" = "x--debug" ] ; then
57 shift
58 CMAKE_EXTRA="$CMAKE_EXTRA -DCMAKE_BUILD_TYPE=Debug"
61 dotag=0
62 if [ "x$1" = "xbranch" ] ; then
63 checkout=HEAD
64 dotag=1
65 # Pre release checks
66 if grep -q '^20[0-9][0-9]???? - ' ChangeLog ; then
67 echo 'ChangeLog does not seem to be finalised, aborting!'
68 exit 1
70 shift
71 elif [ "x$1" = "x" ] ; then
72 checkout=HEAD
73 else
74 checkout=$1
75 version=$1
76 shift
79 tmp=`mktemp -dt $repo-build-XXXXXX`
80 cd $tmp
81 echo Working in $tmp
82 echo "Creating release $version from $checkout"
83 git clone $srcdir $repo-$version
84 cd $repo-$version
85 git checkout $checkout
86 git submodule update --init
87 find . -type d -name .git | xargs -r rm -rf
88 find . -type f -name .gitignore | xargs -r rm -f
89 cd ..
91 echo 'Creating source tarballs...'
92 tar cfz $repo-$version.tar.gz $repo-$version
93 tar cfj $repo-$version.tar.bz2 $repo-$version
94 tar cfJ $repo-$version.tar.xz $repo-$version
96 echo 'Building Windows version...'
97 mkdir build-win-shared
98 cd build-win-shared
99 cmake ../$repo-$version \
100 -DCMAKE_TOOLCHAIN_FILE=../$repo-$version/$toolchain \
101 -DBUILD_SHARED_LIBS=ON \
102 -DDLL_LIBMYSQL.DLL=~/win-cross/mysql/bin/libmysql.dll \
103 -DMYSQL_INCLUDE_DIR=~/win-cross/mysql/include \
104 -DMYSQL_LIBRARIES=~/win-cross/mysql/lib/libmysql.a \
105 -DWITH_LibDBI=OFF \
106 -DINSTALL_BASH_COMPLETION=OFF \
107 $CMAKE_EXTRA \
109 make -j2
110 checkexe gammu/gammu.exe
111 signexe gammu/gammu.exe "Gammu"
112 cpack -G NSIS
113 cpack -G ZIP
114 mv Gammu-*-Windows.* $tmp/
115 cd ..
117 mkdir build-win-minimal
118 echo "Building minimal Windows version..."
119 cd $tmp/build-win-minimal
120 cmake ../$repo-$version \
121 -DCMAKE_TOOLCHAIN_FILE=../$repo-$version/$toolchain \
122 -DBUILD_SHARED_LIBS=ON \
123 $CMAKE_EXTRA \
124 -DCPACK_SYSTEM_NAME=Windows-Minimal \
125 -DWITH_Postgres=OFF \
126 -DWITH_MySQL=OFF \
127 -DWITH_Libintl=OFF \
128 -DWITH_Iconv=OFF \
129 -DWITH_CURL=OFF \
130 -DWITH_Glib=OFF \
131 -DWITH_LibDBI=OFF \
132 -DINSTALL_BASH_COMPLETION=OFF \
134 make -j2
135 checkexe gammu/gammu.exe
136 signexe gammu/gammu.exe "Gammu"
137 cpack -G NSIS
138 cpack -G ZIP
139 mv Gammu-*-Windows-Minimal.* $tmp/
140 cd $tmp
142 mkdir build-win-64
143 echo "Building 64-bit Windows version..."
144 cd $tmp/build-win-64
145 cmake ../$repo-$version \
146 -DCMAKE_TOOLCHAIN_FILE=../$repo-$version/$toolchain64 \
147 -DBUILD_SHARED_LIBS=ON \
148 $CMAKE_EXTRA \
149 -DCPACK_SYSTEM_NAME=Windows-64bit \
150 -DWITH_Postgres=OFF \
151 -DWITH_MySQL=OFF \
152 -DWITH_LibDBI=OFF \
153 -DINSTALL_BASH_COMPLETION=OFF \
155 make -j2
156 checkexe gammu/gammu.exe
157 signexe gammu/gammu.exe "Gammu"
158 cpack -G NSIS
159 cpack -G ZIP
160 mv Gammu-*-Windows-64bit.* $tmp/
161 cd $tmp
163 if false ; then
164 mkdir build-win-python
165 for py in 2.6 ; do
166 pynodot=`echo $py | tr -d '.'`
167 echo "Building minimal Windows version with Python $py..."
168 cd $tmp/build-win-python
169 cmake ../$repo-$version \
170 -DCMAKE_TOOLCHAIN_FILE=../$repo-$version/$toolchain \
171 -DBUILD_SHARED_LIBS=OFF \
172 $CMAKE_EXTRA \
173 -DCPACK_SYSTEM_NAME=Windows-Minimal \
174 -DWITH_Postgres=OFF \
175 -DWITH_MySQL=OFF \
176 -DWITH_GettextLibs=OFF \
177 -DWITH_Iconv=ON \
178 -DWITH_CURL=OFF \
179 -DWITH_LibDBI=OFF \
180 -DPYTHON_LIBRARY=~/.wine/drive_c/Python$pynodot/libs/libpython$pynodot.a \
181 -DPYTHON_INCLUDE_PATH=~/.wine/drive_c/Python$pynodot/include/ \
182 -DPYTHON_EXECUTABLE=~/.wine/drive_c/Python$pynodot/python.exe \
183 -DINSTALL_BASH_COMPLETION=OFF \
185 make -j2
186 mkdir -p $tmp/$repo-$version/python/build/lib.win32-$py/gammu/
187 cp python/gammu/*.py $tmp/$repo-$version/python/build/lib.win32-$py/gammu/
188 cp python/gammu/*.pyd $tmp/$repo-$version/python/build/lib.win32-$py/gammu/
189 cp python/gammu/*.dll $tmp/$repo-$version/python/build/lib.win32-$py/gammu/
190 cd ..
191 cd $repo-$version/python
192 rm -rf gammu/CMakeFiles
193 wine \
194 ~/.wine/drive_c/Python$pynodot/python.exe setup.py \
195 bdist_wininst --skip-build --target-version $py
196 mv dist/*.exe $tmp/
197 if [ $py != "2.4" ] ; then
198 wine \
199 ~/.wine/drive_c/Python$pynodot/python.exe setup.py \
200 bdist_msi --skip-build --target-version $py
201 mv dist/*.msi $tmp/
203 cd $tmp
204 done
207 # Sign binaries (not for python-gammu, it breaks some code underneath)
208 for bin in $tmp/Gammu*.exe ; do
209 signexe $bin "Gammu installer"
210 done
212 # We're done
213 echo "Release is in $tmp directory"
214 ls -lh $tmp
216 cd "$srcdir"
218 if [ $dotag -eq 1 ] ; then
219 # Tag the release
220 git tag -s -m "Tag release $version" "$version"
221 # Submit to PyPi
222 $tmp/$repo-$version/python/setup.py register
223 # Upload to sf.net
224 ./admin/upload-release $version $tmp