src/wscript_build: do not hardcode install_path
[aubio.git] / src / wscript_build
index 5333b8a..7c9fc1c 100644 (file)
@@ -1,29 +1,39 @@
 # vim:set syntax=python:
 
-source = ctx.path.ant_glob('*.c **/*.c')
 uselib = []
+uselib += ['FFTW3', 'FFTW3F']
+uselib += ['SAMPLERATE']
+uselib += ['SNDFILE']
+uselib += ['AVCODEC']
+uselib += ['AVFORMAT']
+uselib += ['AVRESAMPLE']
+uselib += ['AVUTIL']
 
-if 'HAVE_FFTW3' in conf.get_env():
-  source.filter(lambda x: not x.endswith('ooura_fft8g.c'))
-  uselib += ['FFTW3', 'FFTW3F']
-
-if 'HAVE_SAMPLERATE':
-  uselib += ['SAMPLERATE']
+# build each source files
+source = ctx.path.ant_glob('*.c **/*.c')
+ctx(features = 'c',
+        source = source,
+        includes = ['.'],
+        uselib = uselib,
+        lib = 'm',
+        target = 'lib_objects')
 
-if 'HAVE_SNDFILE':
-  uselib += ['SNDFILE']
+# build libaubio.so (cshlib) and/or libaubio.a (cstlib)
+if ctx.env['DEST_OS'] in ['ios', 'iosimulator']:
+    build_features = ['cstlib']
+elif ctx.env['DEST_OS'] in ['win32', 'win64']:
+    build_features = ['cshlib']
+else: #linux, darwin, android, mingw, ...
+    build_features = ['cshlib', 'cstlib']
 
-# build libaubio
-ctx.shlib(
-    includes = ['.'],
-    source = source,
-    target = 'aubio',
-    lib = 'm',
-    uselib = uselib,
-    vnum = ctx.env['LIB_VERSION'])
+for target in build_features:
+    ctx(features = 'c ' + target,
+            use = ['lib_objects'],
+            lib = 'm',
+            target = 'aubio',
+            vnum = ctx.env['LIB_VERSION'])
 
 # install headers, except _priv.h ones
 ctx.install_files('${PREFIX}/include/aubio/',
-       ctx.path.ant_glob('**/*.h',
-       exclude = ['_priv.h', 'config.h']),
-       relative_trick=True)
+        ctx.path.ant_glob('**/*.h', excl = ['**_priv.h', 'config.h']),
+        relative_trick=True)