3 # we assume this script is <ardour-src>/tools/x-win/package.sh
4 pushd "`/usr/bin/dirname \"$0\"`" > /dev/null; this_script_dir="`pwd`"; popd > /dev/null
7 . ../define_versions.sh
9 cd $this_script_dir/../..
11 test -f gtk2_ardour/wscript || exit 1
13 # Defaults (overridden by environment)
14 : ${XARCH=i686} # or x86_64
15 : ${ROOT=/home/ardour}
18 : ${SRCCACHE=/var/tmp/winsrc} # source-code tgz cache
20 : ${HARRISONCHANNELSTRIP=harrison_channelstrip}
21 : ${HARRISONLV2=harrison_lv2s-n}
22 : ${HARRISONDSPURL=https://www.harrisonconsoles.com/plugins/releases/public}
24 # see also wscript, video_tool_paths.cc, bundle_env_mingw.cc
25 # registry keys based on this are used there
28 PROGRAM_VERSION=${major_version}
31 PRODUCT_VERSION=${major_version}
36 # TODO: grep from build/config.log instead
37 while [ $# -gt 0 ] ; do
47 MANUAL_NAME="mixbus${major_version}-live-manual"
53 PRODUCT_NAME=Mixbus32C
55 PROGRAM_NAME=Mixbus32C-${PROGRAM_VERSION}
57 MANUAL_NAME="mixbus32c-${major_version}-live-manual"
59 --chanstrip) HARRISONCHANNELSTRIP=$2 ; shift; shift ;;
64 LOWERCASE_DIRNAME=ardour${major_version}
65 STATEFILE_SUFFIX=ardour # see filename_extensions.cc
69 PRODUCT_ID=${PROGRAM_NAME}${PROGRAM_VERSION}
70 PRODUCT_EXE=${PRODUCT_NAME}.exe
71 PRODUCT_ICON=${PRODUCT_NAME}.ico
73 ###############################################################################
75 echo "Packaging $PRODUCT_ID"
77 if test "$XARCH" = "x86_64" -o "$XARCH" = "amd64"; then
78 echo "Target: 64bit Windows (x86_64)"
79 XPREFIX=x86_64-w64-mingw32
82 echo "Target: 32 Windows (i686)"
83 XPREFIX=i686-w64-mingw32
87 : ${PREFIX=${ROOT}/win-stack-$WARCH}
90 if [ "$(id -u)" = "0" ]; then
91 apt-get -y install nsis curl wget
96 echo "--- Downloading.. $2"
97 test -f ${SRCCACHE}/$1 || curl -k -L -o ${SRCCACHE}/$1 $2
100 ################################################################################
103 ARDOURVERSION=${release_version}
104 ARDOURDATE=$(date -R)
105 if ! test -f build/gtk2_ardour/ardour-${ARDOURVERSION}.exe; then
106 echo "*** Please compile ardour-${ARDOURVERSION}.exe first."
110 echo " === bundle to $DESTDIR"
114 ################################################################################
116 if test -z "$DESTDIR"; then
118 trap 'rm -rf $DESTDIR' exit SIGINT SIGTERM
122 echo " === bundle to $DESTDIR"
124 ALIBDIR=$DESTDIR/lib/${LOWERCASE_DIRNAME}
126 mkdir -p $DESTDIR/bin
127 mkdir -p $DESTDIR/share/
128 mkdir -p $ALIBDIR/surfaces
129 mkdir -p $ALIBDIR/backends
130 mkdir -p $ALIBDIR/panners
131 mkdir -p $ALIBDIR/vamp
132 mkdir -p $ALIBDIR/suil
134 cp build/libs/gtkmm2ext/gtkmm2ext-*.dll $DESTDIR/bin/
135 cp build/libs/midi++2/midipp-*.dll $DESTDIR/bin/
136 cp build/libs/evoral/evoral-*.dll $DESTDIR/bin/
137 cp build/libs/ardour/ardour-*.dll $DESTDIR/bin/
138 cp build/libs/temporal/temporal-*.dll $DESTDIR/bin/
139 cp build/libs/canvas/canvas-*.dll $DESTDIR/bin/
140 cp build/libs/widgets/widgets-*.dll $DESTDIR/bin/
141 cp build/libs/waveview/waveview-*.dll $DESTDIR/bin/
142 cp build/libs/pbd/pbd-*.dll $DESTDIR/bin/
143 cp build/libs/ptformat/ptformat-*.dll $DESTDIR/bin/
144 cp build/libs/audiographer/audiographer-*.dll $DESTDIR/bin/
145 cp build/libs/fst/ardour-vst-scanner.exe $DESTDIR/bin/ || true
146 cp build/session_utils/*-*.exe $DESTDIR/bin/ || true
147 cp build/tools/luadevel/ardour6-lua.exe $DESTDIR/bin/ || true
148 cp `ls -t build/gtk2_ardour/ardour-*.exe | head -n1` $DESTDIR/bin/${PRODUCT_EXE}
150 mkdir -p $DESTDIR/lib/gtk-2.0/engines
151 cp build/libs/clearlooks-newer/clearlooks.dll $DESTDIR/lib/gtk-2.0/engines/libclearlooks.la
153 cp $PREFIX/bin/*dll $DESTDIR/bin/
154 cp $PREFIX/lib/*dll $DESTDIR/bin/
155 # special case libportaudio (wasapi), old stack has no wasapi and hence no .xp
156 cp $PREFIX/bin/libportaudio-2.xp $DESTDIR/bin/ || cp $PREFIX/bin/libportaudio-2.dll $DESTDIR/bin/libportaudio-2.xp
157 rm -rf $DESTDIR/bin/libjack*.dll
159 cp `find build/libs/surfaces/ -iname "*.dll"` $ALIBDIR/surfaces/
160 cp `find build/libs/backends/ -iname "*.dll"` $ALIBDIR/backends/
161 cp `find build/libs/panners/ -iname "*.dll"` $ALIBDIR/panners/
163 cp -r build/libs/LV2 $ALIBDIR/
164 cp -r build/libs/vamp-plugins/*ardourvampplugins*.dll $ALIBDIR/vamp/libardourvampplugins.dll
165 cp -r build/libs/vamp-pyin/*ardourvamppyin*.dll $ALIBDIR/vamp/libardourvamppyin.dll
166 cp $PREFIX/lib/suil-*/*.dll $ALIBDIR/suil/ || true
168 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
169 if test -d $PREFIX/lib/lv2/lv2core.lv2 ; then
170 cp -R $PREFIX/lib/lv2/lv2core.lv2 $ALIBDIR/LV2/
173 mv $ALIBDIR/surfaces/ardourcp*.dll $DESTDIR/bin/
175 # TODO use -static-libgcc -static-libstdc++ -- but for .exe files only
176 if update-alternatives --query ${XPREFIX}-gcc | grep Value: | grep -q win32; then
177 cp /usr/lib/gcc/${XPREFIX}/*-win32/libgcc_s_*.dll $DESTDIR/bin/
178 cp /usr/lib/gcc/${XPREFIX}/*-win32/libstdc++-6.dll $DESTDIR/bin/
179 elif update-alternatives --query ${XPREFIX}-gcc | grep Value: | grep -q posix; then
180 cp /usr/lib/gcc/${XPREFIX}/*-posix/libgcc_s_*.dll $DESTDIR/bin/
181 cp /usr/lib/gcc/${XPREFIX}/*-posix/libstdc++-6.dll $DESTDIR/bin/
183 cp /usr/lib/gcc/${XPREFIX}/*/libgcc_s_sjlj-1.dll $DESTDIR/bin/
184 cp /usr/lib/gcc/${XPREFIX}/*/libstdc++-6.dll $DESTDIR/bin/
186 #Ubuntu's 14.04's mingw needs this one for the std libs above
187 if test -f /usr/${XPREFIX}/lib/libwinpthread-1.dll; then
188 cp /usr/${XPREFIX}/lib/libwinpthread-1.dll $DESTDIR/bin/
191 cp -r $PREFIX/share/${LOWERCASE_DIRNAME} $DESTDIR/share/
192 cp -r $PREFIX/share/locale $DESTDIR/share/
193 cp -r $PREFIX/etc/${LOWERCASE_DIRNAME}/* $DESTDIR/share/${LOWERCASE_DIRNAME}/
195 cp COPYING $DESTDIR/share/
196 cp gtk2_ardour/icons/${PRODUCT_ICON} $DESTDIR/share/
197 cp gtk2_ardour/icons/ArdourBug.ico $DESTDIR/share/
199 # replace default cursor with square version (sans hotspot file)
200 cp gtk2_ardour/icons/cursor_square/* $DESTDIR/share/${LOWERCASE_DIRNAME}/icons/
202 # clean build-dir after depoyment
203 echo " === bundle completed, cleaning up"
208 ################################################################################
210 if test -z "$NOVIDEOTOOLS"; then
211 echo " === Including video-tools"
212 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
213 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
215 rsync -a -q --partial \
216 rsync://ardour.org/video-tools/harvid_${WARCH}-${HARVID_VERSION}.tar.xz \
217 "${SRCCACHE}/harvid_${WARCH}-${HARVID_VERSION}.tar.xz"
219 rsync -a -q --partial \
220 rsync://ardour.org/video-tools/xjadeo_${WARCH}-${XJADEO_VERSION}.tar.xz \
221 "${SRCCACHE}/xjadeo_${WARCH}-${XJADEO_VERSION}.tar.xz"
224 tar -xf "${SRCCACHE}/harvid_${WARCH}-${HARVID_VERSION}.tar.xz" -C "$DESTDIR/video/"
225 tar -xf "${SRCCACHE}/xjadeo_${WARCH}-${XJADEO_VERSION}.tar.xz" -C "$DESTDIR/video/"
228 du -sh $DESTDIR/video
232 ################################################################################
233 ### include static gdb - re-zipped binaries from
234 ### http://sourceforge.net/projects/mingw/files/MinGW/Extension/gdb/gdb-7.6.1-1/gdb-7.6.1-1-mingw32-bin.tar.lzma
235 ### 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
236 if ! grep " using ./waf configure" build/config.log | grep -q -- "--optimize"; then
237 download gdb-static-win3264.tar.xz http://robin.linuxaudio.org/gdb-static-win3264.tar.xz
239 tar xf gdb-static-win3264.tar.xz
242 echo " === Creating debug.bat"
243 cp -r ${SRCCACHE}/gdb_$WARCH $DESTDIR/gdb
244 cat > $DESTDIR/debug.bat << EOF
246 START ..\\gdb\\bin\\gdb.exe -iex "set logging overwrite on" -iex "set height 0" -iex "set logging on %UserProfile%\\${PRODUCT_NAME}-debug.log" -iex "target exec ${PRODUCT_EXE}" -iex "run"
248 OUTFILE="${TMPDIR}/${PRODUCT_NAME}-${ARDOURVERSION}-dbg-${WARCH}-Setup.exe"
249 VERSIONINFO="Debug Version."
251 OUTFILE="${TMPDIR}/${PRODUCT_NAME}-${ARDOURVERSION}-${WARCH}-Setup.exe"
252 VERSIONINFO="Optimized Version."
255 ################################################################################
256 ### Mixbus plugins, etc
258 mkdir -p $ALIBDIR/LV2
260 echo "Adding General MIDI Synth LV2"
262 for proj in x42-gmsynth; do
263 X42_VERSION=$(curl -s -S http://x42-plugins.com/x42/win/${proj}.latest.txt)
264 rsync -a -q --partial \
265 rsync://x42-plugins.com/x42/win/${proj}-lv2-${WARCH}-${X42_VERSION}.zip \
266 "${SRCCACHE}/${proj}-lv2-${WARCH}-${X42_VERSION}.zip"
267 unzip -q -d "$ALIBDIR/LV2/" "${SRCCACHE}/${proj}-lv2-${WARCH}-${X42_VERSION}.zip"
271 if test x$WITH_X42_LV2 != x ; then
272 mkdir -p $ALIBDIR/LV2
274 echo "Adding x42 Plugins"
276 for proj in x42-meters x42-midifilter x42-stereoroute x42-eq setBfree x42-avldrums x42-whirl x42-limiter x42-tuner; do
277 X42_VERSION=$(curl -s -S http://x42-plugins.com/x42/win/${proj}.latest.txt)
278 rsync -a -q --partial \
279 rsync://x42-plugins.com/x42/win/${proj}-lv2-${WARCH}-${X42_VERSION}.zip \
280 "${SRCCACHE}/${proj}-lv2-${WARCH}-${X42_VERSION}.zip"
281 unzip -q -d "$ALIBDIR/LV2/" "${SRCCACHE}/${proj}-lv2-${WARCH}-${X42_VERSION}.zip"
285 if test x$WITH_HARRISON_LV2 != x ; then
286 mkdir -p $ALIBDIR/LV2
288 echo "Including Harrison LV2s"
290 curl -s -S --fail -# \
291 -z "${SRCCACHE}/${HARRISONLV2}.${WARCH}.zip" \
292 -o "${SRCCACHE}/${HARRISONLV2}.${WARCH}.zip" \
293 "${HARRISONDSPURL}/${HARRISONLV2}.${WARCH}.zip"
294 unzip -q -d "$ALIBDIR/LV2/" "${SRCCACHE}/${HARRISONLV2}.${WARCH}.zip"
297 if test -n "$MIXBUS"; then
298 echo "Deploying Harrison Mixbus Channelstrip"
300 mkdir -p $ALIBDIR/ladspa/strip
301 curl -s -S --fail -# \
302 -z "${SRCCACHE}/${HARRISONCHANNELSTRIP}.${WARCH}.dll" \
303 -o "${SRCCACHE}/${HARRISONCHANNELSTRIP}.${WARCH}.dll" \
304 "${HARRISONDSPURL}/${HARRISONCHANNELSTRIP}.${WARCH}.dll"
306 cp "${SRCCACHE}/${HARRISONCHANNELSTRIP}.${WARCH}.dll" \
307 "$ALIBDIR/ladspa/strip/${HARRISONCHANNELSTRIP}.dll"
309 echo "Deploying Harrison Vamp Plugins"
310 mkdir -p $ALIBDIR/vamp
311 curl -s -S --fail -# \
312 -z "${SRCCACHE}/harrison_vamp.${WARCH}.dll" \
313 -o "${SRCCACHE}/harrison_vamp.${WARCH}.dll" \
314 "${HARRISONDSPURL}/harrison_vamp.${WARCH}.dll"
316 cp "${SRCCACHE}/harrison_vamp.${WARCH}.dll" \
317 "$ALIBDIR/vamp/harrison_vamp.dll"
320 ################################################################################
322 if test x$DEMO_SESSION_URL != x ; then
323 mkdir -p $Shared/sessions
324 DEMO_SESSIONS=$(curl -s -S --fail $DEMO_SESSION_URL/index.txt)
325 for demo in $DEMO_SESSIONS; do
326 curl -s -S --fail -# -o $Shared/sessions/$demo $DEMO_SESSION_URL/$demo
330 ################################################################################
332 ( cd $DESTDIR ; find . ) > ${TMPDIR}/file_list.txt
334 ################################################################################
335 echo " === Preparing Windows Installer"
336 NSISFILE=$DESTDIR/a3.nsis
338 if test "$WARCH" = "w64"; then
343 # TODO we should only add this for 32bit on 64bit windows!
347 if test -n "$QUICKZIP" ; then
348 cat > $NSISFILE << EOF
352 cat > $NSISFILE << EOF
353 SetCompressor /SOLID lzma
354 SetCompressorDictSize 32
358 cat >> $NSISFILE << EOF
359 !addincludedir "${this_script_dir}\\nsis"
361 !include FileAssociation.nsh
364 Name "${PROGRAM_NAME}${PROGRAM_VERSION}"
366 RequestExecutionLevel admin
367 InstallDir "\$${PGF}\\${PRODUCT_ID}"
368 InstallDirRegKey HKLM "Software\\${PRODUCT_NAME}\\${PRODUCT_ID}\\$WARCH" "Install_Dir"
369 !define MUI_ICON "share\\${PRODUCT_ICON}"
373 if test -n "$MIXBUS"; then
375 # TODO: proper welcome/finish text.
376 cat >> $NSISFILE << EOF
377 !define MUI_FINISHPAGE_TITLE "Welcome to Harrison Mixbus"
378 !define MUI_FINISHPAGE_TEXT "Thanks for your purchase of Mixbus!\$\\r\$\\nYou will find the Mixbus application in the Start Menu (or the All Apps panel for Windows 8) \$\\r\$\\nClick the link below to view the Mixbus manual, and learn ways to get involved with the Mixbus community."
379 !define MUI_FINISHPAGE_LINK "Mixbus Manual"
380 !define MUI_FINISHPAGE_LINK_LOCATION "http://www.harrisonconsoles.com/mixbus/${MANUAL_NAME}/"
381 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
386 cat >> $NSISFILE << EOF
387 !define MUI_FINISHPAGE_TITLE "Welcome to Ardour"
388 !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."
389 !define MUI_FINISHPAGE_LINK "Ardour Manual"
390 !define MUI_FINISHPAGE_LINK_LOCATION "http://manual.ardour.org/"
391 #this would run as admin - see http://forums.winamp.com/showthread.php?t=353366
392 #!define MUI_FINISHPAGE_RUN "\$INSTDIR\\bin\\${PRODUCT_EXE}"
393 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
398 cat >> $NSISFILE << EOF
399 !define MUI_ABORTWARNING
400 !insertmacro MUI_PAGE_LICENSE "share\\COPYING"
401 !insertmacro MUI_PAGE_COMPONENTS
402 !insertmacro MUI_PAGE_DIRECTORY
403 !insertmacro MUI_PAGE_INSTFILES
404 !insertmacro MUI_PAGE_FINISH
405 !insertmacro MUI_UNPAGE_CONFIRM
406 !insertmacro MUI_UNPAGE_INSTFILES
407 !insertmacro MUI_LANGUAGE "English"
409 Section "${PROGRAM_NAME}${PROGRAM_VERSION} (required)" SecMainProg
415 File /nonfatal debug.bat
416 File /nonfatal /r gdb
417 WriteRegStr HKLM "Software\\${PROGRAM_KEY}\\v${major_version}\\$WARCH" "Install_Dir" "\$INSTDIR"
418 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}" "DisplayName" "${PROGRAM_NAME}${PROGRAM_VERSION}"
419 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}" "UninstallString" '"\$INSTDIR\\uninstall.exe"'
420 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}" "NoModify" 1
421 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}" "NoRepair" 1
422 WriteUninstaller "\$INSTDIR\uninstall.exe"
423 CreateShortCut "\$INSTDIR\\${PROGRAM_NAME}${PROGRAM_VERSION}.lnk" "\$INSTDIR\\bin\\${PRODUCT_EXE}" "" "\$INSTDIR\\bin\\${PRODUCT_EXE}" 0
424 \${registerExtension} "\$INSTDIR\\bin\\${STATEFILE_SUFFIX}" ".${PRODUCT_NAME}" "${PROGRAM_NAME} Session"
427 Section "WASAPI sound driver" SecWASAPI
431 if test -z "$NOVIDEOTOOLS"; then
433 cat >> $NSISFILE << EOF
434 Section "Videotimeline Tools" SecVideo
435 WriteRegStr HKLM "Software\\${PROGRAM_KEY}\\v${major_version}\\video" "Install_Dir" "\$INSTDIR\\video"
443 cat >> $NSISFILE << EOF
444 Section "Start Menu Shortcuts" SecMenu
445 SetShellVarContext all
446 CreateDirectory "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}"
447 CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}\\${PROGRAM_NAME}${PROGRAM_VERSION}.lnk" "\$INSTDIR\\bin\\${PRODUCT_EXE}" "" "\$INSTDIR\\bin\\${PRODUCT_EXE}" 0
450 if test -f "$DESTDIR/debug.bat"; then
451 cat >> $NSISFILE << EOF
452 CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}\\${PROGRAM_NAME}${PROGRAM_VERSION} GDB.lnk" "\$INSTDIR\\debug.bat" "" "\$INSTDIR\\share\\ArdourBug.ico" 0
456 if test -z "$NOVIDEOTOOLS"; then
457 cat >> $NSISFILE << EOF
458 IfFileExists "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" 0 +2
459 CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}\\Video Monitor.lnk" "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" "" "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" 0
463 cat >> $NSISFILE << EOF
464 CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0
466 LangString DESC_SecMainProg \${LANG_ENGLISH} "${PROGRAM_NAME} ${ARDOURVERSION}\$\\r\$\\n${VERSIONINFO}\$\\r\$\\n${ARDOURDATE}"
467 LangString DESC_SecWASAPI \${LANG_ENGLISH} "WASAPI Audio Driver\$\\r\$\\nOnly works on Vista or later. Windows 10 Users may currently also experience issues if this is installed."
470 if test -z "$NOVIDEOTOOLS"; then
471 cat >> $NSISFILE << EOF
472 LangString DESC_SecVideo \${LANG_ENGLISH} "Video Tools\$\\r\$\\nxjadeo-${XJADEO_VERSION}\$\\r\$\\nharvid-${HARVID_VERSION}"
476 cat >> $NSISFILE << EOF
477 LangString DESC_SecMenu \${LANG_ENGLISH} "Create Start-Menu Shortcuts (recommended)."
478 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
479 !insertmacro MUI_DESCRIPTION_TEXT \${SecMainProg} \$(DESC_SecMainProg)
480 !insertmacro MUI_DESCRIPTION_TEXT \${SecWASAPI} \$(DESC_SecWASAPI)
483 if test -z "$NOVIDEOTOOLS"; then
484 cat >> $NSISFILE << EOF
485 !insertmacro MUI_DESCRIPTION_TEXT \${SecVideo} \$(DESC_SecVideo)
489 cat >> $NSISFILE << EOF
490 !insertmacro MUI_DESCRIPTION_TEXT \${SecMenu} \$(DESC_SecMenu)
491 !insertmacro MUI_FUNCTION_DESCRIPTION_END
493 SetShellVarContext all
494 DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}"
495 DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}"
496 DeleteRegKey HKLM "Software\\${PROGRAM_KEY}\\v${major_version}"
497 RMDir /r "\$INSTDIR\\bin"
498 RMDir /r "\$INSTDIR\\lib"
499 RMDir /r "\$INSTDIR\\share"
500 RMDir /r "\$INSTDIR\\gdb"
501 RMDir /r "\$INSTDIR\\video"
502 Delete "\$INSTDIR\\debug.bat"
503 Delete "\$INSTDIR\\uninstall.exe"
504 Delete "\$INSTDIR\\${PROGRAM_NAME}${PROGRAM_VERSION}.lnk"
506 Delete "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}\\*.*"
507 RMDir "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}"
508 \${unregisterExtension} ".${STATEFILE_SUFFIX}" "${PROGRAM_NAME} Session"
514 ReadRegStr \$R0 HKLM \
515 "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}" \
519 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
520 "${PROGRAM_NAME} is already installed. Click 'OK' to remove the previous version or 'Cancel' to cancel this upgrade." \
526 ExecWait '\$R0 _?=\$INSTDIR'
527 IfErrors uninstall_error
529 ReadRegStr \$R1 HKLM \
530 "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}" \
532 StrCmp \$R1 "" 0 done
534 Delete "\$INSTDIR\\uninstall.exe"
540 MessageBox MB_OK|MB_ICONEXCLAMATION \
541 "Uninstaller did not complete successfully. Continue at your own risk..." \
546 \${If} \${AtMostWinXP}
547 SectionSetFlags \${SecWASAPI} \${SF_RO}
549 SectionSetFlags \${SecWASAPI} 0
554 Function .onInstSuccess
556 \${If} \${AtMostWinXP}
560 SectionGetFlags \${SecWASAPI} \$R0
562 IntOp \$R0 \$R0 & \${SF_SELECTED}
563 IntCmp \$R0 \${SF_SELECTED} pa_with_wasapi pa_no_wasapi
566 ; VISTA .. 9, libportaudio with WASAPI is good.
567 Delete "\$INSTDIR\\bin\\libportaudio-2.xp"
570 ; Windows XP lacks support for WASAPI, Windows10 on some system has issues
571 ; http://tracker.ardour.org/view.php?id=6507
573 Delete "\$INSTDIR\\bin\\libportaudio-2.dll"
574 Rename "\$INSTDIR\\bin\\libportaudio-2.xp" "\$INSTDIR\\bin\\libportaudio-2.dll"
582 echo " === OutFile: $OUTFILE"
584 if test -n "$QUICKZIP" ; then
585 echo " === Building Windows Installer (fast zip)"
587 echo " === Building Windows Installer (lzma compression takes ages)"
589 time makensis -V2 $NSISFILE