Browse Source

make dist tweaks, now more generic

tags/v2.3.0-RC1
falkTX 3 years ago
parent
commit
877dc165ce
1 changed files with 57 additions and 74 deletions
  1. +57
    -74
      Makefile.dist.mk

+ 57
- 74
Makefile.dist.mk View File

@@ -20,12 +20,16 @@ _PLUGIN_UIS = \
xycontroller-ui

_QT5_DLLS = \
QtCore \
QtGui \
QtOpenGL \
QtPrintSupport \
QtSvg \
QtWidgets \
iconengines/libqsvgicon$(LIB_EXT) \
imageformats/libqjpeg$(LIB_EXT) \
imageformats/libqsvg$(LIB_EXT) \
platforms/libqcocoa$(LIB_EXT) \
platforms/libqminimal$(LIB_EXT) \
platforms/libqoffscreen$(LIB_EXT) \
styles/carlastyle$(LIB_EXT)

_THEME_FILES = \
@@ -33,11 +37,11 @@ _THEME_FILES = \
styles/carlastyle$(LIB_EXT)

_CARLA_APP_FILES = \
Carla \
carla-bridge-lv2-cocoa \
Carla$(APP_EXT) \
carla-bridge-lv2-cocoa$(APP_EXT) \
carla-bridge-lv2$(LIB_EXT) \
carla-bridge-native \
carla-discovery-native \
carla-bridge-native$(APP_EXT) \
carla-discovery-native$(APP_EXT) \
libcarla_standalone2$(LIB_EXT) \
libcarla_utils$(LIB_EXT) \
$(_PLUGIN_UIS:%=resources/%$(APP_EXT)) \
@@ -45,35 +49,36 @@ _CARLA_APP_FILES = \
$(_THEME_FILES)

_CARLA_CONTROL_APP_FILES = \
Carla-Control \
Carla-Control$(APP_EXT) \
libcarla_utils$(LIB_EXT) \
$(_QT5_DLLS) \
$(_THEME_FILES)

CARLA_APP_FILES = $(_CARLA_APP_FILES:%=build/Carla.app/Contents/MacOS/%)
CARLA_QT5_DLLS = $(_QT5_DLLS:%=build/Carla.app/Contents/MacOS/%)
CARLA_PLUGIN_ZIPS = $(_PLUGIN_UIS:%=build/%.app/Contents/MacOS/lib/library.zip)
CARLA_PLUGIN_UIS_ZIPS = $(_PLUGIN_UIS:%=build/%.app/Contents/MacOS/lib/library.zip)

CARLA_CONTROL_APP_FILES = $(_CARLA_CONTROL_APP_FILES:%=build/Carla-Control.app/Contents/MacOS/%)
CARLA_CONTROL_QT5_DLLS = $(_QT5_DLLS:%=build/Carla-Control.app/Contents/MacOS/%)

# ----------------------------------------------------------------------------------------------------------------------------
# macOS application bundle, depends on cxfreeze library.zip and all qt-related dlls

build/Carla.app/Contents/MacOS/Carla: build/Carla.app/Contents/MacOS/lib/library.zip $(CARLA_QT5_DLLS)
define CLEANUP_AND_PATCH_CXFREEZE_FILES
# cleanup
find build/Carla.app/Contents/MacOS/ -type f -name "*.py" -delete
find build/Carla.app/Contents/MacOS/ -type f -name "*.pyi" -delete
find build/Carla.app/Contents/MacOS/ -type f -name "pylupdate.so" -delete
find build/Carla.app/Contents/MacOS/ -type f -name "pyrcc.so" -delete
find build/Carla.app/Contents/MacOS/ -type f -name "QtMacExtras*" -delete
find build/Carla.app/Contents/MacOS/ -type f -name "QtNetwork*" -delete
find build/Carla.app/Contents/MacOS/ -type f -name "QtSql*" -delete
find build/Carla.app/Contents/MacOS/ -type f -name "QtTest*" -delete
find build/Carla.app/Contents/MacOS/ -type f -name "QtXml*" -delete
find build/Carla.app/Contents/MacOS/ -type f -name "*.pyc" -delete
rm -rf build/Carla.app/Contents/MacOS/lib/PyQt5/uic
find build/${1}.app/Contents/MacOS/ -type f -name "*.py" -delete
find build/${1}.app/Contents/MacOS/ -type f -name "*.pyi" -delete
find build/${1}.app/Contents/MacOS/ -type f -name "pylupdate.so" -delete
find build/${1}.app/Contents/MacOS/ -type f -name "pyrcc.so" -delete
find build/${1}.app/Contents/MacOS/ -type f -name "QtMacExtras*" -delete
find build/${1}.app/Contents/MacOS/ -type f -name "QtNetwork*" -delete
find build/${1}.app/Contents/MacOS/ -type f -name "QtSql*" -delete
find build/${1}.app/Contents/MacOS/ -type f -name "QtTest*" -delete
find build/${1}.app/Contents/MacOS/ -type f -name "QtXml*" -delete
#find build/${1}.app/Contents/MacOS/ -type f -name "*.pyc" -delete
rm -rf build/${1}.app/Contents/MacOS/lib/PyQt5/uic
# adjust binaries
(cd build/Carla.app/Contents/MacOS && \
(cd build/${1}.app/Contents/MacOS && \
for f in `find . -type f | grep -e Q -e libq -e carlastyle.dylib`; do \
install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" @executable_path/QtCore $$f && \
install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" @executable_path/QtGui $$f && \
@@ -83,14 +88,28 @@ build/Carla.app/Contents/MacOS/Carla: build/Carla.app/Contents/MacOS/lib/library
install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" @executable_path/QtWidgets $$f && \
install_name_tool -change "@rpath/QtMacExtras.framework/Versions/5/QtMacExtras" @executable_path/QtMacExtras $$f; \
done)
# symlink resources
endef

build/Carla.app/Contents/MacOS/Carla: build/Carla.app/Contents/MacOS/lib/library.zip $(CARLA_QT5_DLLS)
$(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla)
# extra step for standalone, symlink resources used in plugin UIs
mkdir -p build/Carla.app/Contents/MacOS/resources
(cd build/Carla.app/Contents/MacOS/resources && \
ln -sf ../Qt* ../lib ../iconengines ../imageformats ../platforms ../styles . && \
ln -sf carla-plugin carla-plugin-patchbay)

build/Carla.app/Contents/MacOS/lib/library.zip: $(CARLA_PLUGIN_ZIPS) data/macos/bundle.py data/macos/*.plist source/frontend/*
env PYTHONPATH=$(CURDIR)/source/frontend SCRIPT_NAME=Carla python3 ./data/macos/bundle.py bdist_mac --bundle-name=Carla
build/Carla-Control.app/Contents/MacOS/Carla-Control: build/Carla-Control.app/Contents/MacOS/lib/library.zip $(CARLA_CONTROL_QT5_DLLS)
$(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla-Control)

# ----------------------------------------------------------------------------------------------------------------------------
# macOS library.zip

define GENERATE_LIBRARY_ZIP
env PYTHONPATH=$(CURDIR)/source/frontend SCRIPT_NAME=${1} python3 ./data/macos/bundle.py bdist_mac --bundle-name=${1}
endef

build/Carla.app/Contents/MacOS/lib/library.zip: $(CARLA_PLUGIN_UIS_ZIPS) data/macos/bundle.py data/macos/Carla_Info.plist source/frontend/*
$(call GENERATE_LIBRARY_ZIP,Carla)
# merge all zips into 1
rm -rf build/Carla.app/Contents/MacOS/lib/_lib
mkdir build/Carla.app/Contents/MacOS/lib/_lib
@@ -102,80 +121,44 @@ build/Carla.app/Contents/MacOS/lib/library.zip: $(CARLA_PLUGIN_ZIPS) data/macos/
rm -rf build/Carla.app/Contents/MacOS/lib/_lib
rm -rf build/Carla.app/Contents/MacOS/lib/library-main.zip

build/Carla.app/Contents/MacOS/iconengines/%: ${QT5_PREFIX}/lib/qt5/plugins/iconengines/%
-@mkdir -p $(shell dirname $@)
@cp -v $< $@
build/Carla-Control.app/Contents/MacOS/lib/library.zip: data/macos/bundle.py data/macos/Carla-Control_Info.plist source/frontend/*
$(call GENERATE_LIBRARY_ZIP,Carla-Control)

build/Carla.app/Contents/MacOS/imageformats/%: ${QT5_PREFIX}/lib/qt5/plugins/imageformats/%
-@mkdir -p $(shell dirname $@)
@cp -v $< $@
build/%.app/Contents/MacOS/lib/library.zip: data/macos/bundle.py data/macos/*.plist source/frontend/*
$(call GENERATE_LIBRARY_ZIP,$*)

build/Carla.app/Contents/MacOS/platforms/%: ${QT5_PREFIX}/lib/qt5/plugins/platforms/%
-@mkdir -p $(shell dirname $@)
@cp -v $< $@
# ----------------------------------------------------------------------------------------------------------------------------
# macOS plugin UIs (stored in resources, depend on their respective startup script and generation of matching library.zip)

build/Carla.app/Contents/MacOS/resources/%: build/%.app/Contents/MacOS/lib/library.zip source/frontend/%
-@mkdir -p $(shell dirname $@)
@cp -v build/$*.app/Contents/MacOS/$* $@

build/Carla.app/Contents/MacOS/%: bin/%
-@mkdir -p $(shell dirname $@)
@cp -v $< $@

# ----------------------------------------------------------------------------------------------------------------------------
# macOS generic bundle files (either from Qt or Carla binaries)

build/Carla-Control.app/Contents/MacOS/Carla-Control: build/Carla-Control.app/Contents/MacOS/lib/library.zip $(CARLA_CONTROL_QT5_DLLS)
# cleanup
find build/Carla-Control.app/Contents/MacOS/ -type f -name "*.py" -delete
find build/Carla-Control.app/Contents/MacOS/ -type f -name "*.pyi" -delete
find build/Carla-Control.app/Contents/MacOS/ -type f -name "pylupdate.so" -delete
find build/Carla-Control.app/Contents/MacOS/ -type f -name "pyrcc.so" -delete
find build/Carla-Control.app/Contents/MacOS/ -type f -name "QtMacExtras*" -delete
find build/Carla-Control.app/Contents/MacOS/ -type f -name "QtNetwork*" -delete
find build/Carla-Control.app/Contents/MacOS/ -type f -name "QtSql*" -delete
find build/Carla-Control.app/Contents/MacOS/ -type f -name "QtTest*" -delete
find build/Carla-Control.app/Contents/MacOS/ -type f -name "QtXml*" -delete
find build/Carla-Control.app/Contents/MacOS/ -type f -name "*.pyc" -delete
rm -rf build/Carla-Control.app/Contents/MacOS/lib/PyQt5/uic
# adjust binaries
(cd build/Carla-Control.app/Contents/MacOS && \
for f in `find . -type f | grep -e Q -e libq -e carlastyle.dylib`; do \
install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" @executable_path/QtCore $$f && \
install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" @executable_path/QtGui $$f && \
install_name_tool -change "@rpath/QtOpenGL.framework/Versions/5/QtOpenGL" @executable_path/QtOpenGL $$f && \
install_name_tool -change "@rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport" @executable_path/QtPrintSupport $$f && \
install_name_tool -change "@rpath/QtSvg.framework/Versions/5/QtSvg" @executable_path/QtSvg $$f && \
install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" @executable_path/QtWidgets $$f && \
install_name_tool -change "@rpath/QtMacExtras.framework/Versions/5/QtMacExtras" @executable_path/QtMacExtras $$f; \
done)

build/Carla-Control.app/Contents/MacOS/iconengines/%: ${QT5_PREFIX}/lib/qt5/plugins/iconengines/%
build/Carla.app/Contents/MacOS/Qt% build/Carla-Control.app/Contents/MacOS/Qt%: $(QT5_PREFIX)/lib/Qt%.framework
-@mkdir -p $(shell dirname $@)
@cp -v $< $@
@cp -v $</Versions/5/Qt$* $@

build/Carla-Control.app/Contents/MacOS/imageformats/%: ${QT5_PREFIX}/lib/qt5/plugins/imageformats/%
build/Carla.app/Contents/MacOS/iconengines/% build/Carla-Control.app/Contents/MacOS/iconengines/%: $(QT5_PREFIX)/lib/qt5/plugins/iconengines/%
-@mkdir -p $(shell dirname $@)
@cp -v $< $@

build/Carla-Control.app/Contents/MacOS/platforms/%: ${QT5_PREFIX}/lib/qt5/plugins/platforms/%
build/Carla.app/Contents/MacOS/imageformats/% build/Carla-Control.app/Contents/MacOS/imageformats/%: $(QT5_PREFIX)/lib/qt5/plugins/imageformats/%
-@mkdir -p $(shell dirname $@)
@cp -v $< $@

build/Carla-Control.app/Contents/MacOS/resources/%: build/%.app/Contents/MacOS/lib/library.zip source/frontend/%
build/Carla.app/Contents/MacOS/platforms/% build/Carla-Control.app/Contents/MacOS/platforms/%: $(QT5_PREFIX)/lib/qt5/plugins/platforms/%
-@mkdir -p $(shell dirname $@)
@cp -v build/$*.app/Contents/MacOS/$* $@
@cp -v $< $@

build/Carla-Control.app/Contents/MacOS/%: bin/%
build/Carla.app/Contents/MacOS/% build/Carla-Control.app/Contents/MacOS/%: bin/%
-@mkdir -p $(shell dirname $@)
@cp -v $< $@

# ----------------------------------------------------------------------------------------------------------------------------

build/%.app/Contents/MacOS/lib/library.zip: data/macos/bundle.py data/macos/*.plist source/frontend/*
env PYTHONPATH=$(CURDIR)/source/frontend SCRIPT_NAME=$* python3 ./data/macos/bundle.py bdist_mac --bundle-name=$*

# ----------------------------------------------------------------------------------------------------------------------------

dist: carla_mac

carla_mac: $(CARLA_APP_FILES) $(CARLA_CONTROL_APP_FILES)


Loading…
Cancel
Save