diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index 1f02acffbf..7a3cd5110a 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -966,7 +966,15 @@ class Packager: else: # It's just a normal library - find it on the path. filename = Filename.fromOsSpecific(filename) - filename.resolveFilename(path) + if filename.isLocal(): + filename.resolveFilename(path) + else: + # It's a fully-specified filename; look + # for it under the system root first. + if self.packager.systemRoot: + f2 = Filename(self.packager.systemRoot + filename.cStr()) + if f2.exists(): + filename = f2 newName = Filename(file.dependencyDir, filename.getBasename()) self.addFile(filename, newName = newName.cStr(), @@ -1754,6 +1762,11 @@ class Packager: # This should be set to a Filename. self.installDir = None + # If specified, this is a directory to search first for any + # library references, before searching the system. + # Particularly useful on OSX to reference the universal SDK. + self.systemRoot = None + # The download URL at which these packages will eventually be # hosted. self.hosts = {} diff --git a/direct/src/p3d/ppackage.py b/direct/src/p3d/ppackage.py index 55960c3f28..563e31b3a6 100755 --- a/direct/src/p3d/ppackage.py +++ b/direct/src/p3d/ppackage.py @@ -97,6 +97,15 @@ Options: platforms, it is probably a mistake to set this. However, see the option -u. + -R sysroot + Specify the sysroot that these files were compiled against. This + will shadow the system shared libraries, so that alternate + versions are used instead of the system versions. If any program + references a library, say /usr/lib/libfoo.so, and + /sysroot/usr/lib/libfoo.so exists instead, that file will be used + instead of the system library. This is particularly useful for + cross-compilation. At the moment, this is supported only on OSX. + -h Display this help """ @@ -119,10 +128,11 @@ installSearch = [] signParams = [] allowPythonDev = False universalBinaries = False +systemRoot = None platforms = [] try: - opts, args = getopt.getopt(sys.argv[1:], 'i:ps:S:DuP:h') + opts, args = getopt.getopt(sys.argv[1:], 'i:ps:S:DuP:R:h') except getopt.error, msg: usage(1, msg) @@ -145,6 +155,8 @@ for opt, arg in opts: universalBinaries = True elif opt == '-P': platforms.append(arg) + elif opt == '-R': + systemRoot = arg elif opt == '-h': usage(0) @@ -181,6 +193,7 @@ for platform in platforms: packager.installSearch = [installDir] + installSearch + packager.installSearch packager.signParams = signParams packager.allowPythonDev = allowPythonDev + packager.systemRoot = systemRoot try: packager.setup()