summaryrefslogtreecommitdiff
path: root/sys-devel/bpf-toolchain
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-08-07 12:37:21 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-08-07 12:37:21 +0100
commitb8c7370a682e4e29cda623222d17a790c01c3642 (patch)
treef6caa14689bd00a5760eadaa381ff41e50ef3c1b /sys-devel/bpf-toolchain
parent8a4997a7e2d1e36c089d4d76935b5a902d98d3d0 (diff)
gentoo auto-resync : 07:08:2024 - 12:37:20
Diffstat (limited to 'sys-devel/bpf-toolchain')
-rw-r--r--sys-devel/bpf-toolchain/Manifest4
-rw-r--r--sys-devel/bpf-toolchain/bpf-toolchain-14.2.0.ebuild201
-rw-r--r--sys-devel/bpf-toolchain/metadata.xml12
3 files changed, 217 insertions, 0 deletions
diff --git a/sys-devel/bpf-toolchain/Manifest b/sys-devel/bpf-toolchain/Manifest
new file mode 100644
index 000000000000..1acc70a80dbb
--- /dev/null
+++ b/sys-devel/bpf-toolchain/Manifest
@@ -0,0 +1,4 @@
+DIST binutils-2.43.tar.xz 28175768 BLAKE2B 28b0a04a28273b76eab2d00e00160be889f155f77f5a9d8759ef8dce505c97e97641bf7ec70b92b731b520570a02b06e04e8215b068fcb1bb2573e9ef24732d9 SHA512 93e063163e54d6a6ee2bd48dc754270bf757a3635b49a702ed6b310e929e94063958512d191e66beaf44275f7ea60865dbde138b624626739679fcc306b133bb
+DIST gcc-14.2.0.tar.xz 92306460 BLAKE2B 87baf2a06dfa75d8fb6cd62c747ef1f57d3b9bbbe33a360d9ed3de4b4dbeaa8d920504c67e409bd9863414202c14fd854b46108e984418171205119216d03d3b SHA512 932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396
+EBUILD bpf-toolchain-14.2.0.ebuild 5435 BLAKE2B f81234bd9550045ab935fdf1b0343c954dddc83d06f19193d4c08cd589264d0f31c71ba17e146fd18f32e522653f8cfdfb4eba94ca0bf68eb080bfeb0133ab1a SHA512 d0d9a518d0bb86429a56babfa0ffb353f7aa16eace9e4bb26f1dcb207e1f715fe7021ff06aa69c37713cff5c4e38efa73c00fa49eb6cb3ea270ecf947d46ae3f
+MISC metadata.xml 394 BLAKE2B 4985eaa40c572af9a7ada59b41494a2bd95090a16fba4a9bbbcded4652a03d46dc3678ab882407235bfe77fae729971155d4720e0325f649276ddd72ff96b715 SHA512 29d42cdee5df81b868c07ea9d5419cbbc0f816c69153f24fc63ff8beeee308f85d89bd3e4351b98949e578bcbc4532d06cf2054849774a4e7d9e1c0ee78083e4
diff --git a/sys-devel/bpf-toolchain/bpf-toolchain-14.2.0.ebuild b/sys-devel/bpf-toolchain/bpf-toolchain-14.2.0.ebuild
new file mode 100644
index 000000000000..aba05ad111a3
--- /dev/null
+++ b/sys-devel/bpf-toolchain/bpf-toolchain-14.2.0.ebuild
@@ -0,0 +1,201 @@
+# Copyright 2022-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit edo flag-o-matic toolchain-funcs
+
+# Versioning is just the GCC version in full (so may include a snapshot
+# date). Unlike dev-util/mingw64-toolchain, which this ebuild was heavily
+# inspired by, there's no "third component" here to version on, just
+# GCC + binutils.
+#
+# Do _p1++ rather than revbump on Binutils changes
+# Not using Gentoo patchsets for simplicity, their changes are mostly unneeded here.
+GCC_PV=${PV/_p/-}
+BINUTILS_PV=2.43
+
+DESCRIPTION="All-in-one bpf toolchain for building DTrace and systemd without crossdev"
+HOMEPAGE="
+ https://gcc.gnu.org/
+ https://sourceware.org/binutils/
+ https://gcc.gnu.org/wiki/BPFBackEnd
+"
+SRC_URI="
+ mirror://gnu/binutils/binutils-${BINUTILS_PV}.tar.xz
+"
+if [[ ${GCC_PV} == *-* ]]; then
+ SRC_URI+=" mirror://gcc/snapshots/${GCC_PV}/gcc-${GCC_PV}.tar.xz"
+else
+ SRC_URI+="
+ mirror://gcc/gcc-${GCC_PV}/gcc-${GCC_PV}.tar.xz
+ mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_PV}.tar.xz
+ "
+fi
+S="${WORKDIR}"
+
+# l1:binutils+gcc, l2:gcc(libraries)
+LICENSE="
+ GPL-3+
+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 )
+"
+SLOT="0"
+KEYWORDS="-* ~amd64"
+# TODO: USE=strip, USE=bin-symlinks from dev-util/mingw64-toolchain
+IUSE="custom-cflags"
+
+RDEPEND="
+ dev-libs/gmp:=
+ dev-libs/mpc:=
+ dev-libs/mpfr:=
+ sys-libs/zlib:=
+ virtual/libiconv
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=()
+
+pkg_pretend() {
+ [[ ${MERGE_TYPE} == binary ]] && return
+
+ tc-is-cross-compiler &&
+ die "cross-compilation of the toolchain itself is unsupported"
+}
+
+src_prepare() {
+ # rename directories to simplify both patching and the ebuild
+ mv binutils{-${BINUTILS_PV},} || die
+ mv gcc{-${GCC_PV},} || die
+
+ default
+}
+
+src_compile() {
+ # src_compile is kept similar to dev-util/mingw64-toolchain
+ # at least for now for ease of comparison etc.
+ #
+ # not great but do everything in src_compile given bootstrapping
+ # process needs to be done in steps of configure+compile+install
+ # (done modular to have most package-specific things in one place)
+
+ CTARGET=bpf-unknown-none
+
+ BPFT_D=${T}/root # moved to ${D} in src_install
+ local prefix=${EPREFIX}/usr
+ local sysroot=${BPFT_D}${prefix}
+ local -x PATH=${sysroot}/bin:${PATH}
+
+ use custom-cflags || strip-flags # fancy flags are not realistic here
+
+ # global configure flags
+ local conf=(
+ --build=${CBUILD:-${CHOST}}
+ --target=${CTARGET}
+ --{doc,info,man}dir=/.skip # let the real binutils+gcc handle docs
+ MAKEINFO=: #922230
+ )
+
+ # binutils
+ local conf_binutils=(
+ --prefix="${prefix}"
+ --host=${CHOST}
+ --disable-cet
+ --disable-default-execstack
+ --disable-nls
+ --disable-shared
+ --with-system-zlib
+ --without-debuginfod
+ --without-msgpack
+ --without-zstd
+ )
+
+ # gcc (minimal -- if need more, disable only in stage1 / enable in stage3)
+ local conf_gcc=(
+ --prefix="${prefix}"
+ --host=${CHOST}
+ --disable-bootstrap
+ --disable-cc1
+ --disable-cet
+ --disable-gcov #843989
+ --disable-gomp
+ --disable-nls # filename collisions
+ --disable-libcc1
+ --disable-libquadmath
+ --disable-libsanitizer
+ --disable-libssp
+ --disable-libvtv
+ --disable-shared
+ --disable-werror
+ --enable-languages=c
+ --with-gcc-major-version-only
+ --with-system-zlib
+ --without-isl
+ --without-zstd
+ --disable-multilib
+ )
+
+ # libstdc++ may misdetect sys/sdt.h on systemtap-enabled system and fail
+ # (not passed in conf_gcc above given it is lost in sub-configure calls)
+ local -x glibcxx_cv_sys_sdt_h=no
+
+ # bpft-build <path/package-name>
+ # -> ./configure && make && make install && bpft-package()
+ # passes conf and conf_package to configure, and users can add options
+ # through environment with e.g.
+ # BPFT_BINUTILS_CONF="--some-option"
+ # EXTRA_ECONF="--global-option" (generic naming for if not reading this)
+ bpft-build() {
+ local id=${1##*/}
+ local build_dir=${WORKDIR}/${1}-build
+
+ # econf is not allowed in src_compile and its defaults are
+ # mostly unused here, so use configure directly
+ local conf=( "${WORKDIR}/${1}"/configure "${conf[@]}" )
+
+ local -n conf_id=conf_${id}
+ [[ ${conf_id@a} == *a* ]] && conf+=( "${conf_id[@]}" )
+
+ local -n extra_id=BPFT_${id^^}_CONF
+ conf+=( ${EXTRA_ECONF} ${extra_id} )
+
+ einfo "Building ${id} in ${build_dir} ..."
+
+ mkdir -p "${build_dir}" || die
+ pushd "${build_dir}" >/dev/null || die
+
+ edo "${conf[@]}"
+ emake MAKEINFO=: V=1
+ # -j1 to match bug #906155, other packages may be fragile too
+ emake -j1 MAKEINFO=: V=1 DESTDIR="${BPFT_D}" install
+
+ declare -f bpft-${id} >/dev/null && edo bpft-${id}
+
+ popd >/dev/null || die
+ }
+
+ # build with same ordering that crossdev would do
+ bpft-build binutils
+ bpft-build gcc
+
+ # Delete libdep.a, which has a colliding name and is useless for bpf,
+ # which does not make use of cross-library dependencies: the libdep.a
+ # for the native binutils will do.
+ rm -f ${sysroot}/lib/bfd-plugins/libdep.a || die
+}
+
+src_install() {
+ mv "${BPFT_D}${EPREFIX}"/* "${ED}" || die
+
+ find "${ED}" -type f -name '*.la' -delete || die
+}
+
+pkg_postinst() {
+ if [[ ! ${REPLACING_VERSIONS} ]]; then
+ elog "Note that this package is primarily intended for DTrace, systemd, and related"
+ elog "packages to depend on without needing a manual crossdev setup."
+ elog
+ elog "Settings are oriented only for what these need and simplicity."
+ elog "Use sys-devel/crossdev if need full toolchain/customization:"
+ elog " https://wiki.gentoo.org/wiki/Crossdev"
+ fi
+}
diff --git a/sys-devel/bpf-toolchain/metadata.xml b/sys-devel/bpf-toolchain/metadata.xml
new file mode 100644
index 000000000000..12065082990f
--- /dev/null
+++ b/sys-devel/bpf-toolchain/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>toolchain@gentoo.org</email>
+ <name>Gentoo Toolchain Project</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="cpe">cpe:/a:gnu:gcc</remote-id>
+ <remote-id type="cpe">cpe:/a:gnu:binutils</remote-id>
+ </upstream>
+</pkgmetadata>