mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Build panda3d/*.so as bundles on OSX, make OSX builds relocatable
This commit is contained in:
parent
773614c610
commit
4f3998ae11
@ -1595,9 +1595,10 @@ def CompileLink(dll, obj, opts):
|
|||||||
else:
|
else:
|
||||||
if (GetTarget() == "darwin"):
|
if (GetTarget() == "darwin"):
|
||||||
cmd = cxx + ' -undefined dynamic_lookup'
|
cmd = cxx + ' -undefined dynamic_lookup'
|
||||||
if ("BUNDLE" in opts): cmd += ' -bundle '
|
if ("BUNDLE" in opts or GetOrigExt(dll) == ".pyd"):
|
||||||
|
cmd += ' -bundle '
|
||||||
else:
|
else:
|
||||||
install_name = os.path.basename(dll)
|
install_name = '@loader_path/../lib/' + os.path.basename(dll)
|
||||||
cmd += ' -dynamiclib -install_name ' + install_name
|
cmd += ' -dynamiclib -install_name ' + install_name
|
||||||
cmd += ' -compatibility_version ' + MAJOR_VERSION + ' -current_version ' + VERSION
|
cmd += ' -compatibility_version ' + MAJOR_VERSION + ' -current_version ' + VERSION
|
||||||
cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
|
cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
|
||||||
@ -2622,6 +2623,12 @@ ConditionalWriteFile(GetOutputDir()+"/etc/Confauto.prc", confautoprc)
|
|||||||
|
|
||||||
tp_dir = GetThirdpartyDir()
|
tp_dir = GetThirdpartyDir()
|
||||||
if tp_dir is not None:
|
if tp_dir is not None:
|
||||||
|
dylibs = set()
|
||||||
|
|
||||||
|
if GetTarget() == 'darwin':
|
||||||
|
for lib in glob.glob(tp_dir + "/*/lib/*.dylib"):
|
||||||
|
dylibs.add(os.path.basename(lib))
|
||||||
|
|
||||||
for pkg in PkgListGet():
|
for pkg in PkgListGet():
|
||||||
if PkgSkip(pkg):
|
if PkgSkip(pkg):
|
||||||
continue
|
continue
|
||||||
@ -2641,12 +2648,36 @@ if tp_dir is not None:
|
|||||||
CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib)
|
CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib)
|
||||||
|
|
||||||
if GetTarget() == 'darwin':
|
if GetTarget() == 'darwin':
|
||||||
for tp_lib in glob.glob(tp_pkg + "/lib/*.dylib"):
|
tp_libs = glob.glob(tp_pkg + "/lib/*.dylib")
|
||||||
CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib)
|
|
||||||
|
|
||||||
if not PkgSkip("PYTHON"):
|
if not PkgSkip("PYTHON"):
|
||||||
for tp_lib in glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.dylib")):
|
tp_libs += glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.dylib"))
|
||||||
CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib)
|
|
||||||
|
for tp_lib in tp_libs:
|
||||||
|
basename = os.path.basename(tp_lib)
|
||||||
|
target = GetOutputDir() + "/lib/" + basename
|
||||||
|
if not NeedsBuild([target], [tp_lib]):
|
||||||
|
continue
|
||||||
|
|
||||||
|
CopyFile(target, tp_lib)
|
||||||
|
if os.path.islink(target):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Correct the inter-library dependencies so that the build is relocatable.
|
||||||
|
oscmd('install_name_tool -id @loader_path/../lib/%s %s' % (basename, target))
|
||||||
|
oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (target, GetOutputDir()), True)
|
||||||
|
|
||||||
|
for line in open(GetOutputDir() + "/tmp/otool-libs.txt", "r"):
|
||||||
|
line = line.strip()
|
||||||
|
if not line or line.startswith('@loader_path/../lib/') or line.endswith(":"):
|
||||||
|
continue
|
||||||
|
|
||||||
|
libdep = line.split(" ", 1)[0]
|
||||||
|
dep_basename = os.path.basename(libdep)
|
||||||
|
if dep_basename in dylibs:
|
||||||
|
oscmd("install_name_tool -change %s @loader_path/../lib/%s %s" % (libdep, dep_basename, target), True)
|
||||||
|
|
||||||
|
JustBuilt([target], [tp_lib])
|
||||||
|
|
||||||
for fwx in glob.glob(tp_pkg + "/*.framework"):
|
for fwx in glob.glob(tp_pkg + "/*.framework"):
|
||||||
CopyTree(GetOutputDir() + "/Frameworks/" + os.path.basename(fwx), fwx)
|
CopyTree(GetOutputDir() + "/Frameworks/" + os.path.basename(fwx), fwx)
|
||||||
@ -6649,16 +6680,6 @@ def MakeInstallerOSX():
|
|||||||
# On OSX, just specifying -P is not enough to do that.
|
# On OSX, just specifying -P is not enough to do that.
|
||||||
oscmd("cp -R -P " + GetOutputDir() + "/" + base + " " + libname)
|
oscmd("cp -R -P " + GetOutputDir() + "/" + base + " " + libname)
|
||||||
|
|
||||||
# Execute install_name_tool to make them reference an absolute path
|
|
||||||
if (libname.endswith(".dylib") or libname.endswith(".so")) and not os.path.islink(libname):
|
|
||||||
oscmd("install_name_tool -id /Developer/Panda3D/%s %s" % (base, libname), True)
|
|
||||||
oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (libname, GetOutputDir()), True)
|
|
||||||
for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"):
|
|
||||||
if len(line.strip()) > 0 and not line.strip().endswith(":"):
|
|
||||||
libdep = line.strip().split(" ", 1)[0]
|
|
||||||
if 'lib/' + os.path.basename(libdep) in install_libs:
|
|
||||||
oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, os.path.basename(libdep), libname), True)
|
|
||||||
|
|
||||||
oscmd("mkdir -p dstroot/tools/Developer/Tools/Panda3D")
|
oscmd("mkdir -p dstroot/tools/Developer/Tools/Panda3D")
|
||||||
oscmd("mkdir -p dstroot/tools/Developer/Panda3D")
|
oscmd("mkdir -p dstroot/tools/Developer/Panda3D")
|
||||||
oscmd("mkdir -p dstroot/tools/etc/paths.d")
|
oscmd("mkdir -p dstroot/tools/etc/paths.d")
|
||||||
@ -6673,15 +6694,6 @@ def MakeInstallerOSX():
|
|||||||
# OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird.
|
# OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird.
|
||||||
oscmd("cp -R " + GetOutputDir() + "/bin/" + base + " " + binname)
|
oscmd("cp -R " + GetOutputDir() + "/bin/" + base + " " + binname)
|
||||||
|
|
||||||
# Execute install_name_tool to make the binaries reference an absolute path
|
|
||||||
if (not os.path.islink(binname)):
|
|
||||||
oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (binname, GetOutputDir()), True)
|
|
||||||
for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"):
|
|
||||||
if len(line.strip()) > 0 and not line.strip().endswith(":"):
|
|
||||||
libdep = line.strip().split(" ", 1)[0]
|
|
||||||
if 'lib/' + os.path.basename(libdep) in install_libs:
|
|
||||||
oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, os.path.basename(libdep), binname), True)
|
|
||||||
|
|
||||||
if PkgSkip("PYTHON")==0:
|
if PkgSkip("PYTHON")==0:
|
||||||
PV = SDK["PYTHONVERSION"].replace("python", "")
|
PV = SDK["PYTHONVERSION"].replace("python", "")
|
||||||
oscmd("mkdir -p dstroot/pythoncode/usr/bin")
|
oscmd("mkdir -p dstroot/pythoncode/usr/bin")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user