aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-25 21:41:14 +0000
committerDavid Robillard <d@drobilla.net>2011-01-25 21:41:14 +0000
commit111f9ae3232e986222a2ef41b4af0d083f4f797e (patch)
treeda691482794c2d31bdd74e763c718a5fd8b63400 /wscript
parent204428cdeed5653c876c9580c0a2589b5427e6ae (diff)
downloadserd-111f9ae3232e986222a2ef41b4af0d083f4f797e.tar.gz
serd-111f9ae3232e986222a2ef41b4af0d083f4f797e.tar.bz2
serd-111f9ae3232e986222a2ef41b4af0d083f4f797e.zip
Add `amalgamate' waf target for building single source file distribution.
git-svn-id: http://svn.drobilla.net/serd/trunk@78 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'wscript')
-rw-r--r--wscript24
1 files changed, 24 insertions, 0 deletions
diff --git a/wscript b/wscript
index 067b3629..5c4af7dd 100644
--- a/wscript
+++ b/wscript
@@ -5,6 +5,7 @@ import autowaf
import filecmp
import glob
import os
+import shutil
import subprocess
# Version of this package (even if built as a child)
@@ -113,6 +114,29 @@ def build(bld):
def lint(ctx):
subprocess.call('cpplint.py --filter=-whitespace,+whitespace/comments,-build/header_guard,-readability/casting,-readability/todo src/* serd/*', shell=True)
+def amalgamate(ctx):
+ shutil.copy('serd/serd.h', 'build/serd-%s.h' % SERD_VERSION)
+ amalgamation = open('build/serd-%s.c' % SERD_VERSION, 'w')
+
+ serd_internal_h = open('src/serd_internal.h')
+ for l in serd_internal_h:
+ amalgamation.write(l)
+ serd_internal_h.close()
+
+ for f in 'env.c node.c reader.c uri.c writer.c'.split():
+ fd = open('src/' + f)
+ header = True
+ for l in fd:
+ if header:
+ if l == ' */\n':
+ header = False
+ else:
+ if l != '#include "serd_internal.h"\n':
+ amalgamation.write(l)
+ fd.close()
+
+ amalgamation.close()
+
def test(ctx):
try:
os.makedirs('build/tests')