fun hacks for wine
authorRobin Gareus <robin@gareus.org>
Wed, 16 Dec 2015 21:39:00 +0000 (22:39 +0100)
committerRobin Gareus <robin@gareus.org>
Wed, 16 Dec 2015 22:22:05 +0000 (23:22 +0100)
windows-VST? yes, we could.

tools/linux_packaging/build
tools/linux_packaging/stage2.run.in

index baf4f5771f6d438b45ae41ac04245adc6ef25826..f397386133002d7f0bf15424f3397280f8398d44 100755 (executable)
@@ -33,6 +33,7 @@ EXTERNAL_JACK=
 VENDOR=Ardour ;
 EXENAME=ardour
 GCC5ABI=false
+USEWINE=false
 BUILDTYPE=""
 NOSTRIP="libsuil|libserd|libsord|liblilv|libsratom|liblrdf|libardour|libpbd|libevoral"
 
@@ -239,6 +240,7 @@ echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
 # create startup helper script
 if test -d $BUILD_ROOT/vst; then
        WINEEXE=wine
+       USEWINE=true
        echo export INSTALL_DIR >> $ENVIRONMENT
 else
        WINEEXE=
@@ -682,7 +684,7 @@ chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
 #
 # Add the stage2.run script
 #
-sed -e "s/%REPLACE_MAJOR_VERSION%/${major_version}/;s/%REPLACE_PGM%/${APPNAME}/;s/%REPLACE_VENDOR%/${VENDOR}/;s/%REPLACE_EXE%/${EXENAME}/;s/%REPLACE_GCC5%/${GCC5ABI}/" < stage2.run.in > stage2.run
+sed -e "s/%REPLACE_MAJOR_VERSION%/${major_version}/;s/%REPLACE_PGM%/${APPNAME}/;s/%REPLACE_VENDOR%/${VENDOR}/;s/%REPLACE_EXE%/${EXENAME}/;s/%REPLACE_GCC5%/${GCC5ABI}/;s/%REPLACE_WINE%/${USEWINE}/" < stage2.run.in > stage2.run
 chmod a+x stage2.run
 
 
index ea83a57e207ff6cd771431671719f15fb945ec7f..ba8e280a3a2f8228dfa2e107738601cabc5c44e3 100755 (executable)
@@ -313,6 +313,19 @@ else
        fi
 fi
 
+if %REPLACE_WINE%; then
+       if -z "`which wine`"; then
+               echo ""
+               echo "!!! ERROR !!! - 'wine' was not found."
+               echo ""
+               echo "This version of Ardour with Windows VST support requires wine."
+               echo "https://www.winehq.org/"
+               echo ""
+               read -p "Press ENTER to exit installer:" BLAH
+               exit 1
+       fi
+fi
+
 #####################
 # Unpack the bundle
 #####################
@@ -375,6 +388,46 @@ then
        HAS_XDG="F"
 fi
 
+#################################################
+# Set up libwine.so
+#################################################
+if %REPLACE_WINE%; then
+       echo ""
+       echo "Searching for libwine.so (Windows VST support)"
+       echo ""
+       # we need to add libwine to ardour's LD_LIBRARY_PATH
+       # libwine itself includes paths to the various system-components
+       # which may be different on each platform.
+       #
+       # There's some chicken/egg here: ardour.exe.so is linked against libwine.so
+       # at build-time. wine/wineloader assumes a windows-application (which does not use libwine
+       # directly) and does not set up the LD path to libwine itself. the application terminates
+       # (missing libs) before it even starts..
+       #
+       # wine itself does not provide means to find the location of libwine.
+       # /usr/bin/wine is usually shell-script and libwine.so can be found in
+       # various places on different distros.
+       #
+       # if this check were quick and easy.. it should be done in the startup-script, but it's not
+       # so here we go... (updating wine may require re-installing ardour)
+       #
+       LIBWINE=$(
+               LD_DEBUG=files wine `pwd`/${BUNDLE_DIR}/lib/ardour-vst-scanner.exe.so 2>&1 \
+                                                | grep -e "calling init:.*libwine" \
+                                                | sed 's/^.*calling init: //' \
+                                                | uniq \
+                       )
+       if ! test -f "$LIBWINE"; then
+               echo ""
+               echo "!!! ERROR !!! - 'libwine.so*' was not found."
+               echo ""
+               read -p "Press ENTER to exit installer:" BLAH
+               exit 1
+       fi
+  # this replaces/overwrites the bundled libwine
+       cp -L "$LIBWINE" `pwd`/${BUNDLE_DIR}/lib/libwine.so.1
+fi
+
 #################################################
 # Check if system libs are OK (libc, etc)
 #################################################