source: trunk/dports/cross/arm-apple-darwin-cc/files/patch-libtool-driver @ 28059

Last change on this file since 28059 was 28059, checked in by landonf@…, 13 years ago

Include my patch for libtool support. Fixes linking of dylibs/bundles using static archives, eg:

arm-apple-darwin-cc -dynamiclib -o test.dylib input.a

Patch submitted to upstream, see:

http://developer.berlios.de/bugs/?func=detailbug&bug_id=11802&group_id=8664

File size: 2.5 KB
Line 
1Index: driver/arm-cc-specs.in
2===================================================================
3--- driver/arm-cc-specs.in      (revision 118)
4+++ driver/arm-cc-specs.in      (working copy)
5@@ -18,7 +18,7 @@
6 ASFLAGS=-arch arm
7 LD=@prefix@/bin/arm-apple-darwin-ld
8 LDFLAGS=-syslibroot @prefix@/heavenly @prefix@/csu/crt1.o % -lSystem -lgcc_s_v6.1 -lm -L@prefix@/lib -larmfp
9-LDFLAGS_DYLIB=-syslibroot @prefix@/heavenly -lSystem -lgcc_s_v6.1 -L@prefix@/csu -ldylib1.o -single_module -dylib -dynamic
10-LDFLAGS_BUNDLE=-syslibroot @prefix@/heavenly -bundle -lSystem -lgcc_s_v6.1 -L@prefix@/csu @prefix@/csu/bundle1.o -dynamic
11 LDFLAGS_FRAMEWORKSDIR=-F@prefix@/heavenly/System/Library/Frameworks
12-
13+LIBTOOL=@prefix@/bin/arm-apple-darwin-libtool
14+LIBTOOL_FLAGS_DYLIB=-syslibroot @prefix@/heavenly -lSystem -lgcc_s_v6.1 -L@prefix@/csu -single_module -dynamic
15+LIBTOOL_FLAGS_BUNDLE=-syslibroot @prefix@/heavenly -bundle -lSystem -lgcc_s_v6.1 -L@prefix@/csu @prefix@/csu/bundle1.o -dynamic
16Index: driver/cc.c
17===================================================================
18--- driver/cc.c (revision 118)
19+++ driver/cc.c (working copy)
20@@ -332,22 +332,31 @@
21 
22 char * get_full_path(char *prog_name)
23 {
24-    char *path, *dir, *test_path;
25+    char *envp, *dir, *path, *test_path;
26 
27     if (prog_name[0] == '/' || prog_name[0] == '.')
28         return strdup(prog_name);
29 
30-    path = getenv("PATH");
31+    envp = getenv("PATH");
32+    if (!envp)
33+        return NULL;
34+   
35+    /* Don't directly modify the environment */
36+    path = strdup(envp);
37     if (!path)
38         return NULL;
39+
40     for (dir = strtok(path, ":"); dir != NULL; dir = strtok(NULL, ":")) {
41+
42         asprintf(&test_path, "%s/%s", dir, prog_name);
43         if (!access(test_path, X_OK)) {
44+            free(path);   
45             return test_path;
46         }
47         free(test_path);
48     }
49 
50+    free(path);
51     return NULL;
52 }
53 
54@@ -688,9 +697,14 @@
55     }
56 
57     /* Run the linking step. */
58-    if (req_todo & TODO_LINK)
59-        execute_step("LD", make_dylib ? "LDFLAGS_DYLIB" : make_bundle ? "LDFLAGS_BUNDLE" : "LDFLAGS",
60-            linker_args, 2, "-o", output_path);
61+    if (req_todo & TODO_LINK) {
62+        if (make_dylib)
63+            execute_step("LIBTOOL", "LIBTOOL_FLAGS_DYLIB", linker_args, 2, "-o", output_path);
64+        else if (make_bundle)
65+            execute_step("LIBTOOL", "LIBTOOL_FLAGS_BUNDLE", linker_args, 2, "-o", output_path);
66+        else
67+            execute_step("LD", "LDFLAGS", linker_args, 2, "-o", output_path);
68+    }
69 }
70 
71 void clean_up_temporary_files()
Note: See TracBrowser for help on using the repository browser.