andre@760: #!/bin/bash andre@1160: andre@1160: # Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik andre@1160: # Software engineering by Intevation GmbH andre@1160: # andre@1160: # This file is Free Software under the GNU GPL (v>=2) andre@1160: # and comes with ABSOLUTELY NO WARRANTY! andre@1160: # See LICENSE.txt for details. andre@1160: andre@1160: andre@760: # Helper script to package the files expected by the -admin application andre@760: # Windows build is expected to live in CMAKE_SOURCE_DIR/build-windows andre@760: set -x andre@760: set -e andre@760: andre@831: if [ ! -x `which wine` ]; then andre@831: echo "ERROR: Could not find wine." andre@831: exit 1 andre@831: fi andre@831: andre@885: if [ ! -f @CMAKE_SOURCE_DIR@/build-windows/Makefile ]; then andre@885: echo "Could not find a windows build in: @CMAKE_SOURCE_DIR@/build-windows " andre@885: exit 1 andre@885: fi andre@885: andre@885: if [ ! -f @CMAKE_SOURCE_DIR@/build-i386/Makefile ]; then andre@885: echo "Could not find a i386 build in: @CMAKE_SOURCE_DIR@/build-i386 " andre@885: exit 1 andre@885: fi andre@885: andre@760: TMPD=$(mktemp -d) andre@760: TMPDIR=$TMPD/TrustBridge-@PROJECT_VERSION@ andre@885: cd @CMAKE_SOURCE_DIR@/build-windows andre@885: echo "Updating windows build" andre@887: make -j`nproc` andre@885: cd @CMAKE_SOURCE_DIR@/build-i386 andre@885: echo "Building x86 package" andre@887: make -j`nproc` andre@972: /bin/bash packaging/linux-createpackage.sh i386 andre@760: cd @CMAKE_BINARY_DIR@ andre@885: echo "Building amd64 package" andre@972: /bin/bash packaging/linux-createpackage.sh x86_64 andre@760: mkdir -p $TMPDIR/linux andre@760: mkdir -p $TMPDIR/windows andre@885: mv @CMAKE_BINARY_DIR@/TrustBridge-@PROJECT_VERSION@.sh \ andre@885: $TMPDIR/linux/TrustBridge-@PROJECT_VERSION@-amd64.sh andre@885: mv @CMAKE_SOURCE_DIR@/build-i386/TrustBridge-@PROJECT_VERSION@.sh \ andre@885: $TMPDIR/linux/TrustBridge-@PROJECT_VERSION@-i386.sh andre@760: cp @CMAKE_SOURCE_DIR@/build-windows/ui/trustbridge.exe $TMPDIR/windows andre@1176: cp @CMAKE_SOURCE_DIR@/build-windows/cinst/trustbridge-certificate-installer.exe $TMPDIR/windows andre@1175: cp @CMAKE_SOURCE_DIR@/build-windows/cinst/trustbridge-nss-installer.exe $TMPDIR/windows andre@1121: cp -r @CMAKE_SOURCE_DIR@/packaging/resources $TMPDIR/resources andre@1121: cp @CMAKE_SOURCE_DIR@/build-windows/packaging/DesktopShellRun.dll $TMPDIR/resources andre@1186: cp -r @CMAKE_BINARY_DIR@/doc/help/client/html $TMPDIR/windows/doc andre@963: andre@1188: echo "; This file is autogenerated." > $TMPDIR/resources/filelist_in.nsh andre@1188: echo "; This file is autogenerated." > $TMPDIR/resources/filelist_un.nsh andre@1188: OLDDIR=$(pwd) andre@1188: cd $TMPDIR/windows andre@1188: for file in `find * -name \*.exe`; do andre@1188: echo File \"\${files_dir}\${path_sep}$file\" >> $TMPDIR/resources/filelist_in.nsh andre@1188: echo Delete \"\$INSTDIR\\$file\" >> $TMPDIR/resources/filelist_un.nsh andre@1188: done andre@1188: cd $TMPDIR/windows/doc andre@1188: andre@1188: for curdir in `find * -maxdepth 0 -type d -not -path .`; do andre@1188: cd $curdir andre@1188: curpath=\"\$INSTDIR\\doc\\$curdir\" andre@1188: echo SetOutPath $curpath >> $TMPDIR/resources/filelist_in.nsh andre@1188: for file in `find * -maxdepth 0 -type f`; do andre@1188: echo File \"\${files_dir}\${path_sep}doc\${path_sep}$curdir\${path_sep}$file\" >> $TMPDIR/resources/filelist_in.nsh andre@1188: echo Delete \"\$INSTDIR\\doc\\$curdir\\$file\" >> $TMPDIR/resources/filelist_un.nsh andre@1188: done andre@1188: echo RMDir $curpath >> $TMPDIR/resources/filelist_un.nsh andre@1188: cd - andre@1188: done andre@1188: andre@1188: echo SetOutPath \"\$INSTDIR\\doc\" >> $TMPDIR/resources/filelist_in.nsh andre@1188: for file in `find * -maxdepth 0 -type f -not -path .buildinfo`; do andre@1188: echo File \"\${files_dir}\${path_sep}doc\${path_sep}$file\" >> $TMPDIR/resources/filelist_in.nsh andre@1188: echo Delete \"\$INSTDIR\\doc\\$file\" >> $TMPDIR/resources/filelist_un.nsh andre@1188: done andre@1188: echo RMDir \"\$INSTDIR\\doc\" >> $TMPDIR/resources/filelist_un.nsh andre@1188: andre@1188: cd $OLDDIR andre@1188: andre@1188: andre@1188: andre@760: cp @CMAKE_SOURCE_DIR@/packaging/filelist.nsh $TMPDIR andre@760: cp @CMAKE_SOURCE_DIR@/packaging/trustbridge.nsi $TMPDIR andre@760: LC_ALL="de_DE.latin-1" echo "company=Bundesamt für Sicherheit in der Informationstechnik" > $TMPDIR/meta.ini andre@794: EST_SIZE=$(du -s $TMPDIR/windows | cut -f 1) andre@760: echo "version_number=@PROJECT_VERSION@" >> $TMPDIR/meta.ini andre@760: echo "setupname=%1TrustBridge-@PROJECT_VERSION@.exe" >> $TMPDIR/meta.ini andre@760: echo "productname=TrustBridge" >> $TMPDIR/meta.ini andre@852: echo "info_url=http://wald.intevation.org/projects/trustbridge/" >> $TMPDIR/meta.ini andre@820: echo "productname_short=TrustBridge" >> $TMPDIR/meta.ini andre@820: echo "description=TrustBridge" >> $TMPDIR/meta.ini andre@794: echo "size=$EST_SIZE" >> $TMPDIR/meta.ini andre@831: andre@831: # Create a temporary NSIS file for the uninstaller cration andre@831: LC_ALL="de_DE.latin-1" makensis -Dfiles_dir=$TMPDIR/windows \ andre@831: -Dcompany="Bundesamt für Sicherheit in der Informationstechnik" \ andre@1121: -Dplugin_dir="$TMPDIR/resources" \ andre@831: -Dversion_number=@PROJECT_VERSION@ \ andre@831: -Dsetupname="$TMPDIR/TrustBridge-@PROJECT_VERSION@-uni.exe" \ andre@831: -Dproductname="TrustBridge" \ andre@831: -Dpath_sep="/" \ andre@852: -Dinfo_url="http://wald.intevation.org/projects/trustbridge/" \ andre@831: -Dsize=$EST_SIZE \ andre@1187: -Ddescription="TrustBridge" \ andre@831: -DWRITE_UNINSTALLER \ andre@831: -Dproductname_short="TrustBridge" @CMAKE_SOURCE_DIR@/packaging/trustbridge.nsi andre@831: wine $TMPDIR/TrustBridge-@PROJECT_VERSION@-uni.exe /S || true andre@831: mv ~/.wine/drive_c/tmp-uninstaller/Uninstall.exe $TMPDIR/windows andre@831: rmdir ~/.wine/drive_c/tmp-uninstaller andre@831: rm $TMPDIR/TrustBridge-@PROJECT_VERSION@-uni.exe andre@831: andre@760: cd $TMPD andre@760: zip -r TrustBridge-@PROJECT_VERSION@.zip TrustBridge-@PROJECT_VERSION@ andre@760: mv TrustBridge-@PROJECT_VERSION@.zip @CMAKE_BINARY_DIR@ andre@760: rm -r $TMPD andre@760: echo "Package is: @CMAKE_BINARY_DIR@/TrustBridge-@PROJECT_VERSION@.zip"