diff options
author | Alexis Ballier <aballier@gentoo.org> | 2013-05-24 18:37:41 +0000 |
---|---|---|
committer | Alexis Ballier <aballier@gentoo.org> | 2013-05-24 18:37:41 +0000 |
commit | 72aa8c534334619fd4ae9001ed1417bc7bd0ba63 (patch) | |
tree | 6c95fef601e6f40e4944215fb4e8e7fcb0386b2d /sys-freebsd | |
parent | Version bump for the 3.0 / 3.4 series, remove old. (diff) | |
download | historical-72aa8c534334619fd4ae9001ed1417bc7bd0ba63.tar.gz historical-72aa8c534334619fd4ae9001ed1417bc7bd0ba63.tar.bz2 historical-72aa8c534334619fd4ae9001ed1417bc7bd0ba63.zip |
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.
Package-Manager: portage-2.2.0_alpha177/cvs/Linux x86_64
Manifest-Sign-Key: 0x160F534A
Diffstat (limited to 'sys-freebsd')
-rw-r--r-- | sys-freebsd/freebsd-lib/ChangeLog | 10 | ||||
-rw-r--r-- | sys-freebsd/freebsd-lib/Manifest | 22 | ||||
-rw-r--r-- | sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch | 17 | ||||
-rw-r--r-- | sys-freebsd/freebsd-lib/freebsd-lib-9.1-r1.ebuild | 538 |
4 files changed, 571 insertions, 16 deletions
diff --git a/sys-freebsd/freebsd-lib/ChangeLog b/sys-freebsd/freebsd-lib/ChangeLog index 003b3e2d98d0..01f756347d57 100644 --- a/sys-freebsd/freebsd-lib/ChangeLog +++ b/sys-freebsd/freebsd-lib/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for sys-freebsd/freebsd-lib # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-lib/ChangeLog,v 1.171 2013/03/10 14:01:51 naota Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-lib/ChangeLog,v 1.172 2013/05/24 18:37:27 aballier Exp $ + +*freebsd-lib-9.1-r1 (24 May 2013) + + 24 May 2013; Alexis Ballier <aballier@gentoo.org> +freebsd-lib-9.1-r1.ebuild, + +files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch: + 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. *freebsd-lib-9.0-r4 (10 Mar 2013) diff --git a/sys-freebsd/freebsd-lib/Manifest b/sys-freebsd/freebsd-lib/Manifest index 01ed8b7e8fbd..e178cd605e6d 100644 --- a/sys-freebsd/freebsd-lib/Manifest +++ b/sys-freebsd/freebsd-lib/Manifest @@ -20,6 +20,7 @@ AUX freebsd-lib-9.0-liblink.patch 627 SHA256 41f0b7f92f2a8f0a3e422447b830d7dec70 AUX freebsd-lib-9.0-netware.patch 400 SHA256 e83d43f5bf9461c3d332365cca12db7b041b765c79eef392970665740411c382 SHA512 07ebde5797480f37502e60db2a8c9ce9459bd55b176e79c0f20a859cf737f619559cb27706fb0e83fb501493677a3ffeaa9a98d45db3c0c539b71d2f18140246 WHIRLPOOL 2d78565fe0bc0dcdd61d028ba24b20d2db94f32b40536e7e8e1d5e7f485e0e2f3125807dbb6607d26e4366a6aa8ee89a8f0af7c9498f1fba9431f652c181a8f1 AUX freebsd-lib-9.0-opieincludes.patch 4495 SHA256 0868e7454053170c3399f1a03a68f3e70410c79db865e7e2f2b51f5961b5718b SHA512 a3828985f7da9e72ad44d88640952d56079693024bc11b4e3cca86b6f455a9e4756ba76f9e6d4c15960898f39e1dac7bc833e3241082f532c7fbd6d7d6f9418b WHIRLPOOL e0180dd0086c054e9f6895ecfe34bfb21d0e1db483dfc63ad411c651954c4703996d9b537a9566133a01770f2cf0f331727865013413181728c3b21740735473 AUX freebsd-lib-9.0-trylock-adaptive.patch 439 SHA256 af501c40124e628c2f739d88a4efa7ef3513694bd79ab44db30e4b3f73864612 SHA512 ceeeea302294db5a25b5534685dce563778572010f0072ecb300a66550ee8cc241e0ae5523e32fd5424560e82d913c37aefe06c2a6725e951ba4ad5df73a1a68 WHIRLPOOL d2a65eab4b03a7fb65e2dd6f03c2e60fe1248412e28a0829757e6cb733d1f487ee79959680f1db8af20fc409a165c5f4aea3038171e7b82aee7d38c29552531e +AUX freebsd-lib-9.1-.eh_frame_hdr-fix.patch 695 SHA256 6c6d7a958c989edc6ee76c5b9c2146fa449adda11c3b89b550780c7a78d93190 SHA512 c40270e8890a1152a6f2e705461ac64f8cc44e6d0306d895a0d146017d4fe3553853de88178e0744fc1be4197a4eb35b578c68593c80467dd8cf15c35720413d WHIRLPOOL 1fa3c5cdba333951b918eb5c1eb793ab49921268a6a397e38f2adad383c2c03ccf382892ed8d44e2480f8ca891ce3c3a0b122a026cbf232058ac3bcf2f2d5133 AUX freebsd-lib-bsdxml.patch 339 SHA256 c1ac47d6c7176475f0f4b86bb17288a980b44a799fb6f4e7b1920f69e0447dc9 SHA512 8d14ebc848426cf600cf2206f60b91d3a5e555c738be8bb84707dcf2455be98ea3dd0a6929495b93027f71097ff0232cc85c16be4d5381a167ee0aae5a14d542 WHIRLPOOL dbafb2f98b56cac9c3ec1377c7fae40935ca3c8b1116665ce36b82a55242dbead24dc4fc38d0268cf5af82e7f908543f1376fdd3f7d847bd92dc51438a3934ee AUX freebsd-lib-bsdxml2expat.patch 708 SHA256 0c3ec3657155c5032479181119c488d43a479ab0dfe7a7d7ed0dabce16853e85 SHA512 d3b321062886ee636a09af4b8714ae90317c17eb954a3d491cd21ca90605e26491033df4d6f02a517eda423783db74dad16adf7ee1bdc5557392cc70218ee9c7 WHIRLPOOL 5c262c59aee9e642d3a8929a453b56c7a55ba60f3011d6ac07b750a30297eb992a564ba4db18714b7eac58bbe3ded1ff4249150128947d25dd1344e59e16c9cb AUX freebsd-lib-includes.patch 316 SHA256 be4dd4c905715c2d165be282cf377f799b32ccb76986947bc0bf1b5730b57b06 SHA512 31b7f368a4d3998e42486cb944a001a8371c365276eac94fa8712e29dbe9a13a7756a2fd77fbff87a1f7f4c19b32721c74bbb099f611d46a8c78b73f92d9255e WHIRLPOOL 8c4c2c6d1e9556303520c4cd8f6996f0f24c8b45985d4326db880c187b6db30e914a6e47b40ea4a79d7a309fdd579b39232329daf74758412ac518b0a9d0a317 @@ -78,23 +79,14 @@ EBUILD freebsd-lib-7.2-r1.ebuild 12064 SHA256 8dbdd55fda050429e3c7fc7c6a8a64c243 EBUILD freebsd-lib-8.0.ebuild 14745 SHA256 9227bfdc720bc90442c918b8aed86fbcedbd7ad5d5b13d29519587016e362aa5 SHA512 73c6744af7e5affa4869f30c6043d1c74bcecb11eba9e9eea2176a3815f2fe9af138f10d48c8c20ce8b08cc6dc865c79fb3675d814fb13dae10b4dba2b6a3595 WHIRLPOOL d96b990bb1d32ca1c1dca097575af6521da9e5b9adbc1f7b0d494ee73ad53ec0fa947d919be10b8f7342c0bd13d1859bed35cf677f47714e20e545d3029d5563 EBUILD freebsd-lib-8.2-r1.ebuild 15816 SHA256 0d7ffdafe52db8b8c0c13741d15cf5ef32d808179bcfd05915afc4b5557a618a SHA512 2623c08ceb9f09d655d742860ca66f26669fb4ac5674e2b36fbe5a737580a16f404ff5abacaa42dd61a5b104805b29cc83f5c37b17f6c94865772cae169dea3a WHIRLPOOL 9b5780f01ca7980b456449fd8bec36e681ee6fb491839d6b7d7655efe31b57c000214e031c389b58e465349a845846860a1d24e8104ea9692bea37a080d7f8af EBUILD freebsd-lib-9.0-r4.ebuild 17066 SHA256 3ee6dd5b4496d557c539778b65686da8bbcf88c34c7725227639254cbfc7152f SHA512 df5b7a8c1c344c4ef4eda924351659b98673bd11d18c33ecacacc467c42278abd88a1226c95b36775a1eb1136d69e4a89d906e9f5a4dd5c528c19cd248ccd35e WHIRLPOOL f5751e23801ac805b14d1f533e58b97711e83b0e18dd73feca2f028a5473d0c3a6161b7f04fb74c858761db44c68c2d9c3ff32688b6407cfd678c69bd3d0e121 +EBUILD freebsd-lib-9.1-r1.ebuild 17335 SHA256 396e2853987e3aa39f8801af12e6de67dfd217062d31cb60fd47819de9f77996 SHA512 7730158f90f200f69fca1d9d264aa0fdb46b5a2bea213d0874354119e5d73d68440952f835b378dc5f51c9d73b822fe2750bb985f8cb3d0e101b233b8aaf8596 WHIRLPOOL 188e4f88dbeaf5efec3f9e2a3eca5f2b05578aa2a850a37186cdc30fdf292135eded14c4388ae2241e1a698cc865756a5405ef0e3f85f5bb42e9ae63ac18e8a5 EBUILD freebsd-lib-9.1.ebuild 17157 SHA256 b1a74967940cb0eb70c6965b3f2add374bc2155afd975c44a90cf65c744ea632 SHA512 ecfb6745880c47dc965363744869cb491f05d60c03463779eb250b3c71d443436dbdc03ae4ce741d8c99d57897a84561e09412d0f825cc9e552c4d17e5253c2d WHIRLPOOL a17b3b88765e62d1f415c41bd5f4e1f9c8349b29eac65e2e064d282ac3af33b5eea532c613fe25d1e6ad2e56ad82263be15128ba5eada42d95023869491c40da -MISC ChangeLog 35256 SHA256 d62fe2104e1b78307eb51b6efbece03a9d3dffc4a051a020633c027ef7c248fb SHA512 69d8f0f82e02d4e90583d2464a5b440099ca023459c78fbbc11ff38a71edbbf3370f43b1793d559aceb1162741d2790688da3cfcfde45b6f9eb758654e9fdcce WHIRLPOOL 0c54f53271e7cf9d017a1b25e50418fb2820550724277d883a9bf9e8e037838af139834e78f5255c66882f51e239fdc41b52e53bc9f5287525c82ad0987505b9 +MISC ChangeLog 35652 SHA256 c7b5a379403d17db85a72ee187906ddd48d8397cd6ab3bdddb097e5ca9882642 SHA512 1f288acc3dc7321b3dcc17bec6b3e686285739fdfdc1c5e8e30abee71a2e47bb157f122df3dc002f03d8c1585b664c6fe9738b74671aac7b1a8eb56b788b7438 WHIRLPOOL e5876e26cc040889cf9fc57a55adcbcf8dc76a02a199f98e8570ef113149d69095183f69b58e5394cf218cafcc1b15365171f612275122a7bbbb71125bff3913 MISC metadata.xml 410 SHA256 0ea0a391db3018afdf230e293ffedbc313b4a20db703c8c83fdf144a28c6c246 SHA512 de2a427cd8fcc2c0d7c0a1821f4cc916a280d9c0e21d83fdb7c35d110b48e96854baffc7d469e3461c2a6ee81eaec14d105c45cafbd3aaa37100a525bc60b7af WHIRLPOOL 3b2f587e647dafdb68bdb147bb0d5fecea0e728b52eabb61deb2623641117be6ac0871405666d7616ae1d60eaacf0b621cba8175dca463e9344ad83a4daf5865 -----BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.19 (GNU/Linux) +Version: GnuPG v2.0.20 (GNU/Linux) -iQIcBAEBCAAGBQJRPJJWAAoJEDYO1FT4VRUUzc4QAJiFhmoxpbne3XCJ7+wGMXuM -/YEZm16zG1JJKeBWJY8MKruc6x3wM5/5CA9ypkGbARgkYlD1qkQtNvyDOFqazzzW -IOkYU+hOlXC7sfe7tKDYNTkvwB9iqjK4PcRuV+UXHjeUcoEo1hLX0vIYP8iO46iW -TKeNWq0D1ofMlwxjE+vwBfA4s5RY46TWWCR9etLJh5ap3KMhUbhZRywYUnmuxzsS -Hx8l5Ww1+yWZHmJqTn81NYYsGE4+sgFN9Mt3g7zkSzf0a29ki9e5ylXsTIbxchir -Ab1+iDxYhzemMMNuq0vfKXK1Fm/WyN1ARm0idTerFkXTTl4g/ZWFsW1Fa/M1cEVs -4QvOZNX063YxODd7QEW9E4ZTwENdwhjtL4QOaBppVLHE5ddlFC7uaP0AqwSkFj6g -jw9IXAWVmD76U75NZJ6j/j4LiSitIIiAMH3ofmbH/tDq7f0jrgTNgFfIvrNPUmLV -PynUpmOLLmeDh5dFS/lY57aORyLLnf70Z4bcpr8khbw3Fh3EHZsgIbmaoli3yiZY -W1sLVsAjsSb1zhIYHVUwciAOs5Q3mCFc70w13Mn5HqpPv06ljdP77tYK9YmSoFqP -fpgXecar68mJGjJiR0s8jU1QXsLWVO4ZakiCFVKBlWRjnWSKiyqiZwd2bzxZNZ3C -VKkR4vyPZ0pa2nt6TWA4 -=dNmj +iEYEAREIAAYFAlGfs2kACgkQvFcC4BYPU0quCQCfdJsLHANJADuGPlr8NP6d7iRk +RH0An2bu/dRnWcJsUqw7a5HgjCiqbXS5 +=B1j+ -----END PGP SIGNATURE----- diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch new file mode 100644 index 000000000000..fdb7e16f6e08 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch @@ -0,0 +1,17 @@ +Fix "no .eh_frame_hdr table will be created" error. + +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47829 +http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4a0e0cd7377c45dc21d5c71bcab931b5e5727e74 + +diff -Nur lib.orig/csu/i386-elf/Makefile lib/csu/i386-elf/Makefile +--- lib.orig/csu/i386-elf/Makefile 2013-03-06 01:07:57.000000000 +0900 ++++ lib/csu/i386-elf/Makefile 2013-03-06 01:10:09.000000000 +0900 +@@ -10,6 +10,8 @@ + FILESDIR= ${LIBDIR} + CFLAGS+= -I${.CURDIR}/../common \ + -I${.CURDIR}/../../libc/include ++CFLAGS+= -fno-omit-frame-pointer ++CFLAGS+= -fno-asynchronous-unwind-tables + CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o + CLEANFILES+= crt1_c.s gcrt1_c.s Scrt1_c.s + diff --git a/sys-freebsd/freebsd-lib/freebsd-lib-9.1-r1.ebuild b/sys-freebsd/freebsd-lib/freebsd-lib-9.1-r1.ebuild new file mode 100644 index 000000000000..635be91a5adb --- /dev/null +++ b/sys-freebsd/freebsd-lib/freebsd-lib-9.1-r1.ebuild @@ -0,0 +1,538 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $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 $ + +EAPI=2 + +inherit bsdmk freebsd flag-o-matic multilib toolchain-funcs eutils + +DESCRIPTION="FreeBSD's base system libraries" +SLOT="0" +KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd" + +# Crypto is needed to have an internal OpenSSL header +# sys is needed for libalias, probably we can just extract that instead of +# extracting the whole tarball +SRC_URI="mirror://gentoo/${LIB}.tar.bz2 + mirror://gentoo/${CONTRIB}.tar.bz2 + mirror://gentoo/${CRYPTO}.tar.bz2 + mirror://gentoo/${LIBEXEC}.tar.bz2 + mirror://gentoo/${ETC}.tar.bz2 + mirror://gentoo/${INCLUDE}.tar.bz2 + mirror://gentoo/${USBIN}.tar.bz2 + mirror://gentoo/${GNU}.tar.bz2 + build? ( + mirror://gentoo/${SYS}.tar.bz2 ) + zfs? ( + mirror://gentoo/${CDDL}.tar.bz2 )" + +if [ "${CATEGORY#*cross-}" = "${CATEGORY}" ]; then + RDEPEND="ssl? ( dev-libs/openssl ) + hesiod? ( net-dns/hesiod ) + kerberos? ( virtual/krb5 ) + usb? ( !dev-libs/libusb !dev-libs/libusbx ) + zfs? ( =sys-freebsd/freebsd-cddl-${RV}* ) + >=dev-libs/expat-2.0.1 + !sys-libs/libutempter + !sys-freebsd/freebsd-headers" + DEPEND="${RDEPEND} + >=sys-devel/flex-2.5.31-r2 + =sys-freebsd/freebsd-sources-${RV}* + !bootstrap? ( app-arch/bzip2 )" +else + SRC_URI="${SRC_URI} + mirror://gentoo/${SYS}.tar.bz2" +fi + +DEPEND="${DEPEND} + userland_GNU? ( sys-apps/mtree ) + =sys-freebsd/freebsd-mk-defs-${RV}*" + +S="${WORKDIR}/lib" + +export CTARGET=${CTARGET:-${CHOST}} +if [ "${CTARGET}" = "${CHOST}" -a "${CATEGORY#*cross-}" != "${CATEGORY}" ]; then + export CTARGET=${CATEGORY/cross-} +fi + +IUSE="atm bluetooth ssl hesiod ipv6 kerberos usb netware + build bootstrap crosscompile_opts_headers-only zfs + userland_GNU userland_BSD multilib" + +pkg_setup() { + [ -c /dev/zero ] || \ + die "You forgot to mount /dev; the compiled libc would break." + + if ! use ssl && use kerberos; then + eerror "If you want kerberos support you need to enable ssl support, too." + fi + + use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= " + use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= " + use hesiod || mymakeopts="${mymakeopts} WITHOUT_HESIOD= " + use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6_SUPPORT= " + use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= " + use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= " + use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= " + use usb || mymakeopts="${mymakeopts} WITHOUT_USB= " + use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= " + + mymakeopts="${mymakeopts} WITHOUT_BIND= WITHOUT_BIND_LIBS= WITHOUT_SENDMAIL= WITHOUT_CLANG= " + + if [ "${CTARGET}" != "${CHOST}" ]; then + mymakeopts="${mymakeopts} MACHINE=$(tc-arch-kernel ${CTARGET})" + mymakeopts="${mymakeopts} MACHINE_ARCH=$(tc-arch-kernel ${CTARGET})" + fi +} + +PATCHES=( + "${FILESDIR}/${PN}-6.0-pmc.patch" + "${FILESDIR}/${PN}-6.0-gccfloat.patch" + "${FILESDIR}/${PN}-6.0-flex-2.5.31.patch" + "${FILESDIR}/${PN}-6.1-csu.patch" + "${FILESDIR}/${PN}-8.0-rpcsec_gss.patch" + "${FILESDIR}/${PN}-9.0-liblink.patch" + "${FILESDIR}/${PN}-bsdxml2expat.patch" + "${FILESDIR}/${PN}-9.0-netware.patch" + "${FILESDIR}/${PN}-9.0-cve-2010-2632.patch" + "${FILESDIR}/${PN}-9.0-bluetooth.patch" + "${FILESDIR}/${PN}-9.1-.eh_frame_hdr-fix.patch" + ) + +# Here we disable and remove source which we don't need or want +# In order: +# - ncurses stuff +# - libexpat creates a bsdxml library which is the same as expat +# - archiving libraries (have their own ebuild) +# - sendmail libraries (they are installed by sendmail) +# - SNMP library and dependency (have their own ebuilds) +# - Clang (compiler_rt and blocksruntime) +# +# The rest are libraries we already have somewhere else because +# they are contribution. +# Note: libtelnet is an internal lib used by telnet and telnetd programs +# as it's not used in freebsd-lib package itself, it's pointless building +# it here. +REMOVE_SUBDIRS="ncurses \ + libexpat \ + libz libbz2 libarchive liblzma \ + libsm libsmdb libsmutil \ + libbegemot libbsnmp \ + libcompiler_rt libblocksruntime \ + libpam libpcap bind libwrap libmagic \ + libcom_err libtelnet + libelf libedit" + +# Are we building a cross-compiler? +is_crosscompile() { + [ "${CATEGORY#*cross-}" != "${CATEGORY}" ] +} + +src_prepare() { + sed -i.bak -e 's:-o/dev/stdout:-t:' "${S}/libc/net/Makefile.inc" + + # Upstream Display Managers default to using VT7 + # We should make FreeBSD allow this by default + local x= + for x in "${WORKDIR}"/etc/etc.*/ttys ; do + sed -i.bak \ + -e '/ttyv5[[:space:]]/ a\ +# Display Managers default to VT7.\ +# If you use the xdm init script, keep ttyv6 commented out\ +# unless you force a different VT for the DM being used.' \ + -e '/^ttyv[678][[:space:]]/ s/^/# /' "${x}" \ + || die "Failed to sed ${x}" + rm "${x}".bak + done + + # This one is here because it also + # patches "${WORKDIR}/include" + cd "${WORKDIR}" + epatch "${FILESDIR}/${PN}-includes.patch" + epatch "${FILESDIR}/${PN}-8.0-gcc45.patch" + epatch "${FILESDIR}/${PN}-9.0-opieincludes.patch" + + # Don't install the hesiod man page or header + rm "${WORKDIR}"/include/hesiod.h || die + sed -i.bak -e 's:hesiod.h::' "${WORKDIR}"/include/Makefile || die + sed -i.bak -e 's:hesiod.c::' -e 's:hesiod.3::' \ + "${WORKDIR}"/lib/libc/net/Makefile.inc || die + + # Fix the Makefiles of these few libraries that will overwrite our LDADD. + cd "${S}" + for dir in libradius libtacplus libcam libdevstat libfetch libgeom libmemstat libopie \ + libsmb libprocstat libulog; do sed -i.bak -e 's:LDADD=:LDADD+=:g' "${dir}/Makefile" || \ + die "Problem fixing \"${dir}/Makefile" + done + # Call LD with LDFLAGS, rename them to RAW_LDFLAGS + sed -e 's/LDFLAGS/RAW_LDFLAGS/g' \ + -i "${S}/csu/i386-elf/Makefile" \ + -i "${S}/csu/ia64/Makefile" || die + if use build; then + cd "${WORKDIR}" + # This patch has to be applied on ${WORKDIR}/sys, so we do it here since it + # shouldn't be a symlink to /usr/src/sys (which should be already patched) + epatch "${FILESDIR}"/${PN}-7.1-types.h-fix.patch + epatch "${FILESDIR}"/freebsd-sources-9.0-sysctluint.patch + return 0 + fi + + if ! is_crosscompile ; then + ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys" || die "Couldn't make sys symlink!" + else + sed -i.bak -e "s:/usr/include:/usr/${CTARGET}/usr/include:g" \ + "${S}/libc/rpc/Makefile.inc" \ + "${S}/libc/yp/Makefile.inc" + fi + + if install --version 2> /dev/null | grep -q GNU; then + sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile" + fi + + # Let arch-specific includes to be found + local machine + machine=$(tc-arch-kernel ${CTARGET}) + ln -s "${WORKDIR}/sys/${machine}/include" "${WORKDIR}/include/machine" || \ + die "Couldn't make ${machine}/include symlink." + + cd "${S}" + use bootstrap && dummy_mk libstand + # Try to fix sed calls for GNU sed. Do it only with GNU userland and force + # BSD's sed on BSD. + if use userland_GNU; then + find . -name Makefile -exec sed -ibak 's/sed -i /sed -i/' {} \; + fi +} + +get_csudir() { + if [ -d "${WORKDIR}/lib/csu/$1-elf" ]; then + echo "lib/csu/$1-elf" + else + echo "lib/csu/$1" + fi +} + +bootstrap_csu() { + local csudir="$(get_csudir $(tc-arch-kernel ${CTARGET}))" + export RAW_LDFLAGS=$(raw-ldflags) + cd "${WORKDIR}/${csudir}" || die "Missing ${csudir}." + freebsd_src_compile + + CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}" + append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}" +} + +# Compile libssp_nonshared.a and add it's path to LDFLAGS. +bootstrap_libssp_nonshared() { + cd "${WORKDIR}/gnu/lib/libssp/libssp_nonshared/" || die "missing libssp." + freebsd_src_compile + append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/libssp/libssp_nonshared/" + export LDADD="-lssp_nonshared" +} + +# What to build for a non-native build: cross-compiler, non-native abi in +# multilib. We also need the csu but this has to be handled separately. +NON_NATIVE_SUBDIRS="lib/libc lib/msun gnu/lib/libssp/libssp_nonshared lib/libthr lib/libutil" + +# Subdirs for a native build: +NATIVE_SUBDIRS="lib gnu/lib/libssp/libssp_nonshared gnu/lib/libregex" + +# Is my $ABI native ? +is_native_abi() { + is_crosscompile && return 1 + use multilib || return 0 + [ "${ABI}" = "${DEFAULT_ABI}" ] +} + +# Do we need to bootstrap the csu and libssp_nonshared? +need_bootstrap() { + is_crosscompile || use build || ! is_native_abi || has_version "<${CATEGORY}/${P}" +} + +# Get the subdirs we are building. +get_subdirs() { + local ret="" + if is_native_abi ; then + # If we are building for the native ABI, build everything + ret="${NATIVE_SUBDIRS}" + elif is_crosscompile ; then + # With a cross-compiler we only build the very core parts. + ret="${NON_NATIVE_SUBDIRS}" + if [ "${EBUILD_PHASE}" = "install" ]; then + # Add the csu dir first when installing. We treat it separately for + # compiling. + ret="$(get_csudir $(tc-arch-kernel ${CTARGET})) ${ret}" + fi + elif use build ; then + # For the non-native ABIs we only build the csu parts and very core + # libraries for now. + ret="gnu/lib/libssp/libssp_nonshared" + if [ "${EBUILD_PHASE}" = "install" ]; then + ret="$(get_csudir $(tc-arch-kernel ${CHOST})) ${ret}" + fi + else + # Only build the csu parts and core libraries for now. + ret="gnu/lib/libssp/libssp_nonshared" + if [ "${EBUILD_PHASE}" = "install" ]; then + ret="$(get_csudir $(tc-arch-kernel ${CHOST})) ${ret}" + fi + # Finally, with a non-native ABI without USE=build, we build everything + # too. + #ret="${NATIVE_SUBDIRS}" + fi + echo "${ret}" +} + +# Bootstrap the core libraries and setup the flags so that the other parts can +# build against it. +do_bootstrap() { + einfo "Bootstrapping on ${CHOST} for ${CTARGET}" + if ! is_crosscompile ; then + # Pre-install headers, but not when building a cross-compiler since we + # assume they have been installed in the previous pass. + einfo "Pre-installing includes in include_proper_${ABI}" + mkdir "${WORKDIR}/include_proper_${ABI}" || die + CTARGET="${CHOST}" install_includes "/include_proper_${ABI}" + CFLAGS="${CFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}" + fi + bootstrap_csu + bootstrap_libssp_nonshared +} + +# Compile it. Assume we have the toolchain setup correctly. +do_compile() { + export MAKEOBJDIRPREFIX="${WORKDIR}/${CHOST}" + mkdir "${MAKEOBJDIRPREFIX}" || die "Could not create ${MAKEOBJDIRPREFIX}." + # Bootstrap if needed, otherwise assume the system headers are in + # /usr/include. + if need_bootstrap ; then + do_bootstrap + else + CFLAGS="${CFLAGS} -isystem /usr/include" + fi + + export RAW_LDFLAGS=$(raw-ldflags) + + # Everything is now setup, build it! + for i in $(get_subdirs) ; do + einfo "Building in ${i}... with CC=${CC} and CFLAGS=${CFLAGS}" + cd "${WORKDIR}/${i}/" || die "missing ${i}." + freebsd_src_compile || die "make ${i} failed" + done +} + +src_compile() { + # Does not work with GNU sed + # Force BSD's sed on BSD. + if use userland_BSD ; then + export ESED=/usr/bin/sed + unalias sed + fi + + cd "${WORKDIR}/include" + $(freebsd_get_bmake) CC="$(tc-getCC)" || die "make include failed" + + use crosscompile_opts_headers-only && return 0 + + # Bug #270098 + append-flags $(test-flags -fno-strict-aliasing) + + # Bug #324445 + append-flags $(test-flags -fno-strict-overflow) + + # strip flags and do not do it later, we only add safe, and in fact + # needed flags after all + strip-flags + export NOFLAGSTRIP=yes + if is_crosscompile ; then + export YACC='yacc -by' + CHOST=${CTARGET} tc-export CC LD CXX RANLIB + mymakeopts="${mymakeopts} NLS=" + CFLAGS="${CFLAGS} -isystem /usr/${CTARGET}/usr/include" + append-ldflags "-L${WORKDIR}/${CHOST}/${WORKDIR}/lib/libc" + fi + + if is_crosscompile ; then + do_compile + else + for ABI in $(get_all_abis) ; do + # First, save the variables: CFLAGS, CXXFLAGS, LDFLAGS and mymakeopts. + for i in CFLAGS CXXFLAGS LDFLAGS mymakeopts ; do + export ${i}_SAVE="${!i}" + done + + multilib_toolchain_setup ${ABI} + + local target="$(tc-arch-kernel ${CHOST})" + mymakeopts="${mymakeopts} TARGET=${target} MACHINE=${target} MACHINE_ARCH=${target}" + CFLAGADD="" + if ! is_native_abi ; then + mymakeopts="${mymakeopts} COMPAT_32BIT=" + fi + + einfo "Building for ABI ${ABI} and TARGET=$(tc-arch-kernel ${CHOST})" + + CTARGET="${CHOST}" do_compile + + # Restore the variables now. + for i in CFLAGS CXXFLAGS LDFLAGS mymakeopts ; do + ii="${i}_SAVE" + export ${i}="${!ii}" + done + done + fi +} + +gen_libc_ldscript() { + # Parameters: + # $1 = target libdir + # $2 = source libc dir + # $3 = source libssp_nonshared dir + + # Clear the symlink. + rm -f "${D}/$2/libc.so" || die + + # Move the library if needed + if [ "$1" != "$2" ] ; then + mv "${D}/$2/libc.so.7" "${D}/$1/" || die + fi + + # Generate libc.so ldscript for inclusion of libssp_nonshared.a when linking + # this is done to avoid having to touch gcc spec file as it is currently + # done on FreeBSD upstream, mostly because their binutils aren't able to + # cope with linker scripts yet. + # Taken from toolchain-funcs.eclass: + local output_format + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + cat > "${D}/$2/libc.so" <<-END_LDSCRIPT +/* GNU ld script + SSP (-fstack-protector) requires __stack_chk_fail_local to be local. + GCC invokes this symbol in a non-PIC way, which results in TEXTRELs if + this symbol was provided by a shared libc. So we link in + libssp_nonshared.a from here. + */ +${output_format} +GROUP ( /$1/libc.so.7 /$3/libssp_nonshared.a ) +END_LDSCRIPT +} + +do_install() { + export MAKEOBJDIRPREFIX="${WORKDIR}/${CHOST}" + for i in $(get_subdirs) ; do + einfo "Installing in ${i}..." + cd "${WORKDIR}/${i}/" || die "missing ${i}." + freebsd_src_install || die "Install ${i} failed" + done +} + +src_install() { + [ "${CTARGET}" = "${CHOST}" ] \ + && INCLUDEDIR="/usr/include" \ + || INCLUDEDIR="/usr/${CTARGET}/usr/include" + dodir ${INCLUDEDIR} + einfo "Installing for ${CTARGET} in ${CHOST}.." + install_includes ${INCLUDEDIR} + + use crosscompile_opts_headers-only && return 0 + local mylibdir=$(get_libdir) + + if is_crosscompile ; then + mymakeopts="${mymakeopts} NO_MAN= \ + INCLUDEDIR=/usr/${CTARGET}/usr/include \ + SHLIBDIR=/usr/${CTARGET}/usr/lib \ + LIBDIR=/usr/${CTARGET}/usr/lib" + + dosym "usr/include" "/usr/${CTARGET}/sys-include" + do_install + else + if ! use multilib ; then + # Set SHLIBDIR and LIBDIR for multilib + mymakeopts="${mymakeopts} SHLIBDIR=/usr/${mylibdir} LIBDIR=/usr/${mylibdir}" + do_install + else + for ABI in $(get_all_abis) ; do + mymakeopts_SAVE="${mymakeopts}" + multilib_toolchain_setup ${ABI} + mymakeopts="${mymakeopts} SHLIBDIR=/usr/$(get_libdir) LIBDIR=/usr/$(get_libdir)" + do_install + mymakeopts="${mymakeopts_SAVE}" + done + fi + fi + + # Don't install the rest of the configuration files if crosscompiling + if is_crosscompile ; then + # This is to get it stripped with the correct tools, otherwise it gets + # stripped with the host strip. + # And also get the correct OUTPUT_FORMAT in the libc ldscript. + export CHOST=${CTARGET} + gen_libc_ldscript "usr/${CTARGET}/usr/lib" "usr/${CTARGET}/usr/lib" "usr/${CTARGET}/usr/lib" + return 0 + fi + + cd "${WORKDIR}/etc/" + insinto /etc + doins nls.alias mac.conf netconfig + + # Install ttys file + local MACHINE="$(tc-arch-kernel)" + doins "etc.${MACHINE}"/* + + # Generate ldscripts for core libraries that will go in / + gen_usr_ldscript -a alias cam geom ipsec jail kiconv \ + kvm m md procstat sbuf thr ufs util + + gen_libc_ldscript "${mylibdir}" "usr/${mylibdir}" "usr/${mylibdir}" + + # Install a libusb.pc for better compat with Linux's libusb + if use usb ; then + dodir /usr/$(get_libdir)/pkgconfig + sed -e "s:@LIBDIR@:/usr/$(get_libdir):" "${FILESDIR}/libusb.pc.in" > "${D}/usr/$(get_libdir)/pkgconfig/libusb.pc" || die + sed -e "s:@LIBDIR@:/usr/$(get_libdir):" "${FILESDIR}/libusb-1.0.pc.in" > "${D}/usr/$(get_libdir)/pkgconfig/libusb1.0.pc" || die + fi +} + +install_includes() +{ + local INCLUDEDIR="$1" + + # The idea is to be called from either install or unpack. + # During unpack it's required to install them as portage's user. + if [[ "${EBUILD_PHASE}" == "install" ]]; then + local DESTDIR="${D}" + BINOWN="root" + BINGRP="wheel" + else + local DESTDIR="${WORKDIR}" + [[ -z "${USER}" ]] && USER="portage" + BINOWN="${USER}" + [[ -z "${GROUPS}" ]] && GROUPS="portage" + BINGRP="${GROUPS}" + fi + + # Must exist before we use it. + [[ -d "${DESTDIR}${INCLUDEDIR}" ]] || die "dodir or mkdir ${INCLUDEDIR} before using install_includes." + cd "${WORKDIR}/include" + + local MACHINE="$(tc-arch-kernel)" + + einfo "Installing includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..." + $(freebsd_get_bmake) installincludes \ + MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \ + DESTDIR="${DESTDIR}" \ + INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \ + BINGRP="${BINGRP}" || die "install_includes() failed" + einfo "includes installed ok." + EXTRA_INCLUDES="lib/librtld_db lib/libutil lib/msun gnu/lib/libregex" + for i in $EXTRA_INCLUDES; do + einfo "Installing $i includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..." + cd "${WORKDIR}/$i" || die + $(freebsd_get_bmake) installincludes DESTDIR="${DESTDIR}" \ + MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \ + INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \ + BINGRP="${BINGRP}" || die "problem installing $i includes." + einfo "$i includes installed ok." + done +} |