Browse Source

Use @executable_path for libRack.dylib for plugins on Mac. This is a hack that will need to be changed to @rpath later.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
b584e5f506
4 changed files with 16 additions and 11 deletions
  1. +1
    -0
      Makefile
  2. +11
    -9
      plugin.mk
  3. +1
    -1
      src/app/MenuBar.cpp
  4. +3
    -1
      src/plugin.cpp

+ 1
- 0
Makefile View File

@@ -170,6 +170,7 @@ ifdef ARCH_MAC
cp $(STANDALONE_TARGET) dist/Rack.app/Contents/MacOS/
$(STRIP) -S dist/Rack.app/Contents/MacOS/$(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)
# Manually check that no nonstandard shared libraries are linked
otool -L dist/Rack.app/Contents/MacOS/$(TARGET)
otool -L dist/Rack.app/Contents/MacOS/$(STANDALONE_TARGET)


+ 11
- 9
plugin.mk View File

@@ -42,7 +42,7 @@ endif
ifdef ARCH_WIN
TARGET := plugin.dll
LDFLAGS += -static-libstdc++
RACK_USER_DIR ?= "$(USERPROFILE)"/Documents/Rack
RACK_USER_DIR ?= $(USERPROFILE)/Documents/Rack
endif


@@ -59,26 +59,28 @@ clean:

dist: all
rm -rf dist
mkdir -p dist/"$(SLUG)"
mkdir -p dist/$(SLUG)
@# Strip and copy plugin binary
cp $(TARGET) dist/"$(SLUG)"/
cp $(TARGET) dist/$(SLUG)/
ifdef ARCH_MAC
$(STRIP) -S dist/"$(SLUG)"/$(TARGET)
$(STRIP) -S dist/$(SLUG)/$(TARGET)
install_name_tool -change libRack.dylib @executable_path/libRack.dylib dist/$(SLUG)/$(TARGET)
otool -L dist/$(SLUG)/$(TARGET)
else
$(STRIP) -s dist/"$(SLUG)"/$(TARGET)
$(STRIP) -s dist/$(SLUG)/$(TARGET)
endif
@# Copy distributables
ifdef ARCH_MAC
rsync -rR $(DISTRIBUTABLES) dist/"$(SLUG)"/
rsync -rR $(DISTRIBUTABLES) dist/$(SLUG)/
else
cp -r --parents $(DISTRIBUTABLES) dist/"$(SLUG)"/
cp -r --parents $(DISTRIBUTABLES) dist/$(SLUG)/
endif
@# Create ZIP package
cd dist && ZSTD_CLEVEL=19 tar -cf "$(SLUG)"-"$(VERSION)"-$(ARCH).vcvplugin --zstd "$(SLUG)"
cd dist && tar -c $(SLUG) | zstd -19 -o $(SLUG)-"$(VERSION)"-$(ARCH).vcvplugin

install: dist
mkdir -p "$(RACK_USER_DIR)"/plugins-v2/
cp dist/"$(SLUG)"-"$(VERSION)"-$(ARCH).vcvplugin "$(RACK_USER_DIR)"/plugins-v2/
cp dist/$(SLUG)-"$(VERSION)"-$(ARCH).vcvplugin "$(RACK_USER_DIR)"/plugins-v2/

.PHONY: clean dist
.DEFAULT_GOAL := all

+ 1
- 1
src/app/MenuBar.cpp View File

@@ -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 built for Christoph Scholtes. Not for release.";
layout->addChild(alphaButton);
}



+ 3
- 1
src/plugin.cpp View File

@@ -54,7 +54,9 @@ 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();
system::setWorkingDirectory(asset::systemDir);
std::string libDir = asset::systemDir;
DEBUG("Setting working directory to %s", libDir.c_str());
system::setWorkingDirectory(libDir);
// Change it back when we're finished
DEFER({system::setWorkingDirectory(cwd);});
// Load library with dlopen


Loading…
Cancel
Save