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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
|
#!/bin/sh
# vim: expandtab sw=4 ts=4 sts=4:
# Usage: make-release [branch]
set -e
repo=gammu
toolchain=cmake/Toolchain-mingw32msvc.cmake
#toolchain=cmake/Toolchain-mingw32.cmake
version=`sed -n 's/set (VERSION "\([^"]*\)".*)/\1/p' CMakeLists.txt`
srcdir=`pwd`
if [ -f ~/.id/codesigning.spc -a "x$NO_SIGN" = "x" ] ; then
sign_passwd=`gk-get --user=nijel --object=codesign || true`
if [ -z "$sign_passwd" ] ; then
echo -n "Enter sign password: "
read sign_passwd
fi
fi
signexe() {
if [ ! -f ~/.id/codesigning.spc ] ; then
echo 'Skipping signing, no certificates!'
return 0
fi
if [ "x$NO_SIGN" != "x" ] ; then
echo 'Skipping signing, disabled!'
return 0
fi
echo "$sign_passwd" | signcode \
-spc ~/.id/codesigning.spc \
-v ~/.id/codesigning.pvk \
-a sha1 \
-$ individual \
-n "$2" \
-t http://timestamp.verisign.com/scripts/timstamp.dll \
-i http://cihar.com/ \
"$1"
rm "$1.bak"
}
checkexe() {
# Disabled for now because we don't build Python binaries
return
if /usr/i*mingw*/bin/objdump -x "$1" | grep -qi 'DLL Name.*msvcrt.dll' ; then
echo "Program $1 is linked to msvcrt.dll!"
exit 1
fi
}
CMAKE_EXTRA=""
if [ "x$1" = "x--debug" ] ; then
shift
CMAKE_EXTRA="$CMAKE_EXTRA -DCMAKE_BUILD_TYPE=Debug"
fi
dotag=0
if [ "x$1" = "xbranch" ] ; then
checkout=HEAD
dotag=1
# Pre release checks
if grep -q '^20[0-9][0-9]???? - ' ChangeLog ; then
echo 'ChangeLog does not seem to be finalised, aborting!'
exit 1
fi
shift
elif [ "x$1" = "x" ] ; then
checkout=HEAD
else
checkout=$1
version=$1
shift
fi
tmp=`mktemp -dt $repo-build-XXXXXX`
cd $tmp
echo Working in $tmp
echo "Creating release $version from $checkout"
git clone $srcdir $repo-$version
cd $repo-$version
git checkout $checkout
rm -rf .git
cd ..
echo 'Creating source tarballs...'
tar cfz $repo-$version.tar.gz $repo-$version
tar cfj $repo-$version.tar.bz2 $repo-$version
echo 'Building Windows version...'
mkdir build-win-shared
cd build-win-shared
cmake ../$repo-$version \
-DCMAKE_TOOLCHAIN_FILE=../$repo-$version/$toolchain \
-DBUILD_SHARED_LIBS=ON \
-DDLL_LIBMYSQL.DLL=~/win-cross/mysql/bin/libmysql.dll \
-DMYSQL_INCLUDE_DIR=~/win-cross/mysql/include \
-DMYSQL_LIBRARIES=~/win-cross/mysql/lib/libmysql.a \
-DWITH_LibDBI=OFF \
-DINSTALL_BASH_COMPLETION=OFF \
$CMAKE_EXTRA \
make -j2
checkexe gammu/gammu.exe
signexe gammu/gammu.exe "Gammu"
cpack -G NSIS
cpack -G ZIP
mv Gammu-*-Windows.* $tmp/
cd ..
mkdir build-win-minimal
echo "Building minimal Windows version..."
cd $tmp/build-win-minimal
cmake ../$repo-$version \
-DCMAKE_TOOLCHAIN_FILE=../$repo-$version/$toolchain \
-DBUILD_SHARED_LIBS=OFF \
$CMAKE_EXTRA \
-DCPACK_SYSTEM_NAME=Windows-Minimal \
-DWITH_Postgres=OFF \
-DWITH_MySQL=OFF \
-DWITH_GettextLibs=OFF \
-DWITH_Iconv=OFF \
-DWITH_CURL=OFF \
-DWITH_LibDBI=OFF \
-DINSTALL_BASH_COMPLETION=OFF \
make -j2
checkexe gammu/gammu.exe
signexe gammu/gammu.exe "Gammu"
cpack -G NSIS
cpack -G ZIP
mv Gammu-*-Windows-Minimal.* $tmp/
cd $tmp
if false ; then
mkdir build-win-python
for py in 2.6 ; do
pynodot=`echo $py | tr -d '.'`
echo "Building minimal Windows version with Python $py..."
cd $tmp/build-win-python
cmake ../$repo-$version \
-DCMAKE_TOOLCHAIN_FILE=../$repo-$version/$toolchain \
-DBUILD_SHARED_LIBS=OFF \
$CMAKE_EXTRA \
-DCPACK_SYSTEM_NAME=Windows-Minimal \
-DWITH_Postgres=OFF \
-DWITH_MySQL=OFF \
-DWITH_GettextLibs=OFF \
-DWITH_Iconv=ON \
-DWITH_CURL=OFF \
-DWITH_LibDBI=OFF \
-DPYTHON_LIBRARY=~/.wine/drive_c/Python$pynodot/libs/libpython$pynodot.a \
-DPYTHON_INCLUDE_PATH=~/.wine/drive_c/Python$pynodot/include/ \
-DPYTHON_EXECUTABLE=~/.wine/drive_c/Python$pynodot/python.exe \
-DINSTALL_BASH_COMPLETION=OFF \
make -j2
mkdir -p $tmp/$repo-$version/python/build/lib.win32-$py/gammu/
cp python/gammu/*.py $tmp/$repo-$version/python/build/lib.win32-$py/gammu/
cp python/gammu/*.pyd $tmp/$repo-$version/python/build/lib.win32-$py/gammu/
cp python/gammu/*.dll $tmp/$repo-$version/python/build/lib.win32-$py/gammu/
cd ..
cd $repo-$version/python
rm -rf gammu/CMakeFiles
wine \
~/.wine/drive_c/Python$pynodot/python.exe setup.py \
bdist_wininst --skip-build --target-version $py
mv dist/*.exe $tmp/
if [ $py != "2.4" ] ; then
wine \
~/.wine/drive_c/Python$pynodot/python.exe setup.py \
bdist_msi --skip-build --target-version $py
mv dist/*.msi $tmp/
fi
cd $tmp
done
fi
# Sign binaries (not for python-gammu, it breaks some code underneath)
for bin in $tmp/Gammu*.exe ; do
signexe $bin "Gammu installer"
done
# We're done
echo "Release is in $tmp directory"
ls -lh $tmp
cd "$srcdir"
if [ $dotag -eq 1 ] ; then
# Tag the release
git tag -s -m "Tag release $version" "$version"
# Submit to PyPi
$tmp/$repo-$version/python/setup.py register
# Upload to sf.net
./admin/upload-release $version $tmp
fi
|