mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
Bug: https://bugs.gentoo.org/982281 Thanks-to: Nick Bowler <nbowler@draconx.ca> Signed-off-by: Sam James <sam@gentoo.org>
123 lines
2.9 KiB
Bash
123 lines
2.9 KiB
Bash
# Copyright 2026 Gentoo Authors
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
EAPI=8
|
|
|
|
inherit autotools crossdev flag-o-matic toolchain-funcs
|
|
|
|
DESCRIPTION="GNU Mach microkernel, for the Hurd"
|
|
HOMEPAGE="https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html"
|
|
|
|
if [[ ${PV} == 9999 ]] ; then
|
|
EGIT_REPO_URI="https://git.savannah.gnu.org/git/hurd/gnumach.git"
|
|
inherit git-r3
|
|
elif [[ ${PV} == *_p* ]] ; then
|
|
MY_PV=${PV%_p*}+git${PV#*_p}
|
|
MY_P=${PN}_${MY_PV}
|
|
|
|
# savannah doesn't allow snapshot downloads from cgit as of 2026-03,
|
|
# but the Debian maintainer is also upstream, so just use theirs
|
|
# instead.
|
|
#SRC_URI="mirror://debian/pool/main/${PN:0:1}/${PN}/${MY_P}.orig.tar.xz"
|
|
#S="${WORKDIR}"/${MY_P/_/-}
|
|
|
|
# Debian only make full snapshots every so often, but apply other
|
|
# commits as backports. This is a bit awkward for us to follow, so
|
|
# roll our own snapshots:
|
|
# $ git archive --format=tar --prefix=gnumach/ HEAD | xz > gnumach-1.8_p20260330.tar.xz
|
|
SRC_URI="https://distfiles.gentoo.org/pub/proj/hurd/snapshots/gnumach/${P}.tar.xz"
|
|
S="${WORKDIR}"/${PN}
|
|
else
|
|
SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
|
|
fi
|
|
|
|
LICENSE="GPL-2 BSD-2"
|
|
SLOT="0"
|
|
IUSE="debug headers-only"
|
|
[[ ${PV} != 9999 ]] && KEYWORDS="~amd64 ~x86"
|
|
|
|
if is_crosspkg ; then
|
|
DEPEND="
|
|
!headers-only? ( cross-${CTARGET}/mig )
|
|
"
|
|
else
|
|
DEPEND="
|
|
dev-util/mig
|
|
"
|
|
fi
|
|
|
|
BDEPEND="sys-apps/texinfo"
|
|
|
|
src_prepare() {
|
|
default
|
|
eautoreconf
|
|
}
|
|
|
|
src_configure() {
|
|
if target_is_not_host ; then
|
|
local sysroot=/usr/${CTARGET}
|
|
|
|
if use headers-only ; then
|
|
# Assume we don't have working cross-compiler
|
|
export CC=$(tc-getBUILD_CC)
|
|
else
|
|
export MIG="${CTARGET}-mig"
|
|
fi
|
|
fi
|
|
|
|
# Make sure host make.conf doesn't pollute us
|
|
if target_is_not_host || tc-is-cross-compiler ; then
|
|
CHOST=${CTARGET} strip-unsupported-flags
|
|
fi
|
|
|
|
strip-flags
|
|
# LTO confuses one of the assemble steps
|
|
filter-lto
|
|
# -g3 confuses MIG which relies on preprocessed input
|
|
replace-flags -ggdb[3-9] -ggdb2
|
|
replace-flags -g3 -g
|
|
# LD gets invoked directly. raw-ldflags would work here except
|
|
# that it breaks configure which uses the compiler driver
|
|
unset LDFLAGS
|
|
|
|
local myeconfargs=(
|
|
# MIG machinery relies on this!
|
|
--enable-dependency-tracking
|
|
--prefix="${EPREFIX}${sysroot}/usr"
|
|
--datadir="${EPREFIX}${sysroot}/usr/share"
|
|
--host=${CTARGET}
|
|
|
|
# Needed for QEMU with `-net nic,model=ne2k_pc` at least
|
|
--enable-net-group
|
|
|
|
$(use_enable debug kdb)
|
|
)
|
|
|
|
econf "${myeconfargs[@]}"
|
|
}
|
|
|
|
src_compile() {
|
|
use headers-only && return
|
|
default
|
|
}
|
|
|
|
src_test() {
|
|
use headers-only && return
|
|
default
|
|
}
|
|
|
|
src_install() {
|
|
emake DESTDIR="${D}" $(usex headers-only install-data install)
|
|
|
|
if target_is_not_host ; then
|
|
# On Hurd, gcc expects system headers to be in /include, not /usr/include
|
|
# TODO: Is this needed?
|
|
dosym usr/include /usr/${CTARGET}/include
|
|
|
|
# Avoid collisions for other Hurd targets
|
|
# TODO: autoconf var?
|
|
rm -rfv "${ED}"/usr/share/info || die
|
|
rmdir "${ED}"/usr/share || die
|
|
fi
|
|
}
|