net-libs/rpcsvc-proto: Sync with Gentoo

It's from Gentoo commit 9bde1eeaa3e03433543ff9b9a2f62dd8ff57e804.
This commit is contained in:
Flatcar Buildbot 2025-06-16 07:12:53 +00:00 committed by Krzesimir Nowak
parent 912ef80f03
commit 605bca2dc6
2 changed files with 113 additions and 0 deletions

View File

@ -0,0 +1,43 @@
From 7dc8c2a5051208c8808405c8bbdb3fca0cf43f74 Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
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 <chewi@gentoo.org>
--- 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

View File

@ -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
}