Browse Source

More about ABI compatibility:
* Fixed the bug on non-Windows where the incorrect libraries are located
* OSX dylibs now have compatibility_version and current_version set

rdb 16 years ago
parent
commit
d668a53639

+ 5 - 5
dtool/src/dtoolutil/executionEnvironment.cxx

@@ -468,7 +468,7 @@ read_args() {
     char buffer[buffer_size];
     char buffer[buffer_size];
     DWORD size = GetModuleFileName(dllhandle, buffer, buffer_size);
     DWORD size = GetModuleFileName(dllhandle, buffer, buffer_size);
     if (size != 0) {
     if (size != 0) {
-      Filename tmp = Filename::from_os_specific(string(buffer,size));
+      Filename tmp = Filename::from_os_specific(string(buffer, size));
       tmp.make_true_case();
       tmp.make_true_case();
       _dtool_name = tmp;
       _dtool_name = tmp;
     }
     }
@@ -487,11 +487,11 @@ read_args() {
     char buffer[PATH_MAX];
     char buffer[PATH_MAX];
     buffer[0] = 0;
     buffer[0] = 0;
     maps.getline(buffer, PATH_MAX);
     maps.getline(buffer, PATH_MAX);
-    char *tail = strrchr(buffer,'/');
-    char *head = strchr(buffer,'/');
-    if (tail && head && (strcmp(tail,"/libp3dtool.so." PANDA_VERSION_STR)==0)) {
+    char *tail = strrchr(buffer, '/');
+    char *head = strchr(buffer, '/');
+    if (tail && head && (strcmp(tail, "/libp3dtool.so." PANDA_ABI_VERSION_STR) == 0)) {
       _dtool_name = head;
       _dtool_name = head;
-    } else if (tail && head && (strcmp(tail,"/libp3dtool.so")==0)) {
+    } else if (tail && head && (strcmp(tail, "/libp3dtool.so") == 0)) {
       _dtool_name = head;
       _dtool_name = head;
     }
     }
   }
   }

+ 6 - 0
dtool/src/dtoolutil/pandaVersion.h.pp

@@ -57,6 +57,12 @@ $[cdefine PANDA_NUMERIC_VERSION]
    out from CVS by the builder). */
    out from CVS by the builder). */
 # define PANDA_VERSION_STR "$[PANDA_VERSION_STR]"
 # define PANDA_VERSION_STR "$[PANDA_VERSION_STR]"
 
 
+/* This is the version of the Panda3D ABI expressed as a string.
+   This usually means the major and minor version. It should be the
+   same for Panda3D versions that are supposed to be backward
+   ABI compatible with each other. */
+# define PANDA_ABI_VERSION_STR "$[PANDA_MAJOR_VERSION].$[PANDA_MINOR_VERSION]"
+
 /* This is a string indicating who has provided this distribution. */
 /* This is a string indicating who has provided this distribution. */
 # define PANDA_DISTRIBUTOR "$[PANDA_DISTRIBUTOR]"
 # define PANDA_DISTRIBUTOR "$[PANDA_DISTRIBUTOR]"
 
 

+ 3 - 0
makepanda/makepanda.py

@@ -892,6 +892,7 @@ def CompileLink(dll, obj, opts):
                 cmd = 'g++ -undefined dynamic_lookup'
                 cmd = 'g++ -undefined dynamic_lookup'
                 if ("BUNDLE" in opts): cmd += ' -bundle '
                 if ("BUNDLE" in opts): cmd += ' -bundle '
                 else: cmd += ' -dynamiclib -install_name ' + os.path.basename(dll)
                 else: cmd += ' -dynamiclib -install_name ' + os.path.basename(dll)
+                cmd += ' -compatibility_version ' + MAJOR_VERSION + ' -current_version ' + VERSION
                 cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp -L/usr/X11R6/lib'
                 cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp -L/usr/X11R6/lib'
             else:
             else:
                 cmd = 'g++ -shared'
                 cmd = 'g++ -shared'
@@ -1516,6 +1517,7 @@ PANDAVERSION_H="""
 #define PANDA_VERSION $NVERSION
 #define PANDA_VERSION $NVERSION
 #define PANDA_NUMERIC_VERSION $NVERSION
 #define PANDA_NUMERIC_VERSION $NVERSION
 #define PANDA_VERSION_STR "$VERSION1.$VERSION2.$VERSION3"
 #define PANDA_VERSION_STR "$VERSION1.$VERSION2.$VERSION3"
+#define PANDA_ABI_VERSION_STR "$VERSION1.$VERSION2"
 #define PANDA_DISTRIBUTOR "$DISTRIBUTOR"
 #define PANDA_DISTRIBUTOR "$DISTRIBUTOR"
 #define PANDA_PACKAGE_VERSION_STR "$RTDIST_VERSION"
 #define PANDA_PACKAGE_VERSION_STR "$RTDIST_VERSION"
 #define PANDA_PACKAGE_HOST_URL "http://runtime.panda3d.org/"
 #define PANDA_PACKAGE_HOST_URL "http://runtime.panda3d.org/"
@@ -1526,6 +1528,7 @@ PANDAVERSION_H_RUNTIME="""
 #define PANDA_MINOR_VERSION 0
 #define PANDA_MINOR_VERSION 0
 #define PANDA_SEQUENCE_VERSION 0
 #define PANDA_SEQUENCE_VERSION 0
 #define PANDA_VERSION_STR "0.0.0"
 #define PANDA_VERSION_STR "0.0.0"
+#define PANDA_ABI_VERSION_STR "0.0"
 #define P3D_PLUGIN_MAJOR_VERSION $VERSION1
 #define P3D_PLUGIN_MAJOR_VERSION $VERSION1
 #define P3D_PLUGIN_MINOR_VERSION $VERSION2
 #define P3D_PLUGIN_MINOR_VERSION $VERSION2
 #define P3D_PLUGIN_SEQUENCE_VERSION $VERSION3
 #define P3D_PLUGIN_SEQUENCE_VERSION $VERSION3