From 4c3617f5708f334504a67458a3dc7c331c7cec6b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 9 Aug 2008 02:04:40 +0000 Subject: Bundle generation, installation. git-svn-id: http://svn.drobilla.net/lad/mda-lv2@1324 a436a847-0d15-0410-975c-d299462d15a1 --- lvz/gendata.cpp | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'lvz') 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 +#include #include #include #include @@ -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 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: ." << endl << endl; os << "<" << effect->getURI() << ">" << endl; os << "\t:symbol \"" << effect->getUniqueID() << "\" ;" << endl; - os << "\tdoap:name \"" << name << "\""; + os << "\tdoap:name \"" << name << "\" ;" << endl; + os << "\tdoap:license ;" << 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 : ." << endl; + os << "@prefix rdfs: ." << 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; } -- cgit v1.2.1