From 22dceb4e8ab12982dfcad50e1d2d1e77a1bd0da6 Mon Sep 17 00:00:00 2001 From: vasilito Date: Fri, 31 Jul 2026 09:39:19 +0300 Subject: [PATCH] libclc: fix install path nesting + relocate libclc.pc to lib/pkgconfig Install used an ABSOLUTE CMAKE_INSTALL_PREFIX (${COOKBOOK_STAGE}/usr) together with DESTDIR=${COOKBOOK_STAGE}/stage, so everything double-nested under stage.tmp//stage.tmp/usr/... and libclc.pc/.bc never reached the expected paths. Use the standard pattern: relative prefix /usr + DESTDIR=${COOKBOOK_STAGE} (libclc.pc gets prefix=/usr, resolved downstream via PKG_CONFIG_SYSROOT_DIR); drop the stage-flatten hack. Also relocate libclc.pc from share/pkgconfig (upstream's DATADIR) to lib/pkgconfig (cookbook convention mesa looks up). All 2610 GPU bitcode files already generate + install correctly. --- local/recipes/dev/libclc/recipe.toml | 29 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/local/recipes/dev/libclc/recipe.toml b/local/recipes/dev/libclc/recipe.toml index 8b58fffeb0..f5c715cef1 100644 --- a/local/recipes/dev/libclc/recipe.toml +++ b/local/recipes/dev/libclc/recipe.toml @@ -157,7 +157,7 @@ COOKBOOK_CMAKE_FLAGS+=( -DLIBCLC_STANDALONE_BUILD=TRUE -DLIBCLC_TARGETS_TO_BUILD="r600--;amdgcn--;amdgcn--amdhsa;amdgcn-mesa-mesa3d" -DENABLE_RUNTIME_SUBNORMAL=OFF - -DCMAKE_INSTALL_PREFIX="${COOKBOOK_STAGE}/usr" + -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_INCLUDEDIR=include -DCMAKE_INSTALL_DATADIR=share @@ -185,15 +185,14 @@ fi # on PATH for the ninja run. export PATH="$(pwd):${PATH}" "${COOKBOOK_NINJA}" -j"${COOKBOOK_MAKE_JOBS}" -DESTDIR="${COOKBOOK_STAGE}/stage" "${COOKBOOK_NINJA}" install - -# Move installed files from $COOKBOOK_STAGE/stage to $COOKBOOK_STAGE. -# The DESTDIR install above places everything under -# $COOKBOOK_STAGE/stage; flatten the extra stage dir. -if [ -d "${COOKBOOK_STAGE}/stage" ]; then - cp -a "${COOKBOOK_STAGE}/stage/." "${COOKBOOK_STAGE}/" - rm -rf "${COOKBOOK_STAGE}/stage" -fi +# Standard install: RELATIVE prefix (/usr, set in COOKBOOK_CMAKE_FLAGS) + +# DESTDIR=${COOKBOOK_STAGE} -> files land at ${COOKBOOK_STAGE}/usr/... and the +# generated libclc.pc carries prefix=/usr, which the downstream mesa build +# resolves via PKG_CONFIG_SYSROOT_DIR. (The previous absolute prefix + +# DESTDIR/stage double-nested everything under +# stage.tmp//stage.tmp/usr/... so libclc.pc was never at the expected +# path.) +DESTDIR="${COOKBOOK_STAGE}" "${COOKBOOK_NINJA}" install # Restore the cross-compile env for any subsequent (cross) steps. The native # cmake/ninja above MUST run with the clean (unset) env, so this restore is @@ -208,6 +207,16 @@ export CPPFLAGS="$_SAVED_CPPFLAGS" # The cmake install above places them at $COOKBOOK_STAGE/usr/share/clc # which is the right path; no further action needed. +# Upstream libclc installs libclc.pc under share/pkgconfig (its DATADIR); +# relocate it to lib/pkgconfig, the cookbook convention that mesa's +# dependency('libclc') pkg-config lookup uses. +if [ -f "${COOKBOOK_STAGE}/usr/share/pkgconfig/libclc.pc" ] \ + && [ ! -f "${COOKBOOK_STAGE}/usr/lib/pkgconfig/libclc.pc" ]; then + mkdir -p "${COOKBOOK_STAGE}/usr/lib/pkgconfig" + mv "${COOKBOOK_STAGE}/usr/share/pkgconfig/libclc.pc" \ + "${COOKBOOK_STAGE}/usr/lib/pkgconfig/libclc.pc" +fi + if [ ! -f "${COOKBOOK_STAGE}/usr/lib/pkgconfig/libclc.pc" ]; then echo "libclc: ERROR — install did not produce libclc.pc" >&2 echo "libclc: expected at ${COOKBOOK_STAGE}/usr/lib/pkgconfig/libclc.pc" >&2