niti: filter the -lrt flag on OS X
authorAlexis Laferrière <alexis.laf@xymus.net>
Mon, 23 May 2016 23:50:24 +0000 (19:50 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Mon, 23 May 2016 23:50:24 +0000 (19:50 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/interpreter/dynamic_loading_ffi/on_demand_compiler.nit

index 4207a01..4e4a5b3 100644 (file)
@@ -128,7 +128,12 @@ redef class AModule
                srcs.add_all mmodule.ffi_files
 
                # Compiler options specific to this module
-               var ldflags = mmodule.ldflags[""].join(" ")
+               var ldflags_array = mmodule.ldflags[""]
+               if ldflags_array.has("-lrt") and system("sh -c 'uname -s 2>/dev/null || echo not' | grep Darwin >/dev/null") == 0 then
+                       # Remove -lrt on OS X
+                       ldflags_array.remove "-lrt"
+               end
+               var ldflags = ldflags_array.join(" ")
 
                # Protect pkg-config
                var pkgconfigs = mmodule.pkgconfigs