commit:     ab775ee9e1080e3b81b007ebecbd0ce4c2c5940f
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 25 06:05:18 2022 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Thu Apr 28 22:23:15 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab775ee9

dev-libs/libffi: add support for loong

The LoongArch patch is generated by diffing the original release
tarball with the dist tarball, made with the LoongArch support
PR [1] applied, not upstreamed yet but already reviewed by me.

Tests have passed on amd64; similar code has been inside
loongson-overlay for a while, no problems spotted so far.

[1]: https://github.com/libffi/libffi/pull/678

Closes: https://github.com/gentoo/gentoo/pull/25189
Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 dev-libs/libffi/Manifest               | 1 +
 dev-libs/libffi/libffi-3.4.2-r1.ebuild | 9 +++++++--
 dev-libs/libffi/metadata.xml           | 1 +
 profiles/arch/base/package.use.mask    | 1 +
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dev-libs/libffi/Manifest b/dev-libs/libffi/Manifest
index 6351b7c81d9d..022b0d07614b 100644
--- a/dev-libs/libffi/Manifest
+++ b/dev-libs/libffi/Manifest
@@ -1,2 +1,3 @@
 DIST libffi-3.3.tar.gz 1305466 BLAKE2B 
cddc40729a30a9bd34d675809f51f8d1b4ccaffa54bc6dd6f7e965f4e260edd34754719f9f6247c8957aeb7cf154d56ce1fe16a54c3f1ad39afbebdf41d23caa
 SHA512 
61513801a156f11420f541d325de697131846487122d6bdcf5491b18b4da788589f5c0bb07e88e396495d3be5830d74e9135595e2b8ddbfe95c448d8597fbd6f
+DIST libffi-3.4.2-loongarch64-20220428.patch.xz 64932 BLAKE2B 
d144dc28a7fce008bc5cd43d9e04125ea8e972324d77951d42039d46e818014079c871f87a0cdbec758b55320c02dff718cf2449f9c630cc899e8e1610784a60
 SHA512 
33715b21fe027692cc584d6524c03510af7876cc35f318221e1b2b91644cf165c02979c8b426228a8cc6c471e6a59d0435e761b6b7aef589c41a4f28caa36e62
 DIST libffi-3.4.2.tar.gz 1351355 BLAKE2B 
a8137bc895b819f949fd7705e405be627219c6d1fdef280253330f7407d4a548bb057d7bb0e9225d1767d42f9bf5f0ab3c455db1c3470d7cc876bb7b7d55d308
 SHA512 
31bad35251bf5c0adb998c88ff065085ca6105cf22071b9bd4b5d5d69db4fadf16cadeec9baca944c4bb97b619b035bb8279de8794b922531fddeb0779eb7fb1

diff --git a/dev-libs/libffi/libffi-3.4.2-r1.ebuild 
b/dev-libs/libffi/libffi-3.4.2-r1.ebuild
index 492d9b34c625..057f31cb8e7f 100644
--- a/dev-libs/libffi/libffi-3.4.2-r1.ebuild
+++ b/dev-libs/libffi/libffi-3.4.2-r1.ebuild
@@ -10,7 +10,8 @@ MY_P=${PN}-${MY_PV}
 
 DESCRIPTION="a portable, high level programming interface to various calling 
conventions"
 HOMEPAGE="https://sourceware.org/libffi/";
-SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz";
+SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz
+       experimental-loong? ( 
https://dev.gentoo.org/~xen0n/distfiles/${MY_P}-loongarch64-20220428.patch.xz )"
 S="${WORKDIR}"/${MY_P}
 
 LICENSE="MIT"
@@ -20,7 +21,7 @@ LICENSE="MIT"
 # changes.
 SLOT="0/8" # SONAME=libffi.so.8
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos 
~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="debug exec-static-trampoline pax-kernel static-libs test"
+IUSE="debug exec-static-trampoline experimental-loong pax-kernel static-libs 
test"
 
 RESTRICT="!test? ( test )"
 BDEPEND="test? ( dev-util/dejagnu )"
@@ -30,6 +31,10 @@ DOCS="ChangeLog* README.md"
 ECONF_SOURCE=${S}
 
 src_prepare() {
+       if use experimental-loong; then
+               PATCHES+=( "${WORKDIR}/${MY_P}-loongarch64-20220428.patch" )
+       fi
+
        default
        if [[ ${CHOST} == arm64-*-darwin* ]] ; then
                # ensure we use aarch64 asm, not x86 on arm64

diff --git a/dev-libs/libffi/metadata.xml b/dev-libs/libffi/metadata.xml
index 53754327cd3f..9a236f87a6a5 100644
--- a/dev-libs/libffi/metadata.xml
+++ b/dev-libs/libffi/metadata.xml
@@ -35,6 +35,7 @@
        </longdescription>
        <use>
                <flag name="exec-static-trampoline">Don't rely on dynamic code 
generation for trampolines.</flag>
+               <flag name="experimental-loong">Add experimental LoongArch 
patchset</flag>
                <flag name="pax-kernel">Use PaX emulated trampolines, for we 
can't use PROT_EXEC</flag>
        </use>
        <upstream>

diff --git a/profiles/arch/base/package.use.mask 
b/profiles/arch/base/package.use.mask
index 8d22c623dfd8..ed839864b801 100644
--- a/profiles/arch/base/package.use.mask
+++ b/profiles/arch/base/package.use.mask
@@ -7,6 +7,7 @@
 # In the meantime, force-enable on loong only.
 # This is not inside use.mask, because crossdev toolchain packages would
 # want to have the flag enabled without hassle.
+dev-libs/libffi experimental-loong
 sys-kernel/linux-headers experimental-loong
 sys-libs/glibc experimental-loong
 sys-libs/libseccomp experimental-loong

Reply via email to