diff --git a/Info.plist b/Info.plist index a6b358d1..0c07db4c 100644 --- a/Info.plist +++ b/Info.plist @@ -19,7 +19,7 @@ CFBundleExecutable Rack CFBundleIconFile - + icon CFBundleLongVersionString 0.0.0 CFBundleShortVersionString @@ -27,6 +27,6 @@ NSPrincipalClass NSApplication NSHighResolutionCapable - NO + YES diff --git a/Makefile b/Makefile index fb08844d..948f454d 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ ifeq ($(ARCH), win) endif clean: - rm -rf $(TARGET) build dist + rm -rfv $(TARGET) build dist # For Windows resources %.res: %.rc @@ -84,27 +84,34 @@ ifeq ($(ARCH), lin) cp dep/lib/libsamplerate.so.0 dist/Rack/ endif ifeq ($(ARCH), mac) + mkdir -p $(BUNDLE) mkdir -p $(BUNDLE)/Contents + mkdir -p $(BUNDLE)/Contents/Resources cp Info.plist $(BUNDLE)/Contents/ mkdir -p $(BUNDLE)/Contents/MacOS cp Rack $(BUNDLE)/Contents/MacOS/ + cp icon.icns $(BUNDLE)/Contents/Resources/ otool -L $(BUNDLE)/Contents/MacOS/Rack - # cp /usr/local/opt/glew/lib/libGLEW.2.0.0.dylib $(BUNDLE)/Contents/MacOS/ - # cp /usr/local/opt/jansson/lib/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/ - # cp /usr/local/opt/portaudio/lib/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/ - # cp /usr/local/opt/portmidi/lib/libportmidi.dylib $(BUNDLE)/Contents/MacOS/ - # cp /usr/local/opt/libsamplerate/lib/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/ - # cp /usr/local/opt/libzip/lib/libzip.4.dylib $(BUNDLE)/Contents/MacOS/ - - # install_name_tool -change /usr/local/opt/glew/lib/libGLEW.2.0.0.dylib @executable_path/libGLEW.2.0.0.dylib $(BUNDLE)/Contents/MacOS/Rack - # install_name_tool -change /usr/local/opt/jansson/lib/libjansson.4.dylib @executable_path/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/Rack - # install_name_tool -change /usr/local/opt/portaudio/lib/libportaudio.2.dylib @executable_path/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/Rack - # install_name_tool -change /usr/local/opt/portmidi/lib/libportmidi.dylib @executable_path/libportmidi.dylib $(BUNDLE)/Contents/MacOS/Rack - # install_name_tool -change /usr/local/opt/libsamplerate/lib/libsamplerate.0.dylib @executable_path/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/Rack - # install_name_tool -change /usr/local/opt/libzip/lib/libzip.4.dylib @executable_path/libzip.4.dylib $(BUNDLE)/Contents/MacOS/Rack + cp dep/lib/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/ + cp dep/lib/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/ + cp dep/lib/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/ + cp dep/lib/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/ + cp dep/lib/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/ + cp dep/lib/libzip.5.dylib $(BUNDLE)/Contents/MacOS/ + cp dep/lib/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/ + cp dep/lib/libportmidi.dylib $(BUNDLE)/Contents/MacOS/ + + install_name_tool -change /usr/local/lib/libGLEW.2.1.0.dylib @executable_path/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/Rack + install_name_tool -change lib/libglfw.3.dylib @executable_path/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/Rack + install_name_tool -change $(PWD)/dep/lib/libjansson.4.dylib @executable_path/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/Rack + install_name_tool -change $(PWD)/dep/lib/libsamplerate.0.dylib @executable_path/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/Rack + install_name_tool -change $(PWD)/dep/lib/libcurl.4.dylib @executable_path/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/Rack + install_name_tool -change $(PWD)/dep/lib/libzip.5.dylib @executable_path/libzip.5.dylib $(BUNDLE)/Contents/MacOS/Rack + install_name_tool -change $(PWD)/dep/lib/libportaudio.2.dylib @executable_path/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/Rack + install_name_tool -change @rpath/libportmidi.dylib @executable_path/libportmidi.dylib $(BUNDLE)/Contents/MacOS/Rack otool -L $(BUNDLE)/Contents/MacOS/Rack @@ -120,4 +127,9 @@ endif $(MAKE) -C plugins/Fundamental dist cp -R plugins/Fundamental/dist/Fundamental dist/Rack/plugins/ +ifeq ($(ARCH), mac) + cd dist && ln -s /Applications Applications + cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg +else cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack +endif diff --git a/dep/Makefile b/dep/Makefile index 82193e7d..d4c472f5 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -49,7 +49,7 @@ $(glfw): $(UNZIP) $@.zip cd $@ && $(CMAKE) . \ -DCMAKE_INSTALL_PREFIX="$(LOCAL)" -DBUILD_SHARED_LIBS=ON \ - -DGLFW_USE_CHDIR=ON -DGLFW_USE_MENUBAR=ON -DGLFW_USE_RETINA=ON + -DGLFW_USE_CHDIR=OFF -DGLFW_USE_MENUBAR=ON -DGLFW_USE_RETINA=ON $(MAKE) -C $@ $(MAKE) -C $@ install ifeq ($(ARCH),win) diff --git a/src/main.cpp b/src/main.cpp index e37d3d14..3966333f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -53,26 +53,33 @@ void fixCwd() { if (isCorrectCwd()) return; +/* // Get path of binary inside the app bundle - // It should be something like */Rack.app/Contents/MacOS + // It should be something like .../Rack.app/Contents/MacOS char path[PATH_MAX]; uint32_t pathLen = sizeof(path); int err = _NSGetExecutablePath(path, &pathLen); assert(!err); + if (isCorrectCwd()) + return; // Switch to the directory of the actual binary chdir(dirname(path)); + if (isCorrectCwd()) + return; + // and then go up three directories to get to the parent directory chdir("../../../"); if (isCorrectCwd()) return; +*/ // Switch to a default absolute path chdir("/Applications/Rack"); if (isCorrectCwd()) return; - alert("Install Rack", "To install Rack, please move the Rack directory to your /Applications folder.", 2); + alert("Install Rack", "To install Rack, please move the Rack directory (including the Rack app and plugins directory) to the /Applications folder.", 2); exit(1); } #endif