Backport a patch to allow clang to compile this release.

special thanks to @1480c1 for creating the patch for upstream
This commit is contained in:
Zach Bacon
2021-06-11 18:46:40 -04:00
parent 3479f31135
commit 5babe62163
2 changed files with 95 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ _realname=aom
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.1.1
pkgrel=1
pkgrel=2
pkgdesc='AV1 codec library (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
@@ -20,10 +20,12 @@ makedepends=("perl"
"${MINGW_PACKAGE_PREFIX}-ninja"
"${MINGW_PACKAGE_PREFIX}-python")
source=("https://storage.googleapis.com/aom-releases/libaom-${pkgver}.tar.gz"{,.asc}
"fix-lib-dest.patch")
"fix-lib-dest.patch"
"f19edfa.diff")
sha256sums=('7cd5e8e469268c37241df93fe61557ea0dc46980ca21b37e786e92a3d0729276'
'SKIP'
'3a202005676f91b2b5ee5d7c10792f1930b204f36a96d7d5b893ef81d375b19d')
'3a202005676f91b2b5ee5d7c10792f1930b204f36a96d7d5b893ef81d375b19d'
'7dc44a08cb6c70f6a2fcd7c1310ac96da386186a27413b8c145644d3fa5b8054')
validpgpkeys=('B002F08B74A148DAA01F7123A48E86DB0B830498')
noextract=("libaom-${pkgver}.tar.gz")
@@ -34,6 +36,7 @@ prepare() {
cd "${srcdir}/${_realname}"
patch -Np1 -i "${srcdir}"/fix-lib-dest.patch
patch -Np1 -i "${srcdir}"/f19edfa.diff
}
build() {

View File

@@ -0,0 +1,89 @@
From f19edfa95f8dc9fa596282a210757e4d6d0cd490 Mon Sep 17 00:00:00 2001
From: Christopher Degawa <christopher.degawa@intel.com>
Date: Thu, 03 Jun 2021 18:05:47 -0500
Subject: [PATCH] exports.cmake: use APPLE and WIN32 and use def for mingw-w64
mingw-w64's ld and lld automatically accepts MSVC's def files and CMake
can handle the proper flags for .def files added to a library's sources.
This fixes the export file handling for mingw-w64 lld as that lld does
not support the --version-script argument
Signed-off-by: Christopher Degawa <christopher.degawa@intel.com>
Change-Id: I18a1ce2696e2f9b083ecab3d0d60566d48b68cf0
---
diff --git a/build/cmake/exports.cmake b/build/cmake/exports.cmake
index fa7842c..4f9d043 100644
--- a/build/cmake/exports.cmake
+++ b/build/cmake/exports.cmake
@@ -17,9 +17,9 @@
# Creates the custom target which handles generation of the symbol export lists.
function(setup_exports_target)
- if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
+ if(APPLE)
set(symbol_file_ext "syms")
- elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS" AND MSVC)
+ elseif(WIN32)
set(symbol_file_ext "def")
else()
set(symbol_file_ext "ver")
@@ -43,7 +43,7 @@
-P
"${AOM_ROOT}/build/cmake/generate_exports.cmake"
SOURCES ${AOM_EXPORTS_SOURCES}
- DEPENDS ${AOM_EXPORTS_SOURCES})
+ DEPENDS ${AOM_EXPORTS_SOURCES} BYPRODUCTS ${aom_sym_file})
# Make libaom depend on the exports file, and set flags to pick it up when
# creating the dylib.
@@ -54,14 +54,12 @@
APPEND_STRING
PROPERTY LINK_FLAGS "-exported_symbols_list ${aom_sym_file}")
elseif(WIN32)
- if(NOT MSVC)
- set_property(TARGET aom
- APPEND_STRING
- PROPERTY LINK_FLAGS "-Wl,--version-script ${aom_sym_file}")
- else()
+ if(MSVC)
set_property(TARGET aom
APPEND_STRING
PROPERTY LINK_FLAGS "/DEF:${aom_sym_file}")
+ else()
+ target_sources(aom PRIVATE "${aom_sym_file}")
endif()
# TODO(tomfinegan): Sort out the import lib situation and flags for MSVC.
diff --git a/build/cmake/generate_exports.cmake b/build/cmake/generate_exports.cmake
index f1d15a0..8720ac8 100644
--- a/build/cmake/generate_exports.cmake
+++ b/build/cmake/generate_exports.cmake
@@ -23,7 +23,7 @@
if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
set(symbol_prefix "_")
-elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS" AND AOM_MSVC)
+elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS")
file(WRITE "${AOM_SYM_FILE}" "LIBRARY aom\n" "EXPORTS\n")
else()
set(symbol_suffix ";")
@@ -33,7 +33,7 @@
if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
file(REMOVE "${aom_sym_file}")
-elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS" AND AOM_MSVC)
+elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS")
file(WRITE "${aom_sym_file}" "LIBRARY aom\n" "EXPORTS\n")
else()
file(WRITE "${aom_sym_file}" "{\nglobal:\n")
@@ -47,7 +47,7 @@
foreach(exported_symbol ${exported_symbols})
string(STRIP "${exported_symbol}" exported_symbol)
- if("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS" AND AOM_MSVC)
+ if("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS")
string(SUBSTRING ${exported_symbol} 0 4 export_type)
string(COMPARE EQUAL "${export_type}" "data" is_data)
if(is_data)