improve itstool detection:
[ardour.git] / tools / x-win / package.sh
index 4f18dd1975274d80e10f26d8460cf3c0cfd9f975..a010ba9007e72f27ed993e886f9dee8e22e3a4b0 100755 (executable)
@@ -23,6 +23,8 @@ while [ $# -gt 0 ] ; do
        case $1 in
                --mixbus)
                        MIXBUS=1
+                       WITH_HARRISON_LV2=1 ;
+                       WITH_X42_LV2=1 ;
                        shift ;;
        esac
 done
@@ -115,6 +117,7 @@ cp build/libs/timecode/timecode.dll $DESTDIR/bin/
 cp build/libs/qm-dsp/qmdsp-*.dll $DESTDIR/bin/
 cp build/libs/canvas/canvas-*.dll $DESTDIR/bin/
 cp build/libs/pbd/pbd-*.dll $DESTDIR/bin/
+cp build/libs/ptformat/ptformat-*.dll $DESTDIR/bin/
 cp build/libs/audiographer/audiographer-*.dll $DESTDIR/bin/
 cp build/libs/fst/ardour-vst-scanner.exe $DESTDIR/bin/ || true
 cp `ls -t build/gtk2_ardour/ardour-*.exe | head -n1` $DESTDIR/bin/${PRODUCT_EXE}
@@ -124,6 +127,8 @@ cp build/libs/clearlooks-newer/clearlooks.dll $DESTDIR/lib/gtk-2.0/engines/libcl
 
 cp $PREFIX/bin/*dll $DESTDIR/bin/
 cp $PREFIX/lib/*dll $DESTDIR/bin/
+# special case libportaudio (wasapi), old stack has no wasapi and hence no .xp
+cp $PREFIX/bin/libportaudio-2.xp $DESTDIR/bin/ || cp $PREFIX/bin/libportaudio-2.dll $DESTDIR/bin/libportaudio-2.xp
 rm -rf $DESTDIR/bin/libjack*.dll
 
 cp `find build/libs/surfaces/ -iname "*.dll"` $ALIBDIR/surfaces/
@@ -174,8 +179,6 @@ echo " === bundle completed, cleaning up"
 echo " === complete"
 du -sh $DESTDIR
 
-( cd $DESTDIR ; find . ) > ${TMPDIR}/file_list.txt
-
 ################################################################################
 ### get video tools
 if test -z "$NOVIDEOTOOLS"; then
@@ -225,37 +228,68 @@ fi
 
 ################################################################################
 ### Mixbus plugins, etc
-if test -n "$MIXBUS"; then
-
+if test x$WITH_X42_LV2 != x ; then
        mkdir -p $ALIBDIR/LV2
-       METERS_VERSION=$(curl -s -S http://gareus.org/x42/win/x42-meters.latest.txt)
+
+       echo "Adding x42 Plugins"
+
+       METERS_VERSION=$(curl -s -S http://x42-plugins.com/x42/win/x42-meters.latest.txt)
        rsync -a -q --partial \
-               rsync://gareus.org/x42/win/x42-meters-lv2-${WARCH}-${METERS_VERSION}.zip \
+               rsync://x42-plugins.com/x42/win/x42-meters-lv2-${WARCH}-${METERS_VERSION}.zip \
                "${SRCDIR}/x42-meters-lv2-${WARCH}-${METERS_VERSION}.zip"
-       unzip -d "$ALIBDIR/LV2/" "${SRCDIR}/x42-meters-lv2-${WARCH}-${METERS_VERSION}.zip"
+       unzip -q -d "$ALIBDIR/LV2/" "${SRCDIR}/x42-meters-lv2-${WARCH}-${METERS_VERSION}.zip"
 
-       SETBFREE_VERSION=$(curl -s -S http://gareus.org/x42/win/setBfree.latest.txt)
+       SETBFREE_VERSION=$(curl -s -S http://x42-plugins.com/x42/win/setBfree.latest.txt)
        rsync -a -q --partial \
-               rsync://gareus.org/x42/win/setBfree-lv2-${WARCH}-${SETBFREE_VERSION}.zip \
+               rsync://x42-plugins.com/x42/win/setBfree-lv2-${WARCH}-${SETBFREE_VERSION}.zip \
                "${SRCDIR}/setBfree-lv2-${WARCH}-${SETBFREE_VERSION}.zip"
-       unzip -d "$ALIBDIR/LV2/" "${SRCDIR}/setBfree-lv2-${WARCH}-${SETBFREE_VERSION}.zip"
+       unzip -q -d "$ALIBDIR/LV2/" "${SRCDIR}/setBfree-lv2-${WARCH}-${SETBFREE_VERSION}.zip"
 
-       MIDIFILTER_VERSION=$(curl -s -S http://gareus.org/x42/win/x42-midifilter.latest.txt)
+       MIDIFILTER_VERSION=$(curl -s -S http://x42-plugins.com/x42/win/x42-midifilter.latest.txt)
        rsync -a -q --partial \
-               rsync://gareus.org/x42/win/x42-midifilter-lv2-${WARCH}-${MIDIFILTER_VERSION}.zip \
+               rsync://x42-plugins.com/x42/win/x42-midifilter-lv2-${WARCH}-${MIDIFILTER_VERSION}.zip \
                "${SRCDIR}/x42-midifilter-lv2-${WARCH}-${MIDIFILTER_VERSION}.zip"
-       unzip -d "$ALIBDIR/LV2/" "${SRCDIR}/x42-midifilter-lv2-${WARCH}-${MIDIFILTER_VERSION}.zip"
+       unzip -q -d "$ALIBDIR/LV2/" "${SRCDIR}/x42-midifilter-lv2-${WARCH}-${MIDIFILTER_VERSION}.zip"
+fi
+
+if test x$WITH_HARRISON_LV2 != x ; then
+       mkdir -p $ALIBDIR/LV2
+
+       echo "Including Harrison LV2s"
+
+       curl -s -S --fail -# \
+               -z "${SRCDIR}/harrison_lv2s.${WARCH}.zip" \
+               -o "${SRCDIR}/harrison_lv2s.${WARCH}.zip" \
+               http://www.harrisonconsoles.com/mixbus/mb3/${WARCH}/harrison_lv2s.zip
+       unzip -q -d "$ALIBDIR/LV2/" "${SRCDIR}/harrison_lv2s.${WARCH}.zip"
+fi
+
+if test -n "$MIXBUS"; then
+       echo "Deploying Harrison Mixbus Channelstrip"
+
+       mkdir -p $ALIBDIR/ladspa/strip
+       curl -s -S --fail -# \
+               -z "${SRCDIR}/harrison_channelstrip.${WARCH}.dll" \
+               -o "${SRCDIR}/harrison_channelstrip.${WARCH}.dll" \
+               http://www.harrisonconsoles.com/mixbus/mb3/${WARCH}/harrison_channelstrip.dll
 
+       cp "${SRCDIR}/harrison_channelstrip.${WARCH}.dll" \
+               "$ALIBDIR/ladspa/strip/harrison_channelstrip.dll"
 fi
 
+( cd $DESTDIR ; find . ) > ${TMPDIR}/file_list.txt
+
 ################################################################################
 echo " === Preparing Windows Installer"
 NSISFILE=$DESTDIR/a3.nsis
 
 if test "$WARCH" = "w64"; then
        PGF=PROGRAMFILES64
+       SFX=
 else
        PGF=PROGRAMFILES
+       # TODO we should only add this for 32bit on 64bit windows!
+       SFX=" (x86)"
 fi
 
 if test -n "$QUICKZIP" ; then
@@ -273,6 +307,7 @@ cat >> $NSISFILE << EOF
 !addincludedir "${this_script_dir}\\nsis"
 !include MUI2.nsh
 !include FileAssociation.nsh
+!include WinVer.nsh
 
 Name "${PROGRAM_NAME}${PROGRAM_VERSION}"
 OutFile "${OUTFILE}"
@@ -287,10 +322,10 @@ if test -n "$MIXBUS"; then
 
 # TODO: proper welcome/finish text.
        cat >> $NSISFILE << EOF
-!define MUI_FINISHPAGE_TITLE "Welcome to Mixbus"
-!define MUI_FINISHPAGE_TEXT "Thank you for choosing Harrison Mixbus."
-!define MUI_FINISHPAGE_LINK "Harrison Consoles Website"
-!define MUI_FINISHPAGE_LINK_LOCATION "http://harrisonconsoles.com"
+!define MUI_FINISHPAGE_TITLE "Welcome to Harrison Mixbus"
+!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."
+!define MUI_FINISHPAGE_LINK "Mixbus Manual"
+!define MUI_FINISHPAGE_LINK_LOCATION "http://www.harrisonconsoles.com/mixbus/mixbus3-live-manual"
 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
 EOF
 
@@ -319,44 +354,6 @@ cat >> $NSISFILE << EOF
 !insertmacro MUI_UNPAGE_INSTFILES
 !insertmacro MUI_LANGUAGE "English"
 
-
-Function .onInit
-
-  ReadRegStr \$R0 HKLM \
-    "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}" \
-    "UninstallString"
-  StrCmp \$R0 "" done
-
-  MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
-    "${PROGRAM_NAME} is already installed. Click 'OK' to remove the previous version or 'Cancel' to cancel this upgrade." \
-    IDOK uninst
-    Abort
-
-  uninst:
-    ClearErrors
-    ExecWait '\$R0 _?=\$INSTDIR'
-    IfErrors uninstall_error
-
-    ReadRegStr \$R1 HKLM \
-      "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}" \
-      "UninstallString"
-    StrCmp \$R1 "" 0 done
-
-    Delete "\$INSTDIR\\uninstall.exe"
-    RMDir "\$INSTDIR"
-    goto done
-
-  uninstall_error:
-
-    MessageBox MB_OK|MB_ICONEXCLAMATION \
-      "Uninstaller did not complete successfully. Continue at your own risk..." \
-      IDOK done
-
-  done:
-
-FunctionEnd
-
-
 Section "${PROGRAM_NAME}${PROGRAM_VERSION} (required)" SecMainProg
   SectionIn RO
   SetOutPath \$INSTDIR
@@ -374,6 +371,9 @@ Section "${PROGRAM_NAME}${PROGRAM_VERSION} (required)" SecMainProg
   CreateShortCut "\$INSTDIR\\${PROGRAM_NAME}${PROGRAM_VERSION}.lnk" "\$INSTDIR\\bin\\${PRODUCT_EXE}" "" "\$INSTDIR\\bin\\${PRODUCT_EXE}" 0
   \${registerExtension} "\$INSTDIR\\bin\\${STATEFILE_SUFFIX}" ".${PRODUCT_NAME}" "${PROGRAM_NAME} Session"
 SectionEnd
+
+Section "WASAPI sound driver" SecWASAPI
+SectionEnd
 EOF
 
 if test -z "$NOVIDEOTOOLS"; then
@@ -391,27 +391,28 @@ fi
 cat >> $NSISFILE << EOF
 Section "Start Menu Shortcuts" SecMenu
   SetShellVarContext all
-  CreateDirectory "\$SMPROGRAMS\\${PRODUCT_ID}"
-  CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}\\${PROGRAM_NAME}${PROGRAM_VERSION}.lnk" "\$INSTDIR\\bin\\${PRODUCT_EXE}" "" "\$INSTDIR\\bin\\${PRODUCT_EXE}" 0
+  CreateDirectory "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}"
+  CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}\\${PROGRAM_NAME}${PROGRAM_VERSION}.lnk" "\$INSTDIR\\bin\\${PRODUCT_EXE}" "" "\$INSTDIR\\bin\\${PRODUCT_EXE}" 0
 EOF
 
 if test -f "$DESTDIR/debug.bat"; then
        cat >> $NSISFILE << EOF
-  CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}\\${PROGRAM_NAME}${PROGRAM_VERSION} GDB.lnk" "\$INSTDIR\\debug.bat" "" "\$INSTDIR\\share\\ardour_bug.ico" 0
+  CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}\\${PROGRAM_NAME}${PROGRAM_VERSION} GDB.lnk" "\$INSTDIR\\debug.bat" "" "\$INSTDIR\\share\\ardour_bug.ico" 0
 EOF
 fi
 
 if test -z "$NOVIDEOTOOLS"; then
        cat >> $NSISFILE << EOF
   IfFileExists "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" 0 +2
-  CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}\\Video Monitor.lnk" "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" "" "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" 0
+  CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}\\Video Monitor.lnk" "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" "" "\$INSTDIR\\video\\xjadeo\\xjadeo.exe" 0
 EOF
 fi
 
 cat >> $NSISFILE << EOF
-  CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0
+  CreateShortCut "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0
 SectionEnd
 LangString DESC_SecMainProg \${LANG_ENGLISH} "${PROGRAM_NAME} ${ARDOURVERSION}\$\\r\$\\n${VERSIONINFO}\$\\r\$\\n${ARDOURDATE}"
+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."
 EOF
 
 if test -z "$NOVIDEOTOOLS"; then
@@ -424,6 +425,7 @@ cat >> $NSISFILE << EOF
 LangString DESC_SecMenu \${LANG_ENGLISH} "Create Start-Menu Shortcuts (recommended)."
 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 !insertmacro MUI_DESCRIPTION_TEXT \${SecMainProg} \$(DESC_SecMainProg)
+!insertmacro MUI_DESCRIPTION_TEXT \${SecWASAPI} \$(DESC_SecWASAPI)
 EOF
 
 if test -z "$NOVIDEOTOOLS"; then
@@ -449,10 +451,79 @@ Section "Uninstall"
   Delete "\$INSTDIR\\uninstall.exe"
   Delete "\$INSTDIR\\${PROGRAM_NAME}${PROGRAM_VERSION}.lnk"
   RMDir "\$INSTDIR"
-  Delete "\$SMPROGRAMS\\${PRODUCT_ID}\\*.*"
-  RMDir "\$SMPROGRAMS\\${PRODUCT_ID}"
+  Delete "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}\\*.*"
+  RMDir "\$SMPROGRAMS\\${PRODUCT_ID}${SFX}"
   \${unregisterExtension} ".${STATEFILE_SUFFIX}" "${PROGRAM_NAME} Session"
 SectionEnd
+
+
+Function .onInit
+
+  ReadRegStr \$R0 HKLM \
+    "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}" \
+    "UninstallString"
+  StrCmp \$R0 "" done
+
+  MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
+    "${PROGRAM_NAME} is already installed. Click 'OK' to remove the previous version or 'Cancel' to cancel this upgrade." \
+    IDOK uninst
+    Abort
+
+  uninst:
+    ClearErrors
+    ExecWait '\$R0 _?=\$INSTDIR'
+    IfErrors uninstall_error
+
+    ReadRegStr \$R1 HKLM \
+      "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${PRODUCT_ID}-${WARCH}" \
+      "UninstallString"
+    StrCmp \$R1 "" 0 done
+
+    Delete "\$INSTDIR\\uninstall.exe"
+    RMDir "\$INSTDIR"
+    goto done
+
+  uninstall_error:
+
+    MessageBox MB_OK|MB_ICONEXCLAMATION \
+      "Uninstaller did not complete successfully. Continue at your own risk..." \
+      IDOK done
+
+  done:
+
+  \${If} \${AtMostWinXP}
+    SectionSetFlags \${SecWASAPI} \${SF_RO}
+  \${Else}
+    SectionSetFlags \${SecWASAPI} \${SF_SELECTED}
+  \${EndIf}
+
+FunctionEnd
+
+Function .onInstSuccess
+
+  \${If} \${AtMostWinXP}
+    goto pa_no_wasapi
+  \${EndIf}
+
+  SectionGetFlags \${SecWASAPI} \$R0
+
+  IntOp \$R0 \$R0 & \${SF_SELECTED}
+  IntCmp \$R0 \${SF_SELECTED} pa_with_wasapi pa_no_wasapi
+
+  pa_with_wasapi:
+; VISTA .. 9, libportaudio with WASAPI is good.
+  Delete "\$INSTDIR\\bin\\libportaudio-2.xp"
+  goto endportaudio
+
+; Windows XP lacks support for WASAPI, Windows10 on some system has issues
+; http://tracker.ardour.org/view.php?id=6507
+  pa_no_wasapi:
+  Delete "\$INSTDIR\\bin\\libportaudio-2.dll"
+  Rename "\$INSTDIR\\bin\\libportaudio-2.xp" "\$INSTDIR\\bin\\libportaudio-2.dll"
+
+  endportaudio:
+
+FunctionEnd
 EOF
 
 rm -f ${OUTFILE}