mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 16:20:11 -04:00
Various improvements, most notably that --installer now supports creating FreeBSD packages. Also, default install path for installpanda.py is now /usr/local
This commit is contained in:
parent
1eb6bf3d42
commit
d73fd17eac
@ -17,7 +17,7 @@ from distutils.sysconfig import get_python_lib
|
||||
from optparse import OptionParser
|
||||
from makepandacore import *
|
||||
|
||||
if (platform.architecture()[0] == "64bit"):
|
||||
if (platform.architecture()[0] == "64bit" and not sys.platform.startswith("freebsd")):
|
||||
libdir = "/lib64"
|
||||
else:
|
||||
libdir = "/lib"
|
||||
@ -116,12 +116,19 @@ def InstallPanda(destdir="", prefix="/usr", outputdir="built"):
|
||||
oscmd("mkdir -p "+destdir+prefix+"/share/applications")
|
||||
oscmd("mkdir -p "+destdir+prefix+libdir+"/panda3d")
|
||||
oscmd("mkdir -p "+destdir+PPATH)
|
||||
oscmd("mkdir -p "+destdir+"/etc/ld.so.conf.d")
|
||||
if (sys.platform.startswith("freebsd")):
|
||||
oscmd("mkdir -p "+destdir+prefix+"/etc")
|
||||
else:
|
||||
oscmd("mkdir -p "+destdir+"/etc/ld.so.conf.d")
|
||||
WriteFile(destdir+prefix+"/share/panda3d/direct/__init__.py", "")
|
||||
Configrc = ReadFile(outputdir+"/etc/Config.prc")
|
||||
Configrc = Configrc.replace("model-path $THIS_PRC_DIR/..", "model-path "+prefix+"/share/panda3d")
|
||||
WriteFile(destdir+"/etc/Config.prc", Configrc)
|
||||
oscmd("cp "+outputdir+"/etc/Confauto.prc "+destdir+"/etc/Confauto.prc")
|
||||
if (sys.platform.startswith("freebsd")):
|
||||
WriteFile(destdir+prefix+"/etc/Config.prc", Configrc)
|
||||
oscmd("cp "+outputdir+"/etc/Confauto.prc "+destdir+prefix+"/etc/Confauto.prc")
|
||||
else:
|
||||
WriteFile(destdir+"/etc/Config.prc", Configrc)
|
||||
oscmd("cp "+outputdir+"/etc/Confauto.prc "+destdir+"/etc/Confauto.prc")
|
||||
oscmd("cp -R "+outputdir+"/include "+destdir+prefix+"/include/panda3d")
|
||||
oscmd("cp -R direct/src/* "+destdir+prefix+"/share/panda3d/direct")
|
||||
oscmd("cp -R "+outputdir+"/pandac "+destdir+prefix+"/share/panda3d/pandac")
|
||||
@ -138,24 +145,25 @@ def InstallPanda(destdir="", prefix="/usr", outputdir="built"):
|
||||
oscmd("cp doc/LICENSE "+destdir+prefix+"/share/panda3d/LICENSE")
|
||||
oscmd("cp doc/LICENSE "+destdir+prefix+"/include/panda3d/LICENSE")
|
||||
oscmd("cp doc/ReleaseNotes "+destdir+prefix+"/share/panda3d/ReleaseNotes")
|
||||
oscmd("echo '"+prefix+libdir+"/panda3d'> "+destdir+"/etc/ld.so.conf.d/panda3d.conf")
|
||||
oscmd("echo '"+prefix+"/share/panda3d' > "+destdir+PPATH+"/panda3d.pth")
|
||||
oscmd("echo '"+prefix+libdir+"/panda3d'>> "+destdir+PPATH+"/panda3d.pth")
|
||||
oscmd("chmod +x "+destdir+"/etc/ld.so.conf.d/panda3d.conf")
|
||||
if (not sys.platform.startswith("freebsd")):
|
||||
oscmd("echo '"+prefix+libdir+"/panda3d'> "+destdir+"/etc/ld.so.conf.d/panda3d.conf")
|
||||
oscmd("chmod +x "+destdir+"/etc/ld.so.conf.d/panda3d.conf")
|
||||
oscmd("ln -s "+PEXEC+" "+destdir+prefix+"/bin/ppython")
|
||||
oscmd("cp "+outputdir+"/bin/* "+destdir+prefix+"/bin/")
|
||||
for base in os.listdir(outputdir+"/lib"):
|
||||
if (not base.endswith(".a")):
|
||||
oscmd("cp -d "+outputdir+"/lib/"+base+" "+destdir+prefix+libdir+"/panda3d/"+base)
|
||||
oscmd("cp -P "+outputdir+"/lib/"+base+" "+destdir+prefix+libdir+"/panda3d/"+base)
|
||||
# rpmlint doesn't like it if we compile pyc.
|
||||
#for base in os.listdir(destdir+prefix+"/share/panda3d/direct"):
|
||||
# if ((base != "extensions") and (base != "extensions_native")):
|
||||
# compileall.compile_dir(destdir+prefix+"/share/panda3d/direct/"+base)
|
||||
#compileall.compile_dir(destdir+prefix+"/share/panda3d/Pmw")
|
||||
DeleteCVS(destdir+prefix+"/include/panda3d")
|
||||
DeleteCVS(destdir+prefix+"/share/panda3d")
|
||||
# rpmlint doesn't like these files, for some reason.
|
||||
DeleteBuildFiles(destdir+prefix+"/share/panda3d")
|
||||
DeleteCVS(destdir)
|
||||
DeleteBuildFiles(destdir)
|
||||
DeleteEmptyDirs(destdir)
|
||||
# rpmlint doesn't like this file, for some reason.
|
||||
if (os.path.isfile(destdir+prefix+"/share/panda3d/direct/leveleditor/copyfiles.pl")):
|
||||
os.remove(destdir+prefix+"/share/panda3d/direct/leveleditor/copyfiles.pl")
|
||||
|
||||
@ -182,8 +190,8 @@ def InstallRuntime(destdir="", prefix="/usr", outputdir="built"):
|
||||
oscmd("cp "+outputdir+"/bin/panda3d "+destdir+prefix+"/bin/")
|
||||
|
||||
if (__name__ == "__main__"):
|
||||
if (sys.platform != "linux2"):
|
||||
exit("This script only works on linux at the moment!")
|
||||
if (sys.platform.startswith("win") or sys.platform == "darwin"):
|
||||
exit("This script is not supported on Windows or Mac OS X at the moment!")
|
||||
|
||||
destdir = "/"
|
||||
if (os.environ.has_key("DESTDIR")):
|
||||
@ -192,7 +200,7 @@ if (__name__ == "__main__"):
|
||||
parser = OptionParser()
|
||||
parser.add_option('', '--outputdir', dest = 'outputdir', help = 'Makepanda\'s output directory (default: built)', default = 'built')
|
||||
parser.add_option('', '--destdir', dest = 'destdir', help = 'Destination directory [default=%s]' % destdir, default = destdir)
|
||||
parser.add_option('', '--prefix', dest = 'prefix', help = 'Prefix [default=/usr]', default = '/usr')
|
||||
parser.add_option('', '--prefix', dest = 'prefix', help = 'Prefix [default=/usr/local]', default = '/usr/local')
|
||||
parser.add_option('', '--runtime', dest = 'runtime', help = 'Specify if runtime build [default=no]', action = 'store_true', default = False)
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
@ -203,7 +211,7 @@ if (__name__ == "__main__"):
|
||||
destdir = ""
|
||||
if (destdir != "" and not os.path.isdir(destdir)):
|
||||
exit("Directory '%s' does not exist!" % destdir)
|
||||
|
||||
|
||||
if (options.runtime):
|
||||
print "Installing Panda3D Runtime into " + destdir + options.prefix
|
||||
InstallRuntime(destdir = destdir, prefix = options.prefix, outputdir = options.outputdir)
|
||||
|
@ -4846,7 +4846,7 @@ Version: VERSION
|
||||
Release: 1
|
||||
License: BSD License
|
||||
Group: Development/Libraries
|
||||
BuildRoot: PANDASOURCE/linuxroot
|
||||
BuildRoot: PANDASOURCE/targetroot
|
||||
%description
|
||||
Panda3D is a game engine which includes graphics, audio, I/O, collision detection, and other abilities relevant to the creation of 3D games. Panda3D is open source and free software under the revised BSD license, and can be used for both free and commercial game development at no financial cost.
|
||||
Panda3D's intended game-development language is Python. The engine itself is written in C++, and utilizes an automatic wrapper-generator to expose the complete functionality of the engine in a Python interface.
|
||||
@ -4880,7 +4880,7 @@ Version: VERSION
|
||||
Release: 1
|
||||
License: BSD License
|
||||
Group: Productivity/Graphics/Other
|
||||
BuildRoot: PANDASOURCE/linuxroot
|
||||
BuildRoot: PANDASOURCE/targetroot
|
||||
%description
|
||||
This package contains the runtime distribution and browser plugin of the Panda3D engine. It allows you view webpages that contain Panda3D content and to run games created with Panda3D that are packaged as .p3d file.
|
||||
%files
|
||||
@ -4897,6 +4897,7 @@ This package contains the runtime distribution and browser plugin of the Panda3D
|
||||
/usr/share/applications/*.desktop
|
||||
"""
|
||||
|
||||
# plist file for Mac OSX
|
||||
Info_plist = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
@ -4915,70 +4916,79 @@ Info_plist = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
</plist>
|
||||
"""
|
||||
|
||||
# FreeBSD pkg-descr
|
||||
INSTALLER_PKG_DESCR_FILE = """
|
||||
Panda3D is a game engine which includes graphics, audio, I/O, collision detection, and other abilities relevant to the creation of 3D games. Panda3D is open source and free software under the revised BSD license, and can be used for both free and commercial game development at no financial cost.
|
||||
Panda3D's intended game-development language is Python. The engine itself is written in C++, and utilizes an automatic wrapper-generator to expose the complete functionality of the engine in a Python interface.
|
||||
|
||||
This package contains the SDK for development with Panda3D, install panda3d-runtime for the runtime files.
|
||||
|
||||
WWW: http://www.panda3d.org/
|
||||
"""
|
||||
|
||||
def MakeInstallerLinux():
|
||||
import compileall
|
||||
if RUNTIME: # No worries, it won't be used
|
||||
PYTHONV = "python"
|
||||
PYTHONV = "python"
|
||||
else:
|
||||
PYTHONV = SDK["PYTHONVERSION"]
|
||||
PYTHONV = SDK["PYTHONVERSION"]
|
||||
PV = PYTHONV.replace("python", "")
|
||||
if (os.path.isdir("linuxroot")): oscmd("chmod -R 755 linuxroot")
|
||||
oscmd("rm -rf linuxroot data.tar.gz control.tar.gz panda3d.spec")
|
||||
oscmd("mkdir linuxroot")
|
||||
if (os.path.isdir("targetroot")): oscmd("chmod -R 755 targetroot")
|
||||
oscmd("rm -rf targetroot data.tar.gz control.tar.gz panda3d.spec")
|
||||
oscmd("mkdir targetroot")
|
||||
|
||||
# Invoke installpanda.py to install it into a temporary dir
|
||||
if RUNTIME:
|
||||
InstallRuntime(destdir = "linuxroot", outputdir = GetOutputDir())
|
||||
InstallRuntime(destdir = "targetroot", outputdir = GetOutputDir())
|
||||
else:
|
||||
InstallPanda(destdir = "linuxroot", outputdir = GetOutputDir())
|
||||
oscmd("chmod -R 755 linuxroot/usr/share/panda3d")
|
||||
InstallPanda(destdir = "targetroot", outputdir = GetOutputDir())
|
||||
oscmd("chmod -R 755 targetroot/usr/share/panda3d")
|
||||
|
||||
if (os.path.exists("/usr/bin/rpmbuild") and not os.path.exists("/usr/bin/dpkg-deb")):
|
||||
oscmd("rm -rf linuxroot/DEBIAN")
|
||||
oscmd("rm -rf targetroot/DEBIAN")
|
||||
oscmd("rpm -E '%_target_cpu' > "+GetOutputDir()+"/tmp/architecture.txt")
|
||||
ARCH = ReadFile(GetOutputDir()+"/tmp/architecture.txt").strip()
|
||||
pandasource = os.path.abspath(os.getcwd())
|
||||
if (RUNTIME):
|
||||
txt = RUNTIME_INSTALLER_SPEC_FILE[1:]
|
||||
txt = RUNTIME_INSTALLER_SPEC_FILE[1:]
|
||||
else:
|
||||
txt = INSTALLER_SPEC_FILE[1:]
|
||||
txt = INSTALLER_SPEC_FILE[1:]
|
||||
txt = txt.replace("VERSION",VERSION).replace("PANDASOURCE",pandasource).replace("PYTHONV",PYTHONV).replace("PV",PV)
|
||||
WriteFile("panda3d.spec", txt)
|
||||
oscmd("rpmbuild --define '_rpmdir "+pandasource+"' --root "+pandasource+" --buildroot linuxroot -bb panda3d.spec")
|
||||
oscmd("rpmbuild --define '_rpmdir "+pandasource+"' --root "+pandasource+" --buildroot targetroot -bb panda3d.spec")
|
||||
if (RUNTIME):
|
||||
oscmd("mv "+ARCH+"/panda3d-runtime-"+VERSION+"-1."+ARCH+".rpm .")
|
||||
oscmd("mv "+ARCH+"/panda3d-runtime-"+VERSION+"-1."+ARCH+".rpm .")
|
||||
else:
|
||||
oscmd("mv "+ARCH+"/panda3d-"+VERSION+"-1."+ARCH+".rpm .")
|
||||
oscmd("mv "+ARCH+"/panda3d-"+VERSION+"-1."+ARCH+".rpm .")
|
||||
oscmd("rmdir "+ARCH, True)
|
||||
|
||||
if (os.path.exists("/usr/bin/dpkg-deb")):
|
||||
oscmd("dpkg --print-architecture > "+GetOutputDir()+"/tmp/architecture.txt")
|
||||
ARCH = ReadFile(GetOutputDir()+"/tmp/architecture.txt").strip()
|
||||
if (RUNTIME):
|
||||
txt = RUNTIME_INSTALLER_DEB_FILE[1:]
|
||||
txt = RUNTIME_INSTALLER_DEB_FILE[1:]
|
||||
else:
|
||||
txt = INSTALLER_DEB_FILE[1:]
|
||||
txt = INSTALLER_DEB_FILE[1:]
|
||||
txt = txt.replace("VERSION",str(VERSION)).replace("PYTHONV",PYTHONV).replace("ARCH",ARCH).replace("PV",PV)
|
||||
oscmd("mkdir --mode=0755 -p linuxroot/DEBIAN")
|
||||
oscmd("cd linuxroot ; (find usr -type f -exec md5sum {} \;) > DEBIAN/md5sums")
|
||||
oscmd("mkdir --mode=0755 -p targetroot/DEBIAN")
|
||||
oscmd("cd targetroot ; (find usr -type f -exec md5sum {} \;) > DEBIAN/md5sums")
|
||||
if (not RUNTIME):
|
||||
oscmd("cd linuxroot ; (find etc -type f -exec md5sum {} \;) >> DEBIAN/md5sums")
|
||||
WriteFile("linuxroot/DEBIAN/conffiles","/etc/Config.prc\n")
|
||||
WriteFile("linuxroot/DEBIAN/control",txt)
|
||||
WriteFile("linuxroot/DEBIAN/postinst","#!/bin/sh\necho running ldconfig\nldconfig\n")
|
||||
oscmd("cp linuxroot/DEBIAN/postinst linuxroot/DEBIAN/postrm")
|
||||
oscmd("chmod -R 755 linuxroot/DEBIAN")
|
||||
oscmd("cd targetroot ; (find etc -type f -exec md5sum {} \;) >> DEBIAN/md5sums")
|
||||
WriteFile("targetroot/DEBIAN/conffiles","/etc/Config.prc\n")
|
||||
WriteFile("targetroot/DEBIAN/control",txt)
|
||||
WriteFile("targetroot/DEBIAN/postinst","#!/bin/sh\necho running ldconfig\nldconfig\n")
|
||||
oscmd("cp targetroot/DEBIAN/postinst targetroot/DEBIAN/postrm")
|
||||
oscmd("chmod -R 755 targetroot/DEBIAN")
|
||||
if (RUNTIME):
|
||||
oscmd("dpkg-deb -b linuxroot panda3d-runtime_"+VERSION+"_"+ARCH+".deb")
|
||||
oscmd("dpkg-deb -b targetroot panda3d-runtime_"+VERSION+"_"+ARCH+".deb")
|
||||
else:
|
||||
oscmd("dpkg-deb -b linuxroot panda3d_"+VERSION+"_"+ARCH+".deb")
|
||||
oscmd("chmod -R 755 linuxroot")
|
||||
oscmd("dpkg-deb -b targetroot panda3d_"+VERSION+"_"+ARCH+".deb")
|
||||
oscmd("chmod -R 755 targetroot")
|
||||
|
||||
if not (os.path.exists("/usr/bin/rpmbuild") or os.path.exists("/usr/bin/dpkg-deb")):
|
||||
exit("To build an installer, either rpmbuild or dpkg-deb must be present on your system!")
|
||||
|
||||
# oscmd("chmod -R 755 linuxroot")
|
||||
# oscmd("rm -rf linuxroot data.tar.gz control.tar.gz panda3d.spec "+ARCH)
|
||||
# oscmd("chmod -R 755 targetroot")
|
||||
# oscmd("rm -rf targetroot data.tar.gz control.tar.gz panda3d.spec "+ARCH)
|
||||
|
||||
def MakeInstallerOSX():
|
||||
if (RUNTIME):
|
||||
@ -5007,8 +5017,7 @@ def MakeInstallerOSX():
|
||||
for base in os.listdir(GetOutputDir()+"/lib"):
|
||||
if (not base.endswith(".a")):
|
||||
libname = "dstroot/base/Developer/Panda3D/lib/" + base
|
||||
# OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird.
|
||||
oscmd("cp -R " + GetOutputDir() + "/lib/" + base + " " + libname)
|
||||
oscmd("cp -P " + GetOutputDir() + "/lib/" + base + " " + libname)
|
||||
|
||||
# Execute install_name_tool to make them reference an absolute path
|
||||
if (libname.endswith(".dylib") and not os.path.islink(libname)):
|
||||
@ -5213,6 +5222,52 @@ function have16installed() {
|
||||
oscmd('hdiutil convert Panda3D-rw.dmg -format UDBZ -o Panda3D-%s.dmg' % VERSION)
|
||||
oscmd('rm -f Panda3D-rw.dmg')
|
||||
|
||||
def MakeInstallerFreeBSD():
|
||||
import compileall
|
||||
oscmd("rm -rf targetroot pkg-descr pkg-plist")
|
||||
oscmd("mkdir targetroot")
|
||||
|
||||
# Invoke installpanda.py to install it into a temporary dir
|
||||
if RUNTIME:
|
||||
InstallRuntime(destdir = "targetroot", prefix = "/usr/local", outputdir = GetOutputDir())
|
||||
else:
|
||||
InstallPanda(destdir = "targetroot", prefix = "/usr/local", outputdir = GetOutputDir())
|
||||
|
||||
if (not os.path.exists("/usr/sbin/pkg_create")):
|
||||
exit("Cannot create an installer without pkg_create")
|
||||
|
||||
if (RUNTIME):
|
||||
descr_txt = RUNTIME_INSTALLER_PKG_DESCR_FILE[1:]
|
||||
else:
|
||||
descr_txt = INSTALLER_PKG_DESCR_FILE[1:]
|
||||
descr_txt = descr_txt.replace("VERSION", VERSION)
|
||||
plist_txt = "@name panda3d-%s\n" % VERSION
|
||||
for root, dirs, files in os.walk("targetroot/usr/local/", True):
|
||||
for f in files:
|
||||
plist_txt += os.path.join(root, f)[21:] + "\n"
|
||||
for remdir in ("lib/panda3d", "share/panda3d", "include/panda3d"):
|
||||
for root, dirs, files in os.walk("targetroot/usr/local/" + remdir, False):
|
||||
for d in dirs:
|
||||
plist_txt += "@dirrm %s\n" % os.path.join(root, d)[21:]
|
||||
plist_txt += "@dirrm %s\n" % remdir
|
||||
WriteFile("pkg-plist", plist_txt)
|
||||
WriteFile("pkg-descr", descr_txt)
|
||||
cmd = "pkg_create"
|
||||
if GetVerbose():
|
||||
cmd += " --verbose"
|
||||
if PkgSkip("PYTHON")==0:
|
||||
# If this version of Python was installed from a package, let's mark it as dependency.
|
||||
oscmd("rm -f %s/tmp/python-pkg.txt" % GetOutputDir())
|
||||
oscmd("pkg_info -E 'python%s>=%s' > %s/tmp/python-pkg.txt" % (SDK["PYTHONVERSION"][6:9:2], SDK["PYTHONVERSION"][6:9], GetOutputDir()), True)
|
||||
if (os.path.isfile(GetOutputDir() + "/tmp/python-pkg.txt")):
|
||||
python_pkg = ReadFile(GetOutputDir() + "/tmp/python-pkg.txt").strip()
|
||||
if (python_pkg):
|
||||
cmd += " -P " + python_pkg
|
||||
cmd += " -p /usr/local -S \"%s\"" % os.path.abspath("targetroot")
|
||||
cmd += " -c -\"The Panda3D free 3D engine SDK\""
|
||||
cmd += " -d pkg-descr -f pkg-plist panda3d-%s" % VERSION
|
||||
oscmd(cmd)
|
||||
|
||||
if (INSTALLER != 0):
|
||||
ProgressOutput(100.0, "Building installer")
|
||||
if (sys.platform.startswith("win")):
|
||||
@ -5232,6 +5287,8 @@ if (INSTALLER != 0):
|
||||
MakeInstallerLinux()
|
||||
elif (sys.platform == "darwin"):
|
||||
MakeInstallerOSX()
|
||||
elif (sys.platform.startswith("freebsd")):
|
||||
MakeInstallerFreeBSD()
|
||||
else:
|
||||
exit("Do not know how to make an installer for this platform")
|
||||
|
||||
|
@ -232,6 +232,7 @@ def oscmd(cmd, ignoreError = False):
|
||||
print GetColor("red") + "Interrogate failed, retrieving debug output..." + GetColor()
|
||||
os.system(cmd.split(" ", 1)[0] + " -v " + cmd.split(" ", 1)[1])
|
||||
exit("")
|
||||
return res
|
||||
|
||||
########################################################################
|
||||
##
|
||||
@ -311,7 +312,7 @@ def LocateBinary(binary):
|
||||
p = os.defpath
|
||||
else:
|
||||
p = os.environ["PATH"]
|
||||
|
||||
|
||||
for path in p.split(os.pathsep):
|
||||
if os.access(os.path.join(path, binary), os.X_OK):
|
||||
return os.path.abspath(os.path.realpath(os.path.join(path, binary)))
|
||||
@ -389,7 +390,7 @@ def NeedsBuild(files,others):
|
||||
##
|
||||
## The following routine scans a CXX file and returns a list of
|
||||
## the include-directives inside that file. It's not recursive:
|
||||
## it just returns the includes that are textually inside the
|
||||
## it just returns the includes that are textually inside the
|
||||
## file. If you need recursive dependencies, you need the higher-level
|
||||
## routine CxxCalcDependencies, defined elsewhere.
|
||||
##
|
||||
@ -567,7 +568,7 @@ def TryRegistryKey(path):
|
||||
return key
|
||||
except: pass
|
||||
return 0
|
||||
|
||||
|
||||
def ListRegistryKeys(path):
|
||||
result=[]
|
||||
index=0
|
||||
@ -681,25 +682,41 @@ def ConditionalWriteFile(dest,desiredcontents):
|
||||
def DeleteCVS(dir):
|
||||
if dir == "": dir = "."
|
||||
for entry in os.listdir(dir):
|
||||
if (entry != ".") and (entry != ".."):
|
||||
subdir = dir + "/" + entry
|
||||
if (os.path.isdir(subdir)):
|
||||
if (entry == "CVS"):
|
||||
shutil.rmtree(subdir)
|
||||
else:
|
||||
DeleteCVS(subdir)
|
||||
elif (os.path.isfile(subdir) and (entry == ".cvsignore" or entry.startswith(".#"))):
|
||||
os.remove(subdir)
|
||||
subdir = os.path.join(dir, entry)
|
||||
if (os.path.isdir(subdir)):
|
||||
if (entry == "CVS" or entry == "CVSROOT"):
|
||||
shutil.rmtree(subdir)
|
||||
else:
|
||||
DeleteCVS(subdir)
|
||||
elif (os.path.isfile(subdir) and (entry == ".cvsignore" or entry.startswith(".#"))):
|
||||
os.remove(subdir)
|
||||
|
||||
def DeleteBuildFiles(dir):
|
||||
if dir == "": dir = "."
|
||||
for entry in os.listdir(dir):
|
||||
if (entry != ".") and (entry != ".."):
|
||||
subdir = dir + "/" + entry
|
||||
if (os.path.isfile(subdir) and os.path.splitext(subdir)[-1] in SUFFIX_INC+[".pp", ".moved"]):
|
||||
os.remove(subdir)
|
||||
elif (os.path.isdir(subdir)):
|
||||
subdir = os.path.join(dir, entry)
|
||||
if (os.path.isfile(subdir) and os.path.splitext(subdir)[-1] in SUFFIX_INC+[".pp", ".moved"]):
|
||||
os.remove(subdir)
|
||||
elif (os.path.isdir(subdir)):
|
||||
if (os.path.basename(subdir)[:3] == "Opt" and os.path.basename(subdir)[4] == "-"):
|
||||
shutil.rmtree(subdir)
|
||||
else:
|
||||
DeleteBuildFiles(subdir)
|
||||
|
||||
def DeleteEmptyDirs(dir):
|
||||
if dir == "": dir = "."
|
||||
entries = os.listdir(dir)
|
||||
if not entries:
|
||||
os.rmdir(dir)
|
||||
return
|
||||
for entry in entries:
|
||||
subdir = os.path.join(dir, entry)
|
||||
if (os.path.isdir(subdir)):
|
||||
if (not os.listdir(subdir)):
|
||||
os.rmdir(subdir)
|
||||
else:
|
||||
DeleteEmptyDirs(subdir)
|
||||
|
||||
def CreateFile(file):
|
||||
if (os.path.exists(file)==0):
|
||||
WriteFile(file,"")
|
||||
@ -1100,12 +1117,12 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
|
||||
defs = {}
|
||||
for d in olddefs:
|
||||
defs[d] = ""
|
||||
|
||||
|
||||
if (pkg.lower() == "swscale" and os.path.isfile(GetThirdpartyDir() + "ffmpeg/include/libswscale/swscale.h")):
|
||||
# Let it be handled by the ffmpeg package
|
||||
LibName(target_pkg, "-lswscale")
|
||||
return
|
||||
|
||||
|
||||
if (os.path.isdir(GetThirdpartyDir() + pkg.lower())):
|
||||
IncDirectory(target_pkg, GetThirdpartyDir() + pkg.lower() + "/include")
|
||||
LibDirectory(target_pkg, GetThirdpartyDir() + pkg.lower() + "/lib")
|
||||
@ -1157,7 +1174,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
|
||||
have_all_pkgs = False
|
||||
if (have_all_pkgs):
|
||||
return
|
||||
|
||||
|
||||
if (pkgconfig != None and (libs == None or len(libs) == 0)):
|
||||
if (pkg in PkgListGet()):
|
||||
print "%sWARNING:%s Could not locate pkg-config package %s, excluding from build" % (GetColor("red"), GetColor(), pkgconfig)
|
||||
@ -1178,7 +1195,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
|
||||
if (VERBOSE):
|
||||
print GetColor("cyan") + "Couldn't find library lib" + libname + GetColor()
|
||||
have_pkg = False
|
||||
|
||||
|
||||
for i in incs:
|
||||
incdir = None
|
||||
if (len(glob.glob("/usr/include/" + i)) > 0):
|
||||
@ -1196,11 +1213,11 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
|
||||
have_pkg = True
|
||||
if (incdir == None and VERBOSE and i.endswith(".h")):
|
||||
print GetColor("cyan") + "Couldn't find header file " + i + GetColor()
|
||||
|
||||
|
||||
# Note: It's possible to specify a file instead of a dir, for the sake of checking if it exists.
|
||||
if (incdir != None and os.path.isdir(incdir)):
|
||||
IncDirectory(target_pkg, incdir)
|
||||
|
||||
|
||||
if (not have_pkg):
|
||||
if (pkg in PkgListGet()):
|
||||
print "%sWARNING:%s Could not locate thirdparty package %s, excluding from build" % (GetColor("red"), GetColor(), pkg.lower())
|
||||
@ -1240,7 +1257,7 @@ def GetSdkDir(sdkname, sdkkey = None):
|
||||
elif (sys.platform == "darwin"):
|
||||
sdir += "/macosx"
|
||||
sdir += "/" + sdkname
|
||||
|
||||
|
||||
# If it does not exist, try the old location.
|
||||
if (sdkkey and not os.path.isdir(sdir)):
|
||||
sdir = "sdks/" + sdir
|
||||
@ -1252,7 +1269,7 @@ def GetSdkDir(sdkname, sdkkey = None):
|
||||
|
||||
if (os.path.isdir(sdir)):
|
||||
SDK[sdkkey] = sdir
|
||||
|
||||
|
||||
return sdir
|
||||
|
||||
def SdkLocateDirectX():
|
||||
@ -1261,21 +1278,21 @@ def SdkLocateDirectX():
|
||||
GetSdkDir("directx9", "DX9")
|
||||
## We first try to locate the August SDK in 64 bits, then 32.
|
||||
if ("DX9" not in SDK):
|
||||
dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")
|
||||
dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")
|
||||
if (dir != 0):
|
||||
SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
|
||||
SDK["GENERIC_DXERR_LIBRARY"] = 1;
|
||||
if ("DX9" not in SDK):
|
||||
dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")
|
||||
dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath")
|
||||
if (dir != 0):
|
||||
SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
|
||||
SDK["GENERIC_DXERR_LIBRARY"] = 1;
|
||||
if ("DX9" not in SDK):
|
||||
## Try to locate the key within the "new" March 2009 location in the registry (yecch):
|
||||
dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (March 2009)", "InstallPath")
|
||||
dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (March 2009)", "InstallPath")
|
||||
if (dir != 0):
|
||||
SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
|
||||
archStr = "x86"
|
||||
archStr = "x86"
|
||||
if (platform.architecture()[0] == "64bit"): archStr = "x64"
|
||||
if ("DX9" not in SDK) or ("DX8" not in SDK):
|
||||
uninstaller = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
|
||||
@ -1321,7 +1338,7 @@ def SdkLocateMaya():
|
||||
else:
|
||||
ddir1 = "/usr/autodesk/maya"+key
|
||||
ddir2 = "/usr/aw/maya"+key
|
||||
|
||||
|
||||
if (os.path.isdir(ddir1)): SDK[ver] = ddir1
|
||||
elif (os.path.isdir(ddir2)): SDK[ver] = ddir2
|
||||
|
||||
@ -1347,14 +1364,14 @@ def SdkLocatePython(force_use_sys_executable = False):
|
||||
SDK["PYTHON"] += "-dbg"
|
||||
if (platform.architecture()[0] == "64bit" and os.path.isdir(SDK["PYTHON"] + "-x64")):
|
||||
SDK["PYTHON"] += "-x64"
|
||||
|
||||
|
||||
SDK["PYTHONEXEC"] = SDK["PYTHON"] + "/python"
|
||||
if (GetOptimize() <= 2): SDK["PYTHONEXEC"] += "_d.exe"
|
||||
else: SDK["PYTHONEXEC"] += ".exe"
|
||||
|
||||
|
||||
if (not os.path.isfile(SDK["PYTHONEXEC"])):
|
||||
exit("Could not find %s!" % SDK["PYTHONEXEC"])
|
||||
|
||||
|
||||
os.system(SDK["PYTHONEXEC"].replace("/", "\\") + " -V > "+OUTPUTDIR+"/tmp/pythonversion 2>&1")
|
||||
pv=ReadFile(OUTPUTDIR+"/tmp/pythonversion")
|
||||
if (pv.startswith("Python ")==0):
|
||||
@ -1403,18 +1420,18 @@ def SdkLocateMSPlatform():
|
||||
if (platsdk == 0):
|
||||
platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.0A","InstallationFolder")
|
||||
if (platsdk and not os.path.isdir(platsdk)): platsdk = 0
|
||||
|
||||
|
||||
if (platsdk == 0 and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2"))):
|
||||
if (platform.architecture()[0]!="64bit" or os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2", "Lib", "AMD64"))):
|
||||
platsdk = os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2")
|
||||
if (not os.path.isdir(platsdk)): platsdk = 0
|
||||
|
||||
# Doesn't work with the Express versions, so we're checking for the "atlmfc" dir, which is not in the Express
|
||||
|
||||
# Doesn't work with the Express versions, so we're checking for the "atlmfc" dir, which is not in the Express
|
||||
if (platsdk == 0 and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Visual Studio 9\\VC\\atlmfc"))
|
||||
and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Visual Studio 9\\VC\\PlatformSDK"))):
|
||||
platsdk = os.path.join(GetProgramFiles(), "Microsoft Visual Studio 9\\VC\\PlatformSDK")
|
||||
if (not os.path.isdir(platsdk)): platsdk = 0
|
||||
|
||||
|
||||
# This may not be the best idea but it does give a warning
|
||||
if (platsdk == 0):
|
||||
if ("WindowsSdkDir" in os.environ):
|
||||
@ -1491,11 +1508,11 @@ def SdkAutoDisableMaya():
|
||||
|
||||
def SdkAutoDisableMax():
|
||||
for version,key1,key2,subdir in MAXVERSIONINFO:
|
||||
if (PkgSkip(version)==0) and ((version not in SDK) or (version+"CS" not in SDK)):
|
||||
if (PkgSkip(version)==0) and ((version not in SDK) or (version+"CS" not in SDK)):
|
||||
if (sys.platform.startswith("win")):
|
||||
if (version in SDK):
|
||||
WARNINGS.append("Your copy of "+version+" does not include the character studio SDK")
|
||||
else:
|
||||
else:
|
||||
WARNINGS.append("The registry does not appear to contain a pointer to "+version)
|
||||
WARNINGS.append("I have automatically added this command-line option: --no-"+version.lower())
|
||||
PkgDisable(version)
|
||||
@ -1508,7 +1525,7 @@ def SdkAutoDisablePhysX():
|
||||
|
||||
########################################################################
|
||||
##
|
||||
## Visual Studio comes with a script called VSVARS32.BAT, which
|
||||
## Visual Studio comes with a script called VSVARS32.BAT, which
|
||||
## you need to run before using visual studio command-line tools.
|
||||
## The following python subroutine serves the same purpose.
|
||||
##
|
||||
@ -1607,13 +1624,13 @@ def CheckLinkerLibraryPath():
|
||||
for line in f: ldpath.append(line.rstrip())
|
||||
f.close()
|
||||
except: ldpath = []
|
||||
|
||||
# Get the current
|
||||
|
||||
# Get the current
|
||||
if ("LD_LIBRARY_PATH" in os.environ):
|
||||
ldpath = ldpath + os.environ["LD_LIBRARY_PATH"].split(":")
|
||||
if (sys.platform == "darwin" and "DYLD_LIBRARY_PATH" in os.environ):
|
||||
dyldpath = os.environ["DYLD_LIBRARY_PATH"].split(":")
|
||||
|
||||
|
||||
# Remove any potential current Panda installation lib dirs
|
||||
for i in ldpath:
|
||||
if i.startswith("/usr/lib/panda"): ldpath.remove(i)
|
||||
@ -1622,7 +1639,7 @@ def CheckLinkerLibraryPath():
|
||||
for i in dyldpath:
|
||||
if i.startswith("/Applications/Panda3D"): dyldpath.remove(i)
|
||||
if i.startswith("/Developer/Panda3D"): dyldpath.remove(i)
|
||||
|
||||
|
||||
# Add built/lib/ to (DY)LD_LIBRARY_PATH if it's not already there
|
||||
if (ldpath.count(builtlib)==0):
|
||||
if ("LD_LIBRARY_PATH" in os.environ):
|
||||
@ -1634,7 +1651,7 @@ def CheckLinkerLibraryPath():
|
||||
os.environ["DYLD_LIBRARY_PATH"] = builtlib + ":" + os.environ["DYLD_LIBRARY_PATH"]
|
||||
else:
|
||||
os.environ["DYLD_LIBRARY_PATH"] = builtlib
|
||||
|
||||
|
||||
# Workaround around compile issue on PCBSD
|
||||
if (os.path.exists("/usr/PCBSD")):
|
||||
os.environ["LD_LIBRARY_PATH"] += ":/usr/PCBSD/local/lib"
|
||||
@ -1757,17 +1774,17 @@ def GenerateResourceFile(**kwargs):
|
||||
kwargs["dotversion"] += ".0"
|
||||
if "commaversion" not in kwargs:
|
||||
kwargs["commaversion"] = kwargs["dotversion"].replace(".", ",")
|
||||
|
||||
|
||||
rcdata = ""
|
||||
if not "noinclude" in kwargs:
|
||||
rcdata += "#define APSTUDIO_READONLY_SYMBOLS\n"
|
||||
rcdata += "#include \"winresrc.h\"\n"
|
||||
rcdata += "#undef APSTUDIO_READONLY_SYMBOLS\n"
|
||||
rcdata += RESOURCE_FILE_TEMPLATE % kwargs
|
||||
|
||||
|
||||
if "icon" in kwargs:
|
||||
rcdata += "\nICON_FILE ICON \"%s\"\n" % kwargs["icon"]
|
||||
|
||||
|
||||
return rcdata
|
||||
|
||||
|
||||
@ -1889,9 +1906,9 @@ def FindLocation(fn, ipath):
|
||||
## this, it needs an include-file search path. So if you supply
|
||||
## any C++ input, you also need to supply compiler options containing
|
||||
## include-directories, or alternately, a separate ipath parameter.
|
||||
##
|
||||
##
|
||||
## The main body of 'makepanda' is a long list of TargetAdd
|
||||
## directives building up a giant list of make targets. Then,
|
||||
## directives building up a giant list of make targets. Then,
|
||||
## finally, the targets are run and panda is built.
|
||||
##
|
||||
## Makepanda's dependency system does not understand multiple
|
||||
|
Loading…
x
Reference in New Issue
Block a user