--- /home/chris/panda3d-1.0.4/makepanda/makepanda.py 2005-05-15 03:17:57.000000000 +0900 +++ makepanda/makepanda.py 2005-06-24 14:03:21.000000000 +0900 @@ -179,6 +179,7 @@ if (sys.platform == "win32"): COMPILERS=["MSVC7"] if (sys.platform == "linux2"): COMPILERS=["LINUXA"] PREFIX="built" +LIBDIR="lib" COMPILER=COMPILERS[0] OPTIMIZE="3" INSTALLER=0 @@ -452,6 +453,7 @@ print " --help (print the help message you're reading now)" print " --package-info (help info about the optional packages)" print " --prefix X (install into prefix dir, default \"built\")" + print " --libdir X (install libs into libdir, default \"lib\")" print " --compiler X (currently, compiler can only be MSVC7,LINUXA)" print " --optimize X (optimization level can be 1,2,3,4)" print " --thirdparty X (directory containing third-party software)" @@ -482,7 +484,7 @@ global PREFIX,COMPILER,OPTIMIZE,OMIT,THIRDPARTY,INSTALLER,GENMAN global PPGAME,COPYEXTRAS,VERSION,COMPRESSOR,DIRECTXSDK,VERBOSE longopts = [ - "help","package-info","prefix=","compiler=","directx-sdk=","thirdparty=", + "help","package-info","prefix=","libdir=","compiler=","directx-sdk=","thirdparty=", "optimize=","everything","nothing","installer","ppgame=","quiet","verbose", "version=","lzma"] anything = 0 @@ -494,6 +496,7 @@ if (option=="--help"): raise "usage" elif (option=="--package-info"): raise "package-info" elif (option=="--prefix"): PREFIX=value + elif (option=="--libdir"): LIBDIR=value elif (option=="--compiler"): COMPILER=value elif (option=="--directx-sdk"): DIRECTXSDK=value elif (option=="--thirdparty"): THIRDPARTY=value @@ -522,7 +525,8 @@ except "package-info": packageInfo() except: usage(0) if (anything==0): usage(0) - if (OPTIMIZE=="1"): OPTIMIZE=1 + if (OPTIMIZE=="0"): OPTIMIZE=0 + elif (OPTIMIZE=="1"): OPTIMIZE=1 elif (OPTIMIZE=="2"): OPTIMIZE=2 elif (OPTIMIZE=="3"): OPTIMIZE=3 elif (OPTIMIZE=="4"): OPTIMIZE=4 @@ -784,7 +788,7 @@ ########################################################################################## if (sys.platform != "win32"): - BUILTLIB = os.path.abspath(PREFIX+"/lib") + BUILTLIB = os.path.abspath(PREFIX+"/"+LIBDIR) try: LDPATH = [] f = file("/etc/ld.so.conf","r") @@ -794,7 +798,7 @@ if (os.environ.has_key("LD_LIBRARY_PATH")): LDPATH = LDPATH + os.environ["LD_LIBRARY_PATH"].split(":") if (LDPATH.count(BUILTLIB)==0): - WARNINGS.append("Caution: the "+PREFIX+"/lib directory is not in LD_LIBRARY_PATH") + WARNINGS.append("Caution: the "+PREFIX+"/"+LIBDIR+" directory is not in LD_LIBRARY_PATH") WARNINGS.append("or /etc/ld.so.conf. You must add it before using panda.") if (os.environ.has_key("LD_LIBRARY_PATH")): os.environ["LD_LIBRARY_PATH"] = BUILTLIB + ":" + os.environ["LD_LIBRARY_PATH"] @@ -819,6 +823,7 @@ if (OMIT.count(x)==0): tkeep = tkeep + x + " " else: tomit = tomit + x + " " print "Makepanda: Prefix Directory:",PREFIX + print "Makepanda: Lib Directory:",PREFIX+"/"+LIBDIR print "Makepanda: Compiler:",COMPILER print "Makepanda: Optimize:",OPTIMIZE print "Makepanda: Keep Pkg:",tkeep @@ -850,7 +855,10 @@ MakeDirectory(PREFIX) MakeDirectory(PREFIX+"/bin") -MakeDirectory(PREFIX+"/lib") +if (sys.platform == "win32"): + MakeDirectory(PREFIX+"/lib") +else: + MakeDirectory(PREFIX+"/"+LIBDIR) MakeDirectory(PREFIX+"/etc") MakeDirectory(PREFIX+"/plugins") MakeDirectory(PREFIX+"/pandac") @@ -1205,17 +1213,26 @@ if (older(wobj, dep)): if VERBOSE >= 0: checkIfNewDir(ipath[1]) - if (src[-2:]==".c"): cmd = 'gcc -c -o ' + wobj - else: cmd = 'g++ -ftemplate-depth-30 -c -o ' + wobj + if (src[-2:]==".c"): + if os.environ.has_key("CFLAGS"): + cmd = 'gcc ' + os.environ["CFLAGS"] + ' -c -o ' + wobj + else: + cmd = 'gcc -c -o ' + wobj + else: + if os.environ.has_key("CXXFLAGS"): + cmd = 'g++ ' + os.environ["CXXFLAGS"] + ' -c -o ' + wobj + else: + cmd = 'g++ -ftemplate-depth-30 -c -o ' + wobj cmd = cmd + ' -I"' + PythonSDK + '"' if (PkgSelected(opts,"VRPN")): cmd = cmd + ' -I' + THIRDPARTY + '/linux-libs-a/vrpn/include' if (PkgSelected(opts,"FFTW")): cmd = cmd + ' -I' + THIRDPARTY + '/linux-libs-a/fftw/include' - if (PkgSelected(opts,"FMOD")): cmd = cmd + ' -I' + THIRDPARTY + '/linux-libs-a/fmod/include' + if (PkgSelected(opts,"FMOD")): pass if (PkgSelected(opts,"NVIDIACG")): cmd = cmd + ' -I' + THIRDPARTY + '/linux-libs-a/nvidiacg/include' - if (PkgSelected(opts,"NSPR")): cmd = cmd + ' -I' + THIRDPARTY + '/linux-libs-a/nspr/include' + if (PkgSelected(opts,"NSPR")): cmd = cmd + ' -I/usr/include/nspr' if (PkgSelected(opts,"FREETYPE")): cmd = cmd + ' -I/usr/include/freetype2' for x in ipath: cmd = cmd + ' -I' + x if (opts.count("WITHINPANDA")): cmd = cmd + ' -DWITHIN_PANDA' + if (OPTIMIZE==0): pass if (OPTIMIZE==1): cmd = cmd + " -g" if (OPTIMIZE==2): cmd = cmd + " -O1" if (OPTIMIZE==3): cmd = cmd + " -O2" @@ -1366,7 +1383,7 @@ if (COMPILER=="LINUXA"): if (lib[-4:]==".ilb"): wlib = PREFIX+"/tmp/" + lib[:-4] + ".a" - else: wlib = PREFIX+"/lib/" + lib[:-4] + ".a" + else: wlib = PREFIX+"/"+ LIBDIR + "/" + lib[:-4] + ".a" wobj = [] for x in obj: wobj.append(PREFIX + "/tmp/" + x[:-4] + ".o") if (older(wlib, wobj)): @@ -1488,15 +1505,15 @@ CopyFile(dll[:-4]+"_d.dll", dll) if (COMPILER=="LINUXA"): - ALLTARGETS.append(PREFIX+"/lib/"+dll[:-4]+".so") + ALLTARGETS.append(PREFIX+"/"+LIBDIR+dll[:-4]+".so") if (dll[-4:]==".exe"): wdll = PREFIX+"/bin/"+dll[:-4] - else: wdll = PREFIX+"/lib/"+dll[:-4]+".so" + else: wdll = PREFIX+"/"+LIBDIR+"/"+dll[:-4]+".so" wobj = [] for x in obj: suffix = x[-4:] if (suffix==".obj"): wobj.append(PREFIX+"/tmp/"+x[:-4]+".o") - elif (suffix==".dll"): wobj.append(PREFIX+"/lib/"+x[:-4]+".so") - elif (suffix==".lib"): wobj.append(PREFIX+"/lib/"+x[:-4]+".a") + elif (suffix==".dll"): wobj.append(PREFIX+"/"+LIBDIR+"/"+x[:-4]+".so") + elif (suffix==".lib"): wobj.append(PREFIX+"/"+LIBDIR+"/"+x[:-4]+".a") elif (suffix==".ilb"): wobj.append(PREFIX+"/tmp/"+x[:-4]+".a") else: sys.exit("unknown suffix in object list.") if (older(wdll, wobj+xdep)): @@ -1506,14 +1523,14 @@ suffix = x[-4:] if (suffix==".obj"): cmd = cmd + ' ' + PREFIX + '/tmp/' + x[:-4] + '.o' elif (suffix==".dll"): cmd = cmd + ' -l' + x[3:-4] - elif (suffix==".lib"): cmd = cmd + ' ' + PREFIX + '/lib/' + x[:-4] + '.a' + elif (suffix==".lib"): cmd = cmd + ' ' + PREFIX + '/'+ LIBDIR + "/" + x[:-4] + '.a' elif (suffix==".ilb"): cmd = cmd + ' ' + PREFIX + '/tmp/' + x[:-4] + '.a' - if (PkgSelected(opts,"FMOD")): cmd = cmd + ' -L' + THIRDPARTY + '/linux-libs-a/fmod/lib -lfmod-3.74' + if (PkgSelected(opts,"FMOD")): cmd = cmd + ' -lfmod' if (PkgSelected(opts,"NVIDIACG")): cmd = cmd + ' -L' + THIRDPARTY + 'nvidiacg/lib ' if (opts.count("CGGL")): cmd = cmd + " -lCgGL" cmd = cmd + " -lCg" - if (PkgSelected(opts,"NSPR")): cmd = cmd + ' -L' + THIRDPARTY + '/linux-libs-a/nspr/lib -lpandanspr4' + if (PkgSelected(opts,"NSPR")): cmd = cmd + ' -L/usr/' + LIBDIR + '/nspr -lnspr4' if (PkgSelected(opts,"ZLIB")): cmd = cmd + " -lz" if (PkgSelected(opts,"PNG")): cmd = cmd + " -lpng" if (PkgSelected(opts,"JPEG")): cmd = cmd + " -ljpeg" @@ -1891,7 +1908,7 @@ CopyAllFiles(PREFIX+"/bin/",THIRDPARTY+"/win-libs-vc7/"+pkg.lower()+"/bin/") if (COMPILER == "LINUXA"): if (os.path.exists(THIRDPARTY+"/linux-libs-a/"+pkg.lower()+"/lib")): - CopyAllFiles(PREFIX+"/lib/",THIRDPARTY+"/linux-libs-a/"+pkg.lower()+"/lib/") + CopyAllFiles(PREFIX+"/"+LIBDIR,THIRDPARTY+"/linux-libs-a/"+pkg.lower()+"/"+LIBDIR) if (sys.platform == "win32"): CopyTree(PREFIX+'/python', 'thirdparty/win-python')