1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit bsdmk freebsd flag-o-matic toolchain-funcs
9 DESCRIPTION="FreeBSD's bootloader"
12 IUSE="bzip2 ieee1394 tftp zfs"
14 if [[ ${PV} != *9999* ]]; then
15 KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
25 DEPEND="=sys-freebsd/freebsd-mk-defs-${RV}*
26 =sys-freebsd/freebsd-lib-${RV}*"
28 S="${WORKDIR}/sys/boot"
30 PATCHES=( "${FILESDIR}/${PN}-10.1-gcc46.patch"
31 "${FILESDIR}/${PN}-10.3-clang.patch"
32 "${FILESDIR}/${PN}-10.3-drop-unsupport-cflags.patch"
33 "${FILESDIR}/${PN}-10.3-uefi-support.patch"
34 "${FILESDIR}/${PN}-add-nossp-cflags.patch" )
37 use ${1} && mymakeopts="${mymakeopts} LOADER_${2}_SUPPORT=\"yes\""
38 use ${1} || mymakeopts="${mymakeopts} WITHOUT_${2}= "
42 boot0_use_enable ieee1394 FIREWIRE
43 boot0_use_enable zfs ZFS
44 boot0_use_enable tftp TFTP
45 boot0_use_enable bzip2 BZIP2
49 sed -e '/-mno-align-long-strings/d' \
50 -i "${S}"/i386/boot2/Makefile \
51 -i "${S}"/i386/gptboot/Makefile \
52 -i "${S}"/i386/gptzfsboot/Makefile \
53 -i "${S}"/i386/zfsboot/Makefile || die
55 export MAKEOBJDIRPREFIX="${WORKDIR}/build"
60 append-flags "-fno-strict-aliasing"
62 cd "${WORKDIR}/lib/libstand" || die
65 CFLAGS="${CFLAGS} -I${WORKDIR}/lib/libstand"
66 LDFLAGS="${LDFLAGS} -L${WORKDIR}/lib/libstand"
67 export LIBSTAND="${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libstand/libstand.a"
70 NOFLAGSTRIP="yes" freebsd_src_compile
75 mkinstall FILESDIR=/boot || die "mkinstall failed"
77 cd "${WORKDIR}/sys/$(tc-arch-kernel)/conf" || die
79 newins GENERIC.hints device.hints
81 echo 'CONFIG_PROTECT="/boot/device.hints"' > "${T}"/50boot0