libelf: new recipe (elfutils carve-out) for Mesa radeonsi; wire into mesa
Mesa's radeonsi gallium driver requires libelf. Add a libelf recipe that builds only the elfutils lib/+libelf/ subdirs (avoiding the libdw/libasm/tools glibc surface) as a PIC static archive, relying on the new relibc headers/functions (byteswap/error/libintl/ar/search + tsearch/mempcpy/rawmemchr). Installs libelf.a + libelf.h/gelf.h/nlist.h + libelf.pc. Wired into mesa deps. Verified: cook libelf - successful.
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
[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]
|
||||
tar = "https://sourceware.org/elfutils/ftp/0.190/elfutils-0.190.tar.bz2"
|
||||
|
||||
[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
|
||||
'''
|
||||
@@ -38,6 +38,10 @@ dependencies = [
|
||||
# is headers only), so depending on "libclc" here is sufficient.
|
||||
"libclc",
|
||||
"libdrm",
|
||||
# radeonsi (AMD gallium) requires libelf to parse shader ELF; provided by
|
||||
# our libelf recipe (elfutils libelf carve-out). Mesa resolves it via
|
||||
# dependency('libelf') / cc.find_library('elf').
|
||||
"libelf",
|
||||
"liborbital",
|
||||
"libwayland",
|
||||
"linux-kpi",
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/dev/libelf
|
||||
Reference in New Issue
Block a user