From f627d1e729dde9d5cad3329f6b3f3a93a0969c5b Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 1 Feb 2021 00:09:11 -0500 Subject: [PATCH] Move libRack.dylib to Resources folder in Mac bundle. Use rpath for plugin build. --- .gitignore | 3 +-- Makefile | 14 +++++++------- plugin.mk | 3 ++- src/app/MenuBar.cpp | 2 +- src/plugin.cpp | 4 +--- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index db399cb0..6baaedfe 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,7 @@ /presets /licenses .DS_Store -/autosave.vcv /autosave /settings.json /screenshots -/Fundamental.zip \ No newline at end of file +/Fundamental.vcvplugin diff --git a/Makefile b/Makefile index adc80beb..9bdc25a6 100644 --- a/Makefile +++ b/Makefile @@ -163,19 +163,19 @@ endif ifdef ARCH_MAC mkdir -p dist/Rack.app mkdir -p dist/Rack.app/Contents - cp Info.plist dist/Rack.app/Contents/ - $(SED) 's/{VERSION}/$(VERSION)/g' dist/Rack.app/Contents/Info.plist + mkdir -p dist/Rack.app/Contents/Resources mkdir -p dist/Rack.app/Contents/MacOS - cp $(TARGET) dist/Rack.app/Contents/MacOS/ + cp $(TARGET) dist/Rack.app/Contents/Resources/ cp $(STANDALONE_TARGET) dist/Rack.app/Contents/MacOS/ - $(STRIP) -S dist/Rack.app/Contents/MacOS/$(TARGET) + $(STRIP) -S dist/Rack.app/Contents/Resources/$(TARGET) $(STRIP) -S dist/Rack.app/Contents/MacOS/$(STANDALONE_TARGET) - install_name_tool -change $(TARGET) @executable_path/$(TARGET) dist/Rack.app/Contents/MacOS/$(STANDALONE_TARGET) + install_name_tool -change $(TARGET) @executable_path/../Resources/$(TARGET) dist/Rack.app/Contents/MacOS/$(STANDALONE_TARGET) # Manually check that no nonstandard shared libraries are linked - otool -L dist/Rack.app/Contents/MacOS/$(TARGET) + otool -L dist/Rack.app/Contents/Resources/$(TARGET) otool -L dist/Rack.app/Contents/MacOS/$(STANDALONE_TARGET) # Copy resources - mkdir -p dist/Rack.app/Contents/Resources + cp Info.plist dist/Rack.app/Contents/ + $(SED) 's/{VERSION}/$(VERSION)/g' dist/Rack.app/Contents/Info.plist cp -R $(DIST_RES) dist/Rack.app/Contents/Resources/ cp -R icon.icns dist/Rack.app/Contents/Resources/ cp Fundamental.vcvplugin dist/Rack.app/Contents/Resources/ diff --git a/plugin.mk b/plugin.mk index f3bb2f49..e951c593 100644 --- a/plugin.mk +++ b/plugin.mk @@ -64,7 +64,8 @@ dist: all cp $(TARGET) dist/$(SLUG)/ ifdef ARCH_MAC $(STRIP) -S dist/$(SLUG)/$(TARGET) - install_name_tool -change libRack.dylib @executable_path/libRack.dylib dist/$(SLUG)/$(TARGET) + install_name_tool -change libRack.dylib @rpath/libRack.dylib dist/$(SLUG)/$(TARGET) + install_name_tool -add_rpath . dist/$(SLUG)/$(TARGET) otool -L dist/$(SLUG)/$(TARGET) else $(STRIP) -s dist/$(SLUG)/$(TARGET) diff --git a/src/app/MenuBar.cpp b/src/app/MenuBar.cpp index a1e082d2..bfe41be3 100644 --- a/src/app/MenuBar.cpp +++ b/src/app/MenuBar.cpp @@ -1012,7 +1012,7 @@ struct MenuBar : widget::OpaqueWidget { layout->addChild(helpButton); MenuButton* alphaButton = new MenuButton; - alphaButton->text = "Pre-alpha built for Christoph Scholtes. Not for release."; + alphaButton->text = "Pre-alpha build. Not for release."; layout->addChild(alphaButton); } diff --git a/src/plugin.cpp b/src/plugin.cpp index 865ff375..e0bfaa81 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -54,9 +54,7 @@ static void* loadLibrary(std::string libraryPath) { #else // As of Rack v2.0, plugins are linked with `-rpath=.` so change current directory so it can find libRack. std::string cwd = system::getWorkingDirectory(); - std::string libDir = asset::systemDir; - DEBUG("Setting working directory to %s", libDir.c_str()); - system::setWorkingDirectory(libDir); + system::setWorkingDirectory(asset::systemDir); // Change it back when we're finished DEFER({system::setWorkingDirectory(cwd);}); // Load library with dlopen