shithub: aubio

Download patch

ref: 06dba46afc27ad76f17ba8a6f1a67abc5acc7a7a
parent: a7343ffed2d649163d0debf566e7decc4b2ccc03
author: Paul Brossier <piem@piem.org>
date: Tue Dec 10 03:39:47 EST 2013

wscript: small tweaks to with mingw32

Signed-off-by: Paul Brossier <piem@piem.org>

--- a/src/wscript_build
+++ b/src/wscript_build
@@ -21,6 +21,8 @@
 # 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']
 
--- a/tests/utils_tests.h
+++ b/tests/utils_tests.h
@@ -3,11 +3,28 @@
 #include <stdio.h>
 #include <math.h>
 #include <assert.h>
+#include "config.h"
 
 #define PRINT_ERR(format, args...)   fprintf(stderr, "AUBIO-TESTS ERROR: " format , ##args)
 #define PRINT_MSG(format, args...)   fprintf(stdout, format , ##args)
 #define PRINT_DBG(format, args...)   fprintf(stderr, format , ##args)
 #define PRINT_WRN(format, args...)   fprintf(stderr, "AUBIO-TESTS WARNING: " format, ##args)
+
+#ifdef HAVE_WIN_HACKS
+// http://en.wikipedia.org/wiki/Linear_congruential_generator
+// no srandom/random on win32
+
+uint_t srandom_seed = 1029;
+
+void srandom(uint_t new_seed) {
+    srandom_seed = new_seed;
+}
+
+uint_t random(void) {
+    srandom_seed = 1664525 * srandom_seed + 1013904223;
+    return srandom_seed;
+}
+#endif
 
 void utils_init_random () {
   time_t now = time(0);
--- a/wscript
+++ b/wscript
@@ -84,15 +84,19 @@
     ctx.load('compiler_c')
     ctx.load('waf_unit_test')
     ctx.load('gnu_dirs')
-    ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra', '-fPIC']
 
+    ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra']
+
     target_platform = Options.platform
     if ctx.options.target_platform:
         target_platform = ctx.options.target_platform
     ctx.env['DEST_OS'] = target_platform
 
-    if target_platform == 'win32':
-        ctx.env['shlib_PATTERN'] = 'lib%s.dll'
+    if target_platform not in ['win32', 'win64']:
+        ctx.env.CFLAGS += ['-fPIC']
+    else:
+        ctx.define('HAVE_WIN_HACKS', 1)
+        ctx.env['cshlib_PATTERN'] = 'lib%s.dll'
 
     if target_platform == 'darwin':
         ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64']
--