Gentoo Archives: gentoo-commits

From: Jory Pratt <anarchy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/nspr/files/, dev-libs/nspr/
Date: Thu, 26 Nov 2015 21:46:28
Message-Id: 1448574252.71653e27381a0b12b56e7d2db32a2f1588ab6053.anarchy@gentoo
1 commit: 71653e27381a0b12b56e7d2db32a2f1588ab6053
2 Author: Jory A. Pratt <anarchy <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 26 21:44:12 2015 +0000
4 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 26 21:44:12 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71653e27
7
8 dev-libs/nspr - add musl support
9
10 .../nspr/files/nspr-4.10.10-musl-support.patch | 21 ++++
11 dev-libs/nspr/nspr-4.10.10-r1.ebuild | 122 +++++++++++++++++++++
12 2 files changed, 143 insertions(+)
13
14 diff --git a/dev-libs/nspr/files/nspr-4.10.10-musl-support.patch b/dev-libs/nspr/files/nspr-4.10.10-musl-support.patch
15 new file mode 100644
16 index 0000000..0588414
17 --- /dev/null
18 +++ b/dev-libs/nspr/files/nspr-4.10.10-musl-support.patch
19 @@ -0,0 +1,21 @@
20 +# HG changeset patch
21 +# User Felix Janda <felix.janda@××××××.de>
22 +# Date 1429558773 -7200
23 +# Mon Apr 20 21:39:33 2015 +0200
24 +# Node ID 12494ff1de6cd7020c134d97b0b1ca81feb20520
25 +# Parent c5cb946571388f1643ab0fb04b3bfacd93cf818e
26 +Fix compilation with musl libc - try 2
27 +
28 +diff -r c5cb94657138 -r 12494ff1de6c pr/src/misc/prnetdb.c
29 +--- a/pr/src/misc/prnetdb.c Mon Apr 20 14:37:29 2015 -0400
30 ++++ b/pr/src/misc/prnetdb.c Mon Apr 20 21:39:33 2015 +0200
31 +@@ -63,8 +63,7 @@
32 +
33 + #if defined(SOLARIS) || (defined(BSDI) && defined(_REENTRANT)) \
34 + || (defined(LINUX) && defined(_REENTRANT) \
35 +- && !(defined(__GLIBC__) && __GLIBC__ >= 2) \
36 +- && !defined(ANDROID))
37 ++ && defined(__GLIBC__) && __GLIBC__ < 2)
38 + #define _PR_HAVE_GETPROTO_R
39 + #define _PR_HAVE_GETPROTO_R_POINTER
40 + #endif
41
42 diff --git a/dev-libs/nspr/nspr-4.10.10-r1.ebuild b/dev-libs/nspr/nspr-4.10.10-r1.ebuild
43 new file mode 100644
44 index 0000000..76a4fd2
45 --- /dev/null
46 +++ b/dev-libs/nspr/nspr-4.10.10-r1.ebuild
47 @@ -0,0 +1,122 @@
48 +# Copyright 1999-2015 Gentoo Foundation
49 +# Distributed under the terms of the GNU General Public License v2
50 +# $Id$
51 +
52 +EAPI=5
53 +WANT_AUTOCONF="2.5"
54 +
55 +inherit autotools eutils multilib toolchain-funcs versionator multilib-minimal
56 +
57 +MIN_PV="$(get_version_component_range 2)"
58 +
59 +DESCRIPTION="Netscape Portable Runtime"
60 +HOMEPAGE="http://www.mozilla.org/projects/nspr/"
61 +SRC_URI="http://archive.mozilla.org/pub/mozilla.org/nspr/releases/v${PV}/src/${P}.tar.gz"
62 +
63 +LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )"
64 +SLOT="0"
65 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
66 +IUSE="debug"
67 +
68 +RDEPEND="
69 + abi_x86_32? (
70 + !<=app-emulation/emul-linux-x86-baselibs-20140508-r12
71 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
72 + )"
73 +
74 +MULTILIB_CHOST_TOOLS=(
75 + /usr/bin/nspr-config
76 +)
77 +
78 +src_prepare() {
79 + cd "${S}"/nspr || die
80 + epatch "${FILESDIR}"/${PN}-4.7.0-prtime.patch
81 + epatch "${FILESDIR}"/${PN}-4.7.1-solaris.patch
82 + epatch "${FILESDIR}"/${PN}-4.10.6-solaris.patch
83 + epatch "${FILESDIR}"/${PN}-4.8.4-darwin-install_name.patch
84 + epatch "${FILESDIR}"/${PN}-4.8.9-link-flags.patch
85 + # We do not need to pass -L$libdir via nspr-config --libs
86 + epatch "${FILESDIR}"/${PN}-4.9.5_nspr_config.patch
87 + # https://bugzilla.mozilla.org/show_bug.cgi?id=1128029
88 + epatch "${FILESDIR}"/${P}-musl-support.patch
89 +
90 + # rename configure.in to configure.ac for new autotools compatibility
91 + if [[ -e "${S}"/nspr/configure.in ]] ; then
92 + einfo "Renaming configure.in to configure.ac"
93 + mv "${S}"/nspr/configure.{in,ac} || die
94 + fi
95 + # We must run eautoconf to regenerate configure
96 + eautoconf
97 +
98 + # make sure it won't find Perl out of Prefix
99 + sed -i -e "s/perl5//g" "${S}"/nspr/configure || die
100 +
101 + # Respect LDFLAGS
102 + sed -i -e 's/\$(MKSHLIB) \$(OBJS)/\$(MKSHLIB) \$(LDFLAGS) \$(OBJS)/g' \
103 + "${S}"/nspr/config/rules.mk || die
104 +}
105 +
106 +multilib_src_configure() {
107 + # We use the standard BUILD_xxx but nspr uses HOST_xxx
108 + tc-export_build_env BUILD_CC
109 + export HOST_CC=${BUILD_CC} HOST_CFLAGS=${BUILD_CFLAGS} HOST_LDFLAGS=${BUILD_LDFLAGS}
110 + tc-export AR CC CXX RANLIB
111 + [[ ${CBUILD} != ${CHOST} ]] \
112 + && export CROSS_COMPILE=1 \
113 + || unset CROSS_COMPILE
114 +
115 + local myconf=()
116 +
117 + # The configure has some fancy --enable-{{n,x}32,64bit} switches
118 + # that trigger some code conditional to platform & arch. This really
119 + # matters for the few common arches (x86, ppc) but we pass a little
120 + # more of them to be future-proof.
121 +
122 + # use ABI first, this will work for most cases
123 + case "${ABI}" in
124 + alpha|arm|hppa|m68k|o32|ppc|s390|sh|sparc|x86) ;;
125 + n32) myconf+=( --enable-n32 );;
126 + x32) myconf+=( --enable-x32 );;
127 + s390x|*64) myconf+=( --enable-64bit );;
128 + default) # no abi actually set, fall back to old check
129 + einfo "Running a short build test to determine 64bit'ness"
130 + echo > "${T}"/test.c || die
131 + ${CC} ${CFLAGS} ${CPPFLAGS} -c "${T}"/test.c -o "${T}"/test.o || die
132 + case $(file "${T}"/test.o) in
133 + *32-bit*x86-64*) myconf+=( --enable-x32 );;
134 + *64-bit*|*ppc64*|*x86_64*) myconf+=( --enable-64bit );;
135 + *32-bit*|*ppc*|*i386*) ;;
136 + *) die "Failed to detect whether your arch is 64bits or 32bits, disable distcc if you're using it, please";;
137 + esac ;;
138 + *) ;;
139 + esac
140 +
141 + # Ancient autoconf needs help finding the right tools.
142 + LC_ALL="C" ECONF_SOURCE="${S}/nspr" \
143 + ac_cv_path_AR="${AR}" \
144 + econf \
145 + --libdir="${EPREFIX}/usr/$(get_libdir)" \
146 + $(use_enable debug) \
147 + $(use_enable !debug optimize) \
148 + "${myconf[@]}"
149 +}
150 +
151 +multilib_src_install() {
152 + # Their build system is royally confusing, as usual
153 + MINOR_VERSION=${MIN_PV} # Used for .so version
154 + emake DESTDIR="${D}" install
155 +
156 + einfo "removing static libraries as upstream has requested!"
157 + rm -f "${ED}"/usr/$(get_libdir)/*.a || die "failed to remove static libraries."
158 +
159 + # install nspr-config
160 + dobin config/nspr-config
161 +
162 + # Remove stupid files in /usr/bin
163 + rm "${ED}"/usr/bin/prerr.properties || die
164 +
165 + # This is used only to generate prerr.c and prerr.h at build time.
166 + # No other projects use it, and we don't want to depend on perl.
167 + # Talked to upstream and they agreed w/punting.
168 + rm "${ED}"/usr/bin/compile-et.pl || die
169 +}