Line 0
Link Here
|
0 |
- |
1 |
# Copyright 1999-2014 Gentoo Foundation |
|
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/dev-libs/nspr/nspr-4.10.7-r1.ebuild,v 1.3 2014/12/10 19:34:49 ago Exp $ |
4 |
|
5 |
EAPI=5 |
6 |
WANT_AUTOCONF="2.5" |
7 |
|
8 |
inherit autotools eutils multilib toolchain-funcs versionator multilib-minimal |
9 |
|
10 |
MIN_PV="$(get_version_component_range 2)" |
11 |
|
12 |
DESCRIPTION="Netscape Portable Runtime" |
13 |
HOMEPAGE="http://www.mozilla.org/projects/nspr/" |
14 |
SRC_URI="ftp://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v${PV}/src/${P}.tar.gz" |
15 |
|
16 |
LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )" |
17 |
SLOT="0" |
18 |
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" |
19 |
IUSE="debug" |
20 |
|
21 |
RDEPEND=" |
22 |
abi_x86_32? ( |
23 |
!<=app-emulation/emul-linux-x86-baselibs-20140508-r12 |
24 |
!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] |
25 |
)" |
26 |
|
27 |
MULTILIB_CHOST_TOOLS=( |
28 |
/usr/bin/nspr-config |
29 |
) |
30 |
|
31 |
src_prepare() { |
32 |
cd "${S}"/nspr || die |
33 |
epatch "${FILESDIR}"/${PN}-4.7.0-prtime.patch |
34 |
epatch "${FILESDIR}"/${PN}-4.7.1-solaris.patch |
35 |
epatch "${FILESDIR}"/${PN}-4.10.6-solaris.patch |
36 |
epatch "${FILESDIR}"/${PN}-4.8.4-darwin-install_name.patch |
37 |
epatch "${FILESDIR}"/${PN}-4.8.9-link-flags.patch |
38 |
# We do not need to pass -L$libdir via nspr-config --libs |
39 |
epatch "${FILESDIR}"/${PN}-4.9.5_nspr_config.patch |
40 |
|
41 |
epatch "${FILESDIR}"/${PN}-4.10.6-no-getprotobyname_r.patch |
42 |
|
43 |
# We must run eautoconf to regenerate configure |
44 |
eautoconf |
45 |
|
46 |
# make sure it won't find Perl out of Prefix |
47 |
sed -i -e "s/perl5//g" "${S}"/nspr/configure || die |
48 |
|
49 |
# Respect LDFLAGS |
50 |
sed -i -e 's/\$(MKSHLIB) \$(OBJS)/\$(MKSHLIB) \$(LDFLAGS) \$(OBJS)/g' \ |
51 |
"${S}"/nspr/config/rules.mk || die |
52 |
} |
53 |
|
54 |
multilib_src_configure() { |
55 |
# We use the standard BUILD_xxx but nspr uses HOST_xxx |
56 |
tc-export_build_env BUILD_CC |
57 |
export HOST_CC=${BUILD_CC} HOST_CFLAGS=${BUILD_CFLAGS} HOST_LDFLAGS=${BUILD_LDFLAGS} |
58 |
tc-export AR CC CXX RANLIB |
59 |
[[ ${CBUILD} != ${CHOST} ]] \ |
60 |
&& export CROSS_COMPILE=1 \ |
61 |
|| unset CROSS_COMPILE |
62 |
|
63 |
local myconf=() |
64 |
|
65 |
# The configure has some fancy --enable-{{n,x}32,64bit} switches |
66 |
# that trigger some code conditional to platform & arch. This really |
67 |
# matters for the few common arches (x86, ppc) but we pass a little |
68 |
# more of them to be future-proof. |
69 |
|
70 |
# use ABI first, this will work for most cases |
71 |
case "${ABI}" in |
72 |
alpha|arm|hppa|m68k|o32|ppc|s390|sh|sparc|x86) ;; |
73 |
n32) myconf+=( --enable-n32 );; |
74 |
x32) myconf+=( --enable-x32 );; |
75 |
s390x|*64) myconf+=( --enable-64bit );; |
76 |
default) # no abi actually set, fall back to old check |
77 |
einfo "Running a short build test to determine 64bit'ness" |
78 |
echo > "${T}"/test.c || die |
79 |
${CC} ${CFLAGS} ${CPPFLAGS} -c "${T}"/test.c -o "${T}"/test.o || die |
80 |
case $(file "${T}"/test.o) in |
81 |
*32-bit*x86-64*) myconf+=( --enable-x32 );; |
82 |
*64-bit*|*ppc64*|*x86_64*) myconf+=( --enable-64bit );; |
83 |
*32-bit*|*ppc*|*i386*) ;; |
84 |
*) die "Failed to detect whether your arch is 64bits or 32bits, disable distcc if you're using it, please";; |
85 |
esac ;; |
86 |
*) ;; |
87 |
esac |
88 |
|
89 |
# Ancient autoconf needs help finding the right tools. |
90 |
LC_ALL="C" ECONF_SOURCE="${S}/nspr" \ |
91 |
ac_cv_path_AR="${AR}" \ |
92 |
econf \ |
93 |
--libdir="${EPREFIX}/usr/$(get_libdir)" \ |
94 |
$(use_enable debug) \ |
95 |
$(use_enable !debug optimize) \ |
96 |
"${myconf[@]}" |
97 |
} |
98 |
|
99 |
multilib_src_install() { |
100 |
# Their build system is royally confusing, as usual |
101 |
MINOR_VERSION=${MIN_PV} # Used for .so version |
102 |
emake DESTDIR="${D}" install |
103 |
|
104 |
einfo "removing static libraries as upstream has requested!" |
105 |
rm -f "${ED}"/usr/$(get_libdir)/*.a || die "failed to remove static libraries." |
106 |
|
107 |
# install nspr-config |
108 |
dobin config/nspr-config |
109 |
|
110 |
# Remove stupid files in /usr/bin |
111 |
rm "${ED}"/usr/bin/prerr.properties || die |
112 |
|
113 |
# This is used only to generate prerr.c and prerr.h at build time. |
114 |
# No other projects use it, and we don't want to depend on perl. |
115 |
# Talked to upstream and they agreed w/punting. |
116 |
rm "${ED}"/usr/bin/compile-et.pl || die |
117 |
} |