Adapt to brotli upstream change regarding static libs

The upstream commit
641bec0e30
changed how static libraries are built and named.
This commit is contained in:
Martchus 2024-01-02 18:46:39 +01:00
parent a4dd538b8d
commit 485b123124
4 changed files with 22 additions and 19 deletions

View File

@ -1,17 +1,17 @@
# Maintainer of AUR version: drakkan <nicola.murino at gmail dot com>
# Maintainer in AUR: drakkan <nicola.murino at gmail dot com>
# This version removes the -R flag from the pkg-config file (required to build Qt 6
# which relies on the pkg-config file).
# This version includes the static library as well (in contrast
# to the version found in the AUR).
pkgname=mingw-w64-brotli
_pkgname=brotli
_gitcommit=e61745a6b7add50d380cfd7d3883dd6c62fc2c71
pkgver=1.0.9
_gitcommit=ed738e842d2fbdf2d6459e39267a633c4a9b2f5d
pkgver=1.1.0
pkgrel=2
pkgdesc='Brotli compression library (mingw-w64)'
arch=('any')
license=('MIT')
url='https://github.com/google/brotli'
url='https://github.com/google/brotli.git'
depends=('mingw-w64-gcc')
makedepends=('mingw-w64-cmake' 'git')
options=('!buildflags' '!strip' 'staticlibs')
@ -29,7 +29,11 @@ build() {
for _arch in ${_architectures}; do
cd "$srcdir"/${_pkgname}
mkdir -p build-${_arch} && pushd build-${_arch}
${_arch}-cmake ..
${_arch}-cmake -DBUILD_SHARED_LIBS=ON ..
make
popd
mkdir -p build-${_arch}-static && pushd build-${_arch}-static
${_arch}-cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/usr/$_arch/static ..
make
popd
done
@ -37,8 +41,9 @@ build() {
package() {
for _arch in ${_architectures}; do
cd "${srcdir}/${_pkgname}/build-${_arch}"
make DESTDIR="${pkgdir}" install
make -C "${srcdir}/${_pkgname}/build-${_arch}-static" DESTDIR="${pkgdir}" install
make -C "${srcdir}/${_pkgname}/build-${_arch}" DESTDIR="${pkgdir}" install
ln -s --verbose --relative --target-directory="$pkgdir"/usr/${_arch}/lib "$pkgdir"/usr/${_arch}/static/lib/*.a
find "${pkgdir}/usr/${_arch}" -name "*.exe" -exec ${_arch}-strip --strip-all {} \;
${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a

View File

@ -7,7 +7,7 @@
pkgname=static-compat-brotli
_gitcommit=ed738e842d2fbdf2d6459e39267a633c4a9b2f5d
pkgver=1.1.0
pkgrel=1
pkgrel=2
pkgdesc='Generic-purpose lossless compression algorithm'
url='https://github.com/google/brotli'
arch=('x86_64')
@ -43,8 +43,5 @@ package() {
cd ${pkgbase}
DESTDIR="$pkgdir" cmake --install build
find "$pkgdir/$static_compat_prefix" -iname '*.so*' -delete
for file in "$pkgdir/$static_compat_prefix"/lib/pkgconfig/*.pc; do
sed -i -E 's/-lbrotli(enc|dec|common)/\0-static/g' "$file"
done
install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}

View File

@ -1,6 +1,6 @@
pkgname=mingw-w64-cmake-static
pkgver=1
pkgrel=3
pkgrel=4
arch=('any')
pkgdesc='CMake wrapper for MinGW (mingw-w64, static)'
depends=('mingw-w64-cmake')

View File

@ -5,7 +5,8 @@
include("/usr/share/mingw/toolchain-@TRIPLE@.cmake")
# prefer libraries from "static" sub-prefix
set(CMAKE_FIND_ROOT_PATH "/usr/@TRIPLE@/static;${CMAKE_FIND_ROOT_PATH}")
set(CMAKE_STATIC_PREFIX "/usr/@TRIPLE@/static")
set(CMAKE_FIND_ROOT_PATH "${CMAKE_STATIC_PREFIX};${CMAKE_FIND_ROOT_PATH}")
# prefer static libraries
# note: It is of no use to set the real variable CMAKE_FIND_LIBRARY_SUFFIXES here because it gets overridden by CMake
@ -21,9 +22,9 @@ set(BOOST_USE_STATIC_LIBS ON)
set(Vulkan_LIBRARY "/usr/@TRIPLE@/lib/libvulkan.dll.a" CACHE FILEPATH "shared Vulkan IDC library")
# workaround limitations in upstream pkg-config files and CMake find modules
set(pkgcfg_lib_libbrotlicommon_brotlicommon "/usr/@TRIPLE@/lib/libbrotlicommon-static.a" CACHE INTERNAL "static libbrotlicommon")
set(pkgcfg_lib_libbrotlienc_brotlienc "/usr/@TRIPLE@/lib/libbrotlienc-static.a;/usr/@TRIPLE@/lib/libbrotlicommon-static.a" CACHE INTERNAL "static libbrotliend")
set(pkgcfg_lib_libbrotlidec_brotlidec "/usr/@TRIPLE@/lib/libbrotlidec-static.a;/usr/@TRIPLE@/lib/libbrotlicommon-static.a" CACHE INTERNAL "static libbrotlidec")
set(pkgcfg_lib_libbrotlicommon_brotlicommon "${CMAKE_STATIC_PREFIX}/lib/libbrotlicommon.a" CACHE INTERNAL "static libbrotlicommon")
set(pkgcfg_lib_libbrotlienc_brotlienc "${CMAKE_STATIC_PREFIX}/lib/libbrotlienc.a;${CMAKE_STATIC_PREFIX}/lib/libbrotlicommon.a" CACHE INTERNAL "static libbrotliend")
set(pkgcfg_lib_libbrotlidec_brotlidec "${CMAKE_STATIC_PREFIX}/lib/libbrotlidec.a;${CMAKE_STATIC_PREFIX}/lib/libbrotlicommon.a" CACHE INTERNAL "static libbrotlidec")
set(libbrotlicommon_STATIC_LDFLAGS "${pkgcfg_lib_libbrotlicommon_brotlicommon}" CACHE INTERNAL "static libbrotlicommon")
set(libbrotlienc_STATIC_LDFLAGS "${pkgcfg_lib_libbrotlienc_brotlienc}" CACHE INTERNAL "static libbrotliend")
set(libbrotlidec_STATIC_LDFLAGS "${pkgcfg_lib_libbrotlidec_brotlidec}" CACHE INTERNAL "static libbrotlidec")
@ -39,6 +40,6 @@ set(POSTGRESQL_DEPENDENCIES "-lpgcommon;-lpgport;-lintl;-lssl;-lcrypto;-lshell32
set(MYSQL_DEPENDENCIES "-lssl;-lcrypto;-lshlwapi;-lgdi32;-lws2_32;-lpthread;-lz;-lm" CACHE INTERNAL "dependencies of static MySQL/MariaDB libraries")
set(LIBPNG_DEPENDENCIES "-lz" CACHE INTERNAL "dependencies of static libpng")
set(GLIB2_DEPENDENCIES "-lintl;-lws2_32;-lole32;-lwinmm;-lshlwapi;-lm" CACHE INTERNAL "dependencies of static Glib2")
set(FREETYPE_DEPENDENCIES "-lbz2;-lharfbuzz;-lfreetype;-lbrotlidec-static;-lbrotlicommon-static" CACHE INTERNAL "dependencies of static FreeType2 library")
set(FREETYPE_DEPENDENCIES "-lbz2;-lharfbuzz;-lfreetype;-lbrotlidec;-lbrotlicommon" CACHE INTERNAL "dependencies of static FreeType2 library")
set(HARFBUZZ_DEPENDENCIES "-lglib-2.0;${GLIB2_DEPENDENCIES};-lintl;-lm;-lfreetype;-lgraphite2" CACHE INTERNAL "dependencies of static HarfBuzz library")
set(DBUS1_DEPENDENCIES "-lws2_32;-liphlpapi;-ldbghelp" CACHE INTERNAL "dependencies of static D-Bus1 library")