diff --git a/data/windows/app-console.py b/data/windows/app-console.py index 2c14c6c98..049df7d4a 100644 --- a/data/windows/app-console.py +++ b/data/windows/app-console.py @@ -14,18 +14,24 @@ from carla_host import VERSION # ------------------------------------------------------------------------------------------------------------ options = { - #"icon": ".\\resources\\ico\\carla.ico", - "packages": [], - "includes": ["re", "subprocess", "inspect"], - "build_exe": ".\\data\\windows\\Carla\\", + "zip_include_packages": ["*"], + "zip_exclude_packages": ["PyQt5"], + "replace_paths": [["*",".\\lib\\"]], + "build_exe": ".\\Carla\\", "optimize": True, - #"compressed": True +} + +exe_options = { + "script": "..\\..\\source\\frontend\\carla", + "icon": "..\\..\\resources\\ico\\carla.ico", + "copyright": "Copyright (C) 2011-2019 Filipe Coelho", + "targetName": "CarlaDebug.exe", } setup(name = "Carla", version = VERSION, description = "Carla Plugin Host", options = {"build_exe": options}, - executables = [Executable(".\\source\\frontend\\carla")]) + executables = [Executable(**exe_options)]) # ------------------------------------------------------------------------------------------------------------ diff --git a/data/windows/app-control.py b/data/windows/app-control.py new file mode 100644 index 000000000..51d2dbb2b --- /dev/null +++ b/data/windows/app-control.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# ------------------------------------------------------------------------------------------------------------ +# Imports (cx_Freeze) + +from cx_Freeze import setup, Executable + +# ------------------------------------------------------------------------------------------------------------ +# Imports (Custom Stuff) + +from carla_host import VERSION + +# ------------------------------------------------------------------------------------------------------------ + +options = { + "zip_include_packages": ["*"], + "zip_exclude_packages": ["PyQt5"], + "replace_paths": [["*",".\\lib\\"]], + "build_exe": ".\\CarlaControl\\", + "optimize": True, +} + +exe_options = { + "script": "..\\..\\source\\frontend\\carla-control", + "icon": "..\\..\\resources\\ico\\carla-control.ico", + "copyright": "Copyright (C) 2011-2019 Filipe Coelho", + "base": "Win32GUI", + "targetName": "CarlaControl.exe", +} + +setup(name = "CarlaControl", + version = VERSION, + description = "Carla Remote Control", + options = {"build_exe": options}, + executables = [Executable(**exe_options)]) + +# ------------------------------------------------------------------------------------------------------------ diff --git a/data/windows/app-gui.py b/data/windows/app-gui.py index 48983a984..e99efde10 100644 --- a/data/windows/app-gui.py +++ b/data/windows/app-gui.py @@ -14,18 +14,25 @@ from carla_host import VERSION # ------------------------------------------------------------------------------------------------------------ options = { - #"icon": ".\\resources\\ico\\carla.ico", - "packages": [], - "includes": ["re", "subprocess", "inspect"], - "build_exe": ".\\data\\windows\\Carla\\", + "zip_include_packages": ["*"], + "zip_exclude_packages": ["PyQt5"], + "replace_paths": [["*",".\\lib\\"]], + "build_exe": ".\\Carla\\", "optimize": True, - #"compressed": True +} + +exe_options = { + "script": "..\\..\\source\\frontend\\carla", + "icon": "..\\..\\resources\\ico\\carla.ico", + "copyright": "Copyright (C) 2011-2019 Filipe Coelho", + "base": "Win32GUI", + "targetName": "Carla.exe", } setup(name = "Carla", version = VERSION, description = "Carla Plugin Host", options = {"build_exe": options}, - executables = [Executable(".\\source\\frontend\\Carla.pyw", base="Win32GUI")]) + executables = [Executable(**exe_options)]) # ------------------------------------------------------------------------------------------------------------ diff --git a/data/windows/plugin-ui.py b/data/windows/app-plugin-ui.py similarity index 59% rename from data/windows/plugin-ui.py rename to data/windows/app-plugin-ui.py index ba1e01508..59eaf7683 100644 --- a/data/windows/plugin-ui.py +++ b/data/windows/app-plugin-ui.py @@ -10,26 +10,32 @@ from cx_Freeze import setup, Executable # Imports (Custom Stuff) from carla_host import VERSION +from os import getenv # ------------------------------------------------------------------------------------------------------------ -name = "bigmeter-ui" - -# ------------------------------------------------------------------------------------------------------------ +name = getenv("TARGET_NAME") options = { - "icon": ".\\resources\\ico\\carla.ico", - "packages": [], - "includes": ["re", "sip", "subprocess", "inspect"], - "build_exe": ".\\data\\windows\\%s\\" % name, - "optimize": False, - "compressed": False + "zip_include_packages": ["*"], + "zip_exclude_packages": ["PyQt5"], + "replace_paths": [["*",".\\lib\\"]], + "build_exe": ".\\Carla\\resources\\", + "optimize": True, +} + +exe_options = { + "script": "..\\..\\bin\\resources\\{}".format(name), + "icon": "..\\..\\resources\\ico\\carla.ico", + "copyright": "Copyright (C) 2011-2019 Filipe Coelho", + "base": "Win32GUI", + "targetName": "{}.exe".format(name), } setup(name = name, version = VERSION, description = name, options = {"build_exe": options}, - executables = [Executable(".\\bin\\resources\\%s.pyw" % name, base="Win32GUI")]) + executables = [Executable(**exe_options)]) # ------------------------------------------------------------------------------------------------------------ diff --git a/data/windows/build-win.sh b/data/windows/build-win.sh index 205e044cf..8d6050335 100755 --- a/data/windows/build-win.sh +++ b/data/windows/build-win.sh @@ -33,7 +33,7 @@ if [ x"${ARCH}" = x"32nosse" ]; then MAKE_ARGS="${MAKE_ARGS} NOOPT=true" fi -MAKE_ARGS="${MAKE_ARGS} BUILDING_FOR_WINDOWS=true HAVE_PYQT5=true" +MAKE_ARGS="${MAKE_ARGS} BUILDING_FOR_WINDOWS=true HAVE_PYQT5=true USING_JUCE=true" export WIN32=true diff --git a/data/windows/pack-win.sh b/data/windows/pack-win.sh index 1463bcd2a..b94ac1b21 100755 --- a/data/windows/pack-win.sh +++ b/data/windows/pack-win.sh @@ -7,7 +7,7 @@ ARCH="${1}" ARCH_PREFIX="${1}" if [ x"${ARCH}" != x"32" ] && [ x"${ARCH}" != x"32nosse" ] && [ x"${ARCH}" != x"64" ]; then - echo "usage: $0 32|nonosse|64" + echo "usage: $0 32|32nosse|64" exit 1 fi @@ -33,7 +33,7 @@ fi source data/windows/common.env -PKG_FOLDER="Carla_2.0-alpha2-win${ARCH}" +PKG_FOLDER="Carla_2.0-beta1-win${ARCH}" export WIN32=true @@ -44,6 +44,8 @@ else CPUARCH="i686" fi +export PYTHONPATH="$(pwd)/source/frontend" + # --------------------------------------------------------------------------------------------------------------------- export_vars() { @@ -52,11 +54,11 @@ local _ARCH="${1}" local _ARCH_PREFIX="${2}" local _MINGW_PREFIX="${3}-w64-mingw32" -export PREFIX=${TARGETDIR}/carla-w${_ARCH_PREFIX} -export MSYS2_PREFIX="${TARGETDIR}/msys2-${CPUARCH}/mingw${ARCH}" +export DEPS_PREFIX=${TARGETDIR}/carla-w${ARCH_PREFIX} +export MSYS2_PREFIX=${TARGETDIR}/msys2-${CPUARCH}/mingw${ARCH} -export PATH=${PREFIX}/bin:/usr/sbin:/usr/bin:/sbin:/bin -export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:${MSYS2_PREFIX}/lib/pkgconfig +export PATH=${DEPS_PREFIX}/bin:/opt/wine-staging/bin:/usr/sbin:/usr/bin:/sbin:/bin +export PKG_CONFIG_PATH=${DEPS_PREFIX}/lib/pkgconfig:${MSYS2_PREFIX}/lib/pkgconfig export AR=${_MINGW_PREFIX}-ar export CC=${_MINGW_PREFIX}-gcc @@ -65,128 +67,186 @@ export STRIP=${_MINGW_PREFIX}-strip export WINDRES=${_MINGW_PREFIX}-windres export CFLAGS="-DPTW32_STATIC_LIB -DFLUIDSYNTH_NOT_A_DLL" -export CFLAGS="${CFLAGS} -I${PREFIX}/include" +export CFLAGS="${CFLAGS} -I${DEPS_PREFIX}/include" export CXXFLAGS="${CFLAGS}" -export LDFLAGS="-L${PREFIX}/lib" +export LDFLAGS="-L${DEPS_PREFIX}/lib" + +export WINEARCH=win${ARCH} +export WINEDEBUG=-all +export WINEPREFIX=~/.winepy3_x${ARCH} +export PYTHON_EXE="wine ${MSYS2_PREFIX}/bin/python.exe" +export CXFREEZE="${PYTHON_EXE} ${MSYS2_PREFIX}/bin/cxfreeze" + } # --------------------------------------------------------------------------------------------------------------------- export_vars "${ARCH}" "${ARCH_PREFIX}" "${CPUARCH}" -export WINEARCH=win${ARCH} -# export WINEDEBUG=-all -export WINEPREFIX=~/.winepy3_x${ARCH} -export PYTHON_EXE="wine ${MSYS2_PREFIX}/bin/python.exe" -export CXFREEZE="$PYTHON_EXE ${MSYS2_PREFIX}/bin/cxfreeze" -export PYTHONPATH="$(pwd)/source/frontend" # ;${MSYS2_PREFIX}/lib/python3.7 - -rm -rf ./data/windows/Carla ./data/windows/Carla.lv2 ./data/windows/Carla.vst -mkdir -p ./data/windows/Carla/Debug -cp ./source/frontend/carla ./source/frontend/Carla.pyw -$PYTHON_EXE ./data/windows/app-console.py build_exe -mv ./data/windows/Carla/carla.exe ./data/windows/Carla/Debug/Carla.exe -$PYTHON_EXE ./data/windows/app-gui.py build_exe -rm -f ./source/frontend/Carla.pyw +# --------------------------------------------------------------------------------------------------------------------- cd data/windows/ -rm -rf dist -$CXFREEZE ../../bin/resources/bigmeter-ui -mv dist/lib/library.zip dist/lib/library-bigmeter.zip -$CXFREEZE ../../bin/resources/midipattern-ui -mv dist/lib/library.zip dist/lib/library-midipattern.zip -$CXFREEZE ../../bin/resources/notes-ui -mv dist/lib/library.zip dist/lib/library-notes.zip -$CXFREEZE ../../bin/resources/carla-plugin -mv dist/lib/library.zip dist/lib/library-carla1.zip -$CXFREEZE ../../bin/resources/carla-plugin-patchbay -mv dist/lib/library.zip dist/lib/library-carla2.zip - -cp ../../bin/*.dll Carla/ -cp ../../bin/*.exe Carla/ -rm Carla/carla-discovery-native.exe -rm Carla/carla-lv2-export.exe -rm Carla/carla-native-plugin.exe - -# rm -f Carla/PyQt5.Qsci.pyd Carla/PyQt5.QtNetwork.pyd Carla/PyQt5.QtSql.pyd Carla/PyQt5.QtTest.pyd Carla/PyQt5.QtXml.pyd -# rm -f dist/PyQt5.Qsci.pyd dist/PyQt5.QtNetwork.pyd dist/PyQt5.QtSql.pyd dist/PyQt5.QtTest.pyd dist/PyQt5.QtXml.pyd - -# cp $WINEPREFIX/drive_c/Python34/python34.dll Carla/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/icu*.dll Carla/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/libEGL.dll Carla/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/libGLESv2.dll Carla/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Core.dll Carla/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Gui.dll Carla/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Widgets.dll Carla/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5OpenGL.dll Carla/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Svg.dll Carla/ - -mv dist Carla/resources -mkdir Carla/resources/lib/_tmp -pushd Carla/resources/lib/_tmp +rm -rf Carla Carla.lv2 Carla.vst + +# --------------------------------------------------------------------------------------------------------------------- +# freeze carla (console and gui) + +${PYTHON_EXE} ./app-console.py build_exe +mv Carla/lib/library.zip Carla/lib/library-console.zip +${PYTHON_EXE} ./app-gui.py build_exe +mv Carla/lib/library.zip Carla/lib/library-gui.zip + +mkdir Carla/lib/_lib +pushd Carla/lib/_lib +unzip -o ../library-console.zip +unzip -o ../library-gui.zip +zip -r -9 ../library.zip * +popd +rm -r Carla/lib/_lib Carla/lib/library-*.zip + +# --------------------------------------------------------------------------------------------------------------------- +# freeze carla-control + +${PYTHON_EXE} ./app-control.py build_exe + +# --------------------------------------------------------------------------------------------------------------------- +# freeze pyqt plugin uis (resources) + +TARGET_NAME="bigmeter-ui" ${PYTHON_EXE} ./app-plugin-ui.py build_exe +mv Carla/resources/lib/library.zip Carla/resources/lib/library-bigmeter.zip +TARGET_NAME="midipattern-ui" ${PYTHON_EXE} ./app-plugin-ui.py build_exe +mv Carla/resources/lib/library.zip Carla/resources/lib/library-midipattern.zip +TARGET_NAME="notes-ui" ${PYTHON_EXE} ./app-plugin-ui.py build_exe +mv Carla/resources/lib/library.zip Carla/resources/lib/library-notes.zip +TARGET_NAME="carla-plugin" ${PYTHON_EXE} ./app-plugin-ui.py build_exe +mv Carla/resources/lib/library.zip Carla/resources/lib/library-carla1.zip +TARGET_NAME="carla-plugin-patchbay" ${PYTHON_EXE} ./app-plugin-ui.py build_exe +mv Carla/resources/lib/library.zip Carla/resources/lib/library-carla2.zip + +mkdir Carla/resources/lib/_lib +pushd Carla/resources/lib/_lib unzip -o ../library-bigmeter.zip unzip -o ../library-midipattern.zip unzip -o ../library-notes.zip unzip -o ../library-carla1.zip unzip -o ../library-carla2.zip -zip -r -9 ../library.zip *.pyc +zip -r -9 ../library.zip * popd -rm -r Carla/resources/lib/_tmp -rm Carla/resources/lib/library-*.zip - -# cp $WINEPREFIX/drive_c/Python34/python34.dll Carla/resources/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/icu*.dll Carla/resources/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/libEGL.dll Carla/resources/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/libGLESv2.dll Carla/resources/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Core.dll Carla/resources/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Gui.dll Carla/resources/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Widgets.dll Carla/resources/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5OpenGL.dll Carla/resources/ -# cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Svg.dll Carla/resources/ - -mkdir Carla.lv2 -cp Carla/*.exe Carla.lv2/ -cp ../../bin/carla.lv2/*.dll Carla.lv2/ -cp ../../bin/carla.lv2/*.ttl Carla.lv2/ -cp ../../bin/libcarla_utils.dll Carla.lv2/ -cp -r Carla/resources Carla.lv2/ - -mkdir Carla.vst -cp Carla/*.exe Carla.vst/ -cp Carla/carla-bridge-lv2.dll Carla.vst/ -cp ../../bin/CarlaVst*.dll Carla.vst/ -cp ../../bin/libcarla_utils.dll Carla.vst/ -cp -r Carla/resources Carla.vst/ +rm -r Carla/resources/lib/_lib Carla/resources/lib/library-*.zip + +# --------------------------------------------------------------------------------------------------------------------- +# cleanup pyqt stuff + +find Carla CarlaControl -name "QAxContainer*" -delete +find Carla CarlaControl -name "QtDBus*" -delete +find Carla CarlaControl -name "QtDesigner*" -delete +find Carla CarlaControl -name "QtBluetooth*" -delete +find Carla CarlaControl -name "QtHelp*" -delete +find Carla CarlaControl -name "QtLocation*" -delete +find Carla CarlaControl -name "QtMultimedia*" -delete +find Carla CarlaControl -name "QtMultimediaWidgets*" -delete +find Carla CarlaControl -name "QtNetwork*" -delete +find Carla CarlaControl -name "QtNetworkAuth*" -delete +find Carla CarlaControl -name "QtNfc*" -delete +find Carla CarlaControl -name "QtPositioning*" -delete +find Carla CarlaControl -name "QtPrintSupport*" -delete +find Carla CarlaControl -name "QtQml*" -delete +find Carla CarlaControl -name "QtQuick*" -delete +find Carla CarlaControl -name "QtQuickWidgets*" -delete +find Carla CarlaControl -name "QtRemoteObjects*" -delete +find Carla CarlaControl -name "QtSensors*" -delete +find Carla CarlaControl -name "QtSerialPort*" -delete +find Carla CarlaControl -name "QtSql*" -delete +find Carla CarlaControl -name "QtTest*" -delete +find Carla CarlaControl -name "QtWebChannel*" -delete +find Carla CarlaControl -name "QtWebKit*" -delete +find Carla CarlaControl -name "QtWebKitWidgets*" -delete +find Carla CarlaControl -name "QtWebSockets*" -delete +find Carla CarlaControl -name "QtWinExtras*" -delete +find Carla CarlaControl -name "QtXml*" -delete +find Carla CarlaControl -name "QtXmlPatterns*" -delete +find Carla CarlaControl -name "*.pyi" -delete + +# --------------------------------------------------------------------------------------------------------------------- +# copy relevant files to binary dir + +cp ../../bin/libcarla_standalone2.dll Carla/ +cp ../../bin/libcarla_utils.dll Carla/ +cp ../../bin/carla-bridge-lv2.dll Carla/ +cp ../../bin/carla-bridge-*.exe Carla/ +cp ../../bin/carla-discovery-win*.exe Carla/ + +mkdir -p Carla/imageformats +cp ${MSYS2_PREFIX}/share/qt5/plugins/imageformats/qsvg.dll Carla/imageformats/ +mkdir -p Carla/platforms +cp ${MSYS2_PREFIX}/share/qt5/plugins/platforms/qwindows.dll Carla/platforms/ + +mkdir -p Carla/styles +cp ../../bin/styles/carlastyle.dll Carla/styles/ + +# --------------------------------------------------------------------------------------------------------------------- +# prepare lv2 bundle + +mkdir -p Carla.lv2 +cp -r Carla/* Carla.lv2/ +cp ../../bin/carla.lv2/*.dll Carla.lv2/ +cp ../../bin/carla.lv2/*.ttl Carla.lv2/ rm Carla.lv2/Carla.exe +rm Carla.lv2/CarlaDebug.exe + +# --------------------------------------------------------------------------------------------------------------------- +# copy relevant files to binary dir + +mkdir -p Carla.vst +cp -r Carla/* Carla.vst/ +cp ../../bin/CarlaVst*.dll Carla.vst/ rm Carla.vst/Carla.exe +rm Carla.vst/CarlaDebug.exe + +# --------------------------------------------------------------------------------------------------------------------- +# stop here for development if [ x"${CARLA_DEV}" != x"" ]; then exit 0 fi +# --------------------------------------------------------------------------------------------------------------------- +# create self-contained zip + # Build unzipfx make -C unzipfx-carla -f Makefile.win32 clean make -C unzipfx-carla -f Makefile.win32 ${MAKE_ARGS} -# Create zip of Carla +# Build unzipfx-control +make -C unzipfx-carla-control -f Makefile.win32 clean +make -C unzipfx-carla-control -f Makefile.win32 ${MAKE_ARGS} + +# Create zip of Carla and CarlaControl rm -f Carla.zip CarlaControl.zip zip -r -9 Carla.zip Carla +zip -r -9 CarlaControl.zip CarlaControl -# Create static build -rm -f Carla.exe CarlaControl.exe +# Create static builds +rm -f Carla.exe cat unzipfx-carla/unzipfx2cat.exe Carla.zip > Carla.exe chmod +x Carla.exe +rm -f CarlaControl.exe +cat unzipfx-carla/unzipfx2cat.exe CarlaControl.zip > CarlaControl.exe +chmod +x CarlaControl.exe + # Cleanup rm -f Carla.zip CarlaControl.zip # Create release zip rm -rf ${PKG_FOLDER} mkdir ${PKG_FOLDER} -cp -r Carla.exe Carla.lv2 Carla.vst README.txt ${PKG_FOLDER} +cp -r Carla.exe CarlaControl.exe Carla.lv2 Carla.vst README.txt ${PKG_FOLDER} unix2dos ${PKG_FOLDER}/README.txt zip -r -9 ${PKG_FOLDER}.zip ${PKG_FOLDER} cd ../.. + +# --------------------------------------------------------------------------------------------------------------------- diff --git a/data/windows/unzipfx-carla-control/win32/nt.c b/data/windows/unzipfx-carla-control/win32/nt.c index a6cf85902..3432134cc 100644 --- a/data/windows/unzipfx-carla-control/win32/nt.c +++ b/data/windows/unzipfx-carla-control/win32/nt.c @@ -37,8 +37,8 @@ #define WIN32_LEAN_AND_MEAN #define UNZIP_INTERNAL -#include "../unzip.h" #include +#include "../unzip.h" #ifdef __RSXNT__ # include "../win32/rsxntwin.h" #endif diff --git a/data/windows/unzipfx-carla-control/win32/win32.c b/data/windows/unzipfx-carla-control/win32/win32.c index 410207f4a..013b3e0f8 100644 --- a/data/windows/unzipfx-carla-control/win32/win32.c +++ b/data/windows/unzipfx-carla-control/win32/win32.c @@ -54,8 +54,8 @@ #define UNZIP_INTERNAL +#include #include "../unzip.h" -#include /* must be AFTER unzip.h to avoid struct G problems */ #ifdef __RSXNT__ # include "../win32/rsxntwin.h" #endif diff --git a/source/frontend/carla_app.py b/source/frontend/carla_app.py index 2712870c7..b0d6a8662 100644 --- a/source/frontend/carla_app.py +++ b/source/frontend/carla_app.py @@ -37,8 +37,8 @@ class CarlaApplication(object): pathBinaries, pathResources = getPaths(libPrefix) # Needed for MacOS and Windows - #if os.path.exists(CWD) and (MACOS or WINDOWS): - #QApplication.addLibraryPath(CWD) + if os.path.exists(CWD) and (MACOS or WINDOWS): + QApplication.addLibraryPath(CWD) # Needed for local wine build if WINDOWS and CWD.endswith(("frontend", "resources")) and os.getenv("CXFREEZE") is None: