diff options
author | Yuta Satoh <nigoro.dev@gmail.com> | 2016-11-01 00:58:03 +0900 |
---|---|---|
committer | Patrice Clement <monsieurp@gentoo.org> | 2016-11-25 23:04:42 +0100 |
commit | 813be3cf27378ccea4e038a0b4a82042e41ba613 (patch) | |
tree | 84e602330673a9bda1c5817bf3a24789e1c42e18 /sys-freebsd/freebsd-sources/freebsd-sources-10.3-r6.ebuild | |
parent | sys-freebsd/boot0: fix FreeBSD-EN-16:18.loader. (diff) | |
download | gentoo-813be3cf27378ccea4e038a0b4a82042e41ba613.tar.gz gentoo-813be3cf27378ccea4e038a0b4a82042e41ba613.tar.bz2 gentoo-813be3cf27378ccea4e038a0b4a82042e41ba613.zip |
sys-freebsd/freebsd-sources: fix FreeBSD-SA-16:15.sysarch.
Signed-off-by: Patrice Clement <monsieurp@gentoo.org>
Diffstat (limited to 'sys-freebsd/freebsd-sources/freebsd-sources-10.3-r6.ebuild')
-rw-r--r-- | sys-freebsd/freebsd-sources/freebsd-sources-10.3-r6.ebuild | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/sys-freebsd/freebsd-sources/freebsd-sources-10.3-r6.ebuild b/sys-freebsd/freebsd-sources/freebsd-sources-10.3-r6.ebuild new file mode 100644 index 000000000000..4283252952f6 --- /dev/null +++ b/sys-freebsd/freebsd-sources/freebsd-sources-10.3-r6.ebuild @@ -0,0 +1,175 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +inherit bsdmk freebsd flag-o-matic toolchain-funcs + +DESCRIPTION="FreeBSD kernel sources" +SLOT="0" +LICENSE="BSD zfs? ( CDDL )" + +IUSE="+build-kernel debug dtrace zfs" + +# Security Advisory and Errata patches. +UPSTREAM_PATCHES=( "SA-16:15/sysarch-01.patch" + "SA-16:18/atkbd.patch" + "SA-16:19/sendmsg.patch" + "SA-16:20/linux.patch" + "SA-16:21/stat.patch" + "EN-16:07/ipi.patch" + "EN-16:08/zfs.patch" + "EN-16:11/vmbus.patch" + "EN-16:12/hv_storvsc.patch" + "EN-16:13/vmbus.patch" + "EN-16:14/hv_storvsc.patch" + "EN-16:15/vmbus.patch" + "EN-16:16/hv_storvsc.patch" ) + +if [[ ${PV} != *9999* ]]; then + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd" + SRC_URI="${SRC_URI} + $(freebsd_upstream_patches)" +fi + +EXTRACTONLY=" + sys/ + contrib/bmake/ + usr.bin/bmake/ +" + +RDEPEND="dtrace? ( >=sys-freebsd/freebsd-cddl-9.2_rc1 ) + =sys-freebsd/freebsd-mk-defs-${RV}* + !sys-freebsd/virtio-kmod + !sys-fs/fuse4bsd + !<sys-freebsd/freebsd-sources-9.2_beta1" +DEPEND="build-kernel? ( + dtrace? ( >=sys-freebsd/freebsd-cddl-9.2_rc1 ) + >=sys-freebsd/freebsd-usbin-9.1 + =sys-freebsd/freebsd-mk-defs-${RV}* + )" + +RESTRICT="strip binchecks" + +S="${WORKDIR}/sys" + +KERN_BUILD=GENTOO + +PATCHES=( "${FILESDIR}/${PN}-9.0-disable-optimization.patch" + "${FILESDIR}/${PN}-10.0-gentoo.patch" + "${FILESDIR}/${PN}-6.0-flex-2.5.31.patch" + "${FILESDIR}/${PN}-8.0-subnet-route-pr40133.patch" + "${FILESDIR}/${PN}-7.1-includes.patch" + "${FILESDIR}/${PN}-9.0-sysctluint.patch" + "${FILESDIR}/${PN}-9.2-gentoo-gcc.patch" + "${FILESDIR}/${PN}-10.1-gcc48.patch" ) + +pkg_setup() { + # Add the required source files. + use zfs && EXTRACTONLY+="cddl/ " + + # WITHOUT_SSP= is required to boot kernel that compiled with newer gcc, bug #477914 + [[ $(tc-getCC) == *gcc* ]] && mymakeopts="${mymakeopts} WITHOUT_SSP=" + use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL=" +} + +src_prepare() { + local conf="${S}/$(tc-arch-kernel)/conf/${KERN_BUILD}" + + cd "${WORKDIR}" || die + epatch "${FILESDIR}/freebsd-ubin-10.3-bmake-workaround.patch" + cd "${S}" || die + + # This replaces the gentoover patch, it doesn't need reapply every time. + sed -i -e 's:^REVISION=.*:REVISION="'${PVR}'":' \ + -e 's:^BRANCH=.*:BRANCH="Gentoo":' \ + -e 's:^VERSION=.*:VERSION="${TYPE} ${BRANCH} ${REVISION}":' \ + "${S}/conf/newvers.sh" + + # __FreeBSD_cc_version comes from FreeBSD's gcc. + # on 10.0-RELEASE it's 1000001. + # FYI, can get it from gnu/usr.bin/cc/cc_tools/freebsd-native.h. + sed -e "s:-D_KERNEL:-D_KERNEL -D__FreeBSD_cc_version=1000001:g" \ + -i "${S}/conf/kern.pre.mk" \ + -i "${S}/conf/kmod.mk" || die "Couldn't set __FreeBSD_cc_version" + + # Remove -Werror + sed -e "s:-Werror:-Wno-error:g" \ + -i "${S}/conf/kern.pre.mk" \ + -i "${S}/conf/kmod.mk" || die + + # Set the kernel configuration using USE flags. + cp -f "${FILESDIR}/config-GENTOO" "${conf}" || die + use debug || echo 'nomakeoptions DEBUG' >> "${conf}" + use dtrace || echo 'nomakeoptions WITH_CTF' >> "${conf}" + + # Only used with USE=build-kernel, let the kernel build with its own flags, its safer. + unset LDFLAGS CFLAGS CXXFLAGS ASFLAGS KERNEL +} + +src_configure() { + if use build-kernel ; then + tc-export CC + cd "${S}/$(tc-arch-kernel)/conf" || die + config ${KERN_BUILD} || die + fi +} + +src_compile() { + if use build-kernel ; then + if has_version "<sys-freebsd/freebsd-ubin-10.0"; then + cd "${WORKDIR}"/usr.bin/bmake || die + CC=${CHOST}-gcc freebsd_src_compile + export BMAKE="${WORKDIR}/usr.bin/bmake/make" + fi + cd "${S}/$(tc-arch-kernel)/compile/${KERN_BUILD}" || die + freebsd_src_compile depend + freebsd_src_compile + else + einfo "Nothing to compile.." + fi +} + +src_install() { + if use build-kernel ; then + cd "${S}/$(tc-arch-kernel)/compile/${KERN_BUILD}" || die + freebsd_src_install + rm -rf "${S}/$(tc-arch-kernel)/compile/${KERN_BUILD}" + cd "${S}" + fi + + insinto "/usr/src/sys" + doins -r "${S}/". + if use zfs ; then + insinto "/usr/src/cddl" + doins -r "${WORKDIR}/cddl/". + fi +} + +pkg_preinst() { + if [[ -L "${ROOT}/usr/src/sys" ]]; then + einfo "/usr/src/sys is a symlink, removing it..." + rm -f "${ROOT}/usr/src/sys" + fi + + if use sparc-fbsd ; then + ewarn "WARNING: kldload currently causes kernel panics" + ewarn "on sparc64. This is probably a gcc-4.1 issue, but" + ewarn "we need gcc-4.1 to compile the kernel correctly :/" + ewarn "Please compile all modules you need into the kernel" + fi + + ewarn "If you want manual compile (not recommended), please don't forget the following step." + if ! use sparc-fbsd ; then + ewarn "export CC=clang" + ewarn "export CXX=clang++" + fi + if ! use zfs ; then + ewarn "export WITHOUT_CDDL=" + ewarn "Note, Please set USE=zfs if you want to enable modules of CDDL license." + fi + if ! use dtrace && ! has_version '>=sys-freebsd/freebsd-cddl-9.2_beta1' ; then + ewarn "GENERIC config require sys-freebsd/freebsd-cddl. Please emerge it." + fi +} |