From e70f7141be86ba97a034224e6357154ff8a7b8e5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 21 Nov 2015 00:05:48 +0100 Subject: [PATCH] {android,win32}/build.py: move class AutotoolsProject to build/autotools.py --- android/build.py | 41 +---------------------------------- python/build/autotools.py | 45 +++++++++++++++++++++++++++++++++++++++ win32/build.py | 43 +------------------------------------ 3 files changed, 47 insertions(+), 82 deletions(-) create mode 100644 python/build/autotools.py diff --git a/android/build.py b/android/build.py index 5cfbfa190..6e90f845a 100755 --- a/android/build.py +++ b/android/build.py @@ -111,46 +111,7 @@ class AndroidNdkToolchain: self.env['PKG_CONFIG_LIBDIR'] = os.path.join(install_prefix, 'lib/pkgconfig') from build.project import Project - -class AutotoolsProject(Project): - def __init__(self, url, md5, installed, configure_args=[], - autogen=False, - cppflags='', - **kwargs): - Project.__init__(self, url, md5, installed, **kwargs) - self.configure_args = configure_args - self.autogen = autogen - self.cppflags = cppflags - - def build(self, toolchain): - src = self.unpack(toolchain) - if self.autogen: - subprocess.check_call(['/usr/bin/aclocal'], cwd=src) - subprocess.check_call(['/usr/bin/automake', '--add-missing', '--force-missing', '--foreign'], cwd=src) - subprocess.check_call(['/usr/bin/autoconf'], cwd=src) - subprocess.check_call(['/usr/bin/libtoolize', '--force'], cwd=src) - - build = self.make_build_path(toolchain) - - configure = [ - os.path.join(src, 'configure'), - 'CC=' + toolchain.cc, - 'CXX=' + toolchain.cxx, - 'CFLAGS=' + toolchain.cflags, - 'CXXFLAGS=' + toolchain.cxxflags, - 'CPPFLAGS=' + toolchain.cppflags + ' ' + self.cppflags, - 'LDFLAGS=' + toolchain.ldflags, - 'LIBS=' + toolchain.libs, - 'AR=' + toolchain.ar, - 'STRIP=' + toolchain.strip, - '--host=' + toolchain.arch, - '--prefix=' + toolchain.install_prefix, - '--enable-silent-rules', - ] + self.configure_args - - subprocess.check_call(configure, cwd=build, env=toolchain.env) - subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], cwd=build, env=toolchain.env) - subprocess.check_call(['/usr/bin/make', '--quiet', 'install'], cwd=build, env=toolchain.env) +from build.autotools import AutotoolsProject class FfmpegProject(Project): def __init__(self, url, md5, installed, configure_args=[], diff --git a/python/build/autotools.py b/python/build/autotools.py new file mode 100644 index 000000000..02744de4a --- /dev/null +++ b/python/build/autotools.py @@ -0,0 +1,45 @@ +import os.path, subprocess + +from build.project import Project + +class AutotoolsProject(Project): + def __init__(self, url, md5, installed, configure_args=[], + autogen=False, + cppflags='', + **kwargs): + Project.__init__(self, url, md5, installed, **kwargs) + self.configure_args = configure_args + self.autogen = autogen + self.cppflags = cppflags + + def build(self, toolchain): + src = self.unpack(toolchain) + if self.autogen: + subprocess.check_call(['/usr/bin/aclocal'], cwd=src) + subprocess.check_call(['/usr/bin/automake', '--add-missing', '--force-missing', '--foreign'], cwd=src) + subprocess.check_call(['/usr/bin/autoconf'], cwd=src) + subprocess.check_call(['/usr/bin/libtoolize', '--force'], cwd=src) + + build = self.make_build_path(toolchain) + + configure = [ + os.path.join(src, 'configure'), + 'CC=' + toolchain.cc, + 'CXX=' + toolchain.cxx, + 'CFLAGS=' + toolchain.cflags, + 'CXXFLAGS=' + toolchain.cxxflags, + 'CPPFLAGS=' + toolchain.cppflags + ' ' + self.cppflags, + 'LDFLAGS=' + toolchain.ldflags, + 'LIBS=' + toolchain.libs, + 'AR=' + toolchain.ar, + 'STRIP=' + toolchain.strip, + '--host=' + toolchain.arch, + '--prefix=' + toolchain.install_prefix, + '--enable-silent-rules', + ] + self.configure_args + + subprocess.check_call(configure, cwd=build, env=toolchain.env) + subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], + cwd=build, env=toolchain.env) + subprocess.check_call(['/usr/bin/make', '--quiet', 'install'], + cwd=build, env=toolchain.env) diff --git a/win32/build.py b/win32/build.py index d8b866699..b15f3d7e4 100755 --- a/win32/build.py +++ b/win32/build.py @@ -59,48 +59,7 @@ class CrossGccToolchain: self.env['PKG_CONFIG_LIBDIR'] = os.path.join(install_prefix, 'lib/pkgconfig') from build.project import Project - -class AutotoolsProject(Project): - def __init__(self, url, md5, installed, configure_args=[], - autogen=False, - cppflags='', - **kwargs): - Project.__init__(self, url, md5, installed, **kwargs) - self.configure_args = configure_args - self.autogen = autogen - self.cppflags = cppflags - - def build(self, toolchain): - src = self.unpack(toolchain) - if self.autogen: - subprocess.check_call(['/usr/bin/aclocal'], cwd=src) - subprocess.check_call(['/usr/bin/automake', '--add-missing', '--force-missing', '--foreign'], cwd=src) - subprocess.check_call(['/usr/bin/autoconf'], cwd=src) - subprocess.check_call(['/usr/bin/libtoolize', '--force'], cwd=src) - - build = self.make_build_path(toolchain) - - configure = [ - os.path.join(src, 'configure'), - 'CC=' + toolchain.cc, - 'CXX=' + toolchain.cxx, - 'CFLAGS=' + toolchain.cflags, - 'CXXFLAGS=' + toolchain.cxxflags, - 'CPPFLAGS=' + toolchain.cppflags + ' ' + self.cppflags, - 'LDFLAGS=' + toolchain.ldflags, - 'LIBS=' + toolchain.libs, - 'AR=' + toolchain.ar, - 'STRIP=' + toolchain.strip, - '--host=' + toolchain.arch, - '--prefix=' + toolchain.install_prefix, - '--enable-silent-rules', - ] + self.configure_args - - subprocess.check_call(configure, cwd=build, env=toolchain.env) - subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], - cwd=build, env=toolchain.env) - subprocess.check_call(['/usr/bin/make', '--quiet', 'install'], - cwd=build, env=toolchain.env) +from build.autotools import AutotoolsProject class ZlibProject(Project): def __init__(self, url, md5, installed,