From d6b382f36d3ac42285e41cd1d049f51bcc19ab30 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 12 Oct 2020 02:19:18 -0400 Subject: [PATCH] Fix bug in resolving paths in system::unarchiveFolder(). Create .tar.zst plugins in `make dist` for plugins. Link to libstdc++ statically for plugins. Remove -lstdc++fs since we replaced it with ghc::filesystem. --- Makefile | 4 ++-- plugin.mk | 7 +++++-- src/system.cpp | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 13b1691b..aeabc645 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ build/dep/osdialog/osdialog_gtk3.c.o: FLAGS += $(shell pkg-config --cflags gtk+- FLAGS += -fno-gnu-unique LDFLAGS += -Wl,--whole-archive - LDFLAGS += dep/lib/libGLEW.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/libarchive.a dep/lib/libzstd.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/librtmidi.a dep/lib/librtaudio.a -lstdc++fs + LDFLAGS += dep/lib/libGLEW.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/libarchive.a dep/lib/libzstd.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/librtmidi.a dep/lib/librtaudio.a LDFLAGS += -Wl,--no-whole-archive LDFLAGS += -lpthread -lGL -ldl -lX11 -lasound -ljack LDFLAGS += $(shell pkg-config --libs gtk+-3.0) @@ -65,7 +65,7 @@ ifdef ARCH_WIN LDFLAGS += -Wl,--export-all-symbols LDFLAGS += -Wl,--out-implib,$(TARGET).a LDFLAGS += -Wl,-Bstatic -Wl,--whole-archive - LDFLAGS += dep/lib/libglew32.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/libarchive.a dep/lib/libzstd.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/librtaudio.a dep/lib/librtmidi.a -lstdc++fs + LDFLAGS += dep/lib/libglew32.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/libarchive.a dep/lib/libzstd.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/librtaudio.a dep/lib/librtmidi.a LDFLAGS += -Wl,-Bdynamic -Wl,--no-whole-archive LDFLAGS += -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi -lmfplat -lmfuuid -lwmcodecdspuuid -ldbghelp diff --git a/plugin.mk b/plugin.mk index 13ebee87..3d5ba611 100644 --- a/plugin.mk +++ b/plugin.mk @@ -20,6 +20,9 @@ FLAGS += -I$(RACK_DIR)/include -I$(RACK_DIR)/dep/include LDFLAGS += -shared LDFLAGS += -L$(RACK_DIR) -lRack +# Since the compiler we're using could have a newer version than the minimum supported libstdc++ version, link it statically. +LDFLAGS += -static-libstdc++ + include $(RACK_DIR)/arch.mk ifdef ARCH_LIN @@ -71,10 +74,10 @@ else cp -r --parents $(DISTRIBUTABLES) dist/"$(SLUG)"/ endif @# Create ZIP package - cd dist && zip -q -9 -r "$(SLUG)"-"$(VERSION)"-$(ARCH).zip "$(SLUG)" + cd dist && ZSTD_CLEVEL=19 tar -cf "$(SLUG)"-"$(VERSION)"-$(ARCH).vcvplugin --zstd "$(SLUG)" install: dist - cp dist/"$(SLUG)"-"$(VERSION)"-$(ARCH).zip $(RACK_USER_DIR)/plugins-v2/ + cp dist/"$(SLUG)"-"$(VERSION)"-$(ARCH).vcvplugin $(RACK_USER_DIR)/plugins-v2/ .PHONY: clean dist .DEFAULT_GOAL := all diff --git a/src/system.cpp b/src/system.cpp index 6a0fcddb..2873a3e6 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -415,7 +415,7 @@ void unarchiveToFolder(const std::string& archivePath, const std::string& folder std::string entryPath = archive_entry_pathname(entry); if (!fs::u8path(entryPath).is_relative()) throw Exception(string::f("Unarchiver does not support absolute tar paths: %s", entryPath.c_str())); - entryPath = fs::relative(fs::u8path(entryPath), fs::u8path(folderPath)).generic_u8string(); + entryPath = (fs::u8path(folderPath) / fs::u8path(entryPath)).generic_u8string(); #if defined ARCH_WIN archive_entry_copy_pathname_w(entry, string::U8toU16(entryPath).c_str()); #else