OSX fixes

This commit is contained in:
rdb 2009-09-22 17:20:02 +00:00
parent 1d42c6dd43
commit 704bcc4932

View File

@ -410,12 +410,17 @@ def CxxGetIncludes(path):
## ##
######################################################################## ########################################################################
DCACHE_BACKED_UP = False
def SaveDependencyCache(): def SaveDependencyCache():
try: global DCACHE_BACKED_UP
if (os.path.exists(os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache"))): if not DCACHE_BACKED_UP:
os.rename(os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache"), try:
os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache-backup")) if (os.path.exists(os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache"))):
except: pass os.rename(os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache"),
os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache-backup"))
except: pass
DCACHE_BACKED_UP = True
try: icache = open(os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache"),'wb') try: icache = open(os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache"),'wb')
except: icache = 0 except: icache = 0
if (icache!=0): if (icache!=0):
@ -914,6 +919,7 @@ def GetLdCache():
libs = glob.glob("/lib/*.so*") + glob.glob("/usr/lib/*.so*") + glob.glob("/usr/local/lib/*.so*") + glob.glob("/usr/PCBSD/local/lib/*.so*") libs = glob.glob("/lib/*.so*") + glob.glob("/usr/lib/*.so*") + glob.glob("/usr/local/lib/*.so*") + glob.glob("/usr/PCBSD/local/lib/*.so*")
if (sys.platform == "darwin"): if (sys.platform == "darwin"):
libs += glob.glob("/lib/*.dylib*") + glob.glob("/usr/lib/*.dylib*") + glob.glob("/usr/local/lib/*.dylib*") libs += glob.glob("/lib/*.dylib*") + glob.glob("/usr/lib/*.dylib*") + glob.glob("/usr/local/lib/*.dylib*")
libs += glob.glob("/usr/X11/lib/*.dylib*") + glob.glob("/usr/X11R6/lib/*.dylib*")
for l in libs: for l in libs:
lib = os.path.basename(l).split(".so", 1)[0].split(".dylib", 1)[0][3:] lib = os.path.basename(l).split(".so", 1)[0].split(".dylib", 1)[0][3:]
LD_CACHE.append(lib) LD_CACHE.append(lib)
@ -975,8 +981,8 @@ def PkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, fram
else: else:
print "%ERROR:%s Could not locate framework %s, aborting build" % (GetColor("red"), GetColor(), framework) print "%ERROR:%s Could not locate framework %s, aborting build" % (GetColor("red"), GetColor(), framework)
exit() exit()
elif (LocateBinary("pkg-config") != None and pkgconfig != None): elif (LocateBinary(tool) != None and (tool != "pkg-config" or pkgconfig != None)):
if (isinstance(pkgconfig, str)): if (isinstance(pkgconfig, str) or tool != "pkg-config"):
if (PkgConfigHavePkg(pkgconfig, tool)): if (PkgConfigHavePkg(pkgconfig, tool)):
return PkgConfigEnable(pkg, pkgconfig, tool) return PkgConfigEnable(pkg, pkgconfig, tool)
else: else:
@ -1019,7 +1025,7 @@ def PkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, fram
for ppkg, pdir in INCDIRECTORIES: for ppkg, pdir in INCDIRECTORIES:
if (pkg == ppkg and len(glob.glob(os.path.join(pdir, i))) > 0): if (pkg == ppkg and len(glob.glob(os.path.join(pdir, i))) > 0):
incdir = sorted(glob.glob(os.path.join(pdir, i)))[-1] incdir = sorted(glob.glob(os.path.join(pdir, i)))[-1]
if (VERBOSE and i.endswith(".h")): if (incdir == None and VERBOSE and i.endswith(".h")):
print GetColor("cyan") + "Couldn't find header file " + i + GetColor() print GetColor("cyan") + "Couldn't find header file " + i + GetColor()
have_pkg = False have_pkg = False