win32/build.py: build zlib in-tree

zlib cannot be built out-of-tree, and previously, we were building in
the "src" directory, not in the "build" directory.  The
make_build_path() return value was unused.
This commit is contained in:
Max Kellermann 2015-06-03 07:35:25 +02:00
parent d6eb74262a
commit 6837a67234
1 changed files with 10 additions and 8 deletions

View File

@ -121,16 +121,20 @@ class Project:
except FileNotFoundError: except FileNotFoundError:
return False return False
def unpack(self): def unpack(self, out_of_tree=True):
global src_path global src_path, build_path
tarball = self.download() tarball = self.download()
path = os.path.join(src_path, self.base) if out_of_tree:
parent_path = src_path
else:
parent_path = build_path
path = os.path.join(parent_path, self.base)
try: try:
shutil.rmtree(path) shutil.rmtree(path)
except FileNotFoundError: except FileNotFoundError:
pass pass
os.makedirs(src_path, exist_ok=True) os.makedirs(parent_path, exist_ok=True)
subprocess.check_call(['/bin/tar', 'xfC', tarball, src_path]) subprocess.check_call(['/bin/tar', 'xfC', tarball, parent_path])
return path return path
def make_build_path(self): def make_build_path(self):
@ -189,9 +193,7 @@ class ZlibProject(Project):
Project.__init__(self, url, md5, installed, **kwargs) Project.__init__(self, url, md5, installed, **kwargs)
def build(self): def build(self):
src = self.unpack() src = self.unpack(out_of_tree=False)
build = self.make_build_path()
select_toolchain() select_toolchain()
subprocess.check_call(['/usr/bin/make', '--quiet', subprocess.check_call(['/usr/bin/make', '--quiet',