From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D675615800F for ; Sat, 7 Jan 2023 07:41:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 52ACBE087E; Sat, 7 Jan 2023 07:41:16 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3D385E087E for ; Sat, 7 Jan 2023 07:41:16 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4C129340EE4 for ; Sat, 7 Jan 2023 07:41:15 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A351A803 for ; Sat, 7 Jan 2023 07:41:13 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1673077197.691874242c42faac0995de394c9ec60787eab0e9.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libsecp256k1/, dev-libs/libsecp256k1/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-libs/libsecp256k1/files/0.2.0-fix-cross-compile.patch dev-libs/libsecp256k1/libsecp256k1-0.2.0-r2.ebuild X-VCS-Directories: dev-libs/libsecp256k1/files/ dev-libs/libsecp256k1/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 691874242c42faac0995de394c9ec60787eab0e9 X-VCS-Branch: master Date: Sat, 7 Jan 2023 07:41:13 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f2de6cb5-69ed-48e9-96ac-16fdbb29cedd X-Archives-Hash: 463138b40d2131caa49c0a7cbc8d1862 commit: 691874242c42faac0995de394c9ec60787eab0e9 Author: Matt Whitlock mattwhitlock name> AuthorDate: Fri Jan 6 22:25:56 2023 +0000 Commit: Sam James gentoo org> CommitDate: Sat Jan 7 07:39:57 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=69187424 dev-libs/libsecp256k1: fix cross-compilation See: https://github.com/bitcoin-core/secp256k1/pull/1159 Signed-off-by: Matt Whitlock mattwhitlock.name> Closes: https://github.com/gentoo/gentoo/pull/28990 Signed-off-by: Sam James gentoo.org> .../files/0.2.0-fix-cross-compile.patch | 85 ++++++++++++++++++++++ dev-libs/libsecp256k1/libsecp256k1-0.2.0-r2.ebuild | 5 ++ 2 files changed, 90 insertions(+) diff --git a/dev-libs/libsecp256k1/files/0.2.0-fix-cross-compile.patch b/dev-libs/libsecp256k1/files/0.2.0-fix-cross-compile.patch new file mode 100644 index 000000000000..585e9b491a81 --- /dev/null +++ b/dev-libs/libsecp256k1/files/0.2.0-fix-cross-compile.patch @@ -0,0 +1,85 @@ +From 772e747bd9104d80fe531bed61f23f75342d7d63 Mon Sep 17 00:00:00 2001 +From: Matt Whitlock +Date: Sun, 20 Nov 2022 01:46:07 -0500 +Subject: [PATCH] Makefile: build precomp generators using build-system + toolchain + +When cross-compiling libsecp256k1, if the `precomputed_ecmult*.c` source +files need to be regenerated, then the generators need to be built for +the *build* system, not for the *host* system. Autoconf supports this +fairly cleanly via the `AX_PROG_CC_FOR_BUILD` macro (from Autoconf +Archive), but Automake requires some hackery. When building the +generators, we override the `CC`, `CFLAGS`, `CPPFLAGS`, and `LDFLAGS` +variables to their build-system counterparts, whose names are suffixed +with `_FOR_BUILD` and whose values are populated by the aforementioned +Autoconf macro and may be overridden on the `make` command line. Since +Automake lacks support for overriding `EXEEXT` on a per-program basis, +we define a recipe that builds the generator binaries with names +suffixed with `$(EXEEXT)` and then renames them suffixed with +`$(BUILD_EXEEXT)`. +--- + Makefile.am | 30 ++++++++++++++++++++++++------ + configure.ac | 1 + + 2 files changed, 25 insertions(+), 6 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 30b6a794d0..e929300298 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -180,8 +180,26 @@ endif + endif + + ### Precomputed tables +-EXTRA_PROGRAMS = precompute_ecmult precompute_ecmult_gen +-CLEANFILES = $(EXTRA_PROGRAMS) ++PROGRAMS_FOR_BUILD = precompute_ecmult precompute_ecmult_gen ++$(addsuffix $(BUILD_EXEEXT),$(PROGRAMS_FOR_BUILD)) : override CC = $(CC_FOR_BUILD) ++$(addsuffix $(BUILD_EXEEXT),$(PROGRAMS_FOR_BUILD)) : override CFLAGS = $(CFLAGS_FOR_BUILD) ++$(addsuffix $(BUILD_EXEEXT),$(PROGRAMS_FOR_BUILD)) : override CPPFLAGS = $(CPPFLAGS_FOR_BUILD) ++$(addsuffix $(BUILD_EXEEXT),$(PROGRAMS_FOR_BUILD)) : override LDFLAGS = $(LDFLAGS_FOR_BUILD) ++# Automake has no support for PROGRAMS suffixed with BUILD_EXEEXT ++# instead of EXEEXT, so if those extensions differ, then we define a ++# recipe that builds the latter and renames it to the former. Since ++# Cygwin toolchains always append '.exe' to the output file name given ++# by '-o', we ignore rename failures since the toolchain will have ++# already created the right output file. (Note: The leading spaces ++# before ifneq and endif here are a hack so Automake won't try to ++# interpret them as an Automake conditional.) ++ ifneq ($(BUILD_EXEEXT),$(EXEEXT)) ++%$(BUILD_EXEEXT) : %$(EXEEXT) ++ mv -- '$<' '$@' || : ++ endif ++ ++EXTRA_PROGRAMS = $(PROGRAMS_FOR_BUILD) ++CLEANFILES = $(addsuffix $(BUILD_EXEEXT),$(PROGRAMS_FOR_BUILD)) + + precompute_ecmult_SOURCES = src/precompute_ecmult.c + precompute_ecmult_CPPFLAGS = $(SECP_INCLUDES) +@@ -198,11 +216,11 @@ precompute_ecmult_gen_LDADD = $(SECP_LIBS) $(COMMON_LIB) + # This means that rebuilds of the prebuilt files always need to be + # forced by deleting them, e.g., by invoking `make clean-precomp`. + src/precomputed_ecmult.c: +- $(MAKE) $(AM_MAKEFLAGS) precompute_ecmult$(EXEEXT) +- ./precompute_ecmult$(EXEEXT) ++ $(MAKE) $(AM_MAKEFLAGS) precompute_ecmult$(BUILD_EXEEXT) ++ ./precompute_ecmult$(BUILD_EXEEXT) + src/precomputed_ecmult_gen.c: +- $(MAKE) $(AM_MAKEFLAGS) precompute_ecmult_gen$(EXEEXT) +- ./precompute_ecmult_gen$(EXEEXT) ++ $(MAKE) $(AM_MAKEFLAGS) precompute_ecmult_gen$(BUILD_EXEEXT) ++ ./precompute_ecmult_gen$(BUILD_EXEEXT) + + PRECOMP = src/precomputed_ecmult_gen.c src/precomputed_ecmult.c + precomp: $(PRECOMP) +diff --git a/configure.ac b/configure.ac +index a2a15d2b82..013964f5ff 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -35,6 +35,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + AC_PROG_CC + AM_PROG_AS + AM_PROG_AR ++AX_PROG_CC_FOR_BUILD + + # Clear some cache variables as a workaround for a bug that appears due to a bad + # interaction between AM_PROG_AR and LT_INIT when combining MSVC's archiver lib.exe. diff --git a/dev-libs/libsecp256k1/libsecp256k1-0.2.0-r2.ebuild b/dev-libs/libsecp256k1/libsecp256k1-0.2.0-r2.ebuild index 9391a6c99236..588001fd95a4 100644 --- a/dev-libs/libsecp256k1/libsecp256k1-0.2.0-r2.ebuild +++ b/dev-libs/libsecp256k1/libsecp256k1-0.2.0-r2.ebuild @@ -21,10 +21,15 @@ REQUIRED_USE=" schnorr? ( extrakeys ) " BDEPEND=" + sys-devel/autoconf-archive virtual/pkgconfig valgrind? ( dev-util/valgrind ) " +PATCHES=( + "${FILESDIR}/0.2.0-fix-cross-compile.patch" +) + S="${WORKDIR}/${MyPN}-${PV}" src_prepare() {