dev-libs/libressl: fix compilation on Solaris 10
authorFabian Groffen <grobian@gentoo.org>
Wed, 13 Mar 2019 14:11:26 +0000 (15:11 +0100)
committerFabian Groffen <grobian@gentoo.org>
Wed, 13 Mar 2019 14:11:50 +0000 (15:11 +0100)
Closes: https://bugs.gentoo.org/679586
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11

dev-libs/libressl/files/libressl-2.8.3-solaris10.patch [new file with mode: 0644]
dev-libs/libressl/libressl-2.8.3.ebuild
dev-libs/libressl/libressl-2.9.0.ebuild

diff --git a/dev-libs/libressl/files/libressl-2.8.3-solaris10.patch b/dev-libs/libressl/files/libressl-2.8.3-solaris10.patch
new file mode 100644 (file)
index 0000000..20a0af0
--- /dev/null
@@ -0,0 +1,69 @@
+From libressl  Thu Jul 21 09:25:08 2016
+From: schily () schily ! net (Joerg Schilling)
+Date: Thu, 21 Jul 2016 09:25:08 +0000
+To: libressl
+Subject: Non-portable code in ./crypto/compat/getentropy_solaris.c
+Message-Id: <579094f4.Ca9M384ri4oiBOIa%schily () schily ! net>
+X-MARC-Message: https://marc.info/?l=libressl&m=146910737815443
+
+Hi,
+
+the code works only on Solaris based on OpenSolaris-ON from February 18 2010 or 
+later.
+
+Many people however still use Solaris 10.
+
+BTW: there is an official portable ELF way based on the AUX vector to do the same 
+but this was unfortunately not made a public libc interface, so it would need to 
+be incorporated into your code:
+
+https://sourceforge.net/p/schillix-on/schillix-on/ci/default/tree/usr/src/lib/libc/port/gen/getauxv.c
+
+___getauxptr(AT_PHDR)  returns the address of &phdr[0]
+___getauxval(AT_PHENT) returns sizeof(phdr[0])
+___getauxval(AT_PHNUM) returns # phdr entries
+
+
+Here is a patch to disable the non-portable code getting the code to compile at 
+all:
+
+
+
+--- a/crypto/compat/getentropy_solaris.c
++++ b/crypto/compat/getentropy_solaris.c
+@@ -72,7 +72,9 @@
+ static int getentropy_urandom(void *buf, size_t len, const char *path,
+     int devfscheck);
+ static int getentropy_fallback(void *buf, size_t len);
++#ifdef        ElfW
+ static int getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data);
++#endif
+ 
+ int
+ getentropy(void *buf, size_t len)
+@@ -244,6 +246,7 @@
+ #endif
+ };
+ 
++#ifdef        ElfW
+ static int
+ getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data)
+ {
+@@ -252,6 +255,7 @@
+       SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr));
+       return (0);
+ }
++#endif
+ 
+ static int
+ getentropy_fallback(void *buf, size_t len)
+@@ -290,7 +294,9 @@
+                               cnt += (int)tv.tv_usec;
+                       }
+ 
++#ifdef        ElfW
+                       dl_iterate_phdr(getentropy_phdr, &ctx);
++#endif
+ 
+                       for (ii = 0; ii < sizeof(cl)/sizeof(cl[0]); ii++)
+                               HX(clock_gettime(cl[ii], &ts) == -1, ts);
index 22b9aef5d690c411ada218dbb37481e03f8b3f7c..b438e7c15cacfb4483a6fda2273858f614771798 100644 (file)
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit multilib-minimal
+inherit multilib-minimal libtool
 
 DESCRIPTION="Free version of the SSL/TLS protocol forked from OpenSSL"
 HOMEPAGE="https://www.libressl.org/"
@@ -34,7 +34,10 @@ src_prepare() {
                -e '/^[ \t]*USER_CFLAGS=/s#-O2"#"#' \
                configure || die "fixing CFLAGS failed"
 
+       eapply "${FILESDIR}"/${P}-solaris10.patch
        eapply_user
+
+       elibtoolize  # for Solaris
 }
 
 multilib_src_configure() {
index f7db72c593510c3943bc39763fbf71a521149809..9356bf70659e0b36e67e27c4570b84cfdfda7fdb 100644 (file)
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit multilib-minimal
+inherit multilib-minimal libtool
 
 DESCRIPTION="Free version of the SSL/TLS protocol forked from OpenSSL"
 HOMEPAGE="https://www.libressl.org/"
@@ -34,7 +34,10 @@ src_prepare() {
                -e '/^[ \t]*USER_CFLAGS=/s#-O2"#"#' \
                configure || die "fixing CFLAGS failed"
 
+       eapply "${FILESDIR}"/${PN}-2.8.3-solaris10.patch
        eapply_user
+
+       elibtoolize  # for Solaris
 }
 
 multilib_src_configure() {