apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject svn commit: r748888 - /apr/apr/trunk/build/jlibtool.c
Date Sat, 28 Feb 2009 17:24:35 GMT
Author: jerenkrantz
Date: Sat Feb 28 17:24:35 2009
New Revision: 748888

URL: http://svn.apache.org/viewvc?rev=748888&view=rev
Log:
jlibtool: improve bundle support on Mac OS X so that Subversion's SWIG Python
bindings can be built (albeit with wrong extension, but that's not our fault).

* build/jlibtool.c
  (MODULE_OPTS): Pass -dynamic when using -bundle.
  (jlibtool_basename, nameof): Move earlier in file.
  (gen_library_name): Add one more character to avoid running over (ouch!);
  if we're using a module, take the basename of it.
  (parse_args): Take in 'release' parameter.
  (run_mode): Clean up if/else clauses.

Modified:
    apr/apr/trunk/build/jlibtool.c

Modified: apr/apr/trunk/build/jlibtool.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/jlibtool.c?rev=748888&r1=748887&r2=748888&view=diff
==============================================================================
--- apr/apr/trunk/build/jlibtool.c (original)
+++ apr/apr/trunk/build/jlibtool.c Sat Feb 28 17:24:35 2009
@@ -64,7 +64,7 @@
 #  define RANLIB "ranlib"
 #  define PIC_FLAG "-fPIC -fno-common"
 #  define SHARED_OPTS "-dynamiclib"
-#  define MODULE_OPTS "-bundle"
+#  define MODULE_OPTS "-bundle -dynamic"
 #  define DYNAMIC_LINK_OPTS "-flat_namespace"
 #  define DYNAMIC_LINK_UNDEFINED "-undefined suppress"
 #  define dynamic_link_version_func darwin_dynamic_link_function
@@ -697,6 +697,44 @@
 #endif
 }
 
+/* returns just a file's name without the path */
+const char *jlibtool_basename(const char *fullpath)
+{
+    const char *name = strrchr(fullpath, '/');
+
+    if (name == NULL) {
+        name = strrchr(fullpath, '\\');
+    }
+
+    if (name == NULL) {
+        name = fullpath;
+    } else {
+        name++;
+    }
+
+    return name;
+}
+
+/* returns just a file's name without path or extension */
+const char *nameof(const char *fullpath)
+{
+    const char *name;
+    const char *ext;
+
+    name = jlibtool_basename(fullpath);
+    ext = strrchr(name, '.');
+
+    if (ext) {
+        char *trimmed;
+        trimmed = malloc(ext - name + 1);
+        strncpy(trimmed, name, ext - name);
+        trimmed[ext-name] = 0;
+        return trimmed;
+    }
+
+    return name;
+}
+
 /* version_info is in the form of MAJOR:MINOR:PATCH */
 const char *darwin_dynamic_link_function(const char *version_info)
 {
@@ -749,14 +787,19 @@
 {
     char *newarg, *newext;
 
-    newarg = (char *)malloc(strlen(name) + 10);
+    newarg = (char *)malloc(strlen(name) + 11);
     strcpy(newarg, ".libs/");
 
     if (genlib == 2 && strncmp(name, "lib", 3) == 0) {
         name += 3;
     }
 
-    strcat(newarg, name);
+    if (genlib == 2) {
+        strcat(newarg, jlibtool_basename(name));
+    }
+    else {
+        strcat(newarg, name);
+    }
 
     newext = strrchr(newarg, '.') + 1;
 
@@ -1138,44 +1181,6 @@
 #endif
 }
 
-/* returns just a file's name without the path */
-const char *jlibtool_basename(const char *fullpath)
-{
-    const char *name = strrchr(fullpath, '/');
-
-    if (name == NULL) {
-        name = strrchr(fullpath, '\\');
-    }
-
-    if (name == NULL) {
-        name = fullpath;
-    } else {
-        name++;
-    }
-
-    return name;
-}
-
-/* returns just a file's name without path or extension */
-const char *nameof(const char *fullpath)
-{
-    const char *name;
-    const char *ext;
-
-    name = jlibtool_basename(fullpath);
-    ext = strrchr(name, '.');
-
-    if (ext) {
-        char *trimmed;
-        trimmed = malloc(ext - name + 1);
-        strncpy(trimmed, name, ext - name);
-        trimmed[ext-name] = 0;
-        return trimmed;
-    }
-
-    return name;
-}
-
 int explode_static_lib(command_t *cmd_data, const char *lib)
 {
     count_chars tmpdir_cc, libname_cc;
@@ -1528,6 +1533,10 @@
                     /* Aha, we should try to link both! */
                     cmd_data->install_path = argv[++a];
                     argused = 1;
+                } else if (strcmp(arg+1, "release") == 0) {
+                    /* Store for later deciphering */
+                    cmd_data->version_info = argv[++a];
+                    argused = 1;
                 } else if (strcmp(arg+1, "version-info") == 0) {
                     /* Store for later deciphering */
                     cmd_data->version_info = argv[++a];
@@ -1894,7 +1903,11 @@
             clear_count_chars(cmd_data->program_opts);
 
             append_count_chars(cmd_data->program_opts, cmd_data->arglist);
-            if (cmd_data->output != otModule) {
+            if (cmd_data->output == otModule) {
+#ifdef MODULE_OPTS
+                push_count_chars(cmd_data->program_opts, MODULE_OPTS);
+#endif
+            } else {
 #ifdef SHARED_OPTS
                 push_count_chars(cmd_data->program_opts, SHARED_OPTS);
 #endif
@@ -1903,11 +1916,6 @@
                              dynamic_link_version_func(cmd_data->version_info));
 #endif
             }
-            if (cmd_data->output == otModule) {
-#ifdef MODULE_OPTS
-                push_count_chars(cmd_data->program_opts, MODULE_OPTS);
-#endif
-            }
             add_dynamic_link_opts(cmd_data, cmd_data->program_opts);
 
             rv = run_command(cmd_data, cmd_data->shared_opts.normal);



Mime
View raw message