aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
Diffstat (limited to 'wscript')
-rw-r--r--wscript134
1 files changed, 35 insertions, 99 deletions
diff --git a/wscript b/wscript
index f927da9..f451a7e 100644
--- a/wscript
+++ b/wscript
@@ -5,6 +5,7 @@ import os
import rdflib
import shutil
import subprocess
+import sys
from waflib.extras import autowaf as autowaf
import waflib.Logs as Logs
@@ -31,99 +32,17 @@ def options(opt):
for i in ['core.lv2']:
opt.recurse(i)
-lv2 = rdflib.Namespace('http://lv2plug.in/ns/lv2core#')
-rdf = rdflib.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
-
-def genwscript(manifest, experimental):
- dir = os.path.dirname(manifest)
- name = os.path.basename(dir).replace('.lv2', '')
-
- m = rdflib.ConjunctiveGraph()
- m.parse(manifest, format='n3')
-
- # Get the first match for a triple pattern, or throw if no matches
- def query(model, s, p, o):
- for i in model.triples([s, p, o]):
- return i
- raise Exception('Insufficient data for %s' % manifest)
-
- try:
- uri = query(m, None, rdf.type, lv2.Specification)[0]
- except:
- print('Skipping: %s' % name)
- return False
-
- minor = micro = '0'
- try:
- minor = query(m, uri, lv2.minorVersion, None)[2]
- micro = query(m, uri, lv2.microVersion, None)[2]
- except:
- if not experimental:
- print('Skipping: %s' % name)
- return False
-
- if experimental or (int(minor) != 0 and int(micro) % 2 == 0):
- print('Generating: %s %s.%s' % (name, minor, micro))
-
- pkgconfig_name = str(uri).replace('http://', 'lv2-').replace('/', '-')
-
- def subst_file(source_path, target_path):
- source = open(source_path, 'r')
- target = open(target_path, 'w')
- for l in source:
- target.write(l.replace(
- '@DESCRIPTION@', 'LV2 "' + name + '" extension').replace(
- '@INCLUDE_PATH@', str(uri).replace('http://', 'lv2/')).replace(
- '@MICRO@', micro).replace(
- '@MINOR@', minor).replace(
- '@NAME@', name).replace(
- '@PKGCONFIG_NAME@', pkgconfig_name).replace(
- '@URI@', str(uri)).replace(
- '@VERSION@', '%s.%s' % (minor, micro)))
- source.close()
- target.close()
-
- # Generate wscript
- subst_file('wscript.template', '%s/wscript' % dir)
-
- # Generate pkgconfig file
- subst_file('ext.pc.template', '%s/%s.pc.in' % (dir, pkgconfig_name))
-
- try:
- os.remove('%s/waf' % dir)
- except:
- pass
-
- #os.symlink('../../waf', '%s/waf' % dir)
- shutil.copy('waf', '%s/waf' % dir)
-
- return True
- else:
- return False
-
def configure(conf):
- subdirs = ['core.lv2']
-
- manifests = glob.glob('ext/*.lv2/manifest.ttl') + [
- 'extensions/ui.lv2/manifest.ttl',
- 'extensions/units.lv2/manifest.ttl'
- ]
-
- manifests.sort()
-
- print('')
- autowaf.display_header("Generating build files")
- for manifest in manifests:
- if genwscript(manifest, Options.options.experimental):
- subdirs += [ os.path.dirname(manifest) ]
- print('')
-
conf.load('compiler_cc')
conf.load('compiler_cxx')
-
autowaf.configure(conf)
+
conf.env.append_unique('CFLAGS', '-std=c99')
+ subdirs = ['core.lv2']
+ subdirs += glob.glob('ext/*.lv2/')
+ subdirs += glob.glob('extensions/*.lv2/')
+
for i in subdirs:
conf.recurse(i)
@@ -134,20 +53,37 @@ def build(bld):
bld.recurse(i)
def release(ctx):
- for i in ['ext/data-access.lv2',
- 'ext/midi.lv2',
- 'ext/event.lv2',
- 'ext/uri-map.lv2',
- 'ext/instance-access.lv2',
- 'extensions/ui.lv2',
- 'extensions/units.lv2',
- 'core.lv2']:
+ lv2 = rdflib.Namespace('http://lv2plug.in/ns/lv2core#')
+ rdf = rdflib.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
+ doap = rdflib.Namespace('http://usefulinc.com/ns/doap#')
+
+ manifests = glob.glob('ext/*.lv2/manifest.ttl')
+ manifests += glob.glob('extensions/*.lv2/manifest.ttl')
+ for manifest in manifests:
+ dir = os.path.dirname(manifest)
+ name = os.path.basename(dir).replace('.lv2', '')
+
+ m = rdflib.ConjunctiveGraph()
+ m.parse(manifest, format='n3')
+
+ uri = minor = micro = None
try:
- subprocess.call(
- ['./waf', 'distclean', 'configure', 'build', 'distcheck'],
- cwd=i)
+ spec = m.value(None, rdf.type, lv2.Specification)
+ uri = str(spec)
+ minor = int(m.value(spec, lv2.minorVersion, None))
+ micro = int(m.value(spec, lv2.microVersion, None))
except:
- print('Error building %s release' % i)
+ e = sys.exc_info()[1]
+ Logs.error('error: %s: %s' % (manifest, str(e)))
+ continue
+
+ if minor != 0 and micro % 2 == 0:
+ try:
+ subprocess.call(
+ ['./waf', 'distclean', 'configure', 'build', 'distcheck', 'distclean'],
+ cwd=dir)
+ except:
+ Logs.error('Error building %s release' % name)
def lint(ctx):
for i in (['core.lv2/lv2.h']