Commit fbaf3bc4 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

cerbero/build: Workaround MSYS trying to be too smart

Finally figured out the actual issue that I was trying to solve in
f38df32d and 78f06dd4. Paths like `c:/foobar` (lowercase drive
letter) are considered to be a POSIX path list, so `c:/foobar/`
becomes `c;C:\foobar`:

http://mingw.org/wiki/Posix_path_conversion

This will happen anytime we try to pass a path as a command-line
argument. We used to work-around this by using `to_unixpath()`,
but that's just sinking deeper into dependence on broken shell
behaviour. This happens now because we're passing includes in CFLAGS,
CXXFLAGS, CPPFLAGS, etc.

So let's just bypass the shell entirely by constructing a list. As
a side-effect, this is another step towards being able to run Cerbero
from a directory with spaces in it.

For now, we'll convert `config_sh` to a list when not using an
Autotools configure. Luckily, we don't need to pass any paths as
arguments to it anyway. When running other stages, we now always use
a list instead of a string. Hopefully the fallout is small and obvious
for people using forks of Cerbero.
parent 151e8c47
...@@ -364,13 +364,15 @@ class MakefilesBase (Build, ModifyEnvBase): ...@@ -364,13 +364,15 @@ class MakefilesBase (Build, ModifyEnvBase):
config_sh = '' config_sh = ''
configure_tpl = '' configure_tpl = ''
configure_options = '' configure_options = ''
make = 'make V=1' make = None
make_install = 'make install' make_install = None
make_check = None make_check = None
make_clean = 'make clean' make_clean = None
allow_parallel_build = True allow_parallel_build = True
srcdir = '.' srcdir = '.'
requires_non_src_build = False requires_non_src_build = False
# recipes often use shell constructs
config_sh_needs_shell = True
def __init__(self): def __init__(self):
Build.__init__(self) Build.__init__(self)
...@@ -384,9 +386,14 @@ class MakefilesBase (Build, ModifyEnvBase): ...@@ -384,9 +386,14 @@ class MakefilesBase (Build, ModifyEnvBase):
self.make_dir = os.path.join (self.config_src_dir, "cerbero-build-dir") self.make_dir = os.path.join (self.config_src_dir, "cerbero-build-dir")
else: else:
self.make_dir = self.config_src_dir self.make_dir = self.config_src_dir
self.make = self.make or ['make', 'V=1']
self.make_install = self.make_install or ['make', 'install']
self.make_clean = self.make_clean or ['make', 'clean']
if self.config.allow_parallel_build and self.allow_parallel_build \ if self.config.allow_parallel_build and self.allow_parallel_build \
and self.config.num_of_cpus > 1: and self.config.num_of_cpus > 1:
self.make += ' -j%d' % self.config.num_of_cpus self.make += ['-j%d' % self.config.num_of_cpus]
# Make sure user's env doesn't mess up with our build. # Make sure user's env doesn't mess up with our build.
self.set_env('MAKEFLAGS', when='now') self.set_env('MAKEFLAGS', when='now')
...@@ -423,16 +430,31 @@ class MakefilesBase (Build, ModifyEnvBase): ...@@ -423,16 +430,31 @@ class MakefilesBase (Build, ModifyEnvBase):
if self.using_msvc(): if self.using_msvc():
self.unset_toolchain_env() self.unset_toolchain_env()
configure_cmd = self.configure_tpl % { substs = {
'config-sh': self.config_sh, 'config-sh': self.config_sh,
'prefix': to_unixpath(self.config.prefix), 'prefix': self.config.prefix,
'libdir': to_unixpath(self.config.libdir), 'libdir': self.config.libdir,
'host': self.config.host, 'host': self.config.host,
'target': self.config.target, 'target': self.config.target,
'build': self.config.build, 'build': self.config.build,
'options': self.configure_options, 'options': self.configure_options,
'build_dir': to_unixpath(self.build_dir), 'build_dir': self.build_dir,
'make_dir': to_unixpath(self.make_dir)} 'make_dir': self.make_dir,
}
# Construct a command list when possible
if not self.config_sh_needs_shell:
configure_cmd = []
for arg in self.configure_tpl.split():
if arg == '%(options)s':
options = self.configure_options
if isinstance(options, str):
options = options.split()
configure_cmd += options
else:
configure_cmd.append(arg % substs)
else:
configure_cmd = self.configure_tpl % substs
self.maybe_add_system_libs(step='configure') self.maybe_add_system_libs(step='configure')
...@@ -486,13 +508,16 @@ class Autotools (MakefilesBase): ...@@ -486,13 +508,16 @@ class Autotools (MakefilesBase):
config_sh = './configure' config_sh = './configure'
configure_tpl = "%(config-sh)s --prefix %(prefix)s "\ configure_tpl = "%(config-sh)s --prefix %(prefix)s "\
"--libdir %(libdir)s" "--libdir %(libdir)s"
make_check = 'make check'
add_host_build_target = True add_host_build_target = True
can_use_configure_cache = True can_use_configure_cache = True
supports_cache_variables = True supports_cache_variables = True
disable_introspection = False disable_introspection = False
override_libtool = True override_libtool = True
def __init__(self):
MakefilesBase.__init__(self)
self.make_check = self.make_check or ['make', 'check']
@async_modify_environment @async_modify_environment
async def configure(self): async def configure(self):
# Build with PIC for static linking # Build with PIC for static linking
...@@ -570,6 +595,7 @@ class CMake (MakefilesBase): ...@@ -570,6 +595,7 @@ class CMake (MakefilesBase):
Build handler for cmake projects Build handler for cmake projects
''' '''
config_sh_needs_shell = False
config_sh = 'cmake' config_sh = 'cmake'
configure_tpl = '%(config-sh)s -DCMAKE_INSTALL_PREFIX=%(prefix)s ' \ configure_tpl = '%(config-sh)s -DCMAKE_INSTALL_PREFIX=%(prefix)s ' \
'-H%(build_dir)s ' \ '-H%(build_dir)s ' \
...@@ -599,24 +625,29 @@ class CMake (MakefilesBase): ...@@ -599,24 +625,29 @@ class CMake (MakefilesBase):
cc = cc.split(' ')[0] cc = cc.split(' ')[0]
cxx = cxx.split(' ')[0] cxx = cxx.split(' ')[0]
if self.configure_options:
self.configure_options = self.configure_options.split()
if self.config.target_platform == Platform.WINDOWS: if self.config.target_platform == Platform.WINDOWS:
self.configure_options += ' -DCMAKE_SYSTEM_NAME=Windows ' self.configure_options += ['-DCMAKE_SYSTEM_NAME=Windows']
elif self.config.target_platform == Platform.ANDROID: elif self.config.target_platform == Platform.ANDROID:
self.configure_options += ' -DCMAKE_SYSTEM_NAME=Linux ' self.configure_options += ['-DCMAKE_SYSTEM_NAME=Linux']
if self.config.platform == Platform.WINDOWS: if self.config.platform == Platform.WINDOWS:
self.configure_options += ' -G"Unix Makefiles"' self.configure_options += ['-G', 'Unix Makefiles']
# FIXME: Maybe export the sysroot properly instead of doing regexp magic # FIXME: Maybe export the sysroot properly instead of doing regexp magic
if self.config.target_platform in [Platform.DARWIN, Platform.IOS]: if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
r = re.compile(r".*-isysroot ([^ ]+) .*") r = re.compile(r".*-isysroot ([^ ]+) .*")
sysroot = r.match(cflags).group(1) sysroot = r.match(cflags).group(1)
self.configure_options += ' -DCMAKE_OSX_SYSROOT=%s' % sysroot self.configure_options += ['-DCMAKE_OSX_SYSROOT=' + sysroot]
self.configure_options += ' -DCMAKE_C_COMPILER=%s ' % cc self.configure_options += [
self.configure_options += ' -DCMAKE_CXX_COMPILER=%s ' % cxx '-DCMAKE_C_COMPILER=' + cc,
self.configure_options += ' -DCMAKE_C_FLAGS="%s"' % cflags '-DCMAKE_CXX_COMPILER=' + cxx,
self.configure_options += ' -DCMAKE_CXX_FLAGS="%s"' % cxxflags '-DCMAKE_C_FLAGS=' + cflags,
self.configure_options += ' -DLIB_SUFFIX=%s ' % self.config.lib_suffix '-DCMAKE_CXX_FLAGS=' + cxxflags,
'-DLIB_SUFFIX=' + self.config.lib_suffix,
]
cmake_cache = os.path.join(self.make_dir, 'CMakeCache.txt') cmake_cache = os.path.join(self.make_dir, 'CMakeCache.txt')
cmake_files = os.path.join(self.make_dir, 'CMakeFiles') cmake_files = os.path.join(self.make_dir, 'CMakeFiles')
...@@ -624,7 +655,7 @@ class CMake (MakefilesBase): ...@@ -624,7 +655,7 @@ class CMake (MakefilesBase):
os.remove(cmake_cache) os.remove(cmake_cache)
if os.path.exists(cmake_files): if os.path.exists(cmake_files):
shutil.rmtree(cmake_files) shutil.rmtree(cmake_files)
self.make += ' VERBOSE=1 ' self.make += ['VERBOSE=1']
await MakefilesBase.configure(self) await MakefilesBase.configure(self)
...@@ -662,6 +693,7 @@ class Meson (Build, ModifyEnvBase) : ...@@ -662,6 +693,7 @@ class Meson (Build, ModifyEnvBase) :
make_install = None make_install = None
make_check = None make_check = None
make_clean = None make_clean = None
meson_sh = None meson_sh = None
meson_options = None meson_options = None
meson_cross_properties = None meson_cross_properties = None
...@@ -690,13 +722,13 @@ class Meson (Build, ModifyEnvBase) : ...@@ -690,13 +722,13 @@ class Meson (Build, ModifyEnvBase) :
# Find ninja # Find ninja
if not self.make: if not self.make:
self.make = 'ninja -v -d keeprsp' self.make = ['ninja', '-v', '-d', 'keeprsp']
if not self.make_install: if not self.make_install:
self.make_install = self.make + ' install' self.make_install = self.make + ['install']
if not self.make_check: if not self.make_check:
self.make_check = self.make + ' test' self.make_check = self.make + ['test']
if not self.make_clean: if not self.make_clean:
self.make_clean = self.make + ' clean' self.make_clean = self.make + ['clean']
@staticmethod @staticmethod
def _get_option_value(opt_type, value): def _get_option_value(opt_type, value):
......
...@@ -22,7 +22,7 @@ class Recipe(recipe.Recipe): ...@@ -22,7 +22,7 @@ class Recipe(recipe.Recipe):
sysroot = os.path.join(self.config.prefix, self.host, 'sysroot') sysroot = os.path.join(self.config.prefix, self.host, 'sysroot')
self.configure_options += ' --host=%s' % self.host self.configure_options += ' --host=%s' % self.host
self.configure_options += ' --with-sysroot=%s ' % sysroot self.configure_options += ' --with-sysroot=%s ' % sysroot
self.make_install = 'make install DESTDIR=%s' % sysroot self.make_install = ['make', 'install', 'DESTDIR=' + sysroot]
self.build_dir = os.path.join(self.config.sources, self.build_dir = os.path.join(self.config.sources,
'mingw-w64-%s' % self.version) 'mingw-w64-%s' % self.version)
self.make_dir = os.path.join(self.build_dir, 'mingw-w64-crt') self.make_dir = os.path.join(self.build_dir, 'mingw-w64-crt')
......
...@@ -16,7 +16,7 @@ class Recipe(recipe.Recipe): ...@@ -16,7 +16,7 @@ class Recipe(recipe.Recipe):
self._sysroot = os.path.join(self.config.prefix, self.host, 'sysroot') self._sysroot = os.path.join(self.config.prefix, self.host, 'sysroot')
self.configure_options += ' --host=%s' % self.host self.configure_options += ' --host=%s' % self.host
self.configure_options += ' --with-sysroot=%s ' % self._sysroot self.configure_options += ' --with-sysroot=%s ' % self._sysroot
self.make_install = 'make install DESTDIR=%s' % self._sysroot self.make_install = ['make', 'install', 'DESTDIR=' + self._sysroot]
self.build_dir = os.path.join(self.config.sources, self.build_dir = os.path.join(self.config.sources,
'mingw-w64-%s' % self.version) 'mingw-w64-%s' % self.version)
self.make_dir = os.path.join(self.build_dir, 'mingw-w64-headers') self.make_dir = os.path.join(self.build_dir, 'mingw-w64-headers')
......
...@@ -39,7 +39,7 @@ class Recipe(recipe.Recipe): ...@@ -39,7 +39,7 @@ class Recipe(recipe.Recipe):
self.host = 'x86_64-w64-mingw32' self.host = 'x86_64-w64-mingw32'
self.sysroot = os.path.join(self.config.prefix, self.host, 'sysroot') self.sysroot = os.path.join(self.config.prefix, self.host, 'sysroot')
self.configure_options += ' --with-sysroot=%s ' % self.sysroot self.configure_options += ' --with-sysroot=%s ' % self.sysroot
self.make_install = 'make install DESTDIR=%s' % self.sysroot self.make_install = ['make', 'install', 'DESTDIR=' + self.sysroot]
self.build_dir = os.path.join(self.config.sources, self.build_dir = os.path.join(self.config.sources,
'mingw-w64-%s' % self.version) 'mingw-w64-%s' % self.version)
self.make_dir = os.path.join(self.config.sources, self.make_dir = os.path.join(self.config.sources,
...@@ -62,7 +62,7 @@ class Recipe(recipe.Recipe): ...@@ -62,7 +62,7 @@ class Recipe(recipe.Recipe):
"RCFLAGS='-F pe-i386' DLLTOOLFLAGS='-m i386'" "RCFLAGS='-F pe-i386' DLLTOOLFLAGS='-m i386'"
host = 'i386-w64-mingw32' host = 'i386-w64-mingw32'
libdir = "/usr/%s/lib32" % self.host libdir = "/usr/%s/lib32" % self.host
shell.call('%s ../configure --bindir=%s --libdir=%s --prefix=/usr/%s --host=%s %s' %\ shell.new_call('%s ../configure --bindir=%s --libdir=%s --prefix=/usr/%s --host=%s %s' %\
(flags, libdir, libdir, host, host, self.configure_options), (flags, libdir, libdir, host, host, self.configure_options),
self.build_dir_32) self.build_dir_32)
...@@ -74,13 +74,13 @@ class Recipe(recipe.Recipe): ...@@ -74,13 +74,13 @@ class Recipe(recipe.Recipe):
"LD=x86_64-w64-mingw32-ld LDFLAGS=' -m64' CFLAGS=' -m64' CXXFLAGS=' -m64' " "LD=x86_64-w64-mingw32-ld LDFLAGS=' -m64' CFLAGS=' -m64' CXXFLAGS=' -m64' "
host = 'x86_64-w64-mingw32' host = 'x86_64-w64-mingw32'
libdir = "/usr/%s/lib" % self.host libdir = "/usr/%s/lib" % self.host
shell.call('%s ../configure --bindir=%s --libdir=%s --prefix=/usr/%s --host=%s %s' %\ shell.new_call('%s ../configure --bindir=%s --libdir=%s --prefix=/usr/%s --host=%s %s' %\
(flags, libdir, libdir, host, host, self.configure_options), (flags, libdir, libdir, host, host, self.configure_options),
self.build_dir_64) self.build_dir_64)
def compile(self): def compile(self):
shell.call(self.make, self.build_dir_32) shell.new_call(self.make, self.build_dir_32)
shell.call(self.make, self.build_dir_64) shell.new_call(self.make, self.build_dir_64)
@modify_environment @modify_environment
def install(self): def install(self):
...@@ -88,11 +88,11 @@ class Recipe(recipe.Recipe): ...@@ -88,11 +88,11 @@ class Recipe(recipe.Recipe):
(self.sysroot, self.host) (self.sysroot, self.host)
libdir = "%s/usr/%s/lib32/" % (self.sysroot, self.host) libdir = "%s/usr/%s/lib32/" % (self.sysroot, self.host)
dest_winpthread_dll = os.path.join(libdir, "libwinpthread-1.dll") dest_winpthread_dll = os.path.join(libdir, "libwinpthread-1.dll")
shell.call(self.make_install, self.build_dir_32) shell.new_call(self.make_install, self.build_dir_32)
if os.path.exists(dest_winpthread_dll): if os.path.exists(dest_winpthread_dll):
os.remove(dest_winpthread_dll) os.remove(dest_winpthread_dll)
shutil.move(src_winpthread_dll, dest_winpthread_dll) shutil.move(src_winpthread_dll, dest_winpthread_dll)
shell.call(self.make_install, self.build_dir_64) shell.new_call(self.make_install, self.build_dir_64)
libdir = "%s/usr/%s/lib/" % (self.sysroot, self.host) libdir = "%s/usr/%s/lib/" % (self.sysroot, self.host)
dest_winpthread_dll = os.path.join(libdir, "libwinpthread-1.dll") dest_winpthread_dll = os.path.join(libdir, "libwinpthread-1.dll")
if os.path.exists(dest_winpthread_dll): if os.path.exists(dest_winpthread_dll):
......
...@@ -96,7 +96,7 @@ class Recipe(recipe.Recipe): ...@@ -96,7 +96,7 @@ class Recipe(recipe.Recipe):
# On Windows, make fails if V=1 is passed with: # On Windows, make fails if V=1 is passed with:
# `couldn't commit memory for cygwin heap, Win32 error 0` # `couldn't commit memory for cygwin heap, Win32 error 0`
if self.config.platform == Platform.WINDOWS: if self.config.platform == Platform.WINDOWS:
self.make = 'make ' self.make = ['make']
async def configure(self): async def configure(self):
await super(recipe.Recipe, self).configure() await super(recipe.Recipe, self).configure()
......
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python # -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import shlex
from cerbero.tools.libtool import LibtoolLibrary from cerbero.tools.libtool import LibtoolLibrary
...@@ -28,14 +27,14 @@ class Recipe(recipe.Recipe): ...@@ -28,14 +27,14 @@ class Recipe(recipe.Recipe):
if self.config.target_platform in [Platform.LINUX, Platform.ANDROID]: if self.config.target_platform in [Platform.LINUX, Platform.ANDROID]:
system = 'posix' system = 'posix'
# LDFLAGS are passed via XLDFLAGS, and are needed for at least Android # LDFLAGS are passed via XLDFLAGS, and are needed for at least Android
cc = shlex.quote(self.get_env('CC')) cc = self.get_env('CC')
ld = shlex.quote(self.get_env('LD')) ld = self.get_env('LD')
prefix = shlex.quote(self.config.prefix) prefix = self.config.prefix
cflags = shlex.quote(self.get_env('CFLAGS')) cflags = self.get_env('CFLAGS')
ldflags = shlex.quote(self.get_env('LDFLAGS')) ldflags = self.get_env('LDFLAGS')
self.make += ' SYS={} prefix={} CRYPTO=GNUTLS XCFLAGS={} XLDFLAGS={} CC={} LD={}' \ self.make += ['SYS=' + system, 'prefix=' + prefix, 'CRYPTO=GNUTLS', 'XCFLAGS=' + cflags,
''.format(system, prefix, cflags, ldflags, cc, ld) 'XLDFLAGS=' + ldflags, 'CC=' + cc, 'LD=' + ld]
self.make_install = self.make + ' install' self.make_install = self.make + ['install']
def post_install(self): def post_install(self):
soversion = 1 soversion = 1
......
...@@ -8,6 +8,7 @@ class Recipe(recipe.Recipe): ...@@ -8,6 +8,7 @@ class Recipe(recipe.Recipe):
name = 'libsrtp' name = 'libsrtp'
version = '2.2.0' version = '2.2.0'
stype = SourceType.TARBALL stype = SourceType.TARBALL
make = ['make', 'all', 'shared_library']
url = 'https://github.com/cisco/%(name)s/archive/v%(version)s.tar.gz' url = 'https://github.com/cisco/%(name)s/archive/v%(version)s.tar.gz'
tarball_checksum = '44fd7497bce78767e96b54a11bca520adb2ad32effd515f04bce602b60a1a50b' tarball_checksum = '44fd7497bce78767e96b54a11bca520adb2ad32effd515f04bce602b60a1a50b'
licenses = [{License.BSD_like: ['LICENSE']}] licenses = [{License.BSD_like: ['LICENSE']}]
...@@ -19,7 +20,6 @@ class Recipe(recipe.Recipe): ...@@ -19,7 +20,6 @@ class Recipe(recipe.Recipe):
def prepare(self): def prepare(self):
# Don't accidentially build with pcap support # Don't accidentially build with pcap support
self.set_env('ac_cv_lib_pcap_pcap_create', 'no') self.set_env('ac_cv_lib_pcap_pcap_create', 'no')
self.make += ' all shared_library'
async def install(self): async def install(self):
await super(Recipe, self).install() await super(Recipe, self).install()
......
...@@ -22,7 +22,7 @@ class Recipe(recipe.Recipe): ...@@ -22,7 +22,7 @@ class Recipe(recipe.Recipe):
add_host_build_target = False add_host_build_target = False
supports_cache_variables = False supports_cache_variables = False
can_use_configure_cache = False can_use_configure_cache = False
make = 'make HAVE_GNU_STRIP=no' make = ['make', 'HAVE_GNU_STRIP=no']
# The shell-based build system magically supports Visual Studio with the # The shell-based build system magically supports Visual Studio with the
# power of awesome hacks # power of awesome hacks
can_msvc = True can_msvc = True
......
...@@ -19,57 +19,56 @@ class Recipe(recipe.Recipe): ...@@ -19,57 +19,56 @@ class Recipe(recipe.Recipe):
def prepare(self): def prepare(self):
make = self.make make = self.make
if self.config.target_platform == Platform.IOS: if self.config.target_platform == Platform.IOS:
make += ' OS=ios ' make += ['OS=ios']
if self.config.target_arch == Architecture.X86: if self.config.target_arch == Architecture.X86:
make += ' ARCH=i386' make += ['ARCH=i386']
elif self.config.target_arch == Architecture.X86_64: elif self.config.target_arch == Architecture.X86_64:
make += ' ARCH=x86_64' make += ['ARCH=x86_64']
elif self.config.target_arch == Architecture.ARMv7: elif self.config.target_arch == Architecture.ARMv7:
make += ' ARCH=armv7' make += ['ARCH=armv7']
elif self.config.target_arch == Architecture.ARMv7S: elif self.config.target_arch == Architecture.ARMv7S:
make += ' ARCH=armv7s' make += ['ARCH=armv7s']
elif self.config.target_arch == Architecture.ARM: elif self.config.target_arch == Architecture.ARM:
make += ' ARCH=arm APP_ABI=armeabi' make += ['ARCH=arm', 'APP_ABI=armeabi']
elif self.config.target_arch == Architecture.ARM64: elif self.config.target_arch == Architecture.ARM64:
make += ' ARCH=arm64' make += ['ARCH=arm64']
elif self.config.target_platform == Platform.DARWIN: elif self.config.target_platform == Platform.DARWIN:
make += ' OS=darwin ' make += ['OS=darwin']
if self.config.target_arch == Architecture.X86: if self.config.target_arch == Architecture.X86:
make += ' ARCH=x86' make += ['ARCH=x86']
elif self.config.target_arch == Architecture.X86_64: elif self.config.target_arch == Architecture.X86_64:
make += ' ARCH=x86_64' make += ['ARCH=x86_64']
elif self.config.target_platform == Platform.ANDROID: elif self.config.target_platform == Platform.ANDROID:
v = DistroVersion.get_android_api_version(self.config.target_distro_version) v = DistroVersion.get_android_api_version(self.config.target_distro_version)
make += ' OS=android TARGET=android-' + str(v) + ' NDKLEVEL=' + str(v) make += ['OS=android', 'TARGET=android-' + str(v), 'NDKLEVEL=' + str(v)]
make += ' NDKROOT=' + self.config.toolchain_prefix make += ['NDKROOT=' + self.config.toolchain_prefix]
if self.config.target_arch == Architecture.X86: if self.config.target_arch == Architecture.X86:
make += ' ARCH=x86'
# According to https://github.com/cisco/openh264/issues/2263 # According to https://github.com/cisco/openh264/issues/2263
# to fix text relocations # need to pass ENABLEPIC=Yes to fix text relocations
make += ' ENABLEPIC=Yes' make += ['ARCH=x86', 'ENABLEPIC=Yes']
elif self.config.target_arch == Architecture.ARM64: elif self.config.target_arch == Architecture.ARM64:
make += ' ARCH=arm64' make += ['ARCH=arm64']
elif self.config.target_arch == Architecture.X86_64: elif self.config.target_arch == Architecture.X86_64:
make += ' ARCH=x86_64' make += ['ARCH=x86_64']
elif self.config.target_platform == Platform.WINDOWS: elif self.config.target_platform == Platform.WINDOWS:
make += ' OS=mingw_nt' make += ['OS=mingw_nt']
if self.config.target_arch == Architecture.X86: if self.config.target_arch == Architecture.X86:
make += ' ARCH=x86' make += ['ARCH=x86']
elif self.config.target_arch == Architecture.X86_64: elif self.config.target_arch == Architecture.X86_64:
make += ' ARCH=x86_64' make += ['ARCH=x86_64']
elif self.config.target_platform == Platform.LINUX: elif self.config.target_platform == Platform.LINUX:
if self.config.target_arch == Architecture.ARMv7: if self.config.target_arch == Architecture.ARMv7:
make += ' ARCH=armv7' make += ['ARCH=armv7']
elif self.config.target_arch == Architecture.ARMv7S: elif self.config.target_arch == Architecture.ARMv7S:
make += ' ARCH=armv7s' make += ['ARCH=armv7s']
elif self.config.target_arch == Architecture.ARM: elif self.config.target_arch == Architecture.ARM:
make += ' ARCH=arm APP_ABI=armeabi' make += ['ARCH=arm', 'APP_ABI=armeabi']
elif self.config.target_arch == Architecture.ARM64: elif self.config.target_arch == Architecture.ARM64:
make += ' ARCH=arm64' make += ['ARCH=arm64']
self.make = make + ' libraries' self.make = make + ['libraries']
# `make install` also needs the exact same parameters as `make` # `make install` also needs the exact same parameters as `make`
self.make_install = make + ' install' self.make_install = make + ['install']
def configure(self): def configure(self):
if self.config.platform == Platform.WINDOWS: if self.config.platform == Platform.WINDOWS:
......
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python # -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import shlex
from cerbero.build.build import async_modify_environment from cerbero.build.build import async_modify_environment
from cerbero.tools.libtool import LibtoolLibrary from cerbero.tools.libtool import LibtoolLibrary
from cerbero.utils import shell, messages from cerbero.utils import shell, messages
...@@ -17,6 +16,8 @@ class Recipe(recipe.Recipe): ...@@ -17,6 +16,8 @@ class Recipe(recipe.Recipe):
deps = ['zlib'] deps = ['zlib']
# Parallel make fails randomly due to undefined macros, probably races # Parallel make fails randomly due to undefined macros, probably races
allow_parallel_build = False allow_parallel_build = False
# Configure script is perl, not shell
config_sh_needs_shell = False
files_bins = ['openssl'] files_bins = ['openssl']
files_libs = ['libcrypto', 'libssl'] files_libs = ['libcrypto', 'libssl']
...@@ -52,7 +53,7 @@ class Recipe(recipe.Recipe): ...@@ -52,7 +53,7 @@ class Recipe(recipe.Recipe):
else: else:
raise NotImplementedError raise NotImplementedError
self.make += ' CROSS_SYSROOT="{0}"'.format(self.config.sysroot) self.make += ['CROSS_SYSROOT=' + self.config.sysroot]
elif self.config.target_platform == Platform.DARWIN: elif self.config.target_platform == Platform.DARWIN:
if self.config.target_arch == Architecture.X86: if self.config.target_arch == Architecture.X86:
self.openssl_platform = 'darwin-i386-cc' self.openssl_platform = 'darwin-i386-cc'
...@@ -80,33 +81,31 @@ class Recipe(recipe.Recipe): ...@@ -80,33 +81,31 @@ class Recipe(recipe.Recipe):
self.openssl_platform = 'mingw64' self.openssl_platform = 'mingw64'
else: else:
raise NotImplementedError raise NotImplementedError
cflags = shlex.quote(self.get_env('CFLAGS') + '-fPIC -DOPENSSL_PIC') cflags = self.get_env('CFLAGS') + '-fPIC -DOPENSSL_PIC'
ldflags = shlex.quote(self.get_env('LDFLAGS') + '-fPIC') ldflags = self.get_env('LDFLAGS') + '-fPIC'
ranlib = shlex.quote(self.get_env('RANLIB')) ranlib = self.get_env('RANLIB')
ar = shlex.quote(self.get_env('AR')) ar = self.get_env('AR')
# Need to add CFLAGS to CC because CFLAG is not used everywhere in the # Need to add CFLAGS to CC because CFLAG is not used everywhere in the
# build, and we can't pass arguments via Configure because on Darwin, # build, and we can't pass arguments via Configure because on Darwin,
# Configure reads the `-arch x86_64` as meaning that you want to use # Configure reads the `-arch x86_64` as meaning that you want to use
# `x86_64` as the platform, and errors out about a redefined platform. # `x86_64` as the platform, and errors out about a redefined platform.
cc = shlex.quote(self.get_env('CC') + ' ' + self.get_env('CFLAGS'))