aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-09 02:04:40 +0000
committerDavid Robillard <d@drobilla.net>2008-08-09 02:04:40 +0000
commit4c3617f5708f334504a67458a3dc7c331c7cec6b (patch)
tree006b914b5575bafbba1bc553f78ce6034c6002aa
parentde77c4beb69f2fc7f27424d2bd07a4d376e7bcdc (diff)
downloadmda.lv2-4c3617f5708f334504a67458a3dc7c331c7cec6b.tar.gz
mda.lv2-4c3617f5708f334504a67458a3dc7c331c7cec6b.tar.bz2
mda.lv2-4c3617f5708f334504a67458a3dc7c331c7cec6b.zip
Bundle generation, installation.
git-svn-id: http://svn.drobilla.net/lad/mda-lv2@1324 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--Makefile130
-rw-r--r--lvz/gendata.cpp42
2 files changed, 120 insertions, 52 deletions
diff --git a/Makefile b/Makefile
index 57ffe80..1b548f6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,62 +1,96 @@
-CFLAGS = -O0 -g -Wall -fPIC -Ilvz -DPLUGIN_URI_PREFIX=\"http://drobilla.net/ns/plugins/mda-lv2/\"
+CFLAGS = -O0 -g -Wall -fPIC -Ilvz -I. -DPLUGIN_URI_PREFIX=\"http://drobilla.net/ns/plugins/mda-lv2/\"
+
+# Change this to wherever you want system-wide bundles installed
+LV2_INSTALL_DIR = /usr/local/lib/lv2
all: lvz/gendata libs data
-libs: \
- src/mdaAmbience.so \
- src/mdaBandisto.so \
- src/mdaBeatBox.so \
- src/mdaCombo.so \
- src/mdaDX10.so \
- src/mdaDeEss.so \
- src/mdaDegrade.so \
- src/mdaDelay.so \
- src/mdaDetune.so \
- src/mdaDither.so \
- src/mdaDubDelay.so \
- src/mdaDynamics.so \
- src/mdaEPiano.so \
- src/mdaImage.so \
- src/mdaJX10.so \
- src/mdaLeslie.so \
- src/mdaLimiter.so \
- src/mdaLoudness.so \
- src/mdaMultiBand.so \
- src/mdaOverdrive.so \
- src/mdaPiano.so \
- src/mdaRePsycho.so \
- src/mdaRezFilter.so \
- src/mdaRingMod.so \
- src/mdaRoundPan.so \
- src/mdaShepard.so \
- src/mdaSplitter.so \
- src/mdaStereo.so \
- src/mdaSubSynth.so \
- src/mdaTalkBox.so \
- src/mdaTestTone.so \
- src/mdaThruZero.so \
- src/mdaTracker.so \
- src/mdaTransient.so \
- src/mdaVocInput.so \
- src/mdaVocoder.so
-
-data: libs
- lvz/gendata src/*.so
+bundle:
+ mkdir -p ./mda.lv2
+
+libs: bundle \
+ mda.lv2/mdaAmbience.so \
+ mda.lv2/mdaBandisto.so \
+ mda.lv2/mdaBeatBox.so \
+ mda.lv2/mdaCombo.so \
+ mda.lv2/mdaDX10.so \
+ mda.lv2/mdaDeEss.so \
+ mda.lv2/mdaDegrade.so \
+ mda.lv2/mdaDelay.so \
+ mda.lv2/mdaDetune.so \
+ mda.lv2/mdaDither.so \
+ mda.lv2/mdaDubDelay.so \
+ mda.lv2/mdaDynamics.so \
+ mda.lv2/mdaEPiano.so \
+ mda.lv2/mdaImage.so \
+ mda.lv2/mdaJX10.so \
+ mda.lv2/mdaLeslie.so \
+ mda.lv2/mdaLimiter.so \
+ mda.lv2/mdaLoudness.so \
+ mda.lv2/mdaMultiBand.so \
+ mda.lv2/mdaOverdrive.so \
+ mda.lv2/mdaPiano.so \
+ mda.lv2/mdaRePsycho.so \
+ mda.lv2/mdaRezFilter.so \
+ mda.lv2/mdaRingMod.so \
+ mda.lv2/mdaRoundPan.so \
+ mda.lv2/mdaShepard.so \
+ mda.lv2/mdaSplitter.so \
+ mda.lv2/mdaStereo.so \
+ mda.lv2/mdaSubSynth.so \
+ mda.lv2/mdaTalkBox.so \
+ mda.lv2/mdaTestTone.so \
+ mda.lv2/mdaThruZero.so \
+ mda.lv2/mdaTracker.so \
+ mda.lv2/mdaTransient.so \
+ mda.lv2/mdaVocInput.so \
+ mda.lv2/mdaVocoder.so
+
+data: libs lvz/gendata
+ cd ./mda.lv2 && ../lvz/gendata ./*.so > manifest.ttl
+
+install:
+ if [ "$(INSTALL_DIR)" == "" ]; then \
+ echo -e "\n*** ERROR: INSTALL_DIR is not set\n"; \
+ echo -e "Try make install-user, install-local, or install-system\n"; \
+ echo -e "You can also specify where to install the plugin bundle:"; \
+ echo -e " make install INSTALL_DIR=~/.lv2/\n"; \
+ else \
+ install -d $(INSTALL_DIR)/mda.lv2; \
+ install -m 644 ./mda.lv2/*.ttl $(INSTALL_DIR)/mda.lv2; \
+ install -m 755 ./mda.lv2/*.so $(INSTALL_DIR)/mda.lv2; \
+ fi
+
+install-user:
+ INSTALL_DIR=$(HOME)/.lv2 make install
+
+install-local:
+ INSTALL_DIR=/usr/local/lib/lv2 make install
+
+install-system:
+ INSTALL_DIR=/usr/lib/lv2 make install
+
+uninstall:
+ rm -rf $(HOME)/.lv2/mda.lv2
+ rm -rf /usr/local/lib/lv2/mda.lv2
+ rm -rf /usr/lib/lv2/mda.lv2
src/%.c: src/%.h lvz/audioeffectx.h
lvz/gendata: lvz/gendata.cpp lvz/audioeffectx.h
$(CXX) $(CFLAGS) -ldl $< -o $@
-src/%.so: src/%.cpp lvz/wrapper.cpp
- basename="foo"
+mda.lv2/%.so: src/%.cpp lvz/wrapper.cpp
$(CXX) -shared $(CFLAGS) \
- -DPLUGIN_CLASS=`echo $@ | sed 's/\..*//' | sed 's/src\///'` \
- -DPLUGIN_URI_SUFFIX=\"`echo $@ | sed 's/\..*//' | sed 's/src\///' | sed 's/^mda//'`\" \
- -DPLUGIN_HEADER=\"`echo $@ | sed 's/\..*//' | sed 's/src\//\.\.\/src\//' | sed 's/$$/\.h/'`\" \
+ -DPLUGIN_CLASS=`echo $@ | sed 's/mda.lv2\///' | sed 's/\..*//'` \
+ -DPLUGIN_URI_SUFFIX=\"`echo $@ | sed 's/mda.lv2\///' | sed 's/^mda//' | sed 's/\..*//'`\" \
+ -DPLUGIN_HEADER=\"`echo $@ | sed 's/^mda.lv2/src/' | sed 's/\(.*\)\..*/\1/' | sed 's/$$/\.h/'`\" \
$< lvz/wrapper.cpp -o $@
clean:
- rm -f src/*.o src/*.so lvz/gendata src/*.ttl
-
+ rm -f `find -name '*.o'`
+ rm -f `find -name '*.so'`
+ rm -f `find -name '*.ttl'`
+ rm -f lvz/gendata
+ rm -rf ./mda.lv2
diff --git a/lvz/gendata.cpp b/lvz/gendata.cpp
index c426b80..3481d3d 100644
--- a/lvz/gendata.cpp
+++ b/lvz/gendata.cpp
@@ -16,6 +16,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <list>
+#include <string>
#include <iostream>
#include <fstream>
#include <dlfcn.h>
@@ -32,8 +34,17 @@ char name[MAX_NAME_LENGTH];
#define NS_LV2CORE "http://lv2plug.in/ns/lv2core#"
+struct Record {
+ Record(const string& u, const string& f) : uri(u), file(f) {}
+ string uri;
+ string file;
+};
+
+typedef std::list<Record> Manifest;
+Manifest manifest;
+
void
-write_data(AudioEffectX* effect, const char* lib_file_name)
+write_plugin(AudioEffectX* effect, const string& lib_file_name)
{
string data_file_name = lib_file_name;
data_file_name = data_file_name.substr(0, data_file_name.find_last_of("."));
@@ -47,7 +58,9 @@ write_data(AudioEffectX* effect, const char* lib_file_name)
os << "@prefix doap: <http://usefulinc.com/ns/doap#> ." << endl << endl;
os << "<" << effect->getURI() << ">" << endl;
os << "\t:symbol \"" << effect->getUniqueID() << "\" ;" << endl;
- os << "\tdoap:name \"" << name << "\"";
+ os << "\tdoap:name \"" << name << "\" ;" << endl;
+ os << "\tdoap:license <http://usefulinc.com/doap/licenses/gpl> ;" << endl;
+ os << "\t:pluginProperty :hardRtCapable";
uint32_t num_params = effect->getNumParameters();
uint32_t num_audio_ins = effect->getNumInputs();
@@ -82,7 +95,20 @@ write_data(AudioEffectX* effect, const char* lib_file_name)
}
os.close();
- cout << "Wrote " << data_file_name << endl;
+
+ manifest.push_back(Record(effect->getURI(), data_file_name));
+}
+
+
+void
+write_manifest(ostream& os)
+{
+ os << "@prefix : <http://lv2plug.in/ns/lv2core#> ." << endl;
+ os << "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> ." << endl << endl;
+ for (Manifest::iterator i = manifest.begin(); i != manifest.end(); ++i) {
+ os << "<" << i->uri << "> a :Plugin ;" << endl;
+ os << "\trdfs:seeAlso <" << i->file << "> ." << endl << endl;
+ }
}
@@ -94,6 +120,7 @@ main(int argc, char** argv)
cout << "Each argument is a path to a LVZ plugin library." << endl;
cout << "For each library an LV2 data file with the same name" << endl;
cout << "will be output containing the data for that plugin." << endl;
+ cout << "A manifest of the plugins found is written to stdout" << endl;
return 1;
}
@@ -115,10 +142,17 @@ main(int argc, char** argv)
}
effect = constructor();
- write_data(effect, argv[i]);
+ string lib_path = argv[i];
+ size_t last_slash = lib_path.find_last_of("/");
+ if (last_slash != string::npos)
+ lib_path = lib_path.substr(last_slash + 1);
+
+ write_plugin(effect, lib_path);
dlclose(handle);
}
+
+ write_manifest(cout);
return 0;
}