aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-09 23:23:54 +0000
committerDavid Robillard <d@drobilla.net>2012-02-09 23:23:54 +0000
commit7e5bf17f9e14b4a24346c402bf5fcf88772c50f3 (patch)
treed8784b58128f9c640ad637ddf4ecfc88efe45691
parent3d8a2bef05f69eff154ad350db4be897f6d3edfa (diff)
downloadlv2-7e5bf17f9e14b4a24346c402bf5fcf88772c50f3.tar.xz
Portability fixes (plugins work on OSX).
-rw-r--r--plugins/eg-amp.lv2/amp.ttl2
-rw-r--r--plugins/eg-amp.lv2/manifest.ttl.in (renamed from plugins/eg-amp.lv2/manifest.ttl)2
-rw-r--r--plugins/eg-amp.lv2/wscript18
-rw-r--r--plugins/eg-sampler.lv2/manifest.ttl7
-rw-r--r--plugins/eg-sampler.lv2/manifest.ttl.in13
-rw-r--r--plugins/eg-sampler.lv2/sampler.c18
-rw-r--r--plugins/eg-sampler.lv2/sampler.ttl5
-rw-r--r--plugins/eg-sampler.lv2/wscript17
8 files changed, 50 insertions, 32 deletions
diff --git a/plugins/eg-amp.lv2/amp.ttl b/plugins/eg-amp.lv2/amp.ttl
index 7d3d9e6..1fe7dc7 100644
--- a/plugins/eg-amp.lv2/amp.ttl
+++ b/plugins/eg-amp.lv2/amp.ttl
@@ -1,6 +1,6 @@
# LV2 Amp Example Plugin
+# Copyright 2006-2012 David Robillard <d@drobilla.net>
# Copyright 2006-2011 Steve Harris <steve@plugin.org.uk>
-# Copyright 2006-2011 David Robillard <d@drobilla.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
diff --git a/plugins/eg-amp.lv2/manifest.ttl b/plugins/eg-amp.lv2/manifest.ttl.in
index 821c977..c642766 100644
--- a/plugins/eg-amp.lv2/manifest.ttl
+++ b/plugins/eg-amp.lv2/manifest.ttl.in
@@ -23,7 +23,7 @@
<http://lv2plug.in/plugins/eg-amp>
a lv2:Plugin ;
- lv2:binary <amp.so> ;
+ lv2:binary <amp@LIB_EXT@> ;
rdfs:seeAlso <amp.ttl> .
# Explanation
diff --git a/plugins/eg-amp.lv2/wscript b/plugins/eg-amp.lv2/wscript
index 3eda122..37ab9b7 100644
--- a/plugins/eg-amp.lv2/wscript
+++ b/plugins/eg-amp.lv2/wscript
@@ -40,12 +40,20 @@ def configure(conf):
def build(bld):
bundle = 'eg-amp.lv2'
- # Copy data files to build bundle (build/eg-amp.lv2)
- for i in [ 'amp.ttl', 'manifest.ttl' ]:
- bld(rule = 'cp ${SRC} ${TGT}',
+ # Build manifest.ttl by substitution (for portable lib extension)
+ bld(features = 'subst',
+ source = 'manifest.ttl.in',
+ target = '%s/%s' % (bundle, 'manifest.ttl'),
+ install_path = '${LV2DIR}/%s' % bundle,
+ LIB_EXT = bld.env['pluginlib_EXT'])
+
+ # Copy other data files to build bundle (build/eg-amp.lv2)
+ for i in [ 'amp.ttl' ]:
+ bld(features = 'subst',
source = i,
- target = bld.path.get_bld().make_node('%s/%s' % (bundle, i)),
- install_path = '${LV2DIR}/%s' % bundle)
+ target = '%s/%s' % (bundle, i),
+ install_path = '${LV2DIR}/%s' % bundle,
+ LIB_EXT = bld.env['pluginlib_EXT'])
# Create a build environment that builds module-style library names
# e.g. eg-amp.so instead of libeg-amp.so
diff --git a/plugins/eg-sampler.lv2/manifest.ttl b/plugins/eg-sampler.lv2/manifest.ttl
deleted file mode 100644
index f6ab02d..0000000
--- a/plugins/eg-sampler.lv2/manifest.ttl
+++ /dev/null
@@ -1,7 +0,0 @@
-@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-
-<http://lv2plug.in/plugins/eg-sampler>
- a lv2:Plugin ;
- lv2:binary <sampler.so> ;
- rdfs:seeAlso <sampler.ttl> .
diff --git a/plugins/eg-sampler.lv2/manifest.ttl.in b/plugins/eg-sampler.lv2/manifest.ttl.in
new file mode 100644
index 0000000..b4fa23e
--- /dev/null
+++ b/plugins/eg-sampler.lv2/manifest.ttl.in
@@ -0,0 +1,13 @@
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
+
+<http://lv2plug.in/plugins/eg-sampler>
+ a lv2:Plugin ;
+ lv2:binary <sampler@LIB_EXT@> ;
+ rdfs:seeAlso <sampler.ttl> .
+
+<http://lv2plug.in/plugins/eg-sampler#ui>
+ a ui:GtkUI ;
+ ui:binary <sampler_ui@LIB_EXT@> ;
+ rdfs:seeAlso <sampler.ttl> .
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c
index 5292aee..8ee2c05 100644
--- a/plugins/eg-sampler.lv2/sampler.c
+++ b/plugins/eg-sampler.lv2/sampler.c
@@ -41,14 +41,14 @@
#include <sndfile.h>
-#include <semaphore.h>
-
#include "lv2/lv2plug.in/ns/ext/atom/atom-helpers.h"
#include "lv2/lv2plug.in/ns/ext/message/message.h"
#include "lv2/lv2plug.in/ns/ext/state/state.h"
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+#include "zix/sem.h"
+
#include "./uris.h"
#define STRING_BUF 8192
@@ -73,7 +73,7 @@ typedef struct {
/* Sample */
SampleFile* samp;
SampleFile* pending_samp;
- sem_t signal;
+ ZixSem signal;
int pending_sample_ready;
/* Ports */
@@ -142,12 +142,10 @@ worker_thread_main(void* arg)
{
Sampler* plugin = (Sampler*)arg;
+ /* TODO: This thread never exits cleanly */
while (true) {
/* Wait for run() to signal that we need to load a sample */
- if (sem_wait(&plugin->signal)) {
- fprintf(stderr, "Odd, sem_wait failed...\n");
- continue;
- }
+ zix_sem_wait(&plugin->signal);
/* Then load it */
handle_load_sample(plugin);
@@ -162,7 +160,7 @@ cleanup(LV2_Handle instance)
Sampler* plugin = (Sampler*)instance;
pthread_cancel(plugin->worker_thread);
pthread_join(plugin->worker_thread, 0);
- sem_destroy(&plugin->signal);
+ zix_sem_destroy(&plugin->signal);
free(plugin->samp->data);
free(plugin->pending_samp->data);
@@ -212,7 +210,7 @@ instantiate(const LV2_Descriptor* descriptor,
memset(&plugin->uris, 0, sizeof(plugin->uris));
/* Create signal for waking up worker thread */
- if (sem_init(&plugin->signal, 0, 0)) {
+ if (zix_sem_init(&plugin->signal, 0)) {
fprintf(stderr, "Could not initialize semaphore.\n");
goto fail;
}
@@ -309,7 +307,7 @@ run(LV2_Handle instance,
char* str = (char*)LV2_ATOM_BODY(filename);
fprintf(stderr, "Request to load %s\n", str);
memcpy(plugin->pending_samp->filepath, str, filename->size);
- sem_post(&plugin->signal);
+ zix_sem_post(&plugin->signal);
} else {
fprintf(stderr, "Unknown message type %d\n", obj->id);
}
diff --git a/plugins/eg-sampler.lv2/sampler.ttl b/plugins/eg-sampler.lv2/sampler.ttl
index 7548396..7f317aa 100644
--- a/plugins/eg-sampler.lv2/sampler.ttl
+++ b/plugins/eg-sampler.lv2/sampler.ttl
@@ -1,7 +1,7 @@
# LV2 Sampler Example Plugin
+# Copyright 2011-2012 David Robillard <d@drobilla.net>
# Copyright 2011 Gabriel M. Beddingfield <gabriel@teuton.org>
# Copyright 2011 James Morris <jwm.art.net@gmail.com>
-# Copyright 2011 David Robillard <d@drobilla.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -47,5 +47,4 @@
<http://lv2plug.in/plugins/eg-sampler#ui>
a ui:GtkUI ;
- lv2:requiredFeature <http://lv2plug.in/ns/ext/urid#map> ;
- ui:binary <sampler_ui.so> .
+ lv2:requiredFeature <http://lv2plug.in/ns/ext/urid#map> .
diff --git a/plugins/eg-sampler.lv2/wscript b/plugins/eg-sampler.lv2/wscript
index e5988ed..cbff316 100644
--- a/plugins/eg-sampler.lv2/wscript
+++ b/plugins/eg-sampler.lv2/wscript
@@ -54,11 +54,18 @@ def configure(conf):
def build(bld):
bundle = 'eg-sampler.lv2'
- # Copy data files to build bundle (build/eg-sampler.lv2)
- for i in [ 'sampler.ttl', 'manifest.ttl', 'monosample.wav' ]:
+ # Build manifest.ttl by substitution (for portable lib extension)
+ bld(features = 'subst',
+ source = 'manifest.ttl.in',
+ target = '%s/%s' % (bundle, 'manifest.ttl'),
+ install_path = '${LV2DIR}/%s' % bundle,
+ LIB_EXT = bld.env['pluginlib_EXT'])
+
+ # Copy other data files to build bundle (build/eg-sampler.lv2)
+ for i in [ 'sampler.ttl', 'monosample.wav' ]:
bld(rule = 'cp ${SRC} ${TGT}',
source = i,
- target = bld.path.get_bld().make_node('%s/%s' % (bundle, i)),
+ target = '%s/%s' % (bundle, i),
install_path = '${LV2DIR}/%s' % bundle)
# Create a build environment that builds module-style library names
@@ -67,9 +74,9 @@ def build(bld):
penv = bld.env.derive()
penv['cshlib_PATTERN'] = bld.env['pluginlib_PATTERN']
- includes = None
+ includes = ['.']
if autowaf.is_child:
- includes = '../..'
+ includes += ['../..']
# Build plugin library
obj = bld(features = 'c cshlib',