diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92c14e0..5d3bcea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,13 +47,16 @@ jobs: - name: Package # macOS users are expected to have Homebrew SDL2/mpv/curl installed. - # We ship the binary + Configs/Data/Library + version stamp; dylibs come from brew. + # We ship the binary + Configs/Data/Library + version stamp; SDL/mpv/curl + # dylibs come from brew. projectM dylibs come bundled in lib/ next to the + # binary (Makefile drops them there for @loader_path/lib). run: | TAG="${{ github.event.inputs.tag || github.ref_name }}" DROP="Theseus-${TAG}-macos" mkdir -p "${DROP}" cp ~/builds/theseus/desktop/theseus "${DROP}/" for D in Configs Data Library; do cp -R ~/builds/theseus/desktop/$D "${DROP}/$D"; done + if [ -d ~/builds/theseus/desktop/lib ]; then cp -R ~/builds/theseus/desktop/lib "${DROP}/lib"; fi zip -r "${DROP}.zip" "${DROP}" echo "ARCHIVE=${DROP}.zip" >> "$GITHUB_ENV" @@ -103,6 +106,7 @@ jobs: mkdir -p "${DROP}" cp ~/builds/theseus/desktop/theseus "${DROP}/" for D in Configs Data Library; do cp -R ~/builds/theseus/desktop/$D "${DROP}/$D"; done + if [ -d ~/builds/theseus/desktop/lib ]; then cp -R ~/builds/theseus/desktop/lib "${DROP}/lib"; fi tar czf "${DROP}.tar.gz" "${DROP}" echo "ARCHIVE=${DROP}.tar.gz" >> "$GITHUB_ENV" @@ -164,6 +168,7 @@ jobs: mkdir -p "${DROP}" cp ~/builds/theseus/desktop/theseus "${DROP}/" for D in Configs Data Library; do cp -R ~/builds/theseus/desktop/$D "${DROP}/$D"; done + if [ -d ~/builds/theseus/desktop/lib ]; then cp -R ~/builds/theseus/desktop/lib "${DROP}/lib"; fi tar czf "${DROP}.tar.gz" "${DROP}" echo "ARCHIVE=${DROP}.tar.gz" >> "$GITHUB_ENV" diff --git a/build/Makefile b/build/Makefile index 15e3691..efc56b9 100644 --- a/build/Makefile +++ b/build/Makefile @@ -526,8 +526,13 @@ MSYS2 `pacman -S mingw-w64-x86_64-curl`) # a clean checkout to silently ship a no-milkdrop binary.) PROJECTM_PREFIX := $(THESEUS_SRC)/third-party/projectm/install PROJECTM_CFLAGS := -I$(PROJECTM_PREFIX)/include -DTHESEUS_HAS_MILKDROP=1 + ifeq ($(UNAME_S),Darwin) + PROJECTM_RPATH := -Wl,-rpath,@loader_path/lib + else + PROJECTM_RPATH := '-Wl,-rpath,$$ORIGIN/lib' + endif PROJECTM_LDFLAGS := -L$(PROJECTM_PREFIX)/lib -lprojectM-4 -lprojectM-4-playlist \ - -Wl,-rpath,$(PROJECTM_PREFIX)/lib + $(PROJECTM_RPATH) endif CDAUDIO_CFLAGS := $(MPV_CFLAGS) CDAUDIO_LDFLAGS := @@ -909,8 +914,14 @@ projectm-clean: rm -rf $(PROJECTM_SRC)/build $(PROJECTM_SRC)/install $(DESKTOP_TARGET): $(DESKTOP_OBJS) - @mkdir -p $(DESKTOP_DIR) + @mkdir -p $(DESKTOP_DIR) $(DESKTOP_DIR)/lib $(DESKTOP_CXX) -o $@ $(DESKTOP_OBJS) $(DESKTOP_LDFLAGS) + @# Bundle projectM shared libs next to the binary so @loader_path/lib + @# (macOS) and $ORIGIN/lib (Linux) resolve at runtime regardless of cwd. + @for f in $(PROJECTM_PREFIX)/lib/libprojectM-4*.dylib \ + $(PROJECTM_PREFIX)/lib/libprojectM-4*.so* ; do \ + [ -e "$$f" ] && cp -a "$$f" $(DESKTOP_DIR)/lib/ || true ; \ + done; true @# Configs/, Data/, Library/ live next to the binary at runtime; the @# binary CWDs into its own directory and resolves Xbox C:/Q:/E: @# paths through them. Prefer rsync for fast incrementals; fall back