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