public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-arch/lz4/files/, app-arch/lz4/
@ 2016-11-10  5:16 Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2016-11-10  5:16 UTC (permalink / raw
  To: gentoo-commits

commit:     22099cef5b70c6147a3c040f95ec26ad57a17f48
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 10 05:16:10 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Nov 10 05:16:10 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=22099cef

app-arch/lz4: add support for USE=static-libs

 app-arch/lz4/files/lz4-0_p131-static-libs.patch | 49 +++++++++++++++++++++++++
 app-arch/lz4/lz4-0_p131-r1.ebuild               | 23 +++++++-----
 app-arch/lz4/lz4-9999.ebuild                    | 23 +++++++-----
 3 files changed, 77 insertions(+), 18 deletions(-)

diff --git a/app-arch/lz4/files/lz4-0_p131-static-libs.patch b/app-arch/lz4/files/lz4-0_p131-static-libs.patch
new file mode 100644
index 00000000..f8c5c2d
--- /dev/null
+++ b/app-arch/lz4/files/lz4-0_p131-static-libs.patch
@@ -0,0 +1,49 @@
+fix from upstream
+
+From 43b631223b2d0425a0970876974074934f89c450 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 22 Sep 2016 23:59:02 -0400
+Subject: [PATCH] add a flag to disable static libs
+
+---
+ lib/Makefile | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/lib/Makefile b/lib/Makefile
+index b5352a0cb372..27b35c41b693 100644
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -40,6 +40,8 @@
+ LIBVER_PATCH=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lz4.h`
+ LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
+ 
++BUILD_STATIC:= yes
++
+ DESTDIR?=
+ PREFIX ?= /usr/local
+ CFLAGS ?= -O3
+@@ -71,9 +72,11 @@
+ all: liblz4
+ 
+ liblz4: lz4.c lz4hc.c lz4frame.c xxhash.c
++ifeq ($(BUILD_STATIC),yes)
+ 	@echo compiling static library
+ 	@$(CC) $(CPPFLAGS) $(CFLAGS) -c $^
+ 	@$(AR) rcs liblz4.a lz4.o lz4hc.o lz4frame.o xxhash.o
++endif
+ 	@echo compiling dynamic library $(LIBVER)
+ 	@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
+ 	@echo creating versioned links
+@@ -104,7 +107,9 @@
+ 	@cp -a liblz4.$(SHARED_EXT_MAJOR) $(DESTDIR)$(LIBDIR)
+ 	@cp -a liblz4.$(SHARED_EXT) $(DESTDIR)$(LIBDIR)
+ 	@cp -a liblz4.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
++ifeq ($(BUILD_STATIC),yes)
+ 	@install -m 644 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
++endif
+ 	@install -m 644 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
+ 	@install -m 644 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
+ 	@install -m 644 lz4frame.h $(DESTDIR)$(INCLUDEDIR)/lz4frame.h
+-- 
+2.9.0
+

diff --git a/app-arch/lz4/lz4-0_p131-r1.ebuild b/app-arch/lz4/lz4-0_p131-r1.ebuild
index 8e7767e..21dc5de 100644
--- a/app-arch/lz4/lz4-0_p131-r1.ebuild
+++ b/app-arch/lz4/lz4-0_p131-r1.ebuild
@@ -26,7 +26,7 @@ LICENSE="BSD-2 GPL-2"
 # with abi-compliance-checker and update the subslot every time ABI
 # changes. This is the least we can do to keep things sane.
 SLOT="0/r131"
-IUSE="test valgrind"
+IUSE="static-libs test valgrind"
 
 DEPEND="test? ( valgrind? ( dev-util/valgrind ) )"
 
@@ -34,27 +34,32 @@ src_prepare() {
 	if ! use valgrind; then
 		sed -i -e '/^test:/s|test-mem||g' programs/Makefile || die
 	fi
+	epatch "${FILESDIR}"/${PN}-0_p131-static-libs.patch
 	multilib_copy_sources
 }
 
+lmake() {
+	emake \
+		BUILD_STATIC=$(usex static-libs) \
+		PREFIX="${EPREFIX}/usr" \
+		LIBDIR="${EPREFIX}"/usr/$(get_libdir) \
+		"$@"
+}
+
 multilib_src_compile() {
 	tc-export CC AR
 	# we must not use the 'all' target since it builds test programs
 	# & extra -m32 executables
-	emake -C lib liblz4 liblz4.pc \
-		PREFIX="${EPREFIX}/usr" \
-		LIBDIR="${EPREFIX}"/usr/$(get_libdir)
-	emake -C programs lz4 lz4c
+	lmake -C lib liblz4 liblz4.pc
+	lmake -C programs lz4 lz4c
 	# work around lack of proper target dependencies
 	touch lib/liblz4
 }
 
 multilib_src_test() {
-	emake -j1 test
+	lmake -j1 test
 }
 
 multilib_src_install() {
-	emake install DESTDIR="${D}" \
-		PREFIX="${EPREFIX}/usr" \
-		LIBDIR="${EPREFIX}"/usr/$(get_libdir)
+	lmake install DESTDIR="${D}"
 }

diff --git a/app-arch/lz4/lz4-9999.ebuild b/app-arch/lz4/lz4-9999.ebuild
index 8e7767e..21dc5de 100644
--- a/app-arch/lz4/lz4-9999.ebuild
+++ b/app-arch/lz4/lz4-9999.ebuild
@@ -26,7 +26,7 @@ LICENSE="BSD-2 GPL-2"
 # with abi-compliance-checker and update the subslot every time ABI
 # changes. This is the least we can do to keep things sane.
 SLOT="0/r131"
-IUSE="test valgrind"
+IUSE="static-libs test valgrind"
 
 DEPEND="test? ( valgrind? ( dev-util/valgrind ) )"
 
@@ -34,27 +34,32 @@ src_prepare() {
 	if ! use valgrind; then
 		sed -i -e '/^test:/s|test-mem||g' programs/Makefile || die
 	fi
+	epatch "${FILESDIR}"/${PN}-0_p131-static-libs.patch
 	multilib_copy_sources
 }
 
+lmake() {
+	emake \
+		BUILD_STATIC=$(usex static-libs) \
+		PREFIX="${EPREFIX}/usr" \
+		LIBDIR="${EPREFIX}"/usr/$(get_libdir) \
+		"$@"
+}
+
 multilib_src_compile() {
 	tc-export CC AR
 	# we must not use the 'all' target since it builds test programs
 	# & extra -m32 executables
-	emake -C lib liblz4 liblz4.pc \
-		PREFIX="${EPREFIX}/usr" \
-		LIBDIR="${EPREFIX}"/usr/$(get_libdir)
-	emake -C programs lz4 lz4c
+	lmake -C lib liblz4 liblz4.pc
+	lmake -C programs lz4 lz4c
 	# work around lack of proper target dependencies
 	touch lib/liblz4
 }
 
 multilib_src_test() {
-	emake -j1 test
+	lmake -j1 test
 }
 
 multilib_src_install() {
-	emake install DESTDIR="${D}" \
-		PREFIX="${EPREFIX}/usr" \
-		LIBDIR="${EPREFIX}"/usr/$(get_libdir)
+	lmake install DESTDIR="${D}"
 }


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-arch/lz4/files/, app-arch/lz4/
@ 2024-07-23 14:13 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2024-07-23 14:13 UTC (permalink / raw
  To: gentoo-commits

commit:     461b33118c1d8b038088b5d8552f2fa8658bc5af
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Mon Jul 22 22:48:18 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul 23 14:13:40 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=461b3311

app-arch/lz4: fix test failures

Add patches for proper stack alignment in the freestanding test
and to disable stack protector for the same test to allow building
with clang.

Bug: https://github.com/lz4/lz4/issues/1466
Closes: https://bugs.gentoo.org/936480
Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Closes: https://github.com/gentoo/gentoo/pull/37681
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../lz4/files/1.10.0-fix-freestanding-test.patch   | 42 ++++++++++++++++++++++
 app-arch/lz4/lz4-1.10.0-r1.ebuild                  |  4 +++
 2 files changed, 46 insertions(+)

diff --git a/app-arch/lz4/files/1.10.0-fix-freestanding-test.patch b/app-arch/lz4/files/1.10.0-fix-freestanding-test.patch
new file mode 100644
index 000000000000..f8dfe2a41c64
--- /dev/null
+++ b/app-arch/lz4/files/1.10.0-fix-freestanding-test.patch
@@ -0,0 +1,42 @@
+
+From: https://github.com/lz4/lz4/pull/1468
+
+commit 63267a77d863f63826d8b13ddb8c190d3a4c01c5
+Author: Holger Hoffstätte <holger@applied-asynchrony.com>
+Date:   Mon Jul 22 22:11:19 2024 +0200
+
+    Fix stack alignment of _start() in freestanding test
+    
+    When the freestanding test is built with any kind of optimization
+    that enables vectorized loops, special care must be taken to align
+    the stack for _start() at a 16-byte boundary.
+
+diff --git a/tests/freestanding.c b/tests/freestanding.c
+index 6109aa7..96de9d3 100644
+--- a/tests/freestanding.c
++++ b/tests/freestanding.c
+@@ -225,7 +225,7 @@ EXTERN_C int memcmp(const void *s1, const void *s2, size_t n) {
+ 
+ 
+ //
+-EXTERN_C void _start(void) {
++EXTERN_C void __attribute__((force_align_arg_pointer)) _start(void) {
+     test();
+     MY_exit(0);
+ }
+
+Disable the stack protector to allow building with clang.
+See https://bugs.gentoo.org/936480
+
+diff -up lz4-1.10.0/build/meson/meson/tests/meson.build lz4-1.10.0/build/meson/meson/tests/meson.build
+--- lz4-1.10.0/build/meson/meson/tests/meson.build	2024-07-21 19:29:49.000000000 +0200
++++ lz4-1.10.0/build/meson/meson/tests/meson.build	2024-07-23 01:26:40.561113031 +0200
+@@ -47,7 +47,7 @@ test_exes = {
+   },
+   'freestanding': {
+     'sources': files(lz4_source_root / 'tests/freestanding.c'),
+-    'c_args': ['-ffreestanding', '-Wno-unused-parameter', '-Wno-declaration-after-statement'],
++    'c_args': ['-ffreestanding', '-fno-stack-protector', '-Wno-unused-parameter', '-Wno-declaration-after-statement'],
+     'link_args': ['-nostdlib'],
+     'build': cc.get_id() in ['gcc', 'clang'] and
+       host_machine.system() == 'linux' and host_machine.cpu_family() == 'x86_64',

diff --git a/app-arch/lz4/lz4-1.10.0-r1.ebuild b/app-arch/lz4/lz4-1.10.0-r1.ebuild
index d05fa3dd02fb..7cbc02aadc78 100644
--- a/app-arch/lz4/lz4-1.10.0-r1.ebuild
+++ b/app-arch/lz4/lz4-1.10.0-r1.ebuild
@@ -17,6 +17,10 @@ RESTRICT="!test? ( test )"
 
 EMESON_SOURCE=${S}/build/meson
 
+PATCHES=(
+	"${FILESDIR}/${PV}-fix-freestanding-test.patch"
+)
+
 multilib_src_configure() {
 	local emesonargs=(
 		-Dtests=$(usex test true false)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-23 14:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-23 14:13 [gentoo-commits] repo/gentoo:master commit in: app-arch/lz4/files/, app-arch/lz4/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2016-11-10  5:16 Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox