diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-03-17 00:51:19 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-03-18 03:30:49 +0530 |
commit | d130cba464d6f8a5e0e9d4688d77178680489138 (patch) | |
tree | 3a04d18677247c3649d66e91788851aa38360f63 | |
parent | 3496589b3d56d5c7b0c71e059237e7269dc4be01 (diff) |
cerbero/windows: Skip DLL/implib code when only static
Previously we were hard-coding libvpx for this, but now we have
a recipe attribute self.library_type to communicate this.
Also, ensure that libvpx always installs `libvpx.a` even when building
with MSVC.
-rw-r--r-- | cerbero/build/filesprovider.py | 16 | ||||
-rw-r--r-- | cerbero/build/recipe.py | 6 | ||||
-rw-r--r-- | recipes/libvpx.recipe | 2 |
3 files changed, 11 insertions, 13 deletions
diff --git a/cerbero/build/filesprovider.py b/cerbero/build/filesprovider.py index e9903ec5..5e64aa26 100644 --- a/cerbero/build/filesprovider.py +++ b/cerbero/build/filesprovider.py @@ -85,11 +85,6 @@ def find_dll_implib(config, libname, prefix, libdir, ext, regex): path = os.path.join(prefix, libdir, dllname) if os.path.exists(path): return [os.path.join(libdir, dllname)] - # libvpx's build system does not build DLLs on Windows, so it's expected - # that the DLL can't be found. Similar code exists in _search_libraries() - # XXX: Remove this when libvpx is ported to Meson. - if libname == 'vpx': - return [] if len(implib_notfound) == len(implibs): m.warning("No import libraries found for {!r}".format(libname)) else: @@ -371,6 +366,8 @@ class FilesProvider(object): files. We use the libname (the key) in gen_library_file so we don't have to guess (incorrectly) based on the dll filename. ''' + if self.library_type == LibraryType.STATIC: + return {} libdir = self.extensions['sdir'] libext = self.extensions['srext'] libregex = self.extensions['sregex'] @@ -386,7 +383,7 @@ class FilesProvider(object): for f in files: libsmatch[f] = find_func(self.config, f[3:], self.config.prefix, libdir, libext, libregex) - if not libsmatch[f] and f != 'libvpx': + if not libsmatch[f]: notfound.append(f) # It's ok if shared libraries aren't found for iOS, we only want the @@ -536,8 +533,11 @@ class FilesProvider(object): libsmatch.append(pattern % {'f': x, 'fnolib': x[3:]}) # PDB names are derived from DLL library names (which are # arbitrary), so we must use the same search function for them. - if self.platform == Platform.WINDOWS and self.can_msvc: - devel_libs += find_pdb_implib(self.config, x[3:], self.config.prefix) + if self.platform != Platform.WINDOWS or not self.using_msvc(): + continue + if self.library_type in (LibraryType.STATIC, LibraryType.NONE): + continue + devel_libs += find_pdb_implib(self.config, x[3:], self.config.prefix) devel_libs.extend(shell.ls_files(libsmatch, self.config.prefix)) return devel_libs diff --git a/cerbero/build/recipe.py b/cerbero/build/recipe.py index 1277853e..cb8d7114 100644 --- a/cerbero/build/recipe.py +++ b/cerbero/build/recipe.py @@ -26,7 +26,7 @@ import asyncio from functools import reduce from pathlib import Path -from cerbero.enums import LicenseDescription +from cerbero.enums import LicenseDescription, LibraryType from cerbero.build import build, source from cerbero.build.filesprovider import FilesProvider, UniversalFilesProvider, UniversalFlatFilesProvider from cerbero.config import Platform @@ -609,9 +609,7 @@ SOFTWARE LICENSE COMPLIANCE.\n\n''' m.warning("BUG: Found multiple DLLs for libname {!r}:\n{}".format(libname, '\n'.join(dllpaths))) continue if len(dllpaths) == 0: - # libvpx only outputs a static library on Windows - if self.name != 'libvpx' or self.config.target_platform != Platform.WINDOWS: - m.warning("Could not create import library for {!r}, no matching DLLs found".format(libname)) + m.warning("Could not create import library for {!r}, no matching DLLs found".format(libname)) continue try: implib = genlib.create(libname, diff --git a/recipes/libvpx.recipe b/recipes/libvpx.recipe index f292bed8..69e2671d 100644 --- a/recipes/libvpx.recipe +++ b/recipes/libvpx.recipe @@ -145,7 +145,7 @@ class Recipe(recipe.Recipe): else: subdir = 'Win32' os.replace(os.path.join(self.config.prefix, 'lib', subdir, 'vpxmd.lib'), - os.path.join(self.config.prefix, 'lib', 'vpx.lib')) + os.path.join(self.config.prefix, 'lib', 'libvpx.a')) LibtoolLibrary('vpx', None, None, None, self.config.libdir, self.config.target_platform).save() if self.config.target_platform == Platform.DARWIN: |