Skip to content

Commit

Permalink
macOS packaging details
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Oct 12, 2023
1 parent 677cb11 commit 0ed0792
Show file tree
Hide file tree
Showing 14 changed files with 190 additions and 79 deletions.
68 changes: 32 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ BOOTSTRAP_FILES = \
TARGETS = build-ui/lib/libmod_utils$(SO_EXT)

ifeq ($(MACOS),true)
TARGETS += build/mod-app.app/Contents/Info.plist
TARGETS += build/mod-app.app/Contents/Frameworks/QtCore.framework
TARGETS += build/mod-app.app/Contents/Frameworks/QtGui.framework
TARGETS += build/mod-app.app/Contents/Frameworks/QtOpenGL.framework
TARGETS += build/mod-app.app/Contents/Frameworks/QtPrintSupport.framework
TARGETS += build/mod-app.app/Contents/Frameworks/QtSvg.framework
TARGETS += build/mod-app.app/Contents/Frameworks/QtWidgets.framework
TARGETS += build/mod-app.app/Contents/MacOS/lib
TARGETS += build/mod-app.app/Contents/MacOS/libjack.0.dylib
TARGETS += build/mod-app.app/Contents/MacOS/libjackserver.0.dylib
TARGETS += build/mod-app.app/Contents/MacOS/jackd
Expand All @@ -70,14 +74,15 @@ TARGETS += build/mod-app.app/Contents/MacOS/mod-screenshot
TARGETS += build/mod-app.app/Contents/MacOS/mod-ui
TARGETS += build/mod-app.app/Contents/MacOS/mod
TARGETS += build/mod-app.app/Contents/MacOS/modtools
TARGETS += build/mod-app.app/Contents/PlugIns/bearer/libqgenericbearer.dylib
TARGETS += build/mod-app.app/Contents/PlugIns/generic/libqtuiotouchplugin.dylib
TARGETS += build/mod-app.app/Contents/PlugIns/iconengines/libqsvgicon.dylib
TARGETS += build/mod-app.app/Contents/PlugIns/imageformats/libqsvg.dylib
TARGETS += build/mod-app.app/Contents/PlugIns/LV2
TARGETS += build/mod-app.app/Contents/PlugIns/platforms/libqcocoa.dylib
TARGETS += build/mod-app.app/Contents/PlugIns/styles/libqmacstyle.dylib
TARGETS += build/mod-app.app/Contents/Resources/default.pedalboard
TARGETS += build/mod-app.app/Contents/Resources/html
TARGETS += build/mod-app.app/Contents/Resources/mod-logo.icns
else
TARGETS += build/jackd$(APP_EXT)
TARGETS += build/jack/jack-session.conf
Expand All @@ -101,7 +106,6 @@ TARGETS += build/Qt5Core.dll
TARGETS += build/Qt5Gui.dll
TARGETS += build/Qt5Svg.dll
TARGETS += build/Qt5Widgets.dll
TARGETS += build/bearer/qgenericbearer.dll
TARGETS += build/generic/qtuiotouchplugin.dll
TARGETS += build/iconengines/qsvgicon.dll
TARGETS += build/imageformats/qsvg.dll
Expand All @@ -118,20 +122,17 @@ endif

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

# FIXME *.so extension
ifneq ($(MACOS),true)
BUNDLES = abGate.lv2
endif
BUNDLES += artyfx.lv2
BUNDLES += carla-files.lv2
ifneq ($(MACOS),true)
# FIXME crashes on load
BUNDLES += carla-files.lv2
endif
BUNDLES += DragonflyEarlyReflections.lv2
BUNDLES += DragonflyHallReverb.lv2
BUNDLES += DragonflyPlateReverb.lv2
BUNDLES += DragonflyRoomReverb.lv2
# FIXME *.so extension
BUNDLES += fil4.lv2
endif
BUNDLES += Black_Pearl_4A.lv2
BUNDLES += Black_Pearl_4B.lv2
BUNDLES += Black_Pearl_5.lv2
Expand Down Expand Up @@ -159,20 +160,13 @@ ifneq ($(MACOS),true)
# BUNDLES += fomp.lv2
endif
BUNDLES += Kars.lv2
ifneq ($(MACOS),true)
# FIXME *.so extension
BUNDLES += midifilter.lv2
endif
BUNDLES += midigen.lv2
# FIXME *.so extension
BUNDLES += mod-bpf.lv2
BUNDLES += MOD-CabinetLoader.lv2
BUNDLES += MOD-ConvolutionLoader.lv2
# FIXME *.so extension
BUNDLES += mod-gain.lv2
# FIXME *.so extension
BUNDLES += mod-gain2x2.lv2
# FIXME *.so extension
BUNDLES += mod-hpf.lv2
BUNDLES += mod-mda-BeatBox.lv2
BUNDLES += mod-mda-Degrade.lv2
Expand All @@ -189,37 +183,29 @@ BUNDLES += mod-mda-Shepard.lv2
BUNDLES += mod-mda-SubSynth.lv2
BUNDLES += mod-mda-ThruZero.lv2
BUNDLES += mod-mda-Vocoder.lv2
ifneq ($(MACOS),true)
# FIXME *.so extension
BUNDLES += modmeter.lv2
# FIXME *.so extension
ifneq ($(MACOS),true)
# FIXME fails to build: implicit declaration of function '__atomic_store_4'
BUNDLES += modspectre.lv2
endif
BUNDLES += MVerb.lv2
BUNDLES += Nekobi.lv2
BUNDLES += neural_amp_modeler.lv2
ifneq ($(MACOS),true)
# FIXME fails to build: implicit declaration of function 'basename'
BUNDLES += notes.lv2
endif
BUNDLES += PingPongPan.lv2
ifneq ($(MACOS),true)
# FIXME plugin binary missing (win32 RUNTIME vs LIBRARY)
BUNDLES += rt-neural-generic.lv2
endif
# FIXME *.so extension
ifneq ($(MACOS),true)
BUNDLES += tinygain.lv2
endif
BUNDLES += wolf-shaper.lv2

# TODO check
ifneq ($(MACOS),true)
BUNDLES += Harmless.lv2
BUNDLES += Larynx.lv2
BUNDLES += Modulay.lv2
BUNDLES += Shiroverb.lv2
endif


# TODO build fails
# BUNDLES += mod-ams.lv2
Expand Down Expand Up @@ -292,10 +278,6 @@ build/Qt5%.dll: $(PAWPAW_PREFIX)/bin/Qt5%.dll
@mkdir -p build
ln -sf $(abspath $<) $@

build/bearer/q%.dll: $(PAWPAW_PREFIX)/lib/qt5/plugins/bearer/q%.dll
@mkdir -p build/bearer
ln -sf $(abspath $<) $@

build/generic/q%.dll: $(PAWPAW_PREFIX)/lib/qt5/plugins/generic/q%.dll
@mkdir -p build/generic
ln -sf $(abspath $<) $@
Expand Down Expand Up @@ -362,6 +344,10 @@ build/modtools: mod-ui/modtools

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

build/mod-app.app/Contents/Info.plist: utils/Info.plist
@mkdir -p build/mod-app.app/Contents
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/Frameworks/Qt%.framework: $(PAWPAW_PREFIX)/lib/Qt%.framework
@mkdir -p build/mod-app.app/Contents/Frameworks
ln -sf $(abspath $<) $@
Expand All @@ -375,7 +361,7 @@ build/mod-app.app/Contents/MacOS/jackd: $(PAWPAW_PREFIX)/bin/jackd$(APP_EXT)
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/MacOS/lib: build-ui/lib
@mkdir -p build/mod-app.app/Contents/MacOS/
@mkdir -p build/mod-app.app/Contents/MacOS
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/MacOS/libjack%: $(PAWPAW_PREFIX)/lib/libjack%
Expand Down Expand Up @@ -418,10 +404,6 @@ build/mod-app.app/Contents/MacOS/modtools: mod-ui/modtools
@mkdir -p build/mod-app.app/Contents/MacOS/
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/PlugIns/bearer/libq%.dylib: $(PAWPAW_PREFIX)/lib/qt5/plugins/bearer/libq%.dylib
@mkdir -p build/mod-app.app/Contents/PlugIns/bearer
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/PlugIns/generic/libq%.dylib: $(PAWPAW_PREFIX)/lib/qt5/plugins/generic/libq%.dylib
@mkdir -p build/mod-app.app/Contents/PlugIns/generic
ln -sf $(abspath $<) $@
Expand All @@ -434,6 +416,11 @@ build/mod-app.app/Contents/PlugIns/imageformats/libq%.dylib: $(PAWPAW_PREFIX)/li
@mkdir -p build/mod-app.app/Contents/PlugIns/imageformats
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/PlugIns/LV2: build/plugins
@mkdir -p build/mod-app.app/Contents/PlugIns
@mkdir -p build/plugins
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/PlugIns/platforms/libq%.dylib: $(PAWPAW_PREFIX)/lib/qt5/plugins/platforms/libq%.dylib
@mkdir -p build/mod-app.app/Contents/PlugIns/platforms
ln -sf $(abspath $<) $@
Expand All @@ -450,6 +437,10 @@ build/mod-app.app/Contents/Resources/html: mod-ui/html
@mkdir -p build/mod-app.app/Contents/Resources
ln -sf $(abspath $<) $@

build/mod-app.app/Contents/Resources/mod-logo.icns: systray/mod-logo.icns
@mkdir -p build/mod-app.app/Contents/Resources
ln -sf $(abspath $<) $@

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

build/mod-screenshot$(APP_EXT): build-screenshot/mod-screenshot$(APP_EXT)
Expand Down Expand Up @@ -506,9 +497,14 @@ systray/mod-app$(APP_EXT): systray/main.cpp systray/mod-app.hpp

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

.KEEP: $(BUNDLES:%=$(PAWPAW_PREFIX)/lib/lv2/%/manifest.ttl)

build/plugins/%: $(PAWPAW_PREFIX)/lib/lv2/%/manifest.ttl
@mkdir -p build/plugins
ln -sf $(subst /manifest.ttl,,$(abspath $<)) $@
rm -f $@
ln -s $(subst /manifest.ttl,,$(abspath $<)) $@
touch $(PAWPAW_PREFIX)/lib/lv2/$*/manifest.ttl
touch $@

$(PAWPAW_PREFIX)/lib/lv2/abGate.lv2/manifest.ttl: $(BOOTSTRAP_FILES)
./utils/plugin-builder.sh $(PAWPAW_TARGET) abgate
Expand Down
2 changes: 1 addition & 1 deletion PawPaw
Submodule PawPaw updated 1 files
+50 −5 bootstrap-mod.sh
2 changes: 1 addition & 1 deletion mod-plugin-builder
8 changes: 4 additions & 4 deletions systray/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ $(TARGET): $(OBJS)
@$(shell mkdir -p $(@D))
$(CXX) $^ $(LDFLAGS) $(QT5_LIBS) -o $@
ifeq ($(MACOS),true)
install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" "@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore" $@
install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $@
install_name_tool -change "@rpath/QtSvg.framework/Versions/5/QtSvg" "@executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg" $@
install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets" $@
install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" "@executable_path/../Frameworks/QtCore.framework/QtCore" $@
install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" "@executable_path/../Frameworks/QtGui.framework/QtGui" $@
install_name_tool -change "@rpath/QtSvg.framework/Versions/5/QtSvg" "@executable_path/../Frameworks/QtSvg.framework/QtSvg" $@
install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/../Frameworks/QtWidgets.framework/QtWidgets" $@
endif

main.cpp.o: main.cpp mod-app.hpp qrc_mod-app.hpp ui_mod-app.hpp
Expand Down
23 changes: 19 additions & 4 deletions systray/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
static const WCHAR* user_files_dir = nullptr;
#else
#include <dlfcn.h>
#include <pwd.h>
#include <signal.h>
#include <sys/stat.h>
#include <unistd.h>
Expand Down Expand Up @@ -93,7 +94,7 @@ int main(int argc, char* argv[])
return 1;
}

#ifdef _WIN32
#ifdef _WIN32
WCHAR path[MAX_PATH + 256] = {};

GetModuleFileNameW(GetModuleHandleW(nullptr), path, sizeof(path)/sizeof(path[0]));
Expand Down Expand Up @@ -121,7 +122,7 @@ int main(int argc, char* argv[])
std::wcscat(path, L"\\user-files");
_wmkdir(path);
user_files_dir = path;
#else
#else
char path[PATH_MAX + 256] = {};

Dl_info info = {};
Expand All @@ -140,12 +141,26 @@ int main(int argc, char* argv[])

char lv2path[(PATH_MAX + 256) * 2] = {};
std::strncat(lv2path, path, pathlen);
#ifdef __APPLE__
std::strcat(lv2path, "/../PlugIns/LV2:");
#else
std::strcat(lv2path, "/plugins:");
#endif

if (const char* const home = getenv("HOME"))
std::strncpy(path, home, sizeof(path));
else if (struct passwd* const pwd = getpwuid(getuid()))
std::strncpy(path, pwd->pw_dir, sizeof(path));
else
return 1;

#ifdef __APPLE__
std::strcat(path, "/Documents/MOD App");
#else
// TODO fetch user docs dir
std::memcpy(path + pathlen, "/data", 6);
#endif

// std::strcat(path, "/MOD App");
mkdir(path, 0777);
setenv("MOD_DATA_DIR", path, 1);

Expand All @@ -163,7 +178,7 @@ int main(int argc, char* argv[])
sigemptyset(&sig.sa_mask);
sigaction(SIGTERM, &sig, nullptr);
sigaction(SIGINT, &sig, nullptr);
#endif
#endif

app.setQuitOnLastWindowClosed(false);

Expand Down
4 changes: 4 additions & 0 deletions systray/mod-app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,11 @@ private slots:
{
case QSystemTrayIcon::DoubleClick:
case QSystemTrayIcon::MiddleClick:
#ifdef Q_OS_MAC
show();
#else
setVisible(!isVisible());
#endif
break;
default:
break;
Expand Down
Binary file added systray/mod-logo.icns
Binary file not shown.
29 changes: 29 additions & 0 deletions utils/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>mod-app</string>
<key>CFBundleIconFile</key>
<string>mod-logo.icns</string>
<key>CFBundleIdentifier</key>
<string>audio.mod.app</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSRequiresAquaSystemAppearance</key>
<false/>
<key>NSMicrophoneUsageDescription</key>
<string>MOD App requires microphone permissions for audio input.</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>NSHumanReadableCopyright</key>
<string>(C) 2023 MOD Audio UG.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.</string>
</dict>
</plist>
43 changes: 43 additions & 0 deletions utils/macos-dmg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -e

if [ ! -d build ]; then
echo "Please run this script from the root folder"
exit
fi

QTLIBS=("Core" "Gui" "OpenGL" "PrintSupport" "Svg" "Widgets")

rm -rf mod-ui/mod/__pycache__
rm -rf mod-ui/mod/communication/__pycache__
rm -rf mod-ui/modtools/__pycache__

rm -rf build/dmg
mkdir build/dmg

cp -rL build/mod-app.app build/dmg/
cp utils/macos-readme.txt build/dmg/README.txt

pushd build/dmg/mod-app.app/Contents

rm -rf Frameworks/*/*.prl
rm -rf Frameworks/*/Headers
rm -rf Frameworks/*/Versions
rm -rf MacOS/data

for f in $(ls Frameworks/*/Qt* PlugIns/*/libq*.dylib); do
for q in "${QTLIBS[@]}"; do
install_name_tool -change "@rpath/Qt${q}.framework/Versions/5/Qt${q}" "@executable_path/../Frameworks/Qt${q}.framework/Qt${q}" "${f}"
done
done

for f in $(ls MacOS/jackd MacOS/lib/libmod_utils.so MacOS/libjack*.dylib MacOS/jack/*.so); do
install_name_tool -change "${HOME}/PawPawBuilds/targets/macos-universal-10.15/lib/libjack.0.1.0.dylib" "@executable_path/libjack.0.dylib" "${f}"
install_name_tool -change "${HOME}/PawPawBuilds/targets/macos-universal-10.15/lib/libjackserver.0.1.0.dylib" "@executable_path/libjackserver.0.dylib" "${f}"
done

popd

hdiutil create "mod-app-$(make version)-macOS.dmg" -srcfolder build/dmg -volname "MOD App" -fs HFS+ -ov
rm -rf build/dmg
9 changes: 9 additions & 0 deletions utils/macos-readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
README for MOD Audio for macOS

For the moment the application bundle is not signed, and as such it will refuse to run by default.

To allow the application to run, please right-click on it and select open.
A warning will appear saying macOS cannot verify the application, that is expected.
Right-click and select to open it a 2nd time, and this time pick the new "Open" option to allow it to run.

Also, MOD App requires macOS 10.15 or later, it will not run on older versions.
Loading

0 comments on commit 0ed0792

Please sign in to comment.