Gentoo Archives: gentoo-commits

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