commit:     6cfdad620208e2b48ab0c22785ba9cf3c646cee6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 25 04:27:19 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 25 04:29:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6cfdad62

net-ftp/ftp: fix musl build; modernise

Closes: https://bugs.gentoo.org/832430
Thanks-to: Cristian Othón Martínez Vera <cfuga <AT> cfuga.mx>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../ftp-0.17.34.0.2.5.1-musl-glob-brace.patch      | 14 ++++++++++
 net-ftp/ftp/ftp-0.17.34.0.2.5.1.ebuild             | 30 ++++++++++++++--------
 2 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/net-ftp/ftp/files/ftp-0.17.34.0.2.5.1-musl-glob-brace.patch 
b/net-ftp/ftp/files/ftp-0.17.34.0.2.5.1-musl-glob-brace.patch
new file mode 100644
index 000000000000..386af410e913
--- /dev/null
+++ b/net-ftp/ftp/files/ftp-0.17.34.0.2.5.1-musl-glob-brace.patch
@@ -0,0 +1,14 @@
+https://bugs.gentoo.org/832430
+
+See e.g. 
https://patchwork.kernel.org/project/selinux/patch/20180517051117.48454-5-ja...@perfinion.com/
 too.
+--- a/ftp/cmds.h
++++ b/ftp/cmds.h
+@@ -61,3 +61,7 @@
+ void do_umask(int argc, char *argv[]);
+ void idle_cmd(int argc, char *argv[]);
+ void setpassive(void);
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
+

diff --git a/net-ftp/ftp/ftp-0.17.34.0.2.5.1.ebuild 
b/net-ftp/ftp/ftp-0.17.34.0.2.5.1.ebuild
index a25ce7b145e0..bbdb45b4f87b 100644
--- a/net-ftp/ftp/ftp-0.17.34.0.2.5.1.ebuild
+++ b/net-ftp/ftp/ftp-0.17.34.0.2.5.1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit flag-o-matic toolchain-funcs
+inherit edo flag-o-matic toolchain-funcs
 
 PATCH_VER="3"
 MY_PN="netkit-ftp"
@@ -11,11 +11,13 @@ MY_PV="$(ver_cut 1-2)"
 MY_P="netkit-${PN}-${MY_PV}"
 DEB_PN="${MY_PN}-ssl"
 DEB_PV="$(ver_cut 1-3)+$(ver_cut 4-5)-$(ver_cut 6-7)"
+
 DESCRIPTION="Standard Linux FTP client"
 HOMEPAGE="http://www.hcs.harvard.edu/~dholland/computers/netkit.html";
 SRC_URI="ftp://sunsite.unc.edu/pub/Linux/system/network/netkit/${MY_P}.tar.gz
        mirror://debian/pool/main/n/${DEB_PN}/${DEB_PN}_${DEB_PV}.debian.tar.xz
        
https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${MY_P}-patches-${PATCH_VER}.tar.bz2";
+S="${WORKDIR}"/${MY_P}
 
 LICENSE="BSD"
 SLOT="0"
@@ -24,22 +26,23 @@ IUSE="ipv6 readline ssl"
 
 RDEPEND="
        >=sys-libs/ncurses-5.2:=
-       readline? ( sys-libs/readline:0= )
-       ssl? ( dev-libs/openssl:0= )
+       elibc_musl? ( sys-libs/obstack-standalone )
+       readline? ( sys-libs/readline:= )
+       ssl? ( dev-libs/openssl:= )
 "
 DEPEND="${RDEPEND}"
 BDEPEND="sys-apps/grep"
 
-S=${WORKDIR}/${MY_P}
-
 src_prepare() {
        local p
        for p in $(grep -v "^#" "${WORKDIR}"/debian/patches/series || die); do
-               eapply "${WORKDIR}/debian/patches/${p}"
+               eapply "${WORKDIR}"/debian/patches/${p}
        done
 
        eapply "${WORKDIR}"/patch
+       eapply "${FILESDIR}"/${PN}-0.17.34.0.2.5.1-musl-glob-brace.patch
 
+       # Drop bashism from configure
        sed -i \
                -e 's:echo -n:printf %s :' \
                configure || die
@@ -48,15 +51,20 @@ src_prepare() {
 }
 
 src_configure() {
-       append-lfs-flags #101038
+       # bug #101038
+       append-lfs-flags
        tc-export CC
-       # not an autoconf script
-       ./configure \
+
+       # Not an autoconf script
+       edo ./configure \
                --prefix=/usr \
                $(use_enable ipv6) \
                $(use_enable readline) \
-               $(use_enable ssl) \
-               || die
+               $(use_enable ssl)
+
+       if use elibc_musl ; then
+               sed -i -e '/^LIBS=/ s/$/ -lobstack/' MCONFIG || die
+       fi
 }
 
 src_install() {

Reply via email to