diff options
author | Sven Gothel <[email protected]> | 2013-09-12 00:08:03 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-09-12 00:08:03 +0200 |
commit | bd772e618b30d7e3ee71b2bb12a4d85139cfe15a (patch) | |
tree | f1b9651af9aa0c0b5d791d4e2b0e5ba3dd2af0b0 /src/main/java | |
parent | 15254861eca42c5d0cdd008eb0c89ee4d953d48d (diff) |
Make OSX/Darwin work (linker options etc)
This patch was private to JogAmp's gluegen project, now exposed.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java | 2 | ||||
-rw-r--r-- | src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java index 75ddcc7..0a0f5ff 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java @@ -59,7 +59,7 @@ public abstract class AbstractLdLinker extends CommandLineLinker { args.addElement("-bundle"); } else { if (linkType.isSharedLibrary()) { - args.addElement("-prebind"); + // args.addElement("-prebind"); // Only required for OSX 10.3 and earlier, no auto-add (can add manually though) args.addElement("-dynamiclib"); } } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java index c4720c8..053f370 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java @@ -17,6 +17,8 @@ package net.sf.antcontrib.cpptasks.gcc; import java.io.File; import java.util.Vector; +import java.util.HashSet; +import java.util.Arrays; import net.sf.antcontrib.cpptasks.CUtil; import net.sf.antcontrib.cpptasks.compiler.LinkType; @@ -33,9 +35,10 @@ public class GccLinker extends AbstractLdLinker { private static final String[] libtoolObjFiles = new String[]{".fo", ".a", ".lib", ".dll", ".so", ".sl"}; private static String[] linkerOptions = new String[]{"-bundle", - "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-s", + "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-noprebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker", "--export-all-symbols", "-static-libgcc",}; + private static String[] darwinLinkerOptions = new String[]{"-arch", "-weak_framework", "-lazy_framework", "-weak_library" }; private static final GccLinker dllLinker = new GccLinker("gcc", objFiles, discardFiles, "lib", ".so", false, new GccLinker("gcc", objFiles, discardFiles, "lib", ".so", true, null)); @@ -97,12 +100,13 @@ public class GccLinker extends AbstractLdLinker { break; default : boolean known = false; - for (int i = 0; i < linkerOptions.length; i++) { - if (linkerOptions[i].equals(arg)) { - known = true; - break; - } + HashSet allLinkerOptions = new HashSet(); + allLinkerOptions.addAll(Arrays.asList(linkerOptions)); + if (isDarwin()) { + allLinkerOptions.addAll(Arrays.asList(darwinLinkerOptions)); } + known = allLinkerOptions.contains(arg); + if (!known) { buf.setLength(0); buf.append("-Wl,"); |