--- makepanda/makepanda.py.old 2005-10-04 13:55:15.000000000 +0900 +++ makepanda/makepanda.py 2005-10-04 14:07:34.000000000 +0900 @@ -192,6 +192,7 @@ if (sys.platform == "win32"): COMPILERS=["MSVC7"] if (sys.platform == "linux2"): COMPILERS=["LINUXA"] PREFIX="built" +LIBDIR="lib" COMPILER=COMPILERS[0] OPTIMIZE="3" INSTALLER=0 @@ -473,6 +474,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)" @@ -500,10 +502,10 @@ sys.exit(1) def parseopts(args): - global PREFIX,COMPILER,OPTIMIZE,OMIT,THIRDPARTY,INSTALLER,GENMAN + global PREFIX,LIBDIR,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","no-python"] anything = 0 @@ -515,6 +517,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 @@ -543,7 +546,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 @@ -839,7 +843,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") @@ -849,7 +853,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"] @@ -874,6 +878,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 @@ -905,6 +910,10 @@ MakeDirectory(PREFIX) MakeDirectory(PREFIX+"/bin") +if (sys.platform == "win32"): + MakeDirectory(PREFIX+"/lib") +else: + MakeDirectory(PREFIX+"/"+LIBDIR) MakeDirectory(PREFIX+"/lib") MakeDirectory(PREFIX+"/etc") MakeDirectory(PREFIX+"/plugins") @@ -1260,17 +1269,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 if (OMIT.count("PYTHON")==0): 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" @@ -1390,7 +1408,7 @@ if (COMPILER=="MSVC7"): if (lib[-4:]==".ilb"): wlib = PREFIX+"/tmp/" + lib[:-4] + ".lib" - else: wlib = PREFIX+"/lib/" + lib[:-4] + ".lib" + else: wlib = PREFIX+"/"+LIBDIR+"/" + lib[:-4] + ".lib" wobj = xpaths(PREFIX+"/tmp/",obj,"") ALLTARGETS.append(wlib) if (older(wlib, wobj)): @@ -1523,14 +1541,14 @@ if (COMPILER=="LINUXA"): if (dll[-4:]==".exe"): wdll = PREFIX+"/bin/"+dll[:-4] - else: wdll = PREFIX+"/lib/"+dll[:-4]+".so" + else: wdll = PREFIX+"/"+LIBDIR+"/"+dll[:-4]+".so" ALLTARGETS.append(wdll) 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==".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)): @@ -1540,14 +1558,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" @@ -1918,7 +1936,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"): CopyFile(PREFIX+'/bin/', 'thirdparty/win-python/python22.dll')