made build script python3 copatible
This commit is contained in:
39
build.py
39
build.py
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python2.7
|
||||
#!/usr/bin/python
|
||||
import os, sys, shutil, re, textwrap
|
||||
|
||||
COMPILER = "i586-pc-msdosdjgpp-gcc"
|
||||
@@ -8,10 +8,10 @@ BIN_NAME = "love.exe"
|
||||
EMBED_DIR = "src/embed"
|
||||
TEMPSRC_DIR = ".tempsrc"
|
||||
|
||||
CFLAGS = [ "-O2", "-Wall", "-s", "-Wno-misleading-indentation" ]
|
||||
DLIBS = [ "m" ]
|
||||
DEFINES = [ "DMT_ABORT_NULL", "LUA_COMPAT_ALL" ]
|
||||
INCLUDES = [ "src", TEMPSRC_DIR ]
|
||||
CFLAGS = ["-O2", "-Wall", "-s", "-Wno-misleading-indentation"]
|
||||
DLIBS = ["m"]
|
||||
DEFINES = ["DMT_ABORT_NULL", "LUA_COMPAT_ALL"]
|
||||
INCLUDES = ["src", TEMPSRC_DIR]
|
||||
|
||||
|
||||
def fmt(fmt, var):
|
||||
@@ -49,30 +49,31 @@ def main():
|
||||
name, text = make_c_include(name, open(filename).read())
|
||||
open("%s/%s.h" % (TEMPSRC_DIR, name), "wb").write(text)
|
||||
|
||||
cfiles = filter(lambda x:x.endswith((".c", ".C")), listdir(SRC_DIR))
|
||||
cfiles = filter(lambda x: x.endswith((".c", ".C")), listdir(SRC_DIR))
|
||||
|
||||
cmd = fmt(
|
||||
"{compiler} {flags} {defines} {includes} -o {outfile} {srcfiles} {libs} {argv}",
|
||||
{
|
||||
"compiler" : COMPILER,
|
||||
"flags" : " ".join(CFLAGS),
|
||||
"defines" : " ".join(map(lambda x: "-D " + x, DEFINES)),
|
||||
"includes" : " ".join(map(lambda x: "-I " + x, INCLUDES)),
|
||||
"outfile" : BIN_DIR + "/" + BIN_NAME,
|
||||
"srcfiles" : " ".join(cfiles),
|
||||
"libs" : " ".join(map(lambda x: "-l" + x, DLIBS)),
|
||||
"argv" : " ".join(sys.argv[1:])
|
||||
})
|
||||
"compiler": COMPILER,
|
||||
"flags": " ".join(CFLAGS),
|
||||
"defines": " ".join(map(lambda x: "-D " + x, DEFINES)),
|
||||
"includes": " ".join(map(lambda x: "-I " + x, INCLUDES)),
|
||||
"outfile": BIN_DIR + "/" + BIN_NAME,
|
||||
"srcfiles": " ".join(cfiles),
|
||||
"libs": " ".join(map(lambda x: "-l" + x, DLIBS)),
|
||||
"argv": " ".join(sys.argv[1:]),
|
||||
},
|
||||
)
|
||||
|
||||
print "compiling..."
|
||||
print("compiling...")
|
||||
print(" {}".format(cmd))
|
||||
res = os.system(cmd)
|
||||
|
||||
print "deleting temporary files..."
|
||||
print("deleting temporary files...")
|
||||
if os.path.exists(TEMPSRC_DIR):
|
||||
shutil.rmtree(TEMPSRC_DIR)
|
||||
|
||||
print "done" + (" with errors" if res else "")
|
||||
|
||||
print("done" + (" with errors" if res else ""))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user