1# 2# Sample script to checkout & build 'openconnect' project 3# with mingw32 on MSYS2 toolchain 4# 5 6[ "$MSYSTEM" != "MINGW32" ] && exit -1 7echo "Starting under MINGW32 build environment..." 8 9export OC_TAG=v7.08 10export STOKEN_TAG=v0.92 11 12pacman --needed -S \ 13 mingw-w64-i686-gnutls \ 14 mingw-w64-i686-libidn2 \ 15 mingw-w64-i686-libunistring \ 16 mingw-w64-i686-nettle \ 17 mingw-w64-i686-gmp \ 18 mingw-w64-i686-p11-kit \ 19 mingw-w64-i686-zlib \ 20 mingw-w64-i686-libxml2 \ 21 mingw-w64-i686-zlib \ 22 mingw-w64-i686-libxml2 \ 23 mingw-w64-i686-lz4 \ 24 mingw-w64-i686-libproxy 25 26 27[ -d work ] || mkdir work 28cd work 29 30[ -d stoken ] || git clone https://github.com/cernekee/stoken 31cd stoken 32git checkout ${STOKEN_TAG} 33./autogen.sh 34[ -d build32 ] || mkdir build32 35cd build32 36git clean -fdx 37../configure --disable-dependency-tracking --without-tomcrypt --without-gtk 38mingw32-make -j4 39mingw32-make install 40cd ../../ 41 42[ -d openconnect ] || git clone git://git.infradead.org/users/dwmw2/openconnect.git 43cd openconnect 44git reset --hard 45git checkout ${OC_TAG} 46./autogen.sh 47[ -d build32 ] || mkdir build32 48cd build32 49git clean -fdx 50../configure --disable-dependency-tracking --with-gnutls --without-openssl --without-libpskc --with-vpnc-script=vpnc-script-win.js 51mingw32-make -j4 52cd ../../ 53 54 55# 56# Sample script to create a package from build 'openconnect' project 57# incl. all dependencies (hardcoded paths!) 58# 59 60export MINGW_PREFIX=/mingw32 61 62rm -rf pkg 63mkdir -p pkg/nsis && cd pkg/nsis 64#cp ${MINGW_PREFIX}/bin/iconv.dll . 65cp ${MINGW_PREFIX}/bin/libffi-6.dll . 66cp ${MINGW_PREFIX}/bin/libgcc_*-1.dll . 67cp ${MINGW_PREFIX}/bin/libgmp-10.dll . 68cp ${MINGW_PREFIX}/bin/libgnutls-30.dll . 69cp ${MINGW_PREFIX}/bin/libhogweed-4.dll . 70cp ${MINGW_PREFIX}/bin/libintl-8.dll . 71cp ${MINGW_PREFIX}/bin/libnettle-6.dll . 72cp ${MINGW_PREFIX}/bin/libp11-kit-0.dll . 73cp ${MINGW_PREFIX}/bin/libtasn1-6.dll . 74cp ${MINGW_PREFIX}/bin/libwinpthread-1.dll . 75cp ${MINGW_PREFIX}/bin/libxml2-2.dll . 76cp ${MINGW_PREFIX}/bin/zlib1.dll . 77cp ${MINGW_PREFIX}/bin/libstoken-1.dll . 78cp ${MINGW_PREFIX}/bin/libproxy-1.dll . 79cp ${MINGW_PREFIX}/bin/liblz4.dll . 80cp ${MINGW_PREFIX}/bin/libiconv-2.dll . 81cp ${MINGW_PREFIX}/bin/libunistring-2.dll . 82cp ${MINGW_PREFIX}/bin/libidn2-0.dll . 83cp ${MINGW_PREFIX}/bin/libstdc++-6.dll . 84cp ${MINGW_PREFIX}/bin/liblzma-5.dll . 85cp ../../openconnect/build32/.libs/libopenconnect-5.dll . 86cp ../../openconnect/build32/.libs/openconnect.exe . 87curl -v -o vpnc-script-win.js http://git.infradead.org/users/dwmw2/vpnc-scripts.git/blob_plain/HEAD:/vpnc-script-win.js 88cd ../../ 89 90mkdir -p pkg/lib && cd pkg/lib 91cp ${MINGW_PREFIX}/lib/libgmp.dll.a . 92cp ${MINGW_PREFIX}/lib/libgnutls.dll.a . 93cp ${MINGW_PREFIX}/lib/libhogweed.dll.a . 94cp ${MINGW_PREFIX}/lib/libnettle.dll.a . 95cp ${MINGW_PREFIX}/lib/libp11-kit.dll.a . 96cp ${MINGW_PREFIX}/lib/libxml2.dll.a . 97cp ${MINGW_PREFIX}/lib/libz.dll.a . 98cp ${MINGW_PREFIX}/lib/libstoken.dll.a . 99cp ${MINGW_PREFIX}/lib/libproxy.dll.a . 100cp ${MINGW_PREFIX}/lib/liblz4.dll.a . 101cp ${MINGW_PREFIX}/lib/libiconv.dll.a . 102cp ${MINGW_PREFIX}/lib/libunistring.dll.a . 103cp ${MINGW_PREFIX}/lib/libidn2.dll.a . 104cp ${MINGW_PREFIX}/lib/liblzma.dll.a . 105cp ../../openconnect/build32/.libs/libopenconnect.dll.a . 106cd ../../ 107 108mkdir -p pkg/lib/pkgconfig && cd pkg/lib/pkgconfig 109cp ${MINGW_PREFIX}/lib/pkgconfig/gnutls.pc . 110cp ${MINGW_PREFIX}/lib/pkgconfig/hogweed.pc . 111cp ${MINGW_PREFIX}/lib/pkgconfig/libxml-2.0.pc . 112cp ${MINGW_PREFIX}/lib/pkgconfig/nettle.pc . 113cp ${MINGW_PREFIX}/lib/pkgconfig/zlib.pc . 114cp ${MINGW_PREFIX}/lib/pkgconfig/stoken.pc . 115cp ../../../openconnect/build32/openconnect.pc . 116cd ../../../ 117 118mkdir -p pkg/include && cd pkg/include 119cp -R ${MINGW_PREFIX}/include/gnutls/ . 120cp -R ${MINGW_PREFIX}/include/libxml2/ . 121cp -R ${MINGW_PREFIX}/include/nettle/ . 122cp -R ${MINGW_PREFIX}/include/p11-kit-1/p11-kit/ . 123cp ${MINGW_PREFIX}/include/gmp.h . 124cp ${MINGW_PREFIX}/include/zconf.h . 125cp ${MINGW_PREFIX}/include/zlib.h . 126cp ${MINGW_PREFIX}/include/stoken.h . 127cp ../../openconnect/openconnect.h . 128cd ../../ 129 130export MINGW_PREFIX= 131 132cd pkg/nsis 1337za a -tzip -mx=9 -sdel ../../openconnect-${OC_TAG}_mingw32.zip * 134cd ../ 135rmdir -v nsis 1367za a -tzip -mx=9 -sdel ../openconnect-devel-${OC_TAG}_mingw32.zip * 137cd ../ 138rmdir -v pkg 139 140 141#cd stoken/build32 142#sudo mingw32-make uninstall 143 144echo "List of system-wide used packages versions:" \ 145 > openconnect-${OC_TAG}_mingw32.txt 146echo "openconnect-${OC_TAG}" \ 147 >> openconnect-${OC_TAG}_mingw32.txt 148echo "stoken-${STOKEN_TAG}" \ 149 >> openconnect-${OC_TAG}_mingw32.txt 150pacman -Q \ 151 mingw-w64-i686-gnutls \ 152 mingw-w64-i686-libidn2 \ 153 mingw-w64-i686-libunistring \ 154 mingw-w64-i686-nettle \ 155 mingw-w64-i686-gmp \ 156 mingw-w64-i686-p11-kit \ 157 mingw-w64-i686-libxml2 \ 158 mingw-w64-i686-zlib \ 159 mingw-w64-i686-libxml2 \ 160 mingw-w64-i686-lz4 \ 161 mingw-w64-i686-libproxy \ 162 >> openconnect-${OC_TAG}_mingw32.txt 163 164sha512sum.exe openconnect-${OC_TAG}_mingw32.zip > openconnect-${OC_TAG}_mingw32.zip.sha512 165sha512sum.exe openconnect-devel-${OC_TAG}_mingw32.zip > openconnect-devel-${OC_TAG}_mingw32.zip.sha512 166 167mv -v openconnect-*.zip openconnect-*.txt openconnect-*.zip.sha512 .. 168