diff options
| author | Liguros - Gitlab CI/CD [develop] <gitlab@liguros.net> | 2026-04-28 21:32:58 +0000 |
|---|---|---|
| committer | Liguros - Gitlab CI/CD [develop] <gitlab@liguros.net> | 2026-04-28 21:32:58 +0000 |
| commit | 91dcdbb1b708bf07b6cc58c8fd2d533c40e0d69f (patch) | |
| tree | 9cc1de10d471103791c641baedcc34f2ecfdabb8 /eclass | |
| parent | ebcfdde700572edcef684fefa2245f7955c655ae (diff) | |
| download | baldeagleos-repo-91dcdbb1b708bf07b6cc58c8fd2d533c40e0d69f.tar.gz baldeagleos-repo-91dcdbb1b708bf07b6cc58c8fd2d533c40e0d69f.tar.xz baldeagleos-repo-91dcdbb1b708bf07b6cc58c8fd2d533c40e0d69f.zip | |
Adding metadata
Diffstat (limited to 'eclass')
| -rw-r--r-- | eclass/go-env.eclass | 33 | ||||
| -rw-r--r-- | eclass/go-module.eclass | 26 | ||||
| -rw-r--r-- | eclass/llvm.org.eclass | 12 | ||||
| -rw-r--r-- | eclass/sysroot.eclass | 50 |
4 files changed, 89 insertions, 32 deletions
diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass index 98faa20795a4..af843a8e81ba 100644 --- a/eclass/go-env.eclass +++ b/eclass/go-env.eclass @@ -6,12 +6,12 @@ # Flatcar Linux Maintainers <infra@flatcar-linux.org> # @AUTHOR: # Flatcar Linux Maintainers <infra@flatcar-linux.org> -# @SUPPORTED_EAPIS: 7 8 +# @SUPPORTED_EAPIS: 7 8 9 # @BLURB: Helper eclass for setting up the Go build environment. # @DESCRIPTION: # This eclass includes helper functions for setting up the build environment for # Go ebuilds. Intended to be called by other Go eclasses in an early build -# stage, e.g. src_unpack. +# stage, e.g. src_configure. # @ECLASS_VARIABLE: GOMAXPROCS # @USER_VARIABLE @@ -77,7 +77,7 @@ # Optimisation setting for riscv when building for CBUILD. case ${EAPI} in - 7|8) ;; + 7|8|9) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac @@ -86,6 +86,26 @@ _GO_ENV_ECLASS=1 inherit flag-o-matic multiprocessing sysroot toolchain-funcs +# @ECLASS_VARIABLE: CGO_ENABLED +# @DESCRIPTION: +# Whether to enable the cgo tool that lets Go packages call C code. Upstream Go +# enables this by default for native builds when a C compiler is found. Some +# projects will forcibly enable it by necessity. Other projects may disable it +# by default or even forcibly disable it to make the resulting binaries more +# portable. When enabled, certain standard library packages will use the libc +# over their own built-in code for things like DNS resolution, which is +# generally preferable. It makes sense for a distribution to enable it where +# possible, even when cross-compiling. Ebuilds may force this setting one way or +# the other before inheriting this eclass where necessary, although upstream +# projects will likely do this for you. If you believe that a project should not +# force it, then please work with upstream to have the variable respected. +# Ebuilds may also disable it by default if this is more appropriate. See +# https://pkg.go.dev/cmd/cgo. +case ${EAPI} in + 7|8) : ;; + *) export CGO_ENABLED="${CGO_ENABLED:-1}" ;; +esac + # @FUNCTION: go-env_set_compile_environment # @DESCRIPTION: # Sets up the environment to build Go code for CHOST. This includes variables @@ -147,9 +167,12 @@ go-env_set_compile_environment() { # go run will build binaries for the target system and try to execute them. # This will fail when cross-compiling unless you provide a wrapper. - local script + local script go_exec if script=$(sysroot_make_run_prefixed); then - GOFLAGS+=" -exec=${script}" "${@}" + go_exec="${T}/go-exec" + PATH="${go_exec}:${PATH}" + mkdir -p "${go_exec}" || die + ln -snfr "${script}" "${go_exec}/go_${GOOS}_${GOARCH}_exec" || die fi } diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass index 5294f50d8ad8..1d7b6044d802 100644 --- a/eclass/go-module.eclass +++ b/eclass/go-module.eclass @@ -7,7 +7,7 @@ # @AUTHOR: # William Hubbs <williamh@gentoo.org> # Robin H. Johnson <robbat2@gentoo.org> -# @SUPPORTED_EAPIS: 7 8 +# @SUPPORTED_EAPIS: 7 8 9 # @BLURB: basic eclass for building software written as go modules # @DESCRIPTION: # This eclass provides basic settings and functions needed by all software @@ -61,7 +61,7 @@ # @CODE case ${EAPI} in - 7|8) ;; + 7|8|9) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac @@ -182,7 +182,7 @@ declare -A -g _GOMODULE_GOSUM_REVERSE_MAP # If set to a non-null value before inherit, the Go part of the # ebuild will be considered optional. No dependencies will be added and # no phase functions will be exported. You will need to set BDEPEND and -# call go-module_src_unpack in your ebuild. +# call go-module_src_unpack and go-module_src_configure in your ebuild. # @FUNCTION: ego # @USAGE: [<args>...] @@ -347,12 +347,11 @@ go-module_setup_proxy() { # @FUNCTION: go-module_src_unpack # @DESCRIPTION: -# Sets up GOFLAGS for the system and then unpacks based on the following rules: +# Unpacks based on the following rules: # 1. If EGO_SUM is set, unpack the base tarball(s) and set up the # local go proxy. This mode is deprecated. # 2. Otherwise, if EGO_VENDOR is set, bail out, as this functionality was removed. # 3. Otherwise, call 'ego mod verify' and then do a normal unpack. -# Set compile env via go-env. go-module_src_unpack() { if [[ "${#EGO_SUM[@]}" -gt 0 ]]; then eqawarn "QA Notice: This ebuild uses EGO_SUM which is deprecated" @@ -372,7 +371,9 @@ go-module_src_unpack() { fi fi - go-env_set_compile_environment + case ${EAPI} in + 7|8) go-env_set_compile_environment ;; + esac } # @FUNCTION: _go-module_src_unpack_gosum @@ -501,8 +502,21 @@ go-module_live_vendor() { popd >& /dev/null || die } +# @FUNCTION: go-module_src_configure +# @DESCRIPTION: +# Sets up the environment to build Go code for the target system. If manually +# calling this from your own src_configure, do it between handling build flags +# and invoking another build system. +go-module_src_configure() { + go-env_set_compile_environment +} + fi if [[ ! ${GO_OPTIONAL} ]]; then EXPORT_FUNCTIONS src_unpack + case ${EAPI} in + 7|8) ;; + *) EXPORT_FUNCTIONS src_configure ;; + esac fi diff --git a/eclass/llvm.org.eclass b/eclass/llvm.org.eclass index 44f909ee7406..2bba8960b817 100644 --- a/eclass/llvm.org.eclass +++ b/eclass/llvm.org.eclass @@ -72,18 +72,12 @@ if [[ -z ${_LLVM_SOURCE_TYPE+1} ]]; then _LLVM_SOURCE_TYPE=snapshot case ${PV} in + 23.0.0_pre20260428) + EGIT_COMMIT=6f2e1a120ebb75da9b3fe6afb19231aa0f801a34 + ;; 23.0.0_pre20260421) EGIT_COMMIT=99457c368586b1debf49f55b3a0684317f5f298d ;; - 23.0.0_pre20260413) - EGIT_COMMIT=dd0c5ebe69e580066de100c8c2ba5430a1aeee44 - ;; - 23.0.0_pre20260331) - EGIT_COMMIT=af6521fb3a36149cd69d83bfdf87ed26e59a14a2 - ;; - 23.0.0_pre20260321) - EGIT_COMMIT=df9eb79970c012990e829d174d181d575d414efe - ;; *) die "Unknown snapshot: ${PV}" ;; diff --git a/eclass/sysroot.eclass b/eclass/sysroot.eclass index 856aa3a9ec8f..398d5233f1da 100644 --- a/eclass/sysroot.eclass +++ b/eclass/sysroot.eclass @@ -76,6 +76,22 @@ qemu_arch_if_needed() { return 0 } + +# @FUNCTION: _sysroot_compile_and_link_test_exe +# @USAGE: <output-path-name> +# @INTERNAL +# @DESCRIPTION: +# Compile and link a test executable that does nothing except to return success. +# The executable is built for the *host* machine using $(tc-getCC), *not* for +# the build machine using $(tc-getBUILD_CC). +_sysroot_compile_and_link_test_exe() { + [[ -n "${1}" ]] || die 'Must specify test executable path name.' + local test="${1}" + echo 'int main(void) { return 0; }' > "${test}.c" || die "failed to write ${test##*/}.c" + $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o "${test}" "${test}.c" || die "failed to build ${test##*/}" +} + + # @FUNCTION: sysroot_make_run_prefixed # @DESCRIPTION: # Create a wrapper script for directly running executables within a (sys)root @@ -117,7 +133,7 @@ sysroot_make_run_prefixed() { fi fi - if [[ ${CHOST} = *-mingw32 ]]; then + if [[ ${CHOST} = *-mingw32 || ${CHOST} = *-cygwin ]]; then if ! type -P wine >/dev/null; then einfo "Wine not found. Continuing without ${SCRIPT##*/} wrapper." return 2 @@ -135,15 +151,26 @@ sysroot_make_run_prefixed() { einfo "Target is not Linux. Continuing without ${SCRIPT##*/} wrapper." return 2 elif ! QEMU_ARCH=$(qemu_arch_if_needed); then - # glibc: ld.so is a symlink, ldd is a binary. - # musl: ld.so doesn't exist, ldd is a symlink. - local DLINKER candidate - for candidate in "${MYEROOT}"/usr/bin/{ld.so,ldd}; do - if [[ -L ${candidate} ]]; then - DLINKER=${candidate} - break - fi - done + local DLINKER + if [[ "${ABI-${DEFAULT_ABI}}" == "${DEFAULT_ABI}" ]]; then + # glibc: ld.so is a symlink, ldd is a binary. + # musl: ld.so doesn't exist, ldd is a symlink. + local candidate + for candidate in "${MYEROOT}"/usr/bin/{ld.so,ldd}; do + if [[ -L ${candidate} ]]; then + DLINKER=${candidate} + break + fi + done + else + # non-default ABI needs a non-default dynamic linker + SCRIPT+="-${ABI}" + local test="${SCRIPT}-test" + _sysroot_compile_and_link_test_exe "${test}" + read -d '' -r DLINKER < <($(tc-getOBJCOPY) -O binary -j .interp -- "${test}" /dev/stdout) + DLINKER="${DLINKER:+${MYEROOT}${DLINKER}}" + [[ -f ${DLINKER} && -x ${DLINKER} ]] || DLINKER= + fi [[ -n ${DLINKER} ]] || die "failed to find dynamic linker" # musl symlinks ldd to ld-musl.so to libc.so. We want the ld-musl.so @@ -169,8 +196,7 @@ sysroot_make_run_prefixed() { # and worse if QEMU does not support the architecture. We therefore need # to perform our own test up front. local test="${SCRIPT}-test" - echo 'int main(void) { return 0; }' > "${test}.c" || die "failed to write ${test##*/}" - $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} "${test}.c" -o "${test}" || die "failed to build ${test##*/}" + _sysroot_compile_and_link_test_exe "${test}" if ! "${SCRIPT}" "${test}" &>/dev/null; then einfo "Failed to run ${test##*/}. Continuing without ${SCRIPT##*/} wrapper." |
