Skip to content
Snippets Groups Projects
Commit 116eb260 authored by Andy Postnikov's avatar Andy Postnikov Committed by Kevin Daudt
Browse files

main/brotli: upgrade to 1.1.0

using cmake, add python tests and switch to gpep517
parent 22f691c2
No related branches found
No related tags found
1 merge request!51027main/brotli: upgrade to 1.1.0
Pipeline #185604 skipped
From 0545759b2ed9b69e3f21fd0ac954bee78f3104b6 Mon Sep 17 00:00:00 2001
From: Evgenii Kliuchnikov <eustas.ru@gmail.com>
Date: Fri, 28 Aug 2020 10:14:08 +0200
Subject: [PATCH] Address issues noted in #833
---
bootstrap | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/bootstrap b/bootstrap
index 92d458f2..33525890 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,4 +1,4 @@
-# !/bin/sh -e
+#!/bin/sh -e
if [ `uname -s` = "Darwin" ]; then
echo "WARNING: OSX autogen build is not supported"
@@ -13,20 +13,22 @@ autoreconf --version >/dev/null 2>&1 || { echo >&2 "'autoconf' $REQUIRED"; exit
# If libtool is not installed -> "error: Libtool library used but 'LIBTOOL' is undefined"
+if [ ! -e "./m4" ]; then
mkdir m4 2>/dev/null
+fi
BROTLI_ABI_HEX=`sed -n 's/#define BROTLI_ABI_VERSION 0x//p' c/common/version.h`
BROTLI_ABI_INT=`echo "ibase=16;$BROTLI_ABI_HEX" | bc`
-BROTLI_ABI_CURRENT=`expr $BROTLI_ABI_INT / 16777216`
-BROTLI_ABI_REVISION=`expr $BROTLI_ABI_INT / 4096 % 4096`
-BROTLI_ABI_AGE=`expr $BROTLI_ABI_INT % 4096`
+BROTLI_ABI_CURRENT=`echo "$BROTLI_ABI_INT / 16777216" | bc`
+BROTLI_ABI_REVISION=`echo "$BROTLI_ABI_INT / 4096 % 4096" | bc`
+BROTLI_ABI_AGE=`echo "$BROTLI_ABI_INT % 4096" | bc`
BROTLI_ABI_INFO="$BROTLI_ABI_CURRENT:$BROTLI_ABI_REVISION:$BROTLI_ABI_AGE"
BROTLI_VERSION_HEX=`sed -n 's/#define BROTLI_VERSION 0x//p' c/common/version.h`
BROTLI_VERSION_INT=`echo "ibase=16;$BROTLI_VERSION_HEX" | bc`
-BROTLI_VERSION_MAJOR=`expr $BROTLI_VERSION_INT / 16777216`
-BROTLI_VERSION_MINOR=`expr $BROTLI_VERSION_INT / 4096 % 4096`
-BROTLI_VERSION_PATCH=`expr $BROTLI_VERSION_INT % 4096`
+BROTLI_VERSION_MAJOR=`echo "$BROTLI_VERSION_INT / 16777216" | bc`
+BROTLI_VERSION_MINOR=`echo "$BROTLI_VERSION_INT / 4096 % 4096" | bc`
+BROTLI_VERSION_PATCH=`echo "$BROTLI_VERSION_INT % 4096" | bc`
BROTLI_VERSION="$BROTLI_VERSION_MAJOR.$BROTLI_VERSION_MINOR.$BROTLI_VERSION_PATCH"
sed -i.bak -r "s/[0-9]+:[0-9]+:[0-9]+/$BROTLI_ABI_INFO/" Makefile.am
Upstream: Yes
Reason: Fixes #11948
From 092446fafb4bfb81738853b7c7f76b293cd92a80 Mon Sep 17 00:00:00 2001
From: Evgenii Kliuchnikov <eustas.ru@gmail.com>
Date: Wed, 2 Sep 2020 10:49:49 +0200
Subject: [PATCH] Revert "Add runtime linker path to pkg-config files (#740)"
This reverts commit 31754d4ffce14153b5c2addf7a11019ec23f51c1.
---
scripts/libbrotlicommon.pc.in | 2 +-
scripts/libbrotlidec.pc.in | 2 +-
scripts/libbrotlienc.pc.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/libbrotlicommon.pc.in b/scripts/libbrotlicommon.pc.in
index 10ca969e..2a8cf7a3 100644
--- a/scripts/libbrotlicommon.pc.in
+++ b/scripts/libbrotlicommon.pc.in
@@ -7,5 +7,5 @@ Name: libbrotlicommon
URL: https://github.com/google/brotli
Description: Brotli common dictionary library
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -R${libdir} -lbrotlicommon
+Libs: -L${libdir} -lbrotlicommon
Cflags: -I${includedir}
diff --git a/scripts/libbrotlidec.pc.in b/scripts/libbrotlidec.pc.in
index e7c3124f..6f8ef2e4 100644
--- a/scripts/libbrotlidec.pc.in
+++ b/scripts/libbrotlidec.pc.in
@@ -7,6 +7,6 @@ Name: libbrotlidec
URL: https://github.com/google/brotli
Description: Brotli decoder library
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -R${libdir} -lbrotlidec
+Libs: -L${libdir} -lbrotlidec
Requires.private: libbrotlicommon >= 1.0.2
Cflags: -I${includedir}
diff --git a/scripts/libbrotlienc.pc.in b/scripts/libbrotlienc.pc.in
index 4dd0811b..2098afe2 100644
--- a/scripts/libbrotlienc.pc.in
+++ b/scripts/libbrotlienc.pc.in
@@ -7,6 +7,6 @@ Name: libbrotlienc
URL: https://github.com/google/brotli
Description: Brotli encoder library
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -R${libdir} -lbrotlienc
+Libs: -L${libdir} -lbrotlienc
Requires.private: libbrotlicommon >= 1.0.2
Cflags: -I${includedir}
# Contributor: prspkt <prspkt@protonmail.com>
# Maintainer: prspkt <prspkt@protonmail.com>
pkgname=brotli
pkgver=1.0.9
pkgrel=15
pkgver=1.1.0
pkgrel=0
pkgdesc="Generic lossless compressor"
url="https://github.com/google/brotli"
arch="all"
license="MIT"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends_build="automake autoconf libtool"
makedepends_build="cmake samurai"
subpackages="
$pkgname-doc
$pkgname-static
......@@ -16,14 +16,11 @@ subpackages="
$pkgname-libs
"
if [ -z "$BOOTSTRAP" ]; then
makedepends_host="python3-dev"
makedepends_host="python3-dev py3-gpep517 py3-setuptools py3-wheel"
subpackages="$subpackages py3-$pkgname-pyc py3-$pkgname:py3"
fi
source="$pkgname-$pkgver.tar.gz::https://github.com/google/brotli/archive/refs/tags/v$pkgver.tar.gz
optimize-mips-s390x.patch
build-tool-against-shared-lib.patch
838.patch
0545759b2ed9b69e3f21fd0ac954bee78f3104b6.patch
"
# secfixes:
......@@ -33,46 +30,53 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/google/brotli/archive/refs/t
prepare() {
default_prepare
sed -i 's,/usr/bin/env bash,/bin/sh,' tests/*.sh
sh ./bootstrap
}
build() {
# use sysroot when cross compiling to avoid libtool pulling in host libs
if [ "$CBUILD" != "$CHOST" ]; then
local cross_configure="--with-sysroot=$CBUILDROOT"
else
CFLAGS="$CFLAGS -flto=auto"
CPPFLAGS="$CPPFLAGS -flto=auto"
fi
export CFLAGS="$CFLAGS -flto=auto -O2"
CFLAGS="$CFLAGS -O2" \
./configure \
--build=$CBUILD \
--host=$CHOST \
--target=$CTARGET \
--prefix=/usr \
$_cross_configure
# static libs, see https://github.com/google/brotli/issues/795
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_SHARED_LIBS=OFF
cmake --build build
make
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_SHARED_LIBS=ON
cmake --build build
if [ -z "$BOOTSTRAP" ]; then
python3 setup.py build
gpep517 build-wheel \
--wheel-dir .dist \
--output-fd 3 3>&1 >&2
fi
}
check() {
make check
ctest --output-on-failure --test-dir build
python3 -m venv --clear --without-pip --system-site-packages .testenv
.testenv/bin/python3 -m installer .dist/*.whl
cd python; ../.testenv/bin/python3 -m unittest discover -v -p '*_test.py'
}
package() {
make DESTDIR="$pkgdir" install
DESTDIR="$pkgdir" cmake --install build
local file; for file in common dec enc; do
install -D -m 755 "$builddir"/build/libbrotli$file.a \
"$pkgdir"/usr/lib/
done
local man; for man in docs/*.?; do
install -D -m644 $man "$pkgdir"/usr/share/man/man${man##*.}/${man##*/}
done
if [ -z "$BOOTSTRAP" ]; then
python3 setup.py install --skip-build --root="$pkgdir"
python3 -m installer -d "$pkgdir" .dist/*.whl
fi
}
......@@ -83,9 +87,6 @@ py3() {
}
sha512sums="
b8e2df955e8796ac1f022eb4ebad29532cb7e3aa6a4b6aee91dbd2c7d637eee84d9a144d3e878895bb5e62800875c2c01c8f737a1261020c54feacf9f676b5f5 brotli-1.0.9.tar.gz
59e934578ce23b703f8f25f56578f8e9fd1466a9844b6f67b542acd6496df352548e3762697dc3851cfd0f8e1bad170bfdaa3e8a87c901fe81e2f3042e3aee84 optimize-mips-s390x.patch
f4a7653a0f7ef69f059d7f744a48c7731c8e66f977ce2e66cd106f697e82aa1f005923898d216a3d8be143b2dc8db1927c09daedb981818e752640a333d75fbc build-tool-against-shared-lib.patch
58ef677595f0db80b7d1353e42603cc30ef9b0b9530927f731ee31ac60ad9a3b2aac960a5cd100f8b10e547c9534e1ebf78c53550b52eed6fb3b7fb853317d20 838.patch
6b7953f09c7ce4219dd9411d53fcd495e0de92f210c53be43dcd235a47050b10933b347fcc8e92d7e3fd89b12375eb0deea61b01eb279902079fa7b7aca62a5a 0545759b2ed9b69e3f21fd0ac954bee78f3104b6.patch
6eb280d10d8e1b43d22d00fa535435923c22ce8448709419d676ff47d4a644102ea04f488fc65a179c6c09fee12380992e9335bad8dfebd5d1f20908d10849d9 brotli-1.1.0.tar.gz
3f91155c76c27268b94515087d042b6669f790027cb394c694ec492bf2d5a9a98272fc501d179b4b3736a8be3e016189d2d996ee50ae3e07b52f21857cbfc391 optimize-mips-s390x.patch
"
Upstream: no.
Reason: Without it the tool is linked staticlly.
GH has an issue requesting an option to build against the shared lib.
URL: https://github.com/google/brotli/issues/803
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -183,7 +183,7 @@
# Build the brotli executable
add_executable(brotli ${BROTLI_CLI_C})
-target_link_libraries(brotli ${BROTLI_LIBRARIES_STATIC})
+target_link_libraries(brotli ${BROTLI_LIBRARIES})
# Installation
if(NOT BROTLI_BUNDLED_MODE)
......@@ -2,8 +2,8 @@ diff --git a/c/common/platform.h b/c/common/platform.h
index 84c448c..853fa83 100755
--- a/c/common/platform.h
+++ b/c/common/platform.h
@@ -223,12 +223,21 @@ OR:
#define BROTLI_TARGET_RISCV64
@@ -213,6 +213,14 @@
#define BROTLI_TARGET_LOONGARCH64
#endif
+#if defined(__s390x__)
......@@ -14,28 +14,11 @@ index 84c448c..853fa83 100755
+#define BROTLI_TARGET_MIPS64
+#endif
+
#if defined(BROTLI_BUILD_64_BIT)
#define BROTLI_64_BITS 1
#elif defined(BROTLI_BUILD_32_BIT)
#define BROTLI_64_BITS 0
#elif defined(BROTLI_TARGET_X64) || defined(BROTLI_TARGET_ARMV8_64) || \
- defined(BROTLI_TARGET_POWERPC64) || defined(BROTLI_TARGET_RISCV64)
+ defined(BROTLI_TARGET_POWERPC64) || defined(BROTLI_TARGET_RISCV64) || \
+ defined(BROTLI_TARGET_S390X) || defined(BROTLI_TARGET_MIPS64)
#define BROTLI_64_BITS 1
#else
#define BROTLI_64_BITS 0
@@ -279,7 +288,7 @@ OR:
#define BROTLI_ALIGNED_READ (!!1)
#elif defined(BROTLI_TARGET_X86) || defined(BROTLI_TARGET_X64) || \
defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY) || \
- defined(BROTLI_TARGET_RISCV64)
+ defined(BROTLI_TARGET_RISCV64) || defined(BROTLI_TARGET_S390X)
/* Allow unaligned read only for white-listed CPUs. */
#define BROTLI_ALIGNED_READ (!!0)
#else
@@ -289,22 +298,42 @@ OR:
#if BROTLI_ALIGNED_READ
#if defined(BROTLI_TARGET_X64) || defined(BROTLI_TARGET_ARMV8_64) || \
defined(BROTLI_TARGET_POWERPC64) || defined(BROTLI_TARGET_RISCV64) || \
defined(BROTLI_TARGET_LOONGARCH64)
@@ -285,22 +293,42 @@
/* Portable unaligned memory access: read / write values via memcpy. */
static BROTLI_INLINE uint16_t BrotliUnalignedRead16(const void* p) {
+#if defined(__mips__) && (!defined(__mips_isa_rev) || __mips_isa_rev < 6)
......@@ -75,9 +58,9 @@ index 84c448c..853fa83 100755
memcpy(p, &v, sizeof v);
+#endif
}
#else /* BROTLI_ALIGNED_READ */
/* Unaligned memory access is allowed: just cast pointer to requested type. */
@@ -385,31 +414,20 @@ static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) {
#if BROTLI_LITTLE_ENDIAN
@@ -311,31 +339,20 @@
#define BROTLI_UNALIGNED_STORE64LE BrotliUnalignedWrite64
#elif BROTLI_BIG_ENDIAN /* BROTLI_LITTLE_ENDIAN */
/* Explain compiler to byte-swap values. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment