Allow setting custom MAKEPANDA_THIRDPARTY and MAKEPANDA_SDKS env vars

This commit is contained in:
rdb 2010-11-17 12:36:58 +00:00
parent f05831d24d
commit 3d43d0c8ad
2 changed files with 37 additions and 22 deletions

View File

@ -258,7 +258,7 @@ if (RUNTIME):
exit("Runtime must be compiled with OpenSSL, ZLib, NPAPI, JPEG and PNG support!") exit("Runtime must be compiled with OpenSSL, ZLib, NPAPI, JPEG and PNG support!")
if (sys.platform.startswith("win")): if (sys.platform.startswith("win")):
os.environ["BISON_SIMPLE"] = "thirdparty/win-util/bison.simple" os.environ["BISON_SIMPLE"] = GetThirdpartyBase()+"/win-util/bison.simple"
if (INSTALLER and RTDIST): if (INSTALLER and RTDIST):
exit("Cannot build an installer for the rtdist build!") exit("Cannot build an installer for the rtdist build!")
@ -777,7 +777,7 @@ def CompileBison(wobj, wsrc, opts):
wdstc = GetOutputDir()+"/tmp/" + ifile + ".cxx" wdstc = GetOutputDir()+"/tmp/" + ifile + ".cxx"
pre = GetValueOption(opts, "BISONPREFIX_") pre = GetValueOption(opts, "BISONPREFIX_")
if (COMPILER == "MSVC"): if (COMPILER == "MSVC"):
oscmd('thirdparty/win-util/bison -y -d -o'+GetOutputDir()+'/tmp/'+ifile+'.c -p '+pre+' '+wsrc) oscmd(GetThirdpartyBase()+'/win-util/bison -y -d -o'+GetOutputDir()+'/tmp/'+ifile+'.c -p '+pre+' '+wsrc)
CopyFile(wdstc, GetOutputDir()+"/tmp/"+ifile+".c") CopyFile(wdstc, GetOutputDir()+"/tmp/"+ifile+".c")
CopyFile(wdsth, GetOutputDir()+"/tmp/"+ifile+".h") CopyFile(wdsth, GetOutputDir()+"/tmp/"+ifile+".h")
if (COMPILER == "LINUX"): if (COMPILER == "LINUX"):
@ -798,8 +798,8 @@ def CompileFlex(wobj,wsrc,opts):
pre = GetValueOption(opts, "BISONPREFIX_") pre = GetValueOption(opts, "BISONPREFIX_")
dashi = opts.count("FLEXDASHI") dashi = opts.count("FLEXDASHI")
if (COMPILER == "MSVC"): if (COMPILER == "MSVC"):
if (dashi): oscmd("thirdparty/win-util/flex -i -P" + pre + " -o"+wdst+" "+wsrc) if (dashi): oscmd(GetThirdpartyBase()+"/win-util/flex -i -P" + pre + " -o"+wdst+" "+wsrc)
else: oscmd("thirdparty/win-util/flex -P" + pre + " -o"+wdst+" "+wsrc) else: oscmd(GetThirdpartyBase()+"/win-util/flex -P" + pre + " -o"+wdst+" "+wsrc)
if (COMPILER == "LINUX"): if (COMPILER == "LINUX"):
if (dashi): oscmd("flex -i -P" + pre + " -o"+wdst+" "+wsrc) if (dashi): oscmd("flex -i -P" + pre + " -o"+wdst+" "+wsrc)
else: oscmd("flex -P" + pre + " -o"+wdst+" "+wsrc) else: oscmd("flex -P" + pre + " -o"+wdst+" "+wsrc)
@ -1878,8 +1878,8 @@ CopyFile(GetOutputDir()+"/", "doc/ReleaseNotes")
if (PkgSkip("PANDATOOL")==0): if (PkgSkip("PANDATOOL")==0):
CopyAllFiles(GetOutputDir()+"/plugins/", "pandatool/src/scripts/", ".mel") CopyAllFiles(GetOutputDir()+"/plugins/", "pandatool/src/scripts/", ".mel")
CopyAllFiles(GetOutputDir()+"/plugins/", "pandatool/src/scripts/", ".ms") CopyAllFiles(GetOutputDir()+"/plugins/", "pandatool/src/scripts/", ".ms")
if (PkgSkip("PYTHON")==0 and os.path.isdir("thirdparty/Pmw")): if (PkgSkip("PYTHON")==0 and os.path.isdir(GetThirdpartyBase()+"/Pmw")):
CopyTree(GetOutputDir()+'/Pmw', 'thirdparty/Pmw') CopyTree(GetOutputDir()+'/Pmw', GetThirdpartyBase()+'/Pmw')
ConditionalWriteFile(GetOutputDir()+'/include/ctl3d.h', '/* dummy file to make MAX happy */') ConditionalWriteFile(GetOutputDir()+'/include/ctl3d.h', '/* dummy file to make MAX happy */')
######################################################################## ########################################################################
@ -4915,7 +4915,7 @@ def MakeInstallerNSIS(file, fullname, smdirectory, installdir):
WriteFile(GetOutputDir()+"/tmp/__init__.py", "") WriteFile(GetOutputDir()+"/tmp/__init__.py", "")
psource=os.path.abspath(".") psource=os.path.abspath(".")
panda=os.path.abspath(GetOutputDir()) panda=os.path.abspath(GetOutputDir())
cmd="thirdparty/win-nsis/makensis /V2 " cmd=GetThirdpartyBase()+"/win-nsis/makensis /V2 "
cmd=cmd+'/DCOMPRESSOR="'+COMPRESSOR+'" ' cmd=cmd+'/DCOMPRESSOR="'+COMPRESSOR+'" '
cmd=cmd+'/DNAME="'+fullname+'" ' cmd=cmd+'/DNAME="'+fullname+'" '
cmd=cmd+'/DSMDIRECTORY="'+smdirectory+'" ' cmd=cmd+'/DSMDIRECTORY="'+smdirectory+'" '
@ -4929,7 +4929,7 @@ def MakeInstallerNSIS(file, fullname, smdirectory, installdir):
cmd=cmd+'/DPANDA="'+panda+'" ' cmd=cmd+'/DPANDA="'+panda+'" '
cmd=cmd+'/DPANDACONF="'+panda+'\\etc" ' cmd=cmd+'/DPANDACONF="'+panda+'\\etc" '
cmd=cmd+'/DPSOURCE="'+psource+'" ' cmd=cmd+'/DPSOURCE="'+psource+'" '
cmd=cmd+'/DPYEXTRAS="'+psource+'\\thirdparty\\win-extras" ' cmd=cmd+'/DPYEXTRAS="'+os.path.abspath(GetThirdpartyBase())+'\\win-extras" '
cmd=cmd+'"'+psource+'\\direct\\src\\directscripts\\packpanda.nsi"' cmd=cmd+'"'+psource+'\\direct\\src\\directscripts\\packpanda.nsi"'
oscmd(cmd) oscmd(cmd)
os.rename("nsis-output.exe", file) os.rename("nsis-output.exe", file)

View File

@ -19,6 +19,7 @@ STARTTIME=time.time()
MAINTHREAD=threading.currentThread() MAINTHREAD=threading.currentThread()
OUTPUTDIR="built" OUTPUTDIR="built"
CUSTOM_OUTPUTDIR=False CUSTOM_OUTPUTDIR=False
THIRDPARTYBASE=None
THIRDPARTYDIR=None THIRDPARTYDIR=None
OPTIMIZE="3" OPTIMIZE="3"
VERBOSE=False VERBOSE=False
@ -768,29 +769,39 @@ def CheckPandaSourceTree():
## ##
######################################################################## ########################################################################
def GetThirdpartyBase():
global THIRDPARTYBASE
if (THIRDPARTYBASE != None):
return THIRDPARTYBASE
THIRDPARTYBASE = "thirdparty"
if "MAKEPANDA_THIRDPARTY" in os.environ:
THIRDPARTYBASE = os.environ["MAKEPANDA_THIRDPARTY"]
return THIRDPARTYBASE
def GetThirdpartyDir(): def GetThirdpartyDir():
global THIRDPARTYDIR global THIRDPARTYDIR
if (THIRDPARTYDIR != None): if (THIRDPARTYDIR != None):
return THIRDPARTYDIR return THIRDPARTYDIR
if (sys.platform.startswith("win")): if (sys.platform.startswith("win")):
if (platform.architecture()[0] == "64bit"): if (platform.architecture()[0] == "64bit"):
THIRDPARTYDIR="thirdparty/win-libs-vc9-x64/" THIRDPARTYDIR=GetThirdpartyBase()+"/win-libs-vc9-x64/"
else: else:
THIRDPARTYDIR="thirdparty/win-libs-vc9/" THIRDPARTYDIR=GetThirdpartyBase()+"/win-libs-vc9/"
if not os.path.isdir(THIRDPARTYDIR): if not os.path.isdir(THIRDPARTYDIR):
THIRDPARTYDIR="thirdparty/win-libs-vc9/" THIRDPARTYDIR=GetThirdpartyBase()+"/win-libs-vc9/"
elif (sys.platform == "darwin"): elif (sys.platform == "darwin"):
THIRDPARTYDIR="thirdparty/darwin-libs-a/" THIRDPARTYDIR=GetThirdpartyBase()+"/darwin-libs-a/"
elif (sys.platform.startswith("linux")): elif (sys.platform.startswith("linux")):
if (platform.architecture()[0] == "64bit"): if (platform.architecture()[0] == "64bit"):
THIRDPARTYDIR="thirdparty/linux-libs-x64/" THIRDPARTYDIR=GetThirdpartyBase()+"/linux-libs-x64/"
else: else:
THIRDPARTYDIR="thirdparty/linux-libs-a/" THIRDPARTYDIR=GetThirdpartyBase()+"/linux-libs-a/"
elif (sys.platform.startswith("freebsd")): elif (sys.platform.startswith("freebsd")):
if (platform.architecture()[0] == "64bit"): if (platform.architecture()[0] == "64bit"):
THIRDPARTYDIR="thirdparty/freebsd-libs-x64/" THIRDPARTYDIR=GetThirdpartyBase()+"/freebsd-libs-x64/"
else: else:
THIRDPARTYDIR="thirdparty/freebsd-libs-a/" THIRDPARTYDIR=GetThirdpartyBase()+"/freebsd-libs-a/"
else: else:
print GetColor("red") + "WARNING:" + GetColor("Unsupported platform: " + sys.platform) print GetColor("red") + "WARNING:" + GetColor("Unsupported platform: " + sys.platform)
return THIRDPARTYDIR return THIRDPARTYDIR
@ -1251,7 +1262,11 @@ def GetSdkDir(sdkname, sdkkey = None):
# Returns the default SDK directory. If it exists, # Returns the default SDK directory. If it exists,
# and sdkkey is not None, it is put in SDK[sdkkey]. # and sdkkey is not None, it is put in SDK[sdkkey].
# Note: return value may not be an existing path. # Note: return value may not be an existing path.
sdir = "sdks" sdkbase = "sdks"
if "MAKEPANDA_SDKS" in os.environ:
sdkbase = os.environ["MAKEPANDA_SDKS"]
sdir = sdkbase[:]
if (sys.platform.startswith("win")): if (sys.platform.startswith("win")):
sdir += "/win" sdir += "/win"
sdir += platform.architecture()[0][:2] sdir += platform.architecture()[0][:2]
@ -1264,7 +1279,7 @@ def GetSdkDir(sdkname, sdkkey = None):
# If it does not exist, try the old location. # If it does not exist, try the old location.
if (not os.path.isdir(sdir)): if (not os.path.isdir(sdir)):
sdir = "sdks/" + sdir sdir = sdkbase + "/" + sdir
if (sys.platform.startswith("linux")): if (sys.platform.startswith("linux")):
sdir += "-linux" sdir += "-linux"
sdir += platform.architecture()[0][:2] sdir += platform.architecture()[0][:2]
@ -1363,7 +1378,7 @@ def SdkLocateMax():
def SdkLocatePython(force_use_sys_executable = False): def SdkLocatePython(force_use_sys_executable = False):
if (PkgSkip("PYTHON")==0): if (PkgSkip("PYTHON")==0):
if (sys.platform == "win32" and not force_use_sys_executable): if (sys.platform == "win32" and not force_use_sys_executable):
SDK["PYTHON"] = "thirdparty/win-python" SDK["PYTHON"] = GetThirdpartyBase()+"/win-python"
if (GetOptimize() <= 2): if (GetOptimize() <= 2):
SDK["PYTHON"] += "-dbg" SDK["PYTHON"] += "-dbg"
if (platform.architecture()[0] == "64bit" and os.path.isdir(SDK["PYTHON"] + "-x64")): if (platform.architecture()[0] == "64bit" and os.path.isdir(SDK["PYTHON"] + "-x64")):
@ -1645,10 +1660,10 @@ def LibDirectory(opt, dir):
LIBDIRECTORIES.append((opt, dir)) LIBDIRECTORIES.append((opt, dir))
def LibName(opt, name): def LibName(opt, name):
#check to see if the lib file actually exists for the thrid party library given # Check to see if the lib file actually exists for the thirdparty library given
#are we a thrid party library? # Are we a thirdparty library?
if name.startswith("thirdparty"): if name.startswith("thirdparty"):
#does this lib exists # Does this lib exist?
if not os.path.exists(name): if not os.path.exists(name):
PkgDisable(opt) PkgDisable(opt)
WARNINGS.append(name + " not found. Skipping Package " + opt) WARNINGS.append(name + " not found. Skipping Package " + opt)