commit:     874649cd8388e2959d55ab0eb51cc4654ce86837
Author:     Wynn Wolf Arbor <wolf <AT> oriole <DOT> systems>
AuthorDate: Tue Jun  9 14:12:24 2020 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sun Jun 28 10:40:58 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=874649cd

mail-filter/libmilter: Fix build on musl

The build on musl currently fails in two different places.

Firstly, the sys/cdefs.h header is not available on musl. sendmail
already includes all necessary compatibility definitions for cdefs.h in
its 'libsm' library, but these are turned off through a platform
specific header file when building on Linux. Since gcc processes
-include options after all -D or -U options, we can't simply pass
'-DSM_CONF_SYS_CDEFS_H=0' in the ebuild. Instead, for now, patch the
Linux platform header file directly.

Secondly, musl does not include the getipnodeby* function family. Pass
'-DNEEDSGETIPNODE' to fix this.

Closes: https://bugs.gentoo.org/712628
Signed-off-by: Wynn Wolf Arbor <wolf <AT> oriole.systems>
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 .../libmilter/files/libmilter-musl-disable-cdefs.patch        | 11 +++++++++++
 mail-filter/libmilter/libmilter-1.0.2_p1.ebuild               |  6 ++++++
 2 files changed, 17 insertions(+)

diff --git a/mail-filter/libmilter/files/libmilter-musl-disable-cdefs.patch 
b/mail-filter/libmilter/files/libmilter-musl-disable-cdefs.patch
new file mode 100644
index 00000000000..6dc4ac63105
--- /dev/null
+++ b/mail-filter/libmilter/files/libmilter-musl-disable-cdefs.patch
@@ -0,0 +1,11 @@
+--- a/include/sm/os/sm_os_linux.h      2020-06-09 11:57:46.789786561 +0200
++++ b/include/sm/os/sm_os_linux.h      2020-06-09 11:57:49.174781812 +0200
+@@ -33,7 +33,7 @@
+ # endif /* LINUX_VERSION_CODE */
+ #endif /* SM_CONF_SHM */
+
+-#define SM_CONF_SYS_CDEFS_H   1
++#define SM_CONF_SYS_CDEFS_H   0
+ #ifndef SM_CONF_SEM
+ # define SM_CONF_SEM  2
+ #endif /* SM_CONF_SEM */

diff --git a/mail-filter/libmilter/libmilter-1.0.2_p1.ebuild 
b/mail-filter/libmilter/libmilter-1.0.2_p1.ebuild
index f2d436b1e73..e197eb05925 100644
--- a/mail-filter/libmilter/libmilter-1.0.2_p1.ebuild
+++ b/mail-filter/libmilter/libmilter-1.0.2_p1.ebuild
@@ -42,6 +42,12 @@ src_prepare() {
        use ipv6 && ENVDEF="${ENVDEF} -DNETINET6"
        use poll && ENVDEF="${ENVDEF} -DSM_CONF_POLL=1"
 
+       if use elibc_musl; then
+               use ipv6 && ENVDEF="${ENVDEF} -DNEEDSGETIPNODE"
+
+               eapply "${FILESDIR}/${PN}-musl-disable-cdefs.patch"
+       fi
+
        sed -e "s|@@CFLAGS@@|${CFLAGS}|" \
                -e "s:@@LDFLAGS@@:${LDFLAGS}:" \
                -e "s:@@CC@@:${CC}:" \

Reply via email to