From d668a53639416b3c3648522b67e2c969bae112e0 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 14 Mar 2010 11:48:08 +0000 Subject: [PATCH] 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 --- dtool/src/dtoolutil/executionEnvironment.cxx | 10 +++++----- dtool/src/dtoolutil/pandaVersion.h.pp | 6 ++++++ makepanda/makepanda.py | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/dtool/src/dtoolutil/executionEnvironment.cxx b/dtool/src/dtoolutil/executionEnvironment.cxx index d7975bcc29..50cc60f622 100644 --- a/dtool/src/dtoolutil/executionEnvironment.cxx +++ b/dtool/src/dtoolutil/executionEnvironment.cxx @@ -468,7 +468,7 @@ read_args() { char buffer[buffer_size]; DWORD size = GetModuleFileName(dllhandle, buffer, buffer_size); 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(); _dtool_name = tmp; } @@ -487,11 +487,11 @@ read_args() { char buffer[PATH_MAX]; buffer[0] = 0; 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; - } else if (tail && head && (strcmp(tail,"/libp3dtool.so")==0)) { + } else if (tail && head && (strcmp(tail, "/libp3dtool.so") == 0)) { _dtool_name = head; } } diff --git a/dtool/src/dtoolutil/pandaVersion.h.pp b/dtool/src/dtoolutil/pandaVersion.h.pp index 5a12c230d1..543f9891c6 100644 --- a/dtool/src/dtoolutil/pandaVersion.h.pp +++ b/dtool/src/dtoolutil/pandaVersion.h.pp @@ -57,6 +57,12 @@ $[cdefine PANDA_NUMERIC_VERSION] out from CVS by the builder). */ # 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. */ # define PANDA_DISTRIBUTOR "$[PANDA_DISTRIBUTOR]" diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 432cff1a30..7250554bee 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -892,6 +892,7 @@ def CompileLink(dll, obj, opts): cmd = 'g++ -undefined dynamic_lookup' if ("BUNDLE" in opts): cmd += ' -bundle ' 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' else: cmd = 'g++ -shared' @@ -1516,6 +1517,7 @@ PANDAVERSION_H=""" #define PANDA_VERSION $NVERSION #define PANDA_NUMERIC_VERSION $NVERSION #define PANDA_VERSION_STR "$VERSION1.$VERSION2.$VERSION3" +#define PANDA_ABI_VERSION_STR "$VERSION1.$VERSION2" #define PANDA_DISTRIBUTOR "$DISTRIBUTOR" #define PANDA_PACKAGE_VERSION_STR "$RTDIST_VERSION" #define PANDA_PACKAGE_HOST_URL "http://runtime.panda3d.org/" @@ -1526,6 +1528,7 @@ PANDAVERSION_H_RUNTIME=""" #define PANDA_MINOR_VERSION 0 #define PANDA_SEQUENCE_VERSION 0 #define PANDA_VERSION_STR "0.0.0" +#define PANDA_ABI_VERSION_STR "0.0" #define P3D_PLUGIN_MAJOR_VERSION $VERSION1 #define P3D_PLUGIN_MINOR_VERSION $VERSION2 #define P3D_PLUGIN_SEQUENCE_VERSION $VERSION3