diff options
51 files changed, 227 insertions, 234 deletions
diff --git a/cerbero/build/build.py b/cerbero/build/build.py index 45f931f3..61aee0ab 100644 --- a/cerbero/build/build.py +++ b/cerbero/build/build.py @@ -91,106 +91,117 @@ def modify_environment(func): ''' Decorator to modify the build environment ''' def call(*args): self = args[0] - prepend_env = self.prepend_env - append_env = self.append_env - new_env = self.new_env.copy() if self.use_system_libs and self.config.allow_system_libs: - self._add_system_libs(new_env) - old_env = self._modify_env(prepend_env, append_env, new_env) + self._add_system_libs() + self._modify_env() res = func(*args) - self._restore_env(old_env) + self._restore_env() return res call.__name__ = func.__name__ return call +class EnvVarOp: + ''' + An operation to be done on the values of a particular env var + ''' + def __init__(self, op, var, vals, sep): + if op == 'append': + op = self.append + elif op == 'prepend': + op = self.prepend + elif op == 'set': + op = self.set + else: + raise ValueError('Unknown op: {!r}'.format(op)) + self.execute = op + self.var = var + self.vals = vals + self.sep = sep + + def set(self): + if not self.vals: + # An empty array means unset the env var + if self.var in os.environ: + del os.environ[self.var] + else: + os.environ[self.var] = self.sep.join(self.vals) + + def append(self): + if self.var not in os.environ: + os.environ[self.var] = self.sep.join(self.vals) + else: + os.environ[self.var] += self.sep + self.sep.join(self.vals) + + def prepend(self): + if self.var not in os.environ: + os.environ[self.var] = self.sep.join(self.vals) + else: + old = os.environ[self.var] + os.environ[self.var] = self.sep.join(self.vals) + self.sep + old + + class ModifyEnvBase: ''' - Base class for build systems that require extra env variables + Base class for build systems and recipes that require extra env variables ''' - append_env = None - prepend_env = None - new_env = None use_system_libs = False def __init__(self): - if self.append_env is None: - self.append_env = {} - if self.prepend_env is None: - self.prepend_env = {} - if self.new_env is None: - self.new_env = {} - self._old_env = None - - def _modify_env(self, prepend_env, append_env, new_env): + # An array of #EnvVarOp operations that will be performed sequentially + # on the env when @modify_environment is called. + self._new_env = [] + # Set of env vars that will be modified + self._env_vars = set() + # Old environment to restore + self._old_env = {} + + def append_env(self, var, *vals, sep=' '): + self._env_vars.add(var) + self._new_env.append(EnvVarOp('append', var, vals, sep)) + + def prepend_env(self, var, *vals, sep=' '): + self._env_vars.add(var) + self._new_env.append(EnvVarOp('prepend', var, vals, sep)) + + def set_env(self, var, *vals, sep=' '): + self._env_vars.add(var) + self._new_env.append(EnvVarOp('set', var, vals, sep)) + + def _modify_env(self): ''' - Modifies the build environment appending the values in - append_env or replacing the values in new_env + Modifies the build environment by inserting env vars from new_env ''' - if self._old_env is not None: - return None - - self._old_env = {} - for var in chain(prepend_env.keys(), append_env.keys(), new_env.keys()): + assert(not self._old_env) + # Store old env + for var in self._env_vars: if var in os.environ: self._old_env[var] = os.environ[var] + # Modify env + for env_op in self._new_env: + env_op.execute() - for var, (val, sep) in self._iter_env(prepend_env): - if var not in os.environ or not os.environ[var]: - os.environ[var] = val - else: - os.environ[var] = '{}{}{}'.format(val, sep, os.environ[var]) - - for var, (val, sep) in self._iter_env(append_env): - if var not in os.environ or not os.environ[var]: - os.environ[var] = val - else: - os.environ[var] = '{}{}{}'.format(os.environ[var], sep, val) - - for var, val in new_env.items(): - if val is None: - if var in os.environ: - del os.environ[var] - else: - os.environ[var] = val - return self._old_env - - @staticmethod - def _iter_env(env): - for var, val in env.items(): - if isinstance(val, str): - yield var, (val, ' ') - continue - elif isinstance(val, list): - if len(val) == 1: - yield var, (val[0], ' ') - continue - elif len(val) == 2: - yield var, (val[0], val[1]) - continue - raise AssertionError('Invalid value for env: {!r}'.format(val)) - - def _restore_env(self, old_env): + def _restore_env(self): ''' Restores the old environment ''' - if old_env is None: - return - - for var, val in old_env.items(): + for var, val in self._old_env.items(): if val is None: if var in os.environ: del os.environ[var] else: os.environ[var] = val - self._old_env = None + self._old_env.clear() - def _add_system_libs(self, new_env): + def _add_system_libs(self): ''' Add /usr/lib/pkgconfig to PKG_CONFIG_PATH so the system's .pc file can be found. ''' + new_env = {} add_system_libs(self.config, new_env) + for var, val in new_env.items(): + self.set_env(var, val) class MakefilesBase (Build, ModifyEnvBase): @@ -223,30 +234,23 @@ class MakefilesBase (Build, ModifyEnvBase): self.make += ' -j%d' % self.config.num_of_cpus # Make sure user's env doesn't mess up with our build. - self.new_env['MAKEFLAGS'] = None + self.set_env('MAKEFLAGS') # Disable site config, which is set on openSUSE - self.new_env['CONFIG_SITE'] = None + self.set_env('CONFIG_SITE') # Only add this for non-meson recipes, and only for iPhoneOS if self.config.ios_platform == 'iPhoneOS': - bitcode_cflags = ' -fembed-bitcode ' - # FIXME: Can't pass -bitcode_bundle to Makefile projects because we + bitcode_cflags = ['-fembed-bitcode'] + # NOTE: Can't pass -bitcode_bundle to Makefile projects because we # can't control what options they pass while linking dylibs - bitcode_ldflags = bitcode_cflags #+ '-Wl,-bitcode_bundle ' - # FIXME: Use real objects here instead of strings to clean up this ugliness - if 'CFLAGS' in self.append_env: - self.append_env['CFLAGS'] += bitcode_cflags - else: - self.append_env['CFLAGS'] = bitcode_cflags - if 'CCASFLAGS' in self.append_env: - self.append_env['CCASFLAGS'] += bitcode_cflags - else: - self.append_env['CCASFLAGS'] = bitcode_cflags + bitcode_ldflags = bitcode_cflags #+ ['-Wl,-bitcode_bundle'] + self.append_env('CFLAGS', *bitcode_cflags) + self.append_env('CXXFLAGS', *bitcode_cflags) + self.append_env('OBCCFLAGS', *bitcode_cflags) + self.append_env('OBJCXXFLAGS', *bitcode_cflags) + self.append_env('CCASFLAGS', *bitcode_cflags) # Autotools only adds LDFLAGS when doing compiler checks, # so add -fembed-bitcode again - if 'LDFLAGS' in self.append_env: - self.append_env['LDFLAGS'] += bitcode_ldflags - else: - self.append_env['LDFLAGS'] = bitcode_ldflags + self.append_env('LDFLAGS', *bitcode_ldflags) @modify_environment def configure(self): @@ -352,7 +356,7 @@ class Autotools (MakefilesBase): if self.use_system_libs and self.config.allow_system_libs: use_configure_cache = False - if self.new_env or self.append_env or self.prepend_env: + if self._new_env: use_configure_cache = False if use_configure_cache and self.can_use_configure_cache: @@ -465,7 +469,8 @@ class Meson (Build, ModifyEnvBase) : if self.using_msvc(): # Set the MSVC toolchain environment - self.prepend_env.update(self.config.msvc_toolchain_env) + for var, (val, sep) in self.config.msvc_toolchain_env.items(): + self.prepend_env(var, val, sep=sep) # Find Meson if not self.meson_sh: @@ -603,12 +608,9 @@ class Meson (Build, ModifyEnvBase) : # set in the recipe or other places via @modify_environment if self.using_msvc(): for var in ('CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS'): - if var in self.append_env or var in self.prepend_env: - os.environ[var] = '' - if var in self.prepend_env: - os.environ[var] = self.prepend_env[var] - if var in self.append_env: - os.environ[var] += self.append_env[var] + for env_op in self._new_env: + if env_op.var == var: + env_op.execute() if 'default_library' in self.meson_options: raise RuntimeError('Do not set `default_library` in self.meson_options, use self.meson_default_library instead') diff --git a/config/windows.config b/config/windows.config index 44b73a8e..8c9c17bf 100644 --- a/config/windows.config +++ b/config/windows.config @@ -96,6 +96,7 @@ if platform == Platform.WINDOWS: from cerbero.ide.vs.env import vcvarsall, get_msvc_env, append_path # Contains only the env vars that MSVC needs, including any existing vars # that were appended/prepended and have new values + # FIXME: Use EnvVarOp class from cerbero/build/build.py msvc_toolchain_env = {} for key, value in get_msvc_env(vcvarsall, arch, target_arch).items(): if key in ('PATH', 'PATHEXT', 'INCLUDE', 'LIB'): diff --git a/recipes/a52dec.recipe b/recipes/a52dec.recipe index c9b73d7b..e21e2449 100644 --- a/recipes/a52dec.recipe +++ b/recipes/a52dec.recipe @@ -19,5 +19,4 @@ class Recipe(recipe.Recipe): def prepare(self): if self.config.target_platform == Platform.ANDROID: self.configure_options += ' --disable-oss' - - self.append_env['CFLAGS'] = " -fPIC " + self.append_env('CFLAGS', '-fPIC') diff --git a/recipes/build-tools/autoconf.recipe b/recipes/build-tools/autoconf.recipe index c405e586..1342fd87 100644 --- a/recipes/build-tools/autoconf.recipe +++ b/recipes/build-tools/autoconf.recipe @@ -22,4 +22,4 @@ class Recipe(recipe.Recipe): # default one provided with mingw/msys if self.config.target_platform == Platform.WINDOWS: self.deps.remove('m4') - self.append_env['M4'] = '/bin/m4' + self.set_env('M4', '/bin/m4') diff --git a/recipes/build-tools/gettext-tools.recipe b/recipes/build-tools/gettext-tools.recipe index e4e870fe..51120f85 100644 --- a/recipes/build-tools/gettext-tools.recipe +++ b/recipes/build-tools/gettext-tools.recipe @@ -23,7 +23,7 @@ class Recipe(recipe.Recipe): def prepare(self): if self.config.target_platform == Platform.WINDOWS: self.configure_options += ' --enable-threads=win32' - self.append_env['LDFLAGS'] = '-liconv' + self.append_env('LDFLAGS', '-liconv') def post_install(self): if self.config.platform == Platform.WINDOWS: diff --git a/recipes/build-tools/glib-tools.recipe b/recipes/build-tools/glib-tools.recipe index 85e13fd4..df686986 100644 --- a/recipes/build-tools/glib-tools.recipe +++ b/recipes/build-tools/glib-tools.recipe @@ -26,7 +26,7 @@ class Recipe(recipe.Recipe): if self.config.target_platform != Platform.LINUX: # Disable valgrind code on non-Linux, in the best case it just # gives us compiler errors :) - self.append_env['CFLAGS'] = ' -DNVALGRIND=1 ' + self.append_env('CFLAGS', '-DNVALGRIND=1') self.meson_options.update({'xattr': 'false'}) # macOS provides libiconv as a separate library if self.config.target_platform == Platform.DARWIN: @@ -40,4 +40,4 @@ class Recipe(recipe.Recipe): if self.config.target_platform == Platform.WINDOWS: # Want secure versions of stdlib functions. Glib already defines # _WIN32_WINNT, so undefine it on the cmdline to avoid warnings - self.append_env['CFLAGS'] = ' -DMINGW_HAS_SECURE_API=1 -U_WIN32_WINNT ' + self.append_env('CFLAGS', '-DMINGW_HAS_SECURE_API=1', '-U_WIN32_WINNT') diff --git a/recipes/build-tools/gnu-sed.recipe b/recipes/build-tools/gnu-sed.recipe index bd8f4076..12272e2c 100644 --- a/recipes/build-tools/gnu-sed.recipe +++ b/recipes/build-tools/gnu-sed.recipe @@ -11,4 +11,4 @@ class Recipe(recipe.Recipe): def prepare(self): if needs_xcode8_sdk_workaround(self.config): - self.append_env['ac_cv_func_mkostemp'] = 'no' + self.set_env('ac_cv_func_mkostemp', 'no') diff --git a/recipes/build-tools/m4.recipe b/recipes/build-tools/m4.recipe index 684f6f17..610fd9a4 100644 --- a/recipes/build-tools/m4.recipe +++ b/recipes/build-tools/m4.recipe @@ -14,4 +14,4 @@ class Recipe(recipe.Recipe): def prepare(self): self.configure_options += " --disable-gcc-warnings" - self.append_env['CFLAGS'] = " -Wno-error=cast-align" + self.append_env('CFLAGS', '-Wno-error=cast-align') diff --git a/recipes/build-tools/pkg-config.recipe b/recipes/build-tools/pkg-config.recipe index 3ee300db..47ec61cd 100644 --- a/recipes/build-tools/pkg-config.recipe +++ b/recipes/build-tools/pkg-config.recipe @@ -13,4 +13,4 @@ class Recipe(recipe.Recipe): files_share = ['share/aclocal/pkg.m4'] def prepare(self): - self.append_env['CFLAGS'] = " -Wno-error=format-nonliteral " + self.append_env('CFLAGS', '-Wno-error=format-nonliteral') diff --git a/recipes/build-tools/xz.recipe b/recipes/build-tools/xz.recipe index 03a5438a..de9d669b 100644 --- a/recipes/build-tools/xz.recipe +++ b/recipes/build-tools/xz.recipe @@ -17,5 +17,5 @@ class Recipe(recipe.Recipe): # because the headers and C library define the symbol and xz throws # an error at runtime. Forcibly tell configure that clock_gettime is # not available and use the fallback. - self.append_env['ac_cv_search_clock_gettime'] = 'no' - self.append_env['ac_cv_func_clock_gettime'] = 'no' + self.set_env('ac_cv_search_clock_gettime', 'no') + self.set_env('ac_cv_func_clock_gettime', 'no') diff --git a/recipes/build-tools/yasm.recipe b/recipes/build-tools/yasm.recipe index a285e60a..319753b1 100644 --- a/recipes/build-tools/yasm.recipe +++ b/recipes/build-tools/yasm.recipe @@ -12,4 +12,4 @@ class Recipe(recipe.Recipe): def prepare(self): if self.config.target_platform == Platform.WINDOWS: - self.append_env['LDFLAGS'] = '-lintl' + self.append_env('LDFLAGS', '-lintl') diff --git a/recipes/cairo.recipe b/recipes/cairo.recipe index 7ec27de0..753d73b2 100644 --- a/recipes/cairo.recipe +++ b/recipes/cairo.recipe @@ -41,9 +41,9 @@ class Recipe(recipe.Recipe): def prepare(self): # extra flags needed for gcc 4.9 if self.config.target_distro == Distro.ARCH: - self.append_env['CFLAGS'] = " -fno-lto " - self.append_env['CXXFLAGS'] = " -fno-lto " - self.append_env['CPPFLAGS'] = " -fno-lto " + self.append_env('CFLAGS', '-fno-lto') + self.append_env('CXXFLAGS', '-fno-lto') + self.append_env('CPPFLAGS', '-fno-lto') if self.config.variants.x11: self.files_devel += ['lib/pkgconfig/cairo-xlib-xrender.pc', @@ -59,4 +59,4 @@ class Recipe(recipe.Recipe): # we fail to compile with -D_FILE_OFFSET_BITS=64 # because we don't use clang and we use a platform < 21 (Lollipop) # See $NDK_ROOT/sysroot/usr/include/sys/mman.h as one example - self.new_env['ac_cv_func_mmap'] = 'no' + self.set_env('ac_cv_func_mmap', 'no') diff --git a/recipes/fontconfig.recipe b/recipes/fontconfig.recipe index e791811e..79210dad 100644 --- a/recipes/fontconfig.recipe +++ b/recipes/fontconfig.recipe @@ -29,7 +29,7 @@ class Recipe(recipe.Recipe): def prepare(self): if needs_xcode8_sdk_workaround(self.config): - self.append_env['ac_cv_func_mkostemp'] = 'no' + self.set_env('ac_cv_func_mkostemp', 'no') if self.config.target_platform == Platform.WINDOWS: if self.config.target_arch == Architecture.X86_64: self.configure_options += ' --with-arch=x86_64 ' diff --git a/recipes/gettext.recipe b/recipes/gettext.recipe index aa1fc35b..58c9c6b5 100644 --- a/recipes/gettext.recipe +++ b/recipes/gettext.recipe @@ -25,4 +25,4 @@ class Recipe(recipe.Recipe): self.make_install = 'cd %s && make PACKAGE=gettext-tools install' % intl_path if self.config.target_platform == Platform.WINDOWS: self.configure_options += ' --enable-threads=win32' - self.append_env['CFLAGS'] = '-Dlocale_charset=intl_locale_charset' + self.append_env('CFLAGS', '-Dlocale_charset=intl_locale_charset') diff --git a/recipes/glib.recipe b/recipes/glib.recipe index e18c7d0d..faecac90 100644 --- a/recipes/glib.recipe +++ b/recipes/glib.recipe @@ -89,23 +89,21 @@ class Recipe(recipe.Recipe): files_lang = ['glib20'] def _set_gio_flags(self, path1=None, path2=None, use_old_uri_scheme=False): - self.append_env['CFLAGS'] += self._gio_flags(path1, path2, use_old_uri_scheme) + self.append_env('CFLAGS', *self._gio_flags(path1, path2, use_old_uri_scheme)) def _gio_flags(self, path1=None, path2=None, use_old_uri_scheme=False): - flags = '' + flags = [] def escape(path): return '\\"%s\\"' % path if path1 is not None: - flags += ' -DGST_SDK_GLIB_GIO_DISTRO_GIO_MODULE_PATH=%s' % escape(path1) + flags.append('-DGST_SDK_GLIB_GIO_DISTRO_GIO_MODULE_PATH=' + escape(path1)) if path2 is not None: - flags += ' -DGST_SDK_GLIB_GIO_DISTRO_GIO_MODULE_PATH2=%s' % escape(path2) + flags.append('-DGST_SDK_GLIB_GIO_DISTRO_GIO_MODULE_PATH2=' + escape(path2)) if use_old_uri_scheme: - flags += ' -DGST_SDK_GLIB_GIO_OLD_URI_SCHEME_HANDLERS=1' + flags.append('-DGST_SDK_GLIB_GIO_OLD_URI_SCHEME_HANDLERS=1') return flags def prepare(self): - # We add CFLAGS in various places, so initialize it first - self.append_env['CFLAGS'] = '' # Glib doesn't support static libraries on Windows yet if self.config.target_platform == Platform.WINDOWS: self.meson_default_library = 'shared' @@ -113,7 +111,7 @@ class Recipe(recipe.Recipe): if self.config.target_platform != Platform.LINUX: # Disable valgrind code on non-Linux, in the best case it just # gives us compiler errors :) - self.append_env['CFLAGS'] += ' -DNVALGRIND=1 ' + self.append_env('CFLAGS', '-DNVALGRIND=1') self.meson_options.update({'xattr': 'false'}) self.deps.append('proxy-libintl') @@ -138,11 +136,11 @@ class Recipe(recipe.Recipe): # we fail to compile with -D_FILE_OFFSET_BITS=64 # because we don't use clang and we use a platform < 21 (Lollipop) # See $NDK_ROOT/sysroot/usr/include/sys/mman.h as one example - self.meson_cross_properties['c_args'] = ['-U_FILE_OFFSET_BITS'] + self.append_env('CFLAGS', '-U_FILE_OFFSET_BITS') elif self.config.target_platform == Platform.WINDOWS: # Want secure versions of stdlib functions. Glib already defines # _WIN32_WINNT, so undefine it on the cmdline to avoid warnings - self.append_env['CFLAGS'] += ' -DMINGW_HAS_SECURE_API=1 -U_WIN32_WINNT ' + self.append_env('CFLAGS', '-DMINGW_HAS_SECURE_API=1', '-U_WIN32_WINNT') elif self.config.target_platform in [Platform.DARWIN, Platform.IOS]: self.files_devel.append(os.path.join('lib', 'glib-2.0', 'include', '*', 'glibconfig.h')) arch = self.config.target_arch @@ -152,13 +150,13 @@ class Recipe(recipe.Recipe): arch = 'arm64' elif Architecture.is_arm(arch): arch = 'arm' - extra_flags = '' + extra_flags = [] if self.config.target_platform == Platform.IOS: # Disable mac OS X specifics - extra_flags = '-DGST_SDK_IOS=1' + extra_flags = ['-DGST_SDK_IOS=1'] # XXX: Why did we disable these for iOS? #self.configure_options += ' --disable-carbon --disable-modular-tests --disable-cocoa' - self.append_env['CFLAGS'] += extra_flags + self.append_env('CFLAGS', *extra_flags) elif self.config.target_platform == Platform.LINUX: path1 = '/usr/lib/gio/modules' diff --git a/recipes/gmp.recipe b/recipes/gmp.recipe index e3487450..76ae2b91 100644 --- a/recipes/gmp.recipe +++ b/recipes/gmp.recipe @@ -35,7 +35,7 @@ class Recipe(recipe.Recipe): self.configure_options = ' --disable-assembly' elif self.config.target_platform == Platform.ANDROID: # gmp use CFLAGS to compile and link some programs during configure - self.append_env['CFLAGS'] = os.environ.get('LDFLAGS', '') + self.append_env('CFLAGS', os.environ['LDFLAGS']) if self.config.target_platform in [Platform.DARWIN, Platform.IOS]: self.files_devel.append(os.path.join('include', '*', 'gmp.h')) diff --git a/recipes/gnutls.recipe b/recipes/gnutls.recipe index c495ff1f..a62ecb5c 100644 --- a/recipes/gnutls.recipe +++ b/recipes/gnutls.recipe @@ -38,8 +38,8 @@ class Recipe(recipe.Recipe): def prepare(self): if needs_xcode8_sdk_workaround(self.config): - self.append_env['ac_cv_func_clock_gettime'] = 'no' - self.append_env['ac_cv_func_clock_settime'] = 'no' + self.set_env('ac_cv_func_clock_gettime', 'no') + self.set_env('ac_cv_func_clock_settime', 'no') if self.config.target_platform == Platform.WINDOWS: self.configure_options += ' --enable-threads=win32' self.can_use_configure_cache = False @@ -49,14 +49,14 @@ class Recipe(recipe.Recipe): self.configure_options += ' --disable-cxx' self.files_libs.remove('libgnutlsxx') # Fix build with NDK 16 - self.append_env['ac_cv_header_stdatomic_h'] = 'no' + self.set_env('ac_cv_header_stdatomic_h', 'no') v = DistroVersion.get_android_api_version(self.config.target_distro_version) if self.config.target_arch in [Architecture.ARM, Architecture.ARMv7, Architecture.X86] and v < 21: # FIXME: HACK to make projects compile with NDK 16 # we fail to compile with -D_FILE_OFFSET_BITS=64 # because we don't use clang and we use a platform < 21 (Lollipop) # See $NDK_ROOT/sysroot/usr/include/sys/mman.h as one example - self.new_env['ac_cv_func_mmap'] = 'no' + self.set_env('ac_cv_func_mmap', 'no') if self.config.target_platform == Platform.IOS: if self.config.target_arch == Architecture.ARM64: self.configure_options += ' --disable-hardware-acceleration' diff --git a/recipes/graphene.recipe b/recipes/graphene.recipe index c1115d24..8e948372 100644 --- a/recipes/graphene.recipe +++ b/recipes/graphene.recipe @@ -55,7 +55,7 @@ class Recipe(recipe.Recipe): if self.config.target_platform in [Platform.DARWIN, Platform.IOS]: arch = self.config.target_arch if arch == Architecture.X86_64: - self.new_env['SSE41_CFLAGS'] = " " + self.set_env('SSE41_CFLAGS', ' ') def post_install(self): if self.config.target_platform in [Platform.DARWIN, Platform.IOS]: diff --git a/recipes/gst-libav-1.0.recipe b/recipes/gst-libav-1.0.recipe index b6480857..32aad207 100644 --- a/recipes/gst-libav-1.0.recipe +++ b/recipes/gst-libav-1.0.recipe @@ -26,10 +26,6 @@ class Recipe(custom.GStreamer): ] def prepare(self): - # Default AS is $CC, except iOS (set below) - if Architecture.is_arm(self.config.target_arch): - self.new_env = {'AS': os.environ.get('CC', '')} - if self.config.target_platform == Platform.DARWIN: if self.config.target_arch == Architecture.X86_64: asflags = ' -arch x86_64 -m64' @@ -57,7 +53,7 @@ class Recipe(custom.GStreamer): elif self.config.target_platform == Platform.IOS: if Architecture.is_arm(self.config.target_arch): if 'GAS' in os.environ: - self.new_env = {'AS': os.environ['GAS']} + self.set_env('AS', os.environ['GAS']) # Some optimisations that were previously silently disabled # cause warnings now. Ignore them libavextraconf = " --extra-cflags='-Wno-ignored-optimization-argument' " @@ -77,7 +73,7 @@ class Recipe(custom.GStreamer): self.configure_options += ' --with-libav-extra-configure="{}" '.format(libavextraconf) if self.config.variants.nodebug: - self.append_env['CFLAGS'] += ' -DGST_LEVEL_MAX=GST_LEVEL_FIXME' + self.append_env('CFLAGS', '-DGST_LEVEL_MAX=GST_LEVEL_FIXME') super(Recipe, self).prepare() diff --git a/recipes/gst-omx-1.0.recipe b/recipes/gst-omx-1.0.recipe index 564ded03..cbbf33aa 100644 --- a/recipes/gst-omx-1.0.recipe +++ b/recipes/gst-omx-1.0.recipe @@ -16,15 +16,12 @@ class Recipe(custom.GStreamer): def prepare(self): if self.config.variants.rpi: - flags = ( - ' -I=/opt/vc/include' - ' -I=/opt/vc/include/IL' - ' -I=/opt/vc/include/interface/vcos/pthreads' - ' -I=/opt/vc/include/interface/vmcs_host/linux ' - ) + flags = ['-I/opt/vc/include', '-I/opt/vc/include/IL', + '-I/opt/vc/include/interface/vcos/pthreads', + '-I/opt/vc/include/interface/vmcs_host/linux'] self.configure_options += ' --with-omx-target=rpi ' - self.append_env['CFLAGS'] = flags - self.append_env['CPPFLAGS'] = flags - self.append_env['LDFLAGS'] = ' -L=/opt/vc/lib ' + self.append_env('CFLAGS', *flags) + self.append_env('CPPFLAGS', *flags) + self.append_env('LDFLAGS', '-L/opt/vc/lib') else: self.configure_options += ' --with-omx-target=generic ' diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index 833a01fd..026bfe6b 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -387,7 +387,7 @@ class Recipe(custom.GStreamer): self.files_plugins_dvd_devel.remove('lib/gstreamer-1.0/libgstresindvd.la') if self.config.variants.nodebug: - self.append_env['CFLAGS'] += ' -DGST_LEVEL_MAX=GST_LEVEL_FIXME' + self.append_env('CFLAGS', '-DGST_LEVEL_MAX=GST_LEVEL_FIXME') if self.config.target_distro_version in [DistroVersion.DEBIAN_SQUEEZE, DistroVersion.DEBIAN_WHEEZY]: self.platform_files_plugins_capture[Platform.LINUX].remove('lib/gstreamer-1.0/libgstdvb%(mext)s') diff --git a/recipes/gst-plugins-base-1.0.recipe b/recipes/gst-plugins-base-1.0.recipe index 5338cb4d..28ae3d7a 100644 --- a/recipes/gst-plugins-base-1.0.recipe +++ b/recipes/gst-plugins-base-1.0.recipe @@ -213,8 +213,8 @@ class Recipe(custom.GStreamer): ] def prepare(self): - self.append_env['CFLAGS'] = " -DGSTREAMER_GLIB_COCOA_NSAPPLICATION=1 " - self.append_env['OBJCFLAGS'] = " -DGSTREAMER_GLIB_COCOA_NSAPPLICATION=1 " + self.append_env('CFLAGS', '-DGSTREAMER_GLIB_COCOA_NSAPPLICATION=1') + self.append_env('OBJCFLAGS', '-DGSTREAMER_GLIB_COCOA_NSAPPLICATION=1') if self.config.variants.cdparanoia: self.deps.append('cdparanoia') @@ -247,7 +247,7 @@ class Recipe(custom.GStreamer): self.configure_options += ' --disable-alsa' if self.config.variants.nodebug: - self.append_env['CFLAGS'] += ' -DGST_LEVEL_MAX=GST_LEVEL_FIXME' + self.append_env('CFLAGS', '-DGST_LEVEL_MAX=GST_LEVEL_FIXME') if self.config.target_platform == Platform.ANDROID: v = DistroVersion.get_android_api_version(self.config.target_distro_version) @@ -256,4 +256,4 @@ class Recipe(custom.GStreamer): # we fail to compile with -D_FILE_OFFSET_BITS=64 # because we don't use clang and we use a platform < 21 (Lollipop) # See $NDK_ROOT/sysroot/usr/include/sys/mman.h as one example - self.new_env['ac_cv_func_mmap'] = 'no' + self.set_env('ac_cv_func_mmap', 'no') diff --git a/recipes/gst-plugins-good-1.0.recipe b/recipes/gst-plugins-good-1.0.recipe index 51d3b2be..c02bbe09 100644 --- a/recipes/gst-plugins-good-1.0.recipe +++ b/recipes/gst-plugins-good-1.0.recipe @@ -196,8 +196,8 @@ class Recipe(custom.GStreamer): def prepare(self): # The second detail is to work around use of deprecated NSOpenGLPFAFullScreen on OS X 10.10 - self.append_env['CFLAGS'] = " -DGSTREAMER_GLIB_COCOA_NSAPPLICATION=1 -DLIBSOUP_DOES_NOT_STEAL_OUR_CONTEXT=1 " - self.append_env['OBJCFLAGS'] = " -DGSTREAMER_GLIB_COCOA_NSAPPLICATION=1 " + self.append_env('CFLAGS', '-DGSTREAMER_GLIB_COCOA_NSAPPLICATION=1', '-DLIBSOUP_DOES_NOT_STEAL_OUR_CONTEXT=1') + self.append_env('OBJCFLAGS', '-DGSTREAMER_GLIB_COCOA_NSAPPLICATION=1') if self.config.target_platform == Platform.WINDOWS: self.configure_options += ' --disable-aalib --disable-esd ' @@ -229,7 +229,7 @@ class Recipe(custom.GStreamer): self.configure_options += ' --disable-pulse' if self.config.variants.nodebug: - self.append_env['CFLAGS'] += ' -DGST_LEVEL_MAX=GST_LEVEL_FIXME' + self.append_env('CFLAGS', '-DGST_LEVEL_MAX=GST_LEVEL_FIXME') def configure(self): fix_android_ndk16_cxx (self.config, os.path.join(self.make_dir, 'ext', 'taglib')) diff --git a/recipes/gst-plugins-ugly-1.0.recipe b/recipes/gst-plugins-ugly-1.0.recipe index d3c5eb4b..039a4e14 100644 --- a/recipes/gst-plugins-ugly-1.0.recipe +++ b/recipes/gst-plugins-ugly-1.0.recipe @@ -53,4 +53,4 @@ class Recipe(custom.GStreamer): self.files_plugins_dvd_devel.remove('lib/gstreamer-1.0/libgstdvdread.a') if self.config.variants.nodebug: - self.append_env['CFLAGS'] += ' -DGST_LEVEL_MAX=GST_LEVEL_FIXME' + self.append_env('CFLAGS', '-DGST_LEVEL_MAX=GST_LEVEL_FIXME') diff --git a/recipes/gstreamer-1.0.recipe b/recipes/gstreamer-1.0.recipe index 0a930fa1..909fd654 100644 --- a/recipes/gstreamer-1.0.recipe +++ b/recipes/gstreamer-1.0.recipe @@ -73,4 +73,4 @@ class Recipe(custom.GStreamer): self.configure_options += ' --disable-registry ' if self.config.variants.nodebug: - self.append_env['CFLAGS'] += ' -DGST_LEVEL_MAX=GST_LEVEL_FIXME' + self.append_env('CFLAGS', '-DGST_LEVEL_MAX=GST_LEVEL_FIXME') diff --git a/recipes/harfbuzz.recipe b/recipes/harfbuzz.recipe index 20bc5d3b..71b7dc17 100644 --- a/recipes/harfbuzz.recipe +++ b/recipes/harfbuzz.recipe @@ -22,4 +22,4 @@ class Recipe(recipe.Recipe): # we fail to compile with -D_FILE_OFFSET_BITS=64 # because we don't use clang and we use a platform < 21 (Lollipop) # See $NDK_ROOT/sysroot/usr/include/sys/mman.h as one example - self.new_env['ac_cv_func_mmap'] = 'no' + self.set_env('ac_cv_func_mmap', 'no') diff --git a/recipes/libass.recipe b/recipes/libass.recipe index b5614ef8..b049aabb 100644 --- a/recipes/libass.recipe +++ b/recipes/libass.recipe @@ -18,4 +18,4 @@ class Recipe(recipe.Recipe): def prepare(self): if self.config.target_platform == Platform.IOS and \ self.config.target_arch in [Architecture.X86, Architecture.X86_64]: - self.append_env = {'LDFLAGS': '-Wl,-read_only_relocs,suppress'} + self.append_env('LDFLAGS', '-Wl,-read_only_relocs,suppress') diff --git a/recipes/libdv.recipe b/recipes/libdv.recipe index 35b5bd7d..63c09879 100644 --- a/recipes/libdv.recipe +++ b/recipes/libdv.recipe @@ -26,7 +26,7 @@ class Recipe(recipe.Recipe): self.configure_options += ' --disable-xv --without-x' if self.config.target_platform == Platform.WINDOWS: self.configure_options += ' --disable-asm' - self.append_env = {'LDFLAGS': '-lpthread'} + self.append_env('LDFLAGS', '-lpthread') elif self.config.target_platform == Platform.DARWIN: self.configure_options += ' --disable-asm' elif self.config.target_platform == Platform.ANDROID: diff --git a/recipes/libffi.recipe b/recipes/libffi.recipe index 52541699..9ba21fc3 100644 --- a/recipes/libffi.recipe +++ b/recipes/libffi.recipe @@ -37,7 +37,7 @@ class Recipe(recipe.Recipe): self.configure_options += ' --disable-docs ' if needs_xcode8_sdk_workaround(self.config): - self.append_env['ac_cv_func_mkostemp'] = 'no' + self.set_env('ac_cv_func_mkostemp', 'no') if self.config.target_platform in [Platform.DARWIN, Platform.IOS]: arch = self.config.target_arch diff --git a/recipes/libjpeg-turbo.recipe b/recipes/libjpeg-turbo.recipe index 8aa80df6..ff639354 100644 --- a/recipes/libjpeg-turbo.recipe +++ b/recipes/libjpeg-turbo.recipe @@ -21,4 +21,4 @@ class Recipe(recipe.Recipe): if self.config.target_platform in [Platform.DARWIN, Platform.IOS]: # avoid using xcode's nasm (doesn't support nasm-like arguments) # instead use cerbero's yasm - self.new_env['NASM'] = 'yasm' + self.set_env('NASM', 'yasm') diff --git a/recipes/libkate.recipe b/recipes/libkate.recipe index cf7bc228..a1967404 100644 --- a/recipes/libkate.recipe +++ b/recipes/libkate.recipe @@ -16,4 +16,4 @@ class Recipe(recipe.Recipe): def prepare(self): if self.config.target_distro == Distro.ARCH: - self.append_env = {'LDFLAGS': '-Wl,-O1,--sort-common,--as-needed,-z,relro'} + self.append_env('LDFLAGS', '-Wl,-O1,--sort-common,--as-needed,-z,relro') diff --git a/recipes/libpng/libpng.recipe b/recipes/libpng/libpng.recipe index b3d7e07b..215d3194 100644 --- a/recipes/libpng/libpng.recipe +++ b/recipes/libpng/libpng.recipe @@ -17,7 +17,6 @@ class Recipe(recipe.Recipe): def prepare(self): if self.config.target_platform == Platform.IOS: if 'GAS' in os.environ: - self.new_env = {'CCAS': os.environ['GAS']} - self.new_env['CCAS'] += ' -no-integrated-as ' + self.set_env('CCAS', os.environ['GAS'], '-no-integrated-as') if self.config.target_arch == Architecture.ARM64: self.configure_options += ' --disable-arm-neon ' diff --git a/recipes/libsrtp.recipe b/recipes/libsrtp.recipe index a353f6b4..e9e9f040 100644 --- a/recipes/libsrtp.recipe +++ b/recipes/libsrtp.recipe @@ -18,7 +18,7 @@ class Recipe(recipe.Recipe): def prepare(self): # Don't accidentially build with pcap support - self.append_env['ac_cv_lib_pcap_pcap_create'] = 'no' + self.set_env('ac_cv_lib_pcap_pcap_create', 'no') self.make += ' all shared_library' def install(self): diff --git a/recipes/libtasn1.recipe b/recipes/libtasn1.recipe index 1caddd5c..ae561dc5 100644 --- a/recipes/libtasn1.recipe +++ b/recipes/libtasn1.recipe @@ -18,6 +18,6 @@ class Recipe(recipe.Recipe): def prepare(self): # Don't make compiler warnings errors, there are quite a few # depending on the compiler used - self.append_env['CFLAGS'] = ' -Wno-error ' + self.append_env('CFLAGS', '-Wno-error') if needs_xcode8_sdk_workaround(self.config): - self.append_env['ac_cv_func_clock_gettime'] = 'no' + self.set_env('ac_cv_func_clock_gettime', 'no') diff --git a/recipes/libvpx.recipe b/recipes/libvpx.recipe index c828ba95..3df49148 100644 --- a/recipes/libvpx.recipe +++ b/recipes/libvpx.recipe @@ -51,7 +51,6 @@ class Recipe(recipe.Recipe): elif self.config.target_arch == Architecture.ARM64: arch = 'arm64' - self.new_env['LD'] = os.environ.get('CC', 'gcc') if self.config.target_platform == Platform.DARWIN: platform = 'darwin12' elif self.config.target_platform == Platform.IOS: @@ -66,30 +65,26 @@ class Recipe(recipe.Recipe): platform = 'win64' else: platform = 'win32' - self.append_env['CFLAGS'] = " -mstackrealign " + self.append_env('CFLAGS', '-mstackrealign') # FIXME: elif self.config.target_platform == Platform.ANDROID: platform = 'android' - self.append_env['CFLAGS'] = " -Dandroid_getCpuFamily=vpx_android_getCpuFamily "\ - "-Dandroid_getCpuFeatures=vpx_android_getCpuFeatures "\ - "-Dandroid_getCpuCount=vpx_android_getCpuCount " \ - "-Dandroid_cpuInit=vpx_android_cpuInit " \ - "-Dandroid_cpuInitDummy=vpx_android_cpuInitDummy " \ - "-Dandroid_getCpuIdArm=vpx_android_getCpuIdArm " \ - "-Dandroid_setCpu=vpx_android_setCpu " \ - "-Dandroid_setCpuArm=vpx_android_setCpuArm " + self.append_env('CFLAGS', '-Dandroid_getCpuFamily=vpx_android_getCpuFamily', + '-Dandroid_getCpuFeatures=vpx_android_getCpuFeatures', + '-Dandroid_getCpuCount=vpx_android_getCpuCount', + '-Dandroid_cpuInit=vpx_android_cpuInit', + '-Dandroid_cpuInitDummy=vpx_android_cpuInitDummy', + '-Dandroid_getCpuIdArm=vpx_android_getCpuIdArm', + '-Dandroid_setCpu=vpx_android_setCpu', + '-Dandroid_setCpuArm=vpx_android_setCpuArm') if self.config.target_arch == Architecture.X86: - self.append_env['ASFLAGS'] = " -D__ANDROID__ " - self.append_env['CFLAGS'] += " -D__ANDROID__ " + self.append_env('ASFLAGS', '-D__ANDROID__') + self.append_env('CFLAGS', '-D__ANDROID__') if self.config.target_arch == Architecture.ARM: arch = 'armv5te' - # Fix compiler error with -mthumb - self.new_env['CFLAGS'] = os.environ['CFLAGS'].replace('-mthumb', '') - elif self.config.target_arch in [Architecture.ARMv7, Architecture.X86, Architecture.ARM64, Architecture.X86_64]: - pass - else: + elif self.config.target_arch not in [Architecture.ARMv7, Architecture.X86, Architecture.ARM64, Architecture.X86_64]: raise FatalError("Unsupported Android architecture %s" % self.config.target_arch) self.config_sh = 'LD=$CC ./configure' self.configure_options.replace('--as=yasm', '') diff --git a/recipes/libxml2.recipe b/recipes/libxml2.recipe index 4dc509a9..56d9fc0c 100644 --- a/recipes/libxml2.recipe +++ b/recipes/libxml2.recipe @@ -23,8 +23,8 @@ class Recipe(recipe.Recipe): self.configure_options = '--with-python=no' v = DistroVersion.get_android_api_version(self.config.target_distro_version) if v < 21: - self.new_env['CFLAGS'] = os.environ.get('CFLAGS', '') + ' -D_FILE_OFFSET_BITS=32' - self.new_env['CPPFLAGS'] = os.environ.get('CPPFLAGS', '') + ' -D_FILE_OFFSET_BITS=32' + self.append_env('CFLAGS', '-D_FILE_OFFSET_BITS=32') + self.append_env('CPPFLAGS', '-D_FILE_OFFSET_BITS=32') elif self.config.target_platform == Platform.IOS: self.configure_options = '--with-python=no' elif self.config.target_platform == Platform.LINUX: diff --git a/recipes/mpg123.recipe b/recipes/mpg123.recipe index 448de890..d7ecedef 100644 --- a/recipes/mpg123.recipe +++ b/recipes/mpg123.recipe @@ -17,8 +17,8 @@ class Recipe(recipe.Recipe): if self.config.target_platform in [Platform.ANDROID]: if self.config.target_arch == Architecture.ARM: # Disable thumb mode to get the optimizations compiled properly - self.new_env['CFLAGS'] = os.environ['CFLAGS'].replace('-mthumb', '') - self.new_env['CCASFLAGS'] = os.environ.get('CCASFLAGS', '').replace('-mthumb', '') + self.append_env('CFLAGS', '-marm') + self.append_env('CCASFLAGS', '-marm') elif self.config.target_arch == Architecture.X86: # The custom assembly breaks compiling an application by # using relocations. diff --git a/recipes/pixman.recipe b/recipes/pixman.recipe index 78dc3832..92d2355d 100644 --- a/recipes/pixman.recipe +++ b/recipes/pixman.recipe @@ -25,20 +25,20 @@ class Recipe(recipe.Recipe): self.config.target_arch in [ Architecture.X86, Architecture.X86_64 ]: self.configure_options = '--disable-mmx' if self.config.target_platform == Platform.IOS: - self.append_env['CFLAGS'] = ' -DPIXMAN_NO_TLS ' + self.append_env('CFLAGS', '-DPIXMAN_NO_TLS') if self.config.target_platform == Platform.ANDROID: # FIXME: Fails to link because of undefined __builtin_* symbols self.configure_options = '--disable-arm-iwmmxt' # Prevent symbol conflicts - self.append_env['CFLAGS'] = \ - "-Dandroid_getCpuFamily=pixman_android_getCpuFamily "\ - "-Dandroid_getCpuFeatures=pixman_android_getCpuFeatures "\ - "-Dandroid_getCpuCount=pixman_android_getCpuCount " \ - "-Dandroid_cpuInit=pixman_android_cpuInit " \ - "-Dandroid_cpuInitDummy=pixman_android_cpuInitDummy " \ - "-Dandroid_getCpuIdArm=pixman_android_getCpuIdArm " \ - "-Dandroid_setCpu=pixman_android_setCpu " \ - "-Dandroid_setCpuArm=pixman_android_setCpuArm " + self.append_env('CFLAGS', + '-Dandroid_getCpuFamily=pixman_android_getCpuFamily', + '-Dandroid_getCpuFeatures=pixman_android_getCpuFeatures', + '-Dandroid_getCpuCount=pixman_android_getCpuCount', + '-Dandroid_cpuInit=pixman_android_cpuInit', + '-Dandroid_cpuInitDummy=pixman_android_cpuInitDummy', + '-Dandroid_getCpuIdArm=pixman_android_getCpuIdArm', + '-Dandroid_setCpu=pixman_android_setCpu', + '-Dandroid_setCpuArm=pixman_android_setCpuArm') def configure(self): if self.config.target_platform == Platform.ANDROID: diff --git a/recipes/soundtouch.recipe b/recipes/soundtouch.recipe index 45db401c..1b7035bf 100644 --- a/recipes/soundtouch.recipe +++ b/recipes/soundtouch.recipe @@ -29,7 +29,7 @@ class Recipe(recipe.Recipe): self.configure_options += ' --enable-static ' if self.config.target_platform == Platform.ANDROID: self.configure_options += ' --with-gnustl ' - self.append_env['CXXFLAGS'] = " -fexceptions " + self.append_env('CXXFLAGS', '-fexceptions') elif self.config.target_platform == Platform.IOS: self.autoreconf = True diff --git a/recipes/spandsp.recipe b/recipes/spandsp.recipe index 09d65adc..b84f2c3f 100644 --- a/recipes/spandsp.recipe +++ b/recipes/spandsp.recipe @@ -21,7 +21,7 @@ class Recipe(recipe.Recipe): def prepare(self): # Workaround broken autoconf test in cross compilation if self.config.arch != self.config.target_arch or self.config.target_platform in (Platform.ANDROID, Platform.IOS): - self.new_env['ac_cv_func_malloc_0_nonnull'] = 'yes' - self.new_env['ac_cv_func_realloc_0_nonnull'] = 'yes' + self.set_env('ac_cv_func_malloc_0_nonnull', 'yes') + self.set_env('ac_cv_func_realloc_0_nonnull', 'yes') if self.config.target_platform == Platform.WINDOWS: self.patches += ['spandsp/0001-Fix-build-for-windows-using-mingw.patch'] diff --git a/recipes/srt.recipe b/recipes/srt.recipe index 41fb1fed..02f1becf 100644 --- a/recipes/srt.recipe +++ b/recipes/srt.recipe @@ -23,8 +23,8 @@ class Recipe(recipe.Recipe): def prepare(self): if self.config.target_platform == Platform.ANDROID: - self.append_env['CXXFLAGS'] = " -frtti -fexceptions `pkg-config --cflags gnustl`" - self.append_env['LDFLAGS'] = " -lgnustl" + self.append_env('CXXFLAGS', '-frtti', '-fexceptions', '`pkg-config --cflags gnustl`') + self.append_env('LDFLAGS', '-lgnustl') self.deps += ['gnustl'] def post_install(self): diff --git a/recipes/taglib.recipe b/recipes/taglib.recipe index 6ab2975c..4b912bfb 100644 --- a/recipes/taglib.recipe +++ b/recipes/taglib.recipe @@ -26,7 +26,7 @@ class Recipe(recipe.Recipe): if self.config.target_platform == Platform.ANDROID: # configure for android self.configure_options += ' -DANDROID_NDK=1 ' - self.append_env['CXXFLAGS'] = " -frtti " + self.append_env('CXXFLAGS', '-frtti') self.configure_options += ' -DZLIB_ROOT=%s ' % self.config.prefix def install(self): diff --git a/recipes/tiff.recipe b/recipes/tiff.recipe index eca079af..fb72c855 100644 --- a/recipes/tiff.recipe +++ b/recipes/tiff.recipe @@ -26,4 +26,4 @@ class Recipe(recipe.Recipe): # we fail to compile with -D_FILE_OFFSET_BITS=64 # because we don't use clang and we use a platform < 21 (Lollipop) # See $NDK_ROOT/sysroot/usr/include/sys/mman.h as one example - self.new_env['ac_cv_func_mmap'] = 'no' + self.set_env('ac_cv_func_mmap', 'no') diff --git a/recipes/toolchain/binutils.recipe b/recipes/toolchain/binutils.recipe index 015277fc..18f6f500 100644 --- a/recipes/toolchain/binutils.recipe +++ b/recipes/toolchain/binutils.recipe @@ -55,7 +55,7 @@ class Recipe(recipe.Recipe): self.files_binutils = files # temporary hack to not build info files (requires old texinfo) # Remove when switching to newer version than 2.22 - self.new_env['MAKEINFO'] = 'missing' + self.set_env('MAKEINFO', 'missing') def post_install(self): import shutil diff --git a/recipes/toolchain/gcc-core.recipe b/recipes/toolchain/gcc-core.recipe index 5ae81988..dbb413b1 100644 --- a/recipes/toolchain/gcc-core.recipe +++ b/recipes/toolchain/gcc-core.recipe @@ -27,9 +27,9 @@ class Recipe(recipe.Recipe): requires_non_src_build = True add_host_build_target = False deps = ['mingw-w64-headers', 'gmp-toolchain', 'mpfr', 'mpc', 'cloog'] - new_env = {'CPP': None} def prepare(self): + self.set_env('CPP') # Unset CPP, added in a4acba058 self.remotes = {'origin': '%s/%s' % (self.config.git_root, 'gcc')} self.repo_dir = os.path.join(self.config.local_sources, 'gcc') diff --git a/recipes/toolchain/gmp.recipe b/recipes/toolchain/gmp.recipe index cd29dd6b..cabfc677 100644 --- a/recipes/toolchain/gmp.recipe +++ b/recipes/toolchain/gmp.recipe @@ -13,4 +13,4 @@ class Recipe(recipe.Recipe): def prepare(self): self.remotes = {'origin': '%s/%s' % (self.config.git_root, 'gmp')} if self.config.target_arch == Architecture.X86: - self.new_env['ABI'] = "32" + self.set_env('ABI', '32') diff --git a/recipes/toolchain/mingw-w64.recipe b/recipes/toolchain/mingw-w64.recipe index 6298f089..91e124e4 100644 --- a/recipes/toolchain/mingw-w64.recipe +++ b/recipes/toolchain/mingw-w64.recipe @@ -18,15 +18,15 @@ class Recipe(recipe.Recipe): files = ['%s/lib/%s' % (host, x) for x in self.files_crt] files.extend(['%s/lib/%s' % ('mingw', x) for x in self.files_crt]) self.files_crt = files - self.new_env['CC'] = '%s-gcc' % host - self.new_env['CXX'] = '%s-g++' % host - self.new_env['CPP'] = '%s-cpp' % host - self.new_env['LD'] = '%s-ld' % host - self.new_env['STRIP'] = '%s-strip' % host - self.new_env['RANLIB'] = '%s-ranlib' % host - self.new_env['DLLTOOL'] = '%s-dlltool' % host - self.new_env['AR'] = '%s-ar' % host - self.new_env['AS'] = '%s-as' % host + self.set_env('CC', '%s-gcc' % host) + self.set_env('CXX', '%s-g++' % host) + self.set_env('CPP', '%s-cpp' % host) + self.set_env('LD', '%s-ld' % host) + self.set_env('STRIP', '%s-strip' % host) + self.set_env('RANLIB', '%s-ranlib' % host) + self.set_env('DLLTOOL', '%s-dlltool' % host) + self.set_env('AR', '%s-ar' % host) + self.set_env('AS', '%s-as' % host) files_crt = [ 'CRT_fp10.o', 'CRT_fp8.o', 'CRT_glob.o', 'CRT_noglob.o', 'binmode.o', 'crt1.o', diff --git a/recipes/toolchain/winpthreads.recipe b/recipes/toolchain/winpthreads.recipe index 74226262..36c9abb5 100644 --- a/recipes/toolchain/winpthreads.recipe +++ b/recipes/toolchain/winpthreads.recipe @@ -33,13 +33,13 @@ class Recipe(recipe.Recipe): else: host = 'x86_64-w64-mingw32' self.configure_options += ' --host=%s' % host - self.new_env['CC'] = '%s-gcc' % host - self.new_env['CXX'] = '%s-g++' % host - self.new_env['CPP'] = '%s-cpp' % host - self.new_env['LD'] = '%s-ld' % host - self.new_env['STRIP'] = '%s-strip' % host - self.new_env['RANLIB'] = '%s-ranlib' % host - self.new_env['DLLTOOL'] = '%s-dlltool' % host - self.new_env['AR'] = '%s-ar' % host - self.new_env['AS'] = '%s-as' % host + self.set_env('CC', '%s-gcc' % host) + self.set_env('CXX', '%s-g++' % host) + self.set_env('CPP', '%s-cpp' % host) + self.set_env('LD', '%s-ld' % host) + self.set_env('STRIP', '%s-strip' % host) + self.set_env('RANLIB', '%s-ranlib' % host) + self.set_env('DLLTOOL', '%s-dlltool' % host) + self.set_env('AR', '%s-ar' % host) + self.set_env('AS', '%s-as' % host) diff --git a/recipes/tremor.recipe b/recipes/tremor.recipe index 4670327a..7b83c60c 100644 --- a/recipes/tremor.recipe +++ b/recipes/tremor.recipe @@ -26,9 +26,10 @@ class Recipe(recipe.Recipe): def prepare(self): if self.config.target_arch == Architecture.ARMv7: if self.config.target_platform != Platform.IOS: - self.new_env['CFLAGS'] = os.environ['CFLAGS'] + " -Wa,-mimplicit-it=thumb " + self.append_env('CFLAGS', '-Wa,-mimplicit-it=thumb') elif self.config.target_arch == Architecture.ARM: - self.new_env['CFLAGS'] = os.environ['CFLAGS'].replace('-mthumb', '') + # Disable thumb code generation + self.append_env('CFLAGS', '-marm') def configure(self): if self.config.target_platform == Platform.IOS: diff --git a/recipes/webrtc-audio-processing.recipe b/recipes/webrtc-audio-processing.recipe index 2bae83f4..0c6e0139 100644 --- a/recipes/webrtc-audio-processing.recipe +++ b/recipes/webrtc-audio-processing.recipe @@ -50,8 +50,9 @@ class Recipe(recipe.Recipe): self.configure_options += ' --with-gnustl' elif self.config.target_platform == Platform.WINDOWS: # This recipe requires at least Windows Vista - self.append_env['CFLAGS'] = ' -UWINVER -U_WIN32_WINNT -DWINVER=0x0600 -D_WIN32_WINNT=0x0600' - self.append_env['CXXFLAGS'] = self.append_env['CFLAGS'] + flags = ('-UWINVER', '-U_WIN32_WINNT', '-DWINVER=0x0600', '-D_WIN32_WINNT=0x0600') + self.append_env('CFLAGS', *flags) + self.append_env('CXXFLAGS', *flags) def configure (self): fix_android_ndk16_cxx (self.config, os.path.join(self.make_dir, 'webrtc', 'modules', 'audio_processing')) diff --git a/recipes/x264.recipe b/recipes/x264.recipe index f7516fd2..f651006f 100644 --- a/recipes/x264.recipe +++ b/recipes/x264.recipe @@ -13,7 +13,6 @@ class Recipe(recipe.Recipe): '--disable-strip --disable-lavf' url = 'http://download.videolan.org/pub/x264/snapshots/x264-snapshot-20161218-2245-stable.tar.bz2' tarball_dirname= 'x264-snapshot-20161218-2245-stable' - new_env = {'AS': 'yasm'} files_libs = ['libx264'] files_bins = ['x264'] @@ -24,13 +23,14 @@ class Recipe(recipe.Recipe): # clang x86-32 fails at generating proper asm PIC code # See bug https://bugzilla.gnome.org/show_bug.cgi?id=727079 enable_asm = True + AS = ['yasm'] arch = self.config.target_arch if self.config.target_arch == Architecture.X86: arch = 'i686' if self.config.target_platform == Platform.DARWIN: if self.config.target_arch == Architecture.X86: - self.new_env = {'AS': 'yasm -O2 -f macho -DPREFIX'} + AS = ['yasm', '-O2', '-f', 'macho', '-DPREFIX'] enable_asm = False if self.config.target_platform == Platform.WINDOWS: self.configure_options += ' --enable-win32thread' @@ -38,10 +38,13 @@ class Recipe(recipe.Recipe): # FIXME : Is disabling asm on ARM (< v7) still needed ? enable_asm = False elif Architecture.is_arm(self.config.target_arch): - self.new_env = {'AS': os.environ.get('CC', '')} + if 'CC' in os.environ: + AS = [os.environ['CC']] + else: + AS = [] if self.config.target_platform == Platform.IOS: if Architecture.is_arm(self.config.target_arch): - self.new_env = {'AS': 'tools/gas-preprocessor.pl ' + os.environ['CC'] + ' ' + os.environ['CFLAGS']} + AS = ['tools/gas-preprocessor.pl', os.environ['CC'], os.environ['CFLAGS']] self.patches = ['x264/0001-Disable-fembed-bitcode-incompatible-argument.patch'] elif self.config.target_arch == Architecture.X86: enable_asm = False @@ -54,6 +57,7 @@ class Recipe(recipe.Recipe): # Fails linking into an android application enable_asm = False + self.set_env('AS', *AS) if enable_asm is False: self.configure_options += ' --disable-asm ' |