From a30dabe320b4175811f2c26f9ba96bc2c1ca043c Mon Sep 17 00:00:00 2001 From: jc_gargma Date: Sun, 14 Nov 2021 13:47:56 -0800 Subject: Rebuild with CPPFLAGS patch --- 0001-Fix-CPPFLAGS-in-test-Makefile.patch | 31 +++++++++++++++++++++++++++++++ PKGBUILD | 17 +++++++++++------ 2 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 0001-Fix-CPPFLAGS-in-test-Makefile.patch diff --git a/0001-Fix-CPPFLAGS-in-test-Makefile.patch b/0001-Fix-CPPFLAGS-in-test-Makefile.patch new file mode 100644 index 0000000..22dd89b --- /dev/null +++ b/0001-Fix-CPPFLAGS-in-test-Makefile.patch @@ -0,0 +1,31 @@ +From a33d2ca97d119ef657207fc27248db4c3103531f Mon Sep 17 00:00:00 2001 +From: Thibaut Sautereau +Date: Tue, 2 Nov 2021 20:22:05 +0100 +Subject: [PATCH] Fix CPPFLAGS in test Makefile + +In particular, the _GNU_SOURCE feature test macro needs to be set in +order to correctly define mmap(2) flags such as MAP_ANONYMOUS. +Otherwise, compilation of some test files fails when CPPFLAGS is not +defined in the initial user environment, as Make then does not export it +from the root Makefile to the sub-make. +--- + test/simple-memory-corruption/Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/test/simple-memory-corruption/Makefile b/test/simple-memory-corruption/Makefile +index 609677e7e670..d217b4806565 100644 +--- a/test/simple-memory-corruption/Makefile ++++ b/test/simple-memory-corruption/Makefile +@@ -6,7 +6,8 @@ ifeq (,$(filter $(CONFIG_SLAB_CANARY),true false)) + $(error CONFIG_SLAB_CANARY must be true or false) + endif + +-CFLAGS += -DSLAB_CANARY=$(CONFIG_SLAB_CANARY) ++CPPFLAGS += -D_GNU_SOURCE \ ++ -DSLAB_CANARY=$(CONFIG_SLAB_CANARY) + + LDLIBS := -lhardened_malloc + +-- +2.33.1 + diff --git a/PKGBUILD b/PKGBUILD index a84a8e9..8d1a6b0 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -8,7 +8,7 @@ pkgname=hardened-malloc _altname=hardened_malloc pkgver=8 -pkgrel=1 +pkgrel=2 pkgdesc="Hardened allocator designed for modern systems" arch=('x86_64' 'aarch64') url="https://github.com/GrapheneOS/hardened_malloc" @@ -17,11 +17,17 @@ depends=('gcc-libs') makedepends=('git') checkdepends=('python') provides=('libhardened_malloc.so') -options=(!makeflags) -source=("git+https://github.com/GrapheneOS/${_altname}#tag=$pkgver?signed") -b2sums=('SKIP') +source=("git+https://github.com/GrapheneOS/${_altname}#tag=$pkgver?signed" + '0001-Fix-CPPFLAGS-in-test-Makefile.patch') +b2sums=('SKIP' + '190c3eb933da1f59155ec9bde6243d8bf2eb16ed1132ce2e4a34cc3f82a92031095da158a49b822f665a71dd6445db9e9f253297fdcc20a1ab1dea189e460ecb') validpgpkeys=('65EEFE022108E2B708CBFCF7F9E712E59AF5F22A') # Daniel Micay +prepare() { + + patch --directory="${_altname}" --input="$srcdir/0001-Fix-CPPFLAGS-in-test-Makefile.patch" --strip=1 +} + build() { cd "${_altname}" @@ -31,8 +37,7 @@ build() { check() { cd "${_altname}" - # tests fail if CPPFLAGS is not set - CPPFLAGS="" make CONFIG_WERROR=false test + make CONFIG_WERROR=false test } package() { -- cgit v1.2.1