summaryrefslogtreecommitdiffstats
path: root/make/lib/archive/cpptasks/cpptasks-1.0b5-accumulated.patch
blob: 4965a22e3d9df7b2f7ff0a260c7106530e81a623 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
diff -Nur cpptasks-1.0b5/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java cpptasks-1.0b5-patched/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java
--- cpptasks-1.0b5/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java	2008-04-02 19:26:44.000000000 +0200
+++ cpptasks-1.0b5-patched/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java	2012-03-06 19:39:46.739351056 +0100
@@ -59,7 +59,7 @@
                 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 -Nur cpptasks-1.0b5/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java cpptasks-1.0b5-patched/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java
--- cpptasks-1.0b5/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java	2008-04-02 19:26:44.000000000 +0200
+++ cpptasks-1.0b5-patched/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java	2012-03-06 19:42:21.241385093 +0100
@@ -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 @@
     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));
@@ -78,6 +81,9 @@
      */
     public String decorateLinkerOption(StringBuffer buf, String arg) {
         String decoratedArg = arg;
+        if (arg.startsWith("--sysroot")) {
+          return arg;
+        }
         if (arg.length() > 1 && arg.charAt(0) == '-') {
             switch (arg.charAt(1)) {
                 //
@@ -97,12 +103,13 @@
                     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,");
diff -Nur cpptasks-1.0b5/src/test/java/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java cpptasks-1.0b5-patched/src/test/java/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java
--- cpptasks-1.0b5/src/test/java/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java	2008-04-02 19:26:44.000000000 +0200
+++ cpptasks-1.0b5-patched/src/test/java/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java	2012-03-06 19:39:46.891349119 +0100
@@ -73,9 +73,8 @@
         pluginOutType.setValue("shared");
         pluginType.setOutputType(pluginOutType);
         linker.addImpliedArgs(false, pluginType, args);
-        assertEquals(2, args.size());
-        assertEquals("-prebind", args.elementAt(0));
-        assertEquals("-dynamiclib", args.elementAt(1));
+        assertEquals(1, args.size());
+        assertEquals("-dynamiclib", args.elementAt(0));
     }
     /**
      * Checks for proper arguments for plugin generation on Darwin