1 |
aballier 13/05/24 18:37:27 |
2 |
|
3 |
Modified: ChangeLog |
4 |
Added: freebsd-lib-9.1-r1.ebuild |
5 |
Log: |
6 |
Fix build with netware or bluetooth enabled, bug #448506. Fix glob(3) related resource exhaustion, bug #458718, FreeBSD-SA-13:02. Fix "no .eh_frame_hdr table will be created" error on x86-fbsd. All fixes from Yuta SATOH. |
7 |
|
8 |
(Portage version: 2.2.0_alpha177/cvs/Linux x86_64, signed Manifest commit with key 160F534A) |
9 |
|
10 |
Revision Changes Path |
11 |
1.172 sys-freebsd/freebsd-lib/ChangeLog |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-freebsd/freebsd-lib/ChangeLog?rev=1.172&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-freebsd/freebsd-lib/ChangeLog?rev=1.172&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-freebsd/freebsd-lib/ChangeLog?r1=1.171&r2=1.172 |
16 |
|
17 |
Index: ChangeLog |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-lib/ChangeLog,v |
20 |
retrieving revision 1.171 |
21 |
retrieving revision 1.172 |
22 |
diff -u -r1.171 -r1.172 |
23 |
--- ChangeLog 10 Mar 2013 14:01:51 -0000 1.171 |
24 |
+++ ChangeLog 24 May 2013 18:37:27 -0000 1.172 |
25 |
@@ -1,6 +1,14 @@ |
26 |
# ChangeLog for sys-freebsd/freebsd-lib |
27 |
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 |
28 |
-# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-lib/ChangeLog,v 1.171 2013/03/10 14:01:51 naota Exp $ |
29 |
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-lib/ChangeLog,v 1.172 2013/05/24 18:37:27 aballier Exp $ |
30 |
+ |
31 |
+*freebsd-lib-9.1-r1 (24 May 2013) |
32 |
+ |
33 |
+ 24 May 2013; Alexis Ballier <aballier@g.o> +freebsd-lib-9.1-r1.ebuild, |
34 |
+ +files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch: |
35 |
+ Fix build with netware or bluetooth enabled, bug #448506. Fix glob(3) related |
36 |
+ resource exhaustion, bug #458718, FreeBSD-SA-13:02. Fix "no .eh_frame_hdr |
37 |
+ table will be created" error on x86-fbsd. All fixes from Yuta SATOH. |
38 |
|
39 |
*freebsd-lib-9.0-r4 (10 Mar 2013) |
40 |
|
41 |
|
42 |
|
43 |
|
44 |
1.1 sys-freebsd/freebsd-lib/freebsd-lib-9.1-r1.ebuild |
45 |
|
46 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-freebsd/freebsd-lib/freebsd-lib-9.1-r1.ebuild?rev=1.1&view=markup |
47 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-freebsd/freebsd-lib/freebsd-lib-9.1-r1.ebuild?rev=1.1&content-type=text/plain |
48 |
|
49 |
Index: freebsd-lib-9.1-r1.ebuild |
50 |
=================================================================== |
51 |
# Copyright 1999-2013 Gentoo Foundation |
52 |
# Distributed under the terms of the GNU General Public License v2 |
53 |
# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-lib/freebsd-lib-9.1-r1.ebuild,v 1.1 2013/05/24 18:37:27 aballier Exp $ |
54 |
|
55 |
EAPI=2 |
56 |
|
57 |
inherit bsdmk freebsd flag-o-matic multilib toolchain-funcs eutils |
58 |
|
59 |
DESCRIPTION="FreeBSD's base system libraries" |
60 |
SLOT="0" |
61 |
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
62 |
|
63 |
# Crypto is needed to have an internal OpenSSL header |
64 |
# sys is needed for libalias, probably we can just extract that instead of |
65 |
# extracting the whole tarball |
66 |
SRC_URI="mirror://gentoo/${LIB}.tar.bz2 |
67 |
mirror://gentoo/${CONTRIB}.tar.bz2 |
68 |
mirror://gentoo/${CRYPTO}.tar.bz2 |
69 |
mirror://gentoo/${LIBEXEC}.tar.bz2 |
70 |
mirror://gentoo/${ETC}.tar.bz2 |
71 |
mirror://gentoo/${INCLUDE}.tar.bz2 |
72 |
mirror://gentoo/${USBIN}.tar.bz2 |
73 |
mirror://gentoo/${GNU}.tar.bz2 |
74 |
build? ( |
75 |
mirror://gentoo/${SYS}.tar.bz2 ) |
76 |
zfs? ( |
77 |
mirror://gentoo/${CDDL}.tar.bz2 )" |
78 |
|
79 |
if [ "${CATEGORY#*cross-}" = "${CATEGORY}" ]; then |
80 |
RDEPEND="ssl? ( dev-libs/openssl ) |
81 |
hesiod? ( net-dns/hesiod ) |
82 |
kerberos? ( virtual/krb5 ) |
83 |
usb? ( !dev-libs/libusb !dev-libs/libusbx ) |
84 |
zfs? ( =sys-freebsd/freebsd-cddl-${RV}* ) |
85 |
>=dev-libs/expat-2.0.1 |
86 |
!sys-libs/libutempter |
87 |
!sys-freebsd/freebsd-headers" |
88 |
DEPEND="${RDEPEND} |
89 |
>=sys-devel/flex-2.5.31-r2 |
90 |
=sys-freebsd/freebsd-sources-${RV}* |
91 |
!bootstrap? ( app-arch/bzip2 )" |
92 |
else |
93 |
SRC_URI="${SRC_URI} |
94 |
mirror://gentoo/${SYS}.tar.bz2" |
95 |
fi |
96 |
|
97 |
DEPEND="${DEPEND} |
98 |
userland_GNU? ( sys-apps/mtree ) |
99 |
=sys-freebsd/freebsd-mk-defs-${RV}*" |
100 |
|
101 |
S="${WORKDIR}/lib" |
102 |
|
103 |
export CTARGET=${CTARGET:-${CHOST}} |
104 |
if [ "${CTARGET}" = "${CHOST}" -a "${CATEGORY#*cross-}" != "${CATEGORY}" ]; then |
105 |
export CTARGET=${CATEGORY/cross-} |
106 |
fi |
107 |
|
108 |
IUSE="atm bluetooth ssl hesiod ipv6 kerberos usb netware |
109 |
build bootstrap crosscompile_opts_headers-only zfs |
110 |
userland_GNU userland_BSD multilib" |
111 |
|
112 |
pkg_setup() { |
113 |
[ -c /dev/zero ] || \ |
114 |
die "You forgot to mount /dev; the compiled libc would break." |
115 |
|
116 |
if ! use ssl && use kerberos; then |
117 |
eerror "If you want kerberos support you need to enable ssl support, too." |
118 |
fi |
119 |
|
120 |
use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= " |
121 |
use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= " |
122 |
use hesiod || mymakeopts="${mymakeopts} WITHOUT_HESIOD= " |
123 |
use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6_SUPPORT= " |
124 |
use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= " |
125 |
use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= " |
126 |
use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= " |
127 |
use usb || mymakeopts="${mymakeopts} WITHOUT_USB= " |
128 |
use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= " |
129 |
|
130 |
mymakeopts="${mymakeopts} WITHOUT_BIND= WITHOUT_BIND_LIBS= WITHOUT_SENDMAIL= WITHOUT_CLANG= " |
131 |
|
132 |
if [ "${CTARGET}" != "${CHOST}" ]; then |
133 |
mymakeopts="${mymakeopts} MACHINE=$(tc-arch-kernel ${CTARGET})" |
134 |
mymakeopts="${mymakeopts} MACHINE_ARCH=$(tc-arch-kernel ${CTARGET})" |
135 |
fi |
136 |
} |
137 |
|
138 |
PATCHES=( |
139 |
"${FILESDIR}/${PN}-6.0-pmc.patch" |
140 |
"${FILESDIR}/${PN}-6.0-gccfloat.patch" |
141 |
"${FILESDIR}/${PN}-6.0-flex-2.5.31.patch" |
142 |
"${FILESDIR}/${PN}-6.1-csu.patch" |
143 |
"${FILESDIR}/${PN}-8.0-rpcsec_gss.patch" |
144 |
"${FILESDIR}/${PN}-9.0-liblink.patch" |
145 |
"${FILESDIR}/${PN}-bsdxml2expat.patch" |
146 |
"${FILESDIR}/${PN}-9.0-netware.patch" |
147 |
"${FILESDIR}/${PN}-9.0-cve-2010-2632.patch" |
148 |
"${FILESDIR}/${PN}-9.0-bluetooth.patch" |
149 |
"${FILESDIR}/${PN}-9.1-.eh_frame_hdr-fix.patch" |
150 |
) |
151 |
|
152 |
# Here we disable and remove source which we don't need or want |
153 |
# In order: |
154 |
# - ncurses stuff |
155 |
# - libexpat creates a bsdxml library which is the same as expat |
156 |
# - archiving libraries (have their own ebuild) |
157 |
# - sendmail libraries (they are installed by sendmail) |
158 |
# - SNMP library and dependency (have their own ebuilds) |
159 |
# - Clang (compiler_rt and blocksruntime) |
160 |
# |
161 |
# The rest are libraries we already have somewhere else because |
162 |
# they are contribution. |
163 |
# Note: libtelnet is an internal lib used by telnet and telnetd programs |
164 |
# as it's not used in freebsd-lib package itself, it's pointless building |
165 |
# it here. |
166 |
REMOVE_SUBDIRS="ncurses \ |
167 |
libexpat \ |
168 |
libz libbz2 libarchive liblzma \ |
169 |
libsm libsmdb libsmutil \ |
170 |
libbegemot libbsnmp \ |
171 |
libcompiler_rt libblocksruntime \ |
172 |
libpam libpcap bind libwrap libmagic \ |
173 |
libcom_err libtelnet |
174 |
libelf libedit" |
175 |
|
176 |
# Are we building a cross-compiler? |
177 |
is_crosscompile() { |
178 |
[ "${CATEGORY#*cross-}" != "${CATEGORY}" ] |
179 |
} |
180 |
|
181 |
src_prepare() { |
182 |
sed -i.bak -e 's:-o/dev/stdout:-t:' "${S}/libc/net/Makefile.inc" |
183 |
|
184 |
# Upstream Display Managers default to using VT7 |
185 |
# We should make FreeBSD allow this by default |
186 |
local x= |
187 |
for x in "${WORKDIR}"/etc/etc.*/ttys ; do |
188 |
sed -i.bak \ |
189 |
-e '/ttyv5[[:space:]]/ a\ |
190 |
# Display Managers default to VT7.\ |
191 |
# If you use the xdm init script, keep ttyv6 commented out\ |
192 |
# unless you force a different VT for the DM being used.' \ |
193 |
-e '/^ttyv[678][[:space:]]/ s/^/# /' "${x}" \ |
194 |
|| die "Failed to sed ${x}" |
195 |
rm "${x}".bak |
196 |
done |
197 |
|
198 |
# This one is here because it also |
199 |
# patches "${WORKDIR}/include" |
200 |
cd "${WORKDIR}" |
201 |
epatch "${FILESDIR}/${PN}-includes.patch" |
202 |
epatch "${FILESDIR}/${PN}-8.0-gcc45.patch" |
203 |
epatch "${FILESDIR}/${PN}-9.0-opieincludes.patch" |
204 |
|
205 |
# Don't install the hesiod man page or header |
206 |
rm "${WORKDIR}"/include/hesiod.h || die |
207 |
sed -i.bak -e 's:hesiod.h::' "${WORKDIR}"/include/Makefile || die |
208 |
sed -i.bak -e 's:hesiod.c::' -e 's:hesiod.3::' \ |
209 |
"${WORKDIR}"/lib/libc/net/Makefile.inc || die |
210 |
|
211 |
# Fix the Makefiles of these few libraries that will overwrite our LDADD. |
212 |
cd "${S}" |
213 |
for dir in libradius libtacplus libcam libdevstat libfetch libgeom libmemstat libopie \ |
214 |
libsmb libprocstat libulog; do sed -i.bak -e 's:LDADD=:LDADD+=:g' "${dir}/Makefile" || \ |
215 |
die "Problem fixing \"${dir}/Makefile" |
216 |
done |
217 |
# Call LD with LDFLAGS, rename them to RAW_LDFLAGS |
218 |
sed -e 's/LDFLAGS/RAW_LDFLAGS/g' \ |
219 |
-i "${S}/csu/i386-elf/Makefile" \ |
220 |
-i "${S}/csu/ia64/Makefile" || die |
221 |
if use build; then |
222 |
cd "${WORKDIR}" |
223 |
# This patch has to be applied on ${WORKDIR}/sys, so we do it here since it |
224 |
# shouldn't be a symlink to /usr/src/sys (which should be already patched) |
225 |
epatch "${FILESDIR}"/${PN}-7.1-types.h-fix.patch |
226 |
epatch "${FILESDIR}"/freebsd-sources-9.0-sysctluint.patch |
227 |
return 0 |
228 |
fi |
229 |
|
230 |
if ! is_crosscompile ; then |
231 |
ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys" || die "Couldn't make sys symlink!" |
232 |
else |
233 |
sed -i.bak -e "s:/usr/include:/usr/${CTARGET}/usr/include:g" \ |
234 |
"${S}/libc/rpc/Makefile.inc" \ |
235 |
"${S}/libc/yp/Makefile.inc" |
236 |
fi |
237 |
|
238 |
if install --version 2> /dev/null | grep -q GNU; then |
239 |
sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile" |
240 |
fi |
241 |
|
242 |
# Let arch-specific includes to be found |
243 |
local machine |
244 |
machine=$(tc-arch-kernel ${CTARGET}) |
245 |
ln -s "${WORKDIR}/sys/${machine}/include" "${WORKDIR}/include/machine" || \ |
246 |
die "Couldn't make ${machine}/include symlink." |
247 |
|
248 |
cd "${S}" |
249 |
use bootstrap && dummy_mk libstand |
250 |
# Try to fix sed calls for GNU sed. Do it only with GNU userland and force |
251 |
# BSD's sed on BSD. |
252 |
if use userland_GNU; then |
253 |
find . -name Makefile -exec sed -ibak 's/sed -i /sed -i/' {} \; |
254 |
fi |
255 |
} |
256 |
|
257 |
get_csudir() { |
258 |
if [ -d "${WORKDIR}/lib/csu/$1-elf" ]; then |
259 |
echo "lib/csu/$1-elf" |
260 |
else |
261 |
echo "lib/csu/$1" |
262 |
fi |
263 |
} |
264 |
|
265 |
bootstrap_csu() { |
266 |
local csudir="$(get_csudir $(tc-arch-kernel ${CTARGET}))" |
267 |
export RAW_LDFLAGS=$(raw-ldflags) |
268 |
cd "${WORKDIR}/${csudir}" || die "Missing ${csudir}." |
269 |
freebsd_src_compile |
270 |
|
271 |
CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}" |
272 |
append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}" |
273 |
} |
274 |
|
275 |
# Compile libssp_nonshared.a and add it's path to LDFLAGS. |
276 |
bootstrap_libssp_nonshared() { |
277 |
cd "${WORKDIR}/gnu/lib/libssp/libssp_nonshared/" || die "missing libssp." |
278 |
freebsd_src_compile |
279 |
append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/libssp/libssp_nonshared/" |
280 |
export LDADD="-lssp_nonshared" |
281 |
} |
282 |
|
283 |
# What to build for a non-native build: cross-compiler, non-native abi in |
284 |
# multilib. We also need the csu but this has to be handled separately. |
285 |
NON_NATIVE_SUBDIRS="lib/libc lib/msun gnu/lib/libssp/libssp_nonshared lib/libthr lib/libutil" |
286 |
|
287 |
# Subdirs for a native build: |
288 |
NATIVE_SUBDIRS="lib gnu/lib/libssp/libssp_nonshared gnu/lib/libregex" |
289 |
|
290 |
# Is my $ABI native ? |
291 |
is_native_abi() { |
292 |
is_crosscompile && return 1 |
293 |
use multilib || return 0 |
294 |
[ "${ABI}" = "${DEFAULT_ABI}" ] |
295 |
} |
296 |
|
297 |
# Do we need to bootstrap the csu and libssp_nonshared? |
298 |
need_bootstrap() { |
299 |
is_crosscompile || use build || ! is_native_abi || has_version "<${CATEGORY}/${P}" |
300 |
} |
301 |
|
302 |
# Get the subdirs we are building. |
303 |
get_subdirs() { |
304 |
local ret="" |
305 |
if is_native_abi ; then |
306 |
# If we are building for the native ABI, build everything |
307 |
ret="${NATIVE_SUBDIRS}" |
308 |
elif is_crosscompile ; then |
309 |
# With a cross-compiler we only build the very core parts. |
310 |
ret="${NON_NATIVE_SUBDIRS}" |
311 |
if [ "${EBUILD_PHASE}" = "install" ]; then |
312 |
# Add the csu dir first when installing. We treat it separately for |
313 |
# compiling. |
314 |
ret="$(get_csudir $(tc-arch-kernel ${CTARGET})) ${ret}" |
315 |
fi |
316 |
elif use build ; then |
317 |
# For the non-native ABIs we only build the csu parts and very core |
318 |
# libraries for now. |
319 |
ret="gnu/lib/libssp/libssp_nonshared" |
320 |
if [ "${EBUILD_PHASE}" = "install" ]; then |
321 |
ret="$(get_csudir $(tc-arch-kernel ${CHOST})) ${ret}" |
322 |
fi |
323 |
else |
324 |
# Only build the csu parts and core libraries for now. |
325 |
ret="gnu/lib/libssp/libssp_nonshared" |
326 |
if [ "${EBUILD_PHASE}" = "install" ]; then |
327 |
ret="$(get_csudir $(tc-arch-kernel ${CHOST})) ${ret}" |
328 |
fi |
329 |
# Finally, with a non-native ABI without USE=build, we build everything |
330 |
# too. |
331 |
#ret="${NATIVE_SUBDIRS}" |
332 |
fi |
333 |
echo "${ret}" |
334 |
} |
335 |
|
336 |
# Bootstrap the core libraries and setup the flags so that the other parts can |
337 |
# build against it. |
338 |
do_bootstrap() { |
339 |
einfo "Bootstrapping on ${CHOST} for ${CTARGET}" |
340 |
if ! is_crosscompile ; then |
341 |
# Pre-install headers, but not when building a cross-compiler since we |
342 |
# assume they have been installed in the previous pass. |
343 |
einfo "Pre-installing includes in include_proper_${ABI}" |
344 |
mkdir "${WORKDIR}/include_proper_${ABI}" || die |
345 |
CTARGET="${CHOST}" install_includes "/include_proper_${ABI}" |
346 |
CFLAGS="${CFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}" |
347 |
fi |
348 |
bootstrap_csu |
349 |
bootstrap_libssp_nonshared |
350 |
} |
351 |
|
352 |
# Compile it. Assume we have the toolchain setup correctly. |
353 |
do_compile() { |
354 |
export MAKEOBJDIRPREFIX="${WORKDIR}/${CHOST}" |
355 |
mkdir "${MAKEOBJDIRPREFIX}" || die "Could not create ${MAKEOBJDIRPREFIX}." |
356 |
# Bootstrap if needed, otherwise assume the system headers are in |
357 |
# /usr/include. |
358 |
if need_bootstrap ; then |
359 |
do_bootstrap |
360 |
else |
361 |
CFLAGS="${CFLAGS} -isystem /usr/include" |
362 |
fi |
363 |
|
364 |
export RAW_LDFLAGS=$(raw-ldflags) |
365 |
|
366 |
# Everything is now setup, build it! |
367 |
for i in $(get_subdirs) ; do |
368 |
einfo "Building in ${i}... with CC=${CC} and CFLAGS=${CFLAGS}" |
369 |
cd "${WORKDIR}/${i}/" || die "missing ${i}." |
370 |
freebsd_src_compile || die "make ${i} failed" |
371 |
done |
372 |
} |
373 |
|
374 |
src_compile() { |
375 |
# Does not work with GNU sed |
376 |
# Force BSD's sed on BSD. |
377 |
if use userland_BSD ; then |
378 |
export ESED=/usr/bin/sed |
379 |
unalias sed |
380 |
fi |
381 |
|
382 |
cd "${WORKDIR}/include" |
383 |
$(freebsd_get_bmake) CC="$(tc-getCC)" || die "make include failed" |
384 |
|
385 |
use crosscompile_opts_headers-only && return 0 |
386 |
|
387 |
# Bug #270098 |
388 |
append-flags $(test-flags -fno-strict-aliasing) |
389 |
|
390 |
# Bug #324445 |
391 |
append-flags $(test-flags -fno-strict-overflow) |
392 |
|
393 |
# strip flags and do not do it later, we only add safe, and in fact |
394 |
# needed flags after all |
395 |
strip-flags |
396 |
export NOFLAGSTRIP=yes |
397 |
if is_crosscompile ; then |
398 |
export YACC='yacc -by' |
399 |
CHOST=${CTARGET} tc-export CC LD CXX RANLIB |
400 |
mymakeopts="${mymakeopts} NLS=" |
401 |
CFLAGS="${CFLAGS} -isystem /usr/${CTARGET}/usr/include" |
402 |
append-ldflags "-L${WORKDIR}/${CHOST}/${WORKDIR}/lib/libc" |
403 |
fi |
404 |
|
405 |
if is_crosscompile ; then |
406 |
do_compile |
407 |
else |
408 |
for ABI in $(get_all_abis) ; do |
409 |
# First, save the variables: CFLAGS, CXXFLAGS, LDFLAGS and mymakeopts. |
410 |
for i in CFLAGS CXXFLAGS LDFLAGS mymakeopts ; do |
411 |
export ${i}_SAVE="${!i}" |
412 |
done |
413 |
|
414 |
multilib_toolchain_setup ${ABI} |
415 |
|
416 |
local target="$(tc-arch-kernel ${CHOST})" |
417 |
mymakeopts="${mymakeopts} TARGET=${target} MACHINE=${target} MACHINE_ARCH=${target}" |
418 |
CFLAGADD="" |
419 |
if ! is_native_abi ; then |
420 |
mymakeopts="${mymakeopts} COMPAT_32BIT=" |
421 |
fi |
422 |
|
423 |
einfo "Building for ABI ${ABI} and TARGET=$(tc-arch-kernel ${CHOST})" |
424 |
|
425 |
CTARGET="${CHOST}" do_compile |
426 |
|
427 |
# Restore the variables now. |
428 |
for i in CFLAGS CXXFLAGS LDFLAGS mymakeopts ; do |
429 |
ii="${i}_SAVE" |
430 |
export ${i}="${!ii}" |
431 |
done |
432 |
done |
433 |
fi |
434 |
} |
435 |
|
436 |
gen_libc_ldscript() { |
437 |
# Parameters: |
438 |
# $1 = target libdir |
439 |
# $2 = source libc dir |
440 |
# $3 = source libssp_nonshared dir |
441 |
|
442 |
# Clear the symlink. |
443 |
rm -f "${D}/$2/libc.so" || die |
444 |
|
445 |
# Move the library if needed |
446 |
if [ "$1" != "$2" ] ; then |
447 |
mv "${D}/$2/libc.so.7" "${D}/$1/" || die |
448 |
fi |
449 |
|
450 |
# Generate libc.so ldscript for inclusion of libssp_nonshared.a when linking |
451 |
# this is done to avoid having to touch gcc spec file as it is currently |
452 |
# done on FreeBSD upstream, mostly because their binutils aren't able to |
453 |
# cope with linker scripts yet. |
454 |
# Taken from toolchain-funcs.eclass: |
455 |
local output_format |
456 |
output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') |
457 |
[[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" |
458 |
|
459 |
cat > "${D}/$2/libc.so" <<-END_LDSCRIPT |
460 |
/* GNU ld script |
461 |
SSP (-fstack-protector) requires __stack_chk_fail_local to be local. |
462 |
GCC invokes this symbol in a non-PIC way, which results in TEXTRELs if |
463 |
this symbol was provided by a shared libc. So we link in |
464 |
libssp_nonshared.a from here. |
465 |
*/ |
466 |
${output_format} |
467 |
GROUP ( /$1/libc.so.7 /$3/libssp_nonshared.a ) |
468 |
END_LDSCRIPT |
469 |
} |
470 |
|
471 |
do_install() { |
472 |
export MAKEOBJDIRPREFIX="${WORKDIR}/${CHOST}" |
473 |
for i in $(get_subdirs) ; do |
474 |
einfo "Installing in ${i}..." |
475 |
cd "${WORKDIR}/${i}/" || die "missing ${i}." |
476 |
freebsd_src_install || die "Install ${i} failed" |
477 |
done |
478 |
} |
479 |
|
480 |
src_install() { |
481 |
[ "${CTARGET}" = "${CHOST}" ] \ |
482 |
&& INCLUDEDIR="/usr/include" \ |
483 |
|| INCLUDEDIR="/usr/${CTARGET}/usr/include" |
484 |
dodir ${INCLUDEDIR} |
485 |
einfo "Installing for ${CTARGET} in ${CHOST}.." |
486 |
install_includes ${INCLUDEDIR} |
487 |
|
488 |
use crosscompile_opts_headers-only && return 0 |
489 |
local mylibdir=$(get_libdir) |
490 |
|
491 |
if is_crosscompile ; then |
492 |
mymakeopts="${mymakeopts} NO_MAN= \ |
493 |
INCLUDEDIR=/usr/${CTARGET}/usr/include \ |
494 |
SHLIBDIR=/usr/${CTARGET}/usr/lib \ |
495 |
LIBDIR=/usr/${CTARGET}/usr/lib" |
496 |
|
497 |
dosym "usr/include" "/usr/${CTARGET}/sys-include" |
498 |
do_install |
499 |
else |
500 |
if ! use multilib ; then |
501 |
# Set SHLIBDIR and LIBDIR for multilib |
502 |
mymakeopts="${mymakeopts} SHLIBDIR=/usr/${mylibdir} LIBDIR=/usr/${mylibdir}" |
503 |
do_install |
504 |
else |
505 |
for ABI in $(get_all_abis) ; do |
506 |
mymakeopts_SAVE="${mymakeopts}" |
507 |
multilib_toolchain_setup ${ABI} |
508 |
mymakeopts="${mymakeopts} SHLIBDIR=/usr/$(get_libdir) LIBDIR=/usr/$(get_libdir)" |
509 |
do_install |
510 |
mymakeopts="${mymakeopts_SAVE}" |
511 |
done |
512 |
fi |
513 |
fi |
514 |
|
515 |
# Don't install the rest of the configuration files if crosscompiling |
516 |
if is_crosscompile ; then |
517 |
# This is to get it stripped with the correct tools, otherwise it gets |
518 |
# stripped with the host strip. |
519 |
# And also get the correct OUTPUT_FORMAT in the libc ldscript. |
520 |
export CHOST=${CTARGET} |
521 |
gen_libc_ldscript "usr/${CTARGET}/usr/lib" "usr/${CTARGET}/usr/lib" "usr/${CTARGET}/usr/lib" |
522 |
return 0 |
523 |
fi |
524 |
|
525 |
cd "${WORKDIR}/etc/" |
526 |
insinto /etc |
527 |
doins nls.alias mac.conf netconfig |
528 |
|
529 |
# Install ttys file |
530 |
local MACHINE="$(tc-arch-kernel)" |
531 |
doins "etc.${MACHINE}"/* |
532 |
|
533 |
# Generate ldscripts for core libraries that will go in / |
534 |
gen_usr_ldscript -a alias cam geom ipsec jail kiconv \ |
535 |
kvm m md procstat sbuf thr ufs util |
536 |
|
537 |
gen_libc_ldscript "${mylibdir}" "usr/${mylibdir}" "usr/${mylibdir}" |
538 |
|
539 |
# Install a libusb.pc for better compat with Linux's libusb |
540 |
if use usb ; then |
541 |
dodir /usr/$(get_libdir)/pkgconfig |
542 |
sed -e "s:@LIBDIR@:/usr/$(get_libdir):" "${FILESDIR}/libusb.pc.in" > "${D}/usr/$(get_libdir)/pkgconfig/libusb.pc" || die |
543 |
sed -e "s:@LIBDIR@:/usr/$(get_libdir):" "${FILESDIR}/libusb-1.0.pc.in" > "${D}/usr/$(get_libdir)/pkgconfig/libusb1.0.pc" || die |
544 |
fi |
545 |
} |
546 |
|
547 |
install_includes() |
548 |
{ |
549 |
local INCLUDEDIR="$1" |
550 |
|
551 |
# The idea is to be called from either install or unpack. |
552 |
# During unpack it's required to install them as portage's user. |
553 |
if [[ "${EBUILD_PHASE}" == "install" ]]; then |
554 |
local DESTDIR="${D}" |
555 |
BINOWN="root" |
556 |
BINGRP="wheel" |
557 |
else |
558 |
local DESTDIR="${WORKDIR}" |
559 |
[[ -z "${USER}" ]] && USER="portage" |
560 |
BINOWN="${USER}" |
561 |
[[ -z "${GROUPS}" ]] && GROUPS="portage" |
562 |
BINGRP="${GROUPS}" |
563 |
fi |
564 |
|
565 |
# Must exist before we use it. |
566 |
[[ -d "${DESTDIR}${INCLUDEDIR}" ]] || die "dodir or mkdir ${INCLUDEDIR} before using install_includes." |
567 |
cd "${WORKDIR}/include" |
568 |
|
569 |
local MACHINE="$(tc-arch-kernel)" |
570 |
|
571 |
einfo "Installing includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..." |
572 |
$(freebsd_get_bmake) installincludes \ |
573 |
MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \ |
574 |
DESTDIR="${DESTDIR}" \ |
575 |
INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \ |
576 |
BINGRP="${BINGRP}" || die "install_includes() failed" |
577 |
einfo "includes installed ok." |
578 |
EXTRA_INCLUDES="lib/librtld_db lib/libutil lib/msun gnu/lib/libregex" |
579 |
for i in $EXTRA_INCLUDES; do |
580 |
einfo "Installing $i includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..." |
581 |
cd "${WORKDIR}/$i" || die |
582 |
$(freebsd_get_bmake) installincludes DESTDIR="${DESTDIR}" \ |
583 |
MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \ |
584 |
INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \ |
585 |
BINGRP="${BINGRP}" || die "problem installing $i includes." |
586 |
einfo "$i includes installed ok." |
587 |
done |
588 |
} |