Monkeying with the code from makepanda, I ended up with this modified bit of code which when run from the root of the build will convert all the dylib files to use a relative path. This results in a more portable installation suitable for distribution in source control. I think it might not work for Panda C++ programs outside the bin directory but it works great for Python. Here it is for anyone who stumbles upon this thread:
import os
for base in os.listdir("lib"):
if (not base.endswith(".a")):
libname = "lib/" + base
if (libname.endswith(".dylib") and not os.path.islink(libname)):
os.system("install_name_tool -id @loader_path/../lib/%s %s" % (base, libname))
os.system("otool -L %s | grep .dylib > otool-libs.txt" % libname)
for line in open("otool-libs.txt", "r"):
if len(line.strip()) > 0 and not line.strip().endswith(":"):
libdep = line.strip().split(" ", 1)[0]
if not libdep.startswith("/"):
os.system("install_name_tool -change %s @loader_path/../lib/%s %s" % (libdep, os.path.basename(libdep), libname))
for base in os.listdir("bin"):
binname = "bin/" + base
if (not os.path.islink(binname)):
os.system("otool -L %s | grep .dylib > otool-libs.txt" % binname)
for line in open("otool-libs.txt", "r"):
if len(line.strip()) > 0 and not line.strip().endswith(":"):
libdep = line.strip().split(" ", 1)[0]
if not libdep.startswith("/"):
os.system("install_name_tool -change %s @loader_path/../lib/%s %s" % (libdep, os.path.basename(libdep), binname))
os.system('rm otool-libs.txt')