3 # Copyright (c) 2015 Ryan Prichard
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to
7 # deal in the Software without restriction, including without limitation the
8 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 # sell copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 # Run with native CPython 2.7 on a 64-bit computer.
26 # Each of the targets in BUILD_TARGETS must be installed to the default
27 # location. Each target must have the appropriate MinGW and non-MinGW
28 # compilers installed, as well as make and tar.
33 import multiprocessing
39 os.chdir(common_ship.topDir)
42 version = subprocess.check_output(
44 "[System.Diagnostics.FileVersionInfo]::GetVersionInfo(\"" + path + "\").FileVersion"])
45 return version.strip()
47 # Determine other build parameters.
48 print "Determining Cygwin/MSYS2 DLL versions..."
53 # "path": "C:\\MinGW\\bin;C:\\MinGW\\msys\\1.0\\bin",
54 # # The parallel make.exe in the original MSYS/MinGW project hangs.
55 # "make_binary": "mingw32-make.exe",
58 "name": "msys2-" + dllVersion("C:\\msys32\\usr\\bin\\msys-2.0.dll") + "-ia32",
59 "path": "C:\\msys32\\mingw32\\bin;C:\\msys32\\usr\\bin",
62 "name": "msys2-" + dllVersion("C:\\msys64\\usr\\bin\\msys-2.0.dll") + "-x64",
63 "path": "C:\\msys64\\mingw64\\bin;C:\\msys64\\usr\\bin",
66 "name": "cygwin-" + dllVersion("C:\\cygwin\\bin\\cygwin1.dll") + "-ia32",
67 "path": "C:\\cygwin\\bin",
70 "name": "cygwin-" + dllVersion("C:\\cygwin64\\bin\\cygwin1.dll") + "-x64",
71 "path": "C:\\cygwin64\\bin",
75 def buildTarget(target):
76 packageName = "winpty-" + common_ship.winptyVersion + "-" + target["name"]
77 if os.path.exists("ship\\packages\\" + packageName):
78 shutil.rmtree("ship\\packages\\" + packageName)
79 oldPath = os.environ["PATH"]
80 os.environ["PATH"] = target["path"] + ";" + common_ship.defaultPathEnviron
81 subprocess.check_call(["sh.exe", "configure"])
82 makeBinary = target.get("make_binary", "make.exe")
83 subprocess.check_call([makeBinary, "clean"])
87 "COMMIT_HASH=" + common_ship.commitHash,
88 "PREFIX=ship/packages/" + packageName
90 subprocess.check_call(makeBaseCmd + ["all", "tests", "-j%d" % multiprocessing.cpu_count()])
91 subprocess.check_call(["build\\trivial_test.exe"])
92 subprocess.check_call(makeBaseCmd + ["install"])
93 subprocess.check_call(["tar.exe", "cvfz",
94 packageName + ".tar.gz",
95 packageName], cwd=os.path.join(os.getcwd(), "ship", "packages"))
96 os.environ["PATH"] = oldPath
99 oldPath = os.environ["PATH"]
100 for t in BUILD_TARGETS:
101 os.environ["PATH"] = t["path"] + ";" + common_ship.defaultPathEnviron
102 subprocess.check_output(["tar.exe", "--help"])
103 subprocess.check_output(["make.exe", "--help"])
104 for t in BUILD_TARGETS:
107 if __name__ == "__main__":