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