mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
Add installpanda.py
This commit is contained in:
parent
20a1a06a7c
commit
d89770e23e
76
makepanda/installpanda.py
Normal file
76
makepanda/installpanda.py
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
########################################################################
|
||||||
|
#
|
||||||
|
# Caution: there are two separate, independent build systems:
|
||||||
|
# 'makepanda', and 'ppremake'. Use one or the other, do not attempt
|
||||||
|
# to use both. This file is part of the 'makepanda' system.
|
||||||
|
#
|
||||||
|
# To install panda using this script, type 'installpanda.py'.
|
||||||
|
# To specify an alternate location than the filesystem root /,
|
||||||
|
# set the DESTDIR environment variable.
|
||||||
|
# This script only functions on Linux, for now.
|
||||||
|
#
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
import os, sys, platform, compileall
|
||||||
|
from makepandacore import *
|
||||||
|
|
||||||
|
if (platform.architecture()[0] == "64bit"):
|
||||||
|
libdir = "/lib64"
|
||||||
|
else:
|
||||||
|
libdir = "/lib"
|
||||||
|
|
||||||
|
def InstallPanda(destdir="", prefix="/usr", outputdir="built"):
|
||||||
|
if (not prefix.startswith("/")): prefix = "/" + prefix
|
||||||
|
#FIXME: this might not be the correct python version
|
||||||
|
PYTHONV="python"+sys.version[:3]
|
||||||
|
oscmd("mkdir -p "+destdir+prefix+"/bin")
|
||||||
|
oscmd("mkdir -p "+destdir+prefix+"/include")
|
||||||
|
oscmd("mkdir -p "+destdir+prefix+"/share/panda3d")
|
||||||
|
oscmd("mkdir -p "+destdir+prefix+"/share/panda3d/direct")
|
||||||
|
oscmd("mkdir -p "+destdir+prefix+libdir+"/panda3d")
|
||||||
|
oscmd("mkdir -p "+destdir+prefix+libdir+"/"+PYTHONV+"/lib-dynload")
|
||||||
|
oscmd("mkdir -p "+destdir+prefix+libdir+"/"+PYTHONV+"/site-packages")
|
||||||
|
oscmd("mkdir -p "+destdir+"/etc/ld.so.conf.d")
|
||||||
|
WriteFile(destdir+prefix+"/share/panda3d/direct/__init__.py", "")
|
||||||
|
oscmd("sed -e 's@model-cache-@# model-cache-@' -e 's@$THIS_PRC_DIR/[.][.]@"+prefix+"/share/panda3d@' < "+outputdir+"/etc/Config.prc > "+destdir+"/etc/Config.prc")
|
||||||
|
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")
|
||||||
|
oscmd("cp -R "+outputdir+"/models "+destdir+prefix+"/share/panda3d/models")
|
||||||
|
if os.path.isdir("samples"): oscmd("cp -R samples "+destdir+prefix+"/share/panda3d/samples")
|
||||||
|
if os.path.isdir(outputdir+"/Pmw"): oscmd("cp -R "+outputdir+"/Pmw "+destdir+prefix+"/share/panda3d/Pmw")
|
||||||
|
if os.path.isdir(outputdir+"/plugins"): oscmd("cp -R "+outputdir+"/plugins "+destdir+prefix+"/share/panda3d/plugins")
|
||||||
|
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+prefix+libdir+"/"+PYTHONV+"/site-packages/panda3d.pth")
|
||||||
|
oscmd("echo '"+prefix+libdir+"/panda3d'>> "+destdir+prefix+libdir+"/"+PYTHONV+"/site-packages/panda3d.pth")
|
||||||
|
oscmd("cp "+outputdir+"/bin/* "+destdir+prefix+"/bin/")
|
||||||
|
for base in os.listdir(outputdir+"/lib"):
|
||||||
|
oscmd("cp "+outputdir+"/lib/"+base+" "+destdir+prefix+libdir+"/panda3d/"+base)
|
||||||
|
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)
|
||||||
|
|
||||||
|
if (__name__ == "__main__"):
|
||||||
|
if (sys.platform != "linux2"):
|
||||||
|
exit("This script only works on linux at the moment!")
|
||||||
|
destdir = ""
|
||||||
|
if (os.environ.has_key("DESTDIR")):
|
||||||
|
print "Reading out DESTDIR"
|
||||||
|
destdir = os.environ["DESTDIR"]
|
||||||
|
if (destdir.endswith("/")):
|
||||||
|
destdir = destdir[:-1]
|
||||||
|
if (destdir != "" and not os.path.isdir(destdir)):
|
||||||
|
exit("Directory '%s' does not exist!" % destdir)
|
||||||
|
print "Installing Panda3D into " + destdir
|
||||||
|
else:
|
||||||
|
print "Installing Panda3D into /"
|
||||||
|
InstallPanda(destdir)
|
||||||
|
print "Install done!"
|
||||||
|
|
@ -15,6 +15,7 @@
|
|||||||
import sys,os,platform,time,stat,string,re,getopt,cPickle,fnmatch,threading,Queue,signal,shutil
|
import sys,os,platform,time,stat,string,re,getopt,cPickle,fnmatch,threading,Queue,signal,shutil
|
||||||
|
|
||||||
from makepandacore import *
|
from makepandacore import *
|
||||||
|
from installpanda import *
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
##
|
##
|
||||||
@ -3655,7 +3656,6 @@ The Panda3D engine.
|
|||||||
/usr/include/panda3d
|
/usr/include/panda3d
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def MakeInstallerLinux():
|
def MakeInstallerLinux():
|
||||||
import compileall
|
import compileall
|
||||||
PYTHONV=SDK["PYTHONVERSION"]
|
PYTHONV=SDK["PYTHONVERSION"]
|
||||||
@ -3666,38 +3666,10 @@ def MakeInstallerLinux():
|
|||||||
oscmd("rm -rf `rpm -E '%_target_cpu'`")
|
oscmd("rm -rf `rpm -E '%_target_cpu'`")
|
||||||
if (os.path.exists("/usr/bin/dpkg-deb")):
|
if (os.path.exists("/usr/bin/dpkg-deb")):
|
||||||
oscmd("rm -rf `dpkg --print-architecture`")
|
oscmd("rm -rf `dpkg --print-architecture`")
|
||||||
oscmd("mkdir -p linuxroot/usr/bin")
|
oscmd("mkdir linuxroot")
|
||||||
oscmd("mkdir -p linuxroot/usr/include")
|
|
||||||
oscmd("mkdir -p linuxroot/usr/share/panda3d")
|
# Invoke installpanda.py to install it into a temporary dir
|
||||||
oscmd("mkdir -p linuxroot/usr/share/panda3d/direct")
|
InstallPanda(destdir = "linuxroot", outputdir = GetOutputDir())
|
||||||
oscmd("mkdir -p linuxroot/usr/lib/panda3d")
|
|
||||||
oscmd("mkdir -p linuxroot/usr/lib/"+PYTHONV+"/lib-dynload")
|
|
||||||
oscmd("mkdir -p linuxroot/usr/lib/"+PYTHONV+"/site-packages")
|
|
||||||
oscmd("mkdir -p linuxroot/etc/ld.so.conf.d")
|
|
||||||
WriteFile("linuxroot/usr/share/panda3d/direct/__init__.py", "")
|
|
||||||
oscmd("sed -e 's@model-cache-@# model-cache-@' -e 's@$THIS_PRC_DIR/[.][.]@/usr/share/panda3d@' < "+GetOutputDir()+"/etc/Config.prc > linuxroot/etc/Config.prc")
|
|
||||||
oscmd("cp "+GetOutputDir()+"/etc/Confauto.prc linuxroot/etc/Confauto.prc")
|
|
||||||
oscmd("cp --recursive "+GetOutputDir()+"/include linuxroot/usr/include/panda3d")
|
|
||||||
oscmd("cp --recursive direct/src/* linuxroot/usr/share/panda3d/direct")
|
|
||||||
oscmd("cp --recursive "+GetOutputDir()+"/pandac linuxroot/usr/share/panda3d/pandac")
|
|
||||||
oscmd("cp --recursive "+GetOutputDir()+"/models linuxroot/usr/share/panda3d/models")
|
|
||||||
if os.path.isdir("samples"): oscmd("cp --recursive samples linuxroot/usr/share/panda3d/samples")
|
|
||||||
if os.path.isdir(GetOutputDir()+"/Pmw"): oscmd("cp --recursive "+GetOutputDir()+"/Pmw linuxroot/usr/share/panda3d/Pmw")
|
|
||||||
if os.path.isdir(GetOutputDir()+"/plugins"): oscmd("cp --recursive "+GetOutputDir()+"/plugins linuxroot/usr/share/panda3d/plugins")
|
|
||||||
oscmd("cp doc/LICENSE linuxroot/usr/share/panda3d/LICENSE")
|
|
||||||
oscmd("cp doc/LICENSE linuxroot/usr/include/panda3d/LICENSE")
|
|
||||||
oscmd("cp doc/ReleaseNotes linuxroot/usr/share/panda3d/ReleaseNotes")
|
|
||||||
oscmd("echo '/usr/lib/panda3d' > linuxroot/etc/ld.so.conf.d/panda3d.conf")
|
|
||||||
oscmd("echo '/usr/share/panda3d' > linuxroot/usr/lib/"+PYTHONV+"/site-packages/panda3d.pth")
|
|
||||||
oscmd("echo '/usr/lib/panda3d' >> linuxroot/usr/lib/"+PYTHONV+"/site-packages/panda3d.pth")
|
|
||||||
oscmd("cp "+GetOutputDir()+"/bin/* linuxroot/usr/bin/")
|
|
||||||
for base in os.listdir(GetOutputDir()+"/lib"):
|
|
||||||
oscmd("cp "+GetOutputDir()+"/lib/"+base+" linuxroot/usr/lib/panda3d/"+base)
|
|
||||||
for base in os.listdir("linuxroot/usr/share/panda3d/direct"):
|
|
||||||
if ((base != "extensions") and (base != "extensions_native")):
|
|
||||||
compileall.compile_dir("linuxroot/usr/share/panda3d/direct/"+base)
|
|
||||||
compileall.compile_dir("linuxroot/usr/share/panda3d/Pmw")
|
|
||||||
DeleteCVS("linuxroot")
|
|
||||||
oscmd("chmod -R 555 linuxroot/usr/share/panda3d")
|
oscmd("chmod -R 555 linuxroot/usr/share/panda3d")
|
||||||
|
|
||||||
if (os.path.exists("/usr/bin/rpmbuild") and not os.path.exists("/usr/bin/dpkg-deb")):
|
if (os.path.exists("/usr/bin/rpmbuild") and not os.path.exists("/usr/bin/dpkg-deb")):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user