commit:     9bde1eeaa3e03433543ff9b9a2f62dd8ff57e804
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Fri May  2 16:16:44 2025 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Tue May 27 08:48:39 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9bde1eea

net-libs/rpcsvc-proto: Fix cross-compiling with a patch

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 .../files/rpcsvc-proto-1.4.4-prebuilt-rpcgen.patch | 43 +++++++++++++
 net-libs/rpcsvc-proto/rpcsvc-proto-1.4.4-r1.ebuild | 70 ++++++++++++++++++++++
 2 files changed, 113 insertions(+)

diff --git 
a/net-libs/rpcsvc-proto/files/rpcsvc-proto-1.4.4-prebuilt-rpcgen.patch 
b/net-libs/rpcsvc-proto/files/rpcsvc-proto-1.4.4-prebuilt-rpcgen.patch
new file mode 100644
index 000000000000..ef881a92c135
--- /dev/null
+++ b/net-libs/rpcsvc-proto/files/rpcsvc-proto-1.4.4-prebuilt-rpcgen.patch
@@ -0,0 +1,43 @@
+From 7dc8c2a5051208c8808405c8bbdb3fca0cf43f74 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <[email protected]>
+Date: Fri, 2 May 2025 16:39:19 +0100
+Subject: [PATCH] configure.ac: Add --with-prebuilt-rpcgen option for
+ cross-compiling
+
+If given an argument, it will use that program to generate the rpcsvc
+headers. Otherwise, it will use "rpcgen" from the PATH.
+
+Closes: https://github.com/thkukuk/rpcsvc-proto/issues/13
+Signed-off-by: James Le Cuirot <[email protected]>
+--- a/configure.ac
++++ b/configure.ac
+@@ -23,4 +23,18 @@ AM_GNU_GETTEXT([external])
+ AM_GNU_GETTEXT_VERSION([0.20.2])
+ AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.2])
+ 
++RPCGEN='$(top_builddir)/rpcgen/rpcgen'
++AC_ARG_WITH([prebuilt-rpcgen],
++  AS_HELP_STRING(
++    [--with-prebuilt-rpcgen],
++    [use prebuilt rpcgen to generate rpcsvc headers]
++  ),
++  AS_CASE([$withval],
++    [no],  [],
++    [yes], [RPCGEN=rpcgen],
++           [RPCGEN=$withval]
++  )
++)
++AC_SUBST([RPCGEN])
++
+ AC_OUTPUT([Makefile rpcgen/Makefile rpcsvc/Makefile po/Makefile.in])
+--- a/rpcsvc/Makefile.am
++++ b/rpcsvc/Makefile.am
+@@ -12,4 +12,4 @@ nodist_rpcsvc_HEADERS = klm_prot.h nlm_prot.h rstat.h 
spray.h \
+       nfs_prot.h rquota.h sm_inter.h
+ 
+ .x.h:
+-      $(top_builddir)/rpcgen/rpcgen -h -o $@ $<
++      $(RPCGEN) -h -o $@ $<
+-- 
+2.49.0
+

diff --git a/net-libs/rpcsvc-proto/rpcsvc-proto-1.4.4-r1.ebuild 
b/net-libs/rpcsvc-proto/rpcsvc-proto-1.4.4-r1.ebuild
new file mode 100644
index 000000000000..7f825b44e131
--- /dev/null
+++ b/net-libs/rpcsvc-proto/rpcsvc-proto-1.4.4-r1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools toolchain-funcs
+
+DESCRIPTION="rpcsvc protocol definitions from glibc"
+HOMEPAGE="https://github.com/thkukuk/rpcsvc-proto";
+SRC_URI="https://github.com/thkukuk/rpcsvc-proto/releases/download/v${PV}/${P}.tar.xz";
+
+LICENSE="LGPL-2.1+ BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+
+RDEPEND="
+       !<sys-libs/glibc-2.26
+       virtual/libintl
+"
+DEPEND="${RDEPEND}"
+# sys-devel/gettext is only for libintl detection macros.
+BDEPEND="sys-devel/gettext"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.4.4-prebuilt-rpcgen.patch
+)
+
+src_prepare() {
+       default
+       eautoreconf
+
+       # Search for a valid 'cpp' command.
+       # The CPP envvar might contain '${CC} -E', which does not work for 
rpcgen.
+       # Bug 718138, 870031, 870061.
+       local x cpp=
+       for x in {${CHOST}-,}{,clang-}cpp; do
+               if type -P "${x}" >/dev/null; then
+                       cpp=${x}
+                       break
+               fi
+       done
+       [[ -n ${cpp} ]] || die "Unable to find cpp"
+       sed -i -e "s/CPP = \"cpp\";/CPP = \"${cpp}\";/" rpcgen/rpc_main.c || die
+}
+
+src_configure() {
+       local myconf=()
+
+       if tc-is-cross-compiler; then
+               mkdir "${WORKDIR}"/build || die
+               pushd "${WORKDIR}"/build >/dev/null || die
+               ECONF_SOURCE="${S}" econf_build
+               popd >/dev/null || die
+               myconf+=( 
--with-prebuilt-rpcgen="${WORKDIR}"/build/rpcgen/rpcgen )
+       fi
+
+       econf "${myconf[@]}"
+}
+
+src_compile() {
+       tc-is-cross-compiler && emake -C "${WORKDIR}"/build/rpcgen
+       emake
+}
+
+src_install() {
+       default
+
+       # provided by sys-fs/quota[rpc]
+       rm "${ED}"/usr/include/rpcsvc/rquota.{x,h} || die
+}

Reply via email to