Files
RedBear-OS/local/recipes/dev/libelf/recipe.toml
T

83 lines
3.1 KiB
TOML

[package]
name = "libelf"
# libelf only, carved out of elfutils. Mesa's radeonsi (AMD) gallium driver
# requires libelf (dependency('libelf') / cc.find_library('elf')). We build just
# the elfutils libelf sublibrary (+ its lib/ helper) rather than all of elfutils
# (libdw/libasm/tools drag in a large glibc surface). Version tracks elfutils.
version = "0.190"
description = "libelf — ELF object file access library (from elfutils). Required by Mesa's radeonsi gallium driver."
[source]
# Vendored local fork (full-fork model): builds from the committed source/
# tree (offline, reproducible). source/ = pristine upstream + the patches below
# BAKED IN. .patch files kept tracked so a version bump can re-apply them via
# sync-recipe-source.sh.
# upstream: https://sourceware.org/elfutils/ftp/0.190/elfutils-0.190.tar.bz2
path = "source"
[build]
template = "custom"
# libelf's lib/ helper (eu-config.h/system.h) pulls libintl.h, error.h,
# byteswap.h — now provided by relibc — plus argp.h/obstack.h from the deps.
dependencies = [
"zlib",
"argp-standalone",
"musl-obstack",
"musl-fts",
]
script = '''
DYNAMIC_INIT
# libelf links into radeonsi.so, so build a PIC static archive (baked in; no
# extra runtime .so to ship). -fPIC + static. elfutils compiles with -Werror
# and trips on -Wformat-nonliteral etc. under the Redox cross toolchain; drop
# -Werror (also via --disable-werror below) so warnings are non-fatal.
export CFLAGS="-fPIC -Wno-error ${CFLAGS:-}"
# elfutils' configure autoconf checks assume a few glibc behaviours; force the
# results that are correct for relibc so configure completes without running
# target binaries.
COOKBOOK_CONFIGURE_FLAGS+=(
--enable-static
--disable-shared
--disable-werror
--disable-nls
--disable-debuginfod
--disable-libdebuginfod
--disable-demangler
--without-zstd
--without-bzlib
--without-lzma
ac_cv_func_mempcpy=yes
)
# Configure (out-of-tree, in COOKBOOK_BUILD which is CWD), then build ONLY the
# lib/ helper and libelf/, skipping libdw/libasm/backends/src (not needed and
# glibc-heavy).
"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}"
"${COOKBOOK_MAKE}" -C lib -j"${COOKBOOK_MAKE_JOBS}"
"${COOKBOOK_MAKE}" -C libelf -j"${COOKBOOK_MAKE_JOBS}" libelf.a
# Install libelf.a + public headers by hand (the libelf `install` target also
# pulls the shared lib / versioning we skipped).
mkdir -p "${COOKBOOK_STAGE}/usr/lib" "${COOKBOOK_STAGE}/usr/include" "${COOKBOOK_STAGE}/usr/lib/pkgconfig"
cp libelf/libelf.a "${COOKBOOK_STAGE}/usr/lib/"
cp "${COOKBOOK_SOURCE}/libelf/libelf.h" "${COOKBOOK_SOURCE}/libelf/gelf.h" "${COOKBOOK_SOURCE}/libelf/nlist.h" "${COOKBOOK_STAGE}/usr/include/"
# Provide a pkg-config so Mesa's dependency('libelf') resolves (its
# find_library('elf') fallback would also work, but the .pc is cheap).
cat > "${COOKBOOK_STAGE}/usr/lib/pkgconfig/libelf.pc" <<PC
prefix=/usr
exec_prefix=\${prefix}
libdir=\${prefix}/lib
includedir=\${prefix}/include
Name: libelf
Description: ELF object file access library (elfutils)
Version: 0.190
Libs: -L\${libdir} -lelf
Libs.private: -lz
Cflags: -I\${includedir}
PC
'''