3 # we assuem this script is <ardour-src>/tools/x-win/package
4 pushd "`/usr/bin/dirname \"$0\"`" > /dev/null; this_script_dir="`pwd`"; popd > /dev/null
5 cd $this_script_dir/../..
6 test -f gtk2_ardour/wscript || exit 1
8 : ${XARCH=i686} # or x86_64
12 : ${SRCDIR=/var/tmp/winsrc} # source-code tgz cache
14 if test "$XARCH" = "x86_64" -o "$XARCH" = "amd64"; then
15 echo "Target: 64bit Windows (x86_64)"
16 XPREFIX=x86_64-w64-mingw32
19 echo "Target: 32 Windows (i686)"
20 XPREFIX=i686-w64-mingw32
24 : ${PREFIX=${ROOT}/win-stack-$WARCH}
27 if [ "$(id -u)" = "0" ]; then
28 apt-get -y install nsis curl
33 echo "--- Downloading.. $2"
34 test -f ${SRCDIR}/$1 || curl -k -L -o ${SRCDIR}/$1 $2
37 ################################################################################
40 ARDOURVERSION=$(git describe | sed 's/-g.*$//')
42 BINVERSION=$(git describe | sed 's/-g.*$//' | sed 's/-/./')
43 if ! test -f build/gtk2_ardour/ardour-${BINVERSION}.exe; then
44 echo "*** Please compile ardour ${ARDOURVERSION} first."
49 ################################################################################
51 if test -z "$DESTDIR"; then
53 trap 'rm -rf $DESTDIR' exit SIGINT SIGTERM
56 echo " === bundle to $DESTDIR"
58 ALIBDIR=$DESTDIR/lib/ardour3
62 mkdir -p $DESTDIR/share/
63 mkdir -p $ALIBDIR/surfaces
64 mkdir -p $ALIBDIR/backends
65 mkdir -p $ALIBDIR/panners
66 mkdir -p $ALIBDIR/vamp
68 cp build/libs/gtkmm2ext/gtkmm2ext-*.dll $DESTDIR/bin/
69 cp build/libs/midi++2/midipp-*.dll $DESTDIR/bin/
70 cp build/libs/evoral/evoral-*.dll $DESTDIR/bin/
71 cp build/libs/ardour/ardour-*.dll $DESTDIR/bin/
72 cp build/libs/timecode/timecode.dll $DESTDIR/bin/
73 cp build/libs/qm-dsp/qmdsp-*.dll $DESTDIR/bin/
74 cp build/libs/canvas/canvas-*.dll $DESTDIR/bin/
75 cp build/libs/pbd/pbd-*.dll $DESTDIR/bin/
76 cp build/libs/audiographer/audiographer-*.dll $DESTDIR/bin/
77 cp build/libs/fst/ardour-vst-scanner.exe $DESTDIR/bin/ || true
78 cp `ls -t build/gtk2_ardour/ardour-*.exe | head -n1` $DESTDIR/bin/ardour.exe
80 mkdir -p $DESTDIR/lib/gtk-2.0/engines
81 cp build/libs/clearlooks-newer/clearlooks.dll $DESTDIR/lib/gtk-2.0/engines/libclearlooks.la
83 cp $PREFIX/bin/*dll $DESTDIR/bin/
84 cp $PREFIX/lib/*dll $DESTDIR/bin/
85 rm -rf $DESTDIR/bin/libjack*.dll
87 cp `find build/libs/surfaces/ -iname "*.dll"` $ALIBDIR/surfaces/
88 cp `find build/libs/backends/ -iname "*.dll"` $ALIBDIR/backends/
89 cp `find build/libs/panners/ -iname "*.dll"` $ALIBDIR/panners/
91 cp -r build/libs/LV2 $ALIBDIR/
92 cp -r build/libs/vamp-plugins/*ardourvampplugins*.dll $ALIBDIR/vamp/libardourvampplugins.dll
94 mv $ALIBDIR/surfaces/ardourcp-*.dll $DESTDIR/bin/
96 # TODO use -static-libgcc -static-libstdc++ -- but for .exe files only
97 if update-alternatives --query ${XPREFIX}-gcc | grep Value: | grep -q win32; then
98 cp /usr/lib/gcc/${XPREFIX}/*-win32/libgcc_s_*.dll $DESTDIR/bin/
99 cp /usr/lib/gcc/${XPREFIX}/*-win32/libstdc++-6.dll $DESTDIR/bin/
100 elif update-alternatives --query ${XPREFIX}-gcc | grep Value: | grep -q posix; then
101 cp /usr/lib/gcc/${XPREFIX}/*-posix/libgcc_s_*.dll $DESTDIR/bin/
102 cp /usr/lib/gcc/${XPREFIX}/*-posix/libstdc++-6.dll $DESTDIR/bin/
104 cp /usr/lib/gcc/${XPREFIX}/*/libgcc_s_sjlj-1.dll $DESTDIR/bin/
105 cp /usr/lib/gcc/${XPREFIX}/*/libstdc++-6.dll $DESTDIR/bin/
107 #Ubuntu's 14.04's mingw needs this one for the std libs above
108 if test -f /usr/${XPREFIX}/lib/libwinpthread-1.dll; then
109 cp /usr/${XPREFIX}/lib/libwinpthread-1.dll $DESTDIR/bin/
112 cp -r $PREFIX/share/ardour3 $DESTDIR/share/
113 cp -r $PREFIX/etc/ardour3/* $DESTDIR/share/ardour3/
115 cp COPYING $DESTDIR/share/
116 cp gtk2_ardour/icons/ardour.ico $DESTDIR/share/
117 cp gtk2_ardour/icons/ardour_bug.ico $DESTDIR/share/
119 # replace default cursor with square version (sans hotspot file)
120 cp gtk2_ardour/icons/cursor_square/* $DESTDIR/share/ardour3/icons/
122 # clean build-dir after depoyment
127 ################################################################################
129 if test -z "$NOVIDEOTOOLS"; then
130 echo " === Including video-tools"
131 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
132 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
134 rsync -a -q --partial \
135 rsync://ardour.org/video-tools/harvid_win-${HARVID_VERSION}.tar.xz \
136 "${SRCDIR}/harvid_win-${HARVID_VERSION}.tar.xz"
138 rsync -a -q --partial \
139 rsync://ardour.org/video-tools/xjadeo_win-${XJADEO_VERSION}.tar.xz \
140 "${SRCDIR}/xjadeo_win-${XJADEO_VERSION}.tar.xz"
143 tar -xf "${SRCDIR}/harvid_win-${HARVID_VERSION}.tar.xz" -C "$DESTDIR/video/"
144 tar -xf "${SRCDIR}/xjadeo_win-${XJADEO_VERSION}.tar.xz" -C "$DESTDIR/video/"
147 du -sh $DESTDIR/video
151 ################################################################################
152 ### include static gdb - re-zipped binaries from
153 ### http://sourceforge.net/projects/mingw/files/MinGW/Extension/gdb/gdb-7.6.1-1/gdb-7.6.1-1-mingw32-bin.tar.lzma
154 ### http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.1/threads-win32/sjlj/x86_64-4.9.1-release-win32-sjlj-rt_v3-rev1.7z
155 if ! grep " using ./waf configure" build/config.log | grep -q -- "--optimize"; then
156 download gdb-static-win3264.tar.xz http://robin.linuxaudio.org/gdb-static-win3264.tar.xz
158 tar xf gdb-static-win3264.tar.xz
161 echo " === Creating ardbg.bat"
162 cp -r ${SRCDIR}/gdb_$WARCH $DESTDIR/gdb
163 cat > $DESTDIR/ardbg.bat << EOF
165 START ..\\gdb\\bin\\gdb.exe -iex "set logging overwrite on" -iex "set height 0" -iex "set logging on %UserProfile%\\ardour-debug.log" ardour.exe
167 OUTFILE="${TMPDIR}/ardour-${ARDOURVERSION}-dbg-${WARCH}-Setup.exe"
168 VERSIONINFO="Debug Version."
170 OUTFILE="${TMPDIR}/ardour-${ARDOURVERSION}-${WARCH}-Setup.exe"
171 VERSIONINFO="Optimized Version."
174 ################################################################################
175 echo " === Preparing Windows Installer"
176 NSISFILE=$DESTDIR/a3.nsis
178 if test "$WARCH" = "w64"; then
184 if test -n "$QUICKZIP" ; then
185 cat > $NSISFILE << EOF
189 cat > $NSISFILE << EOF
190 SetCompressor /SOLID lzma
191 SetCompressorDictSize 32
195 cat >> $NSISFILE << EOF
199 RequestExecutionLevel admin
200 InstallDir "\$${PGF}\\ardour3"
201 InstallDirRegKey HKLM "Software\\Ardour\\ardour3\\$WARCH" "Install_Dir"
203 !define MUI_ICON "share\\ardour.ico"
204 !define MUI_FINISHPAGE_TITLE "Welcome to Ardour"
205 !define MUI_FINISHPAGE_TEXT "This windows versions or Ardour is provided as-is.\$\\r\$\\nThe ardour community currently has no expertise in supporting windows users, and there are no developers focusing on windows specific issues either.\$\\r\$\\nIf you like Ardour, please consider helping out."
206 !define MUI_FINISHPAGE_LINK "Ardour Manual"
207 !define MUI_FINISHPAGE_LINK_LOCATION "http://manual.ardour.org"
208 #this would run as admin - see http://forums.winamp.com/showthread.php?t=353366
209 #!define MUI_FINISHPAGE_RUN "\$INSTDIR\\bin\\ardour.exe"
210 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
212 !define MUI_ABORTWARNING
213 !insertmacro MUI_PAGE_LICENSE "share\\COPYING"
214 !insertmacro MUI_PAGE_COMPONENTS
215 !insertmacro MUI_PAGE_DIRECTORY
216 !insertmacro MUI_PAGE_INSTFILES
217 !insertmacro MUI_PAGE_FINISH
218 !insertmacro MUI_UNPAGE_CONFIRM
219 !insertmacro MUI_UNPAGE_INSTFILES
220 !insertmacro MUI_LANGUAGE "English"
222 Section "Ardour3 (required)" SecArdour
228 File /nonfatal ardbg.bat
229 File /nonfatal /r gdb
230 WriteRegStr HKLM SOFTWARE\\Ardour\\ardour3\\$WARCH "Install_Dir" "\$INSTDIR"
231 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ardour3" "DisplayName" "Ardour3"
232 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ardour3" "UninstallString" '"\$INSTDIR\\uninstall.exe"'
233 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ardour3" "NoModify" 1
234 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ardour3" "NoRepair" 1
235 WriteUninstaller "\$INSTDIR\uninstall.exe"
236 CreateShortCut "\$INSTDIR\\Ardour3.lnk" "\$INSTDIR\\bin\\ardour.exe" "" "\$INSTDIR\\bin\\ardour.exe" 0
240 if test -z "$NOVIDEOTOOLS"; then
242 cat >> $NSISFILE << EOF
243 Section "Videotimeline Tools" SecVideo
244 WriteRegStr HKLM SOFTWARE\\Ardour\\video "Install_Dir" "\$INSTDIR\\video"
252 cat >> $NSISFILE << EOF
253 Section "Start Menu Shortcuts" SecMenu
254 SetShellVarContext all
255 CreateDirectory "\$SMPROGRAMS\\ardour3"
256 CreateShortCut "\$SMPROGRAMS\\ardour3\\Ardour3.lnk" "\$INSTDIR\\bin\\ardour.exe" "" "\$INSTDIR\\bin\\ardour.exe" 0
259 if test -f "$DESTDIR/ardbg.bat"; then
260 cat >> $NSISFILE << EOF
261 CreateShortCut "\$SMPROGRAMS\\ardour3\\Ardour3 GDB.lnk" "\$INSTDIR\\ardbg.bat" "" "\$INSTDIR\\share\\ardour_bug.ico" 0
265 if test -z "$NOVIDEOTOOLS"; then
266 cat >> $NSISFILE << EOF
267 IfFileExists "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" 0 +2
268 CreateShortCut "\$SMPROGRAMS\\ardour3\\Video Monitor.lnk" "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" "" "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" 0
272 cat >> $NSISFILE << EOF
273 CreateShortCut "\$SMPROGRAMS\\ardour3\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0
275 LangString DESC_SecArdour \${LANG_ENGLISH} "Ardour ${ARDOURVERSION}\$\\r\$\\n${VERSIONINFO}\$\\r\$\\n${ARDOURDATE}"
278 if test -z "$NOVIDEOTOOLS"; then
279 cat >> $NSISFILE << EOF
280 LangString DESC_SecVideo \${LANG_ENGLISH} "Video Tools\$\\r\$\\nxjadeo-${XJADEO_VERSION}\$\\r\$\\nharvid-${HARVID_VERSION}"
284 cat >> $NSISFILE << EOF
285 LangString DESC_SecMenu \${LANG_ENGLISH} "Create Start-Menu Shortcuts (recommended)."
286 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
287 !insertmacro MUI_DESCRIPTION_TEXT \${SecArdour} \$(DESC_SecArdour)
290 if test -z "$NOVIDEOTOOLS"; then
291 cat >> $NSISFILE << EOF
292 !insertmacro MUI_DESCRIPTION_TEXT \${SecVideo} \$(DESC_SecVideo)
296 cat >> $NSISFILE << EOF
297 !insertmacro MUI_DESCRIPTION_TEXT \${SecMenu} \$(DESC_SecMenu)
298 !insertmacro MUI_FUNCTION_DESCRIPTION_END
300 SetShellVarContext all
301 DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ardour"
302 DeleteRegKey HKLM SOFTWARE\\Ardour\\ardour3
303 RMDir /r "\$INSTDIR\\bin"
304 RMDir /r "\$INSTDIR\\lib"
305 RMDir /r "\$INSTDIR\\share"
306 RMDir /r "\$INSTDIR\\gdb"
307 RMDir /r "\$INSTDIR\\video"
308 Delete "\$INSTDIR\\ardbg.bat"
309 Delete "\$INSTDIR\\uninstall.exe"
310 Delete "\$INSTDIR\\Ardour3.lnk"
312 Delete "\$SMPROGRAMS\\ardour3\\*.*"
313 RMDir "\$SMPROGRAMS\\ardour3"
318 echo " === OutFile: $OUTFILE"
320 if test -n "$QUICKZIP" ; then
321 echo " === Building Windows Installer (fast zip)"
323 echo " === Building Windows Installer (lzma compression takes ages)"
325 time makensis -V2 $NSISFILE