Continue work for redistributable binaries, WIP
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
0c6746fdce
commit
649773c851
6 changed files with 143 additions and 22 deletions
22
Makefile
22
Makefile
|
@ -6,7 +6,24 @@
|
|||
|
||||
include dpf/Makefile.base.mk
|
||||
|
||||
all: cardinal deps dgl plugins gen
|
||||
all: cardinal deps dgl plugins gen resources
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# Build config
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
DESTDIR ?=
|
||||
SYSDEPS ?= false
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# Check for system-wide dependencies
|
||||
|
||||
# HAVE_LIBARCHIVE = $(shell pkg-config --exists libarchive && echo true)
|
||||
#
|
||||
# libjansson.a
|
||||
# libsamplerate.a
|
||||
# libspeexdsp.a
|
||||
# libzstd.a
|
||||
|
||||
# --------------------------------------------------------------
|
||||
|
||||
|
@ -23,6 +40,9 @@ dgl:
|
|||
plugins: deps
|
||||
$(MAKE) all -C plugins
|
||||
|
||||
resources: cardinal gen
|
||||
$(MAKE) resources -C plugins
|
||||
|
||||
ifneq ($(CROSS_COMPILING),true)
|
||||
gen: cardinal dpf/utils/lv2_ttl_generator
|
||||
@$(CURDIR)/dpf/utils/generate-ttl.sh
|
||||
|
|
2
dpf
2
dpf
|
@ -1 +1 @@
|
|||
Subproject commit 1af66e49db01b5e2a5f90e85fe748c162bb83a48
|
||||
Subproject commit 1da1c811c765689790c8bf4290b2f6939f8046f3
|
|
@ -318,6 +318,55 @@ clean:
|
|||
rm -f $(TARGET)
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
# --------------------------------------------------------------
|
||||
|
||||
PLUGIN_LIST = $(subst /plugin.json,,$(wildcard */plugin.json))
|
||||
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/Cardinal.lv2/resources/%)
|
||||
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/Cardinal.lv2/resources/PluginManifests/%.json)
|
||||
ifeq ($(MACOS),true)
|
||||
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/Cardinal.vst/Contents/Resources/%)
|
||||
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/Cardinal.vst/Contents/Resources/PluginManifests/%.json)
|
||||
else
|
||||
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/Cardinal.vst/resources/%)
|
||||
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/Cardinal.vst/resources/PluginManifests/%.json)
|
||||
endif
|
||||
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/Cardinal.vst3/Contents/Resources/%)
|
||||
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/Cardinal.vst3/Contents/Resources/PluginManifests/%.json)
|
||||
|
||||
resources: $(PLUGIN_RESOURCES)
|
||||
|
||||
../bin/Cardinal.lv2/resources/%: %/res
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
../bin/Cardinal.vst/resources/%: %/res
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
../bin/Cardinal.vst/Contents/Resources/%: %/res
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
../bin/Cardinal.vst3/Contents/Resources/%: %/res
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
../bin/Cardinal.lv2/resources/PluginManifests/%.json: %/plugin.json
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
../bin/Cardinal.vst/resources/PluginManifests/%.json: %/plugin.json
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
../bin/Cardinal.vst/Contents/Resources/PluginManifests/%.json: %/plugin.json
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
../bin/Cardinal.vst3/Contents/Resources/PluginManifests/%.json: %/plugin.json
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# Build commands
|
||||
|
||||
|
|
|
@ -72,23 +72,32 @@ struct Initializer {
|
|||
random::init();
|
||||
ui::init();
|
||||
|
||||
std::string resDir;
|
||||
|
||||
if (const char* const bundlePath = plugin->getBundlePath())
|
||||
if (asset::systemDir.empty())
|
||||
{
|
||||
asset::systemDir = bundlePath;
|
||||
#ifdef DISTRHO_OS_MAC
|
||||
asset::systemDir += "/Contents/Resources";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make system dir point to source code location as fallback
|
||||
// TODO use /usr/share if on linux? if we count on it being installed..
|
||||
asset::systemDir = CARDINAL_PLUGIN_SOURCE_DIR DISTRHO_OS_SEP_STR "Rack" DISTRHO_OS_SEP_STR "res";
|
||||
}
|
||||
if (const char* const bundlePath = plugin->getBundlePath())
|
||||
{
|
||||
if (const char* const resourcePath = getResourcePath(bundlePath))
|
||||
{
|
||||
asset::bundlePath = system::join(resourcePath, "PluginManifests");
|
||||
asset::systemDir = resourcePath;
|
||||
}
|
||||
}
|
||||
|
||||
asset::userDir = asset::systemDir;
|
||||
if (asset::systemDir.empty())
|
||||
{
|
||||
// Make system dir point to source code location as fallback
|
||||
// TODO use /usr/share if on linux? if we count on it being installed..
|
||||
asset::systemDir = CARDINAL_PLUGIN_SOURCE_DIR DISTRHO_OS_SEP_STR "Rack";
|
||||
|
||||
if (! system::isDirectory(system::join(asset::systemDir, "res")))
|
||||
{
|
||||
asset::bundlePath = CARDINAL_PLUGIN_PREFIX "/share/Cardinal/Plugins";
|
||||
asset::systemDir = CARDINAL_PLUGIN_PREFIX "/share/Cardinal/Resources";
|
||||
}
|
||||
}
|
||||
|
||||
asset::userDir = asset::systemDir;
|
||||
}
|
||||
|
||||
// Log environment
|
||||
INFO("%s %s v%s", APP_NAME.c_str(), APP_EDITION.c_str(), APP_VERSION.c_str());
|
||||
|
|
40
src/Makefile
40
src/Makefile
|
@ -4,6 +4,13 @@
|
|||
# Created by falkTX
|
||||
#
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# Build config
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
DESTDIR ?=
|
||||
SYSDEPS ?= false
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# Project name, used for binaries
|
||||
|
||||
|
@ -150,10 +157,41 @@ SOURCE_DIR = $(CURDIR)
|
|||
endif
|
||||
|
||||
BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_SOURCE_DIR='"$(SOURCE_DIR)"'
|
||||
BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_PREFIX='"$(PREFIX)"'
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# Enable all possible plugin types
|
||||
|
||||
all: jack lv2 vst2 vst3
|
||||
all: jack lv2 vst2 vst3 resources
|
||||
|
||||
# --------------------------------------------------------------
|
||||
|
||||
CORE_RESOURCES = $(wildcard Rack/res/*)
|
||||
|
||||
PLUGIN_RESOURCES += $(CORE_RESOURCES:%=../bin/Cardinal.lv2/resources/%)
|
||||
ifeq ($(MACOS),true)
|
||||
PLUGIN_RESOURCES += $(CORE_RESOURCES:%=../bin/Cardinal.vst/Contents/Resources/%)
|
||||
else
|
||||
PLUGIN_RESOURCES += $(CORE_RESOURCES:%=../bin/Cardinal.vst/resources/%)
|
||||
endif
|
||||
PLUGIN_RESOURCES += $(CORE_RESOURCES:%=../bin/Cardinal.vst3/Contents/Resources/%)
|
||||
|
||||
resources: $(PLUGIN_RESOURCES)
|
||||
|
||||
../bin/Cardinal.lv2/resources/%: Rack/res/%
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
../bin/Cardinal.vst/resources/%: Rack/res/%
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
../bin/Cardinal.vst/Contents/Resources/%: Rack/res/%
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
../bin/Cardinal.vst3/Contents/Resources/%: Rack/res/%
|
||||
-@mkdir -p "$(shell dirname $@)"
|
||||
ln -sf $(abspath $<) $@
|
||||
|
||||
# --------------------------------------------------------------
|
||||
|
|
13
src/dep.cpp
13
src/dep.cpp
|
@ -87,14 +87,19 @@ static inline std::string& trim(std::string& s) {
|
|||
return s;
|
||||
}
|
||||
std::string system(std::string filename) {
|
||||
return system::join(systemDir, trim(filename));
|
||||
return system::join(systemDir, bundlePath.empty() ? filename : trim(filename));
|
||||
}
|
||||
std::string user(std::string filename) {
|
||||
return system::join(userDir, trim(filename));
|
||||
return system(filename);
|
||||
}
|
||||
std::string plugin(plugin::Plugin* plugin, std::string filename) {
|
||||
DISTRHO_SAFE_ASSERT_RETURN(plugin != nullptr, {});
|
||||
return system::join(systemDir, plugin->path, trim(filename));
|
||||
DISTRHO_SAFE_ASSERT_RETURN(plugin != nullptr, {});
|
||||
return system::join(systemDir, plugin->path, bundlePath.empty() ? filename : trim(filename));
|
||||
}
|
||||
std::string pluginManifest(std::string dirname) {
|
||||
if (bundlePath.empty())
|
||||
return system::join(systemDir, dirname, "plugin.json");
|
||||
return system::join(bundlePath, dirname + ".json");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue