Simplify mesa recipe

This commit is contained in:
Wildan Mubarok 2025-07-07 20:36:46 +00:00
parent d2128d6bee
commit 6445edc868

View File

@ -11,53 +11,25 @@ dependencies = [
"zlib",
]
script = """
#TODO: do this in cook instead
unset AR AS CC CXX LD NM OBJCOPY OBJDUMP RANLIB READELF STRIP
export CFLAGS="-I${COOKBOOK_SYSROOT}/include -DHAVE_PTHREAD=1"
export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include -DHAVE_PTHREAD=1"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib --static"
export LLVM_CONFIG="${TARGET}-llvm-config"
# TODO: Fix this annoying shite
echo "[binaries]" > cross_file.txt
echo "c = '${TARGET}-gcc'" >> cross_file.txt
echo "cpp = '${TARGET}-g++'" >> cross_file.txt
echo "ar = '${TARGET}-ar'" >> cross_file.txt
echo "strip = '${TARGET}-strip'" >> cross_file.txt
echo "pkgconfig = '${TARGET}-pkg-config'" >> cross_file.txt
echo "llvm-config = '${TARGET}-llvm-config'" >> cross_file.txt
echo "[host_machine]" >> cross_file.txt
echo "system = 'redox'" >> cross_file.txt
echo "cpu_family = '$(echo "${TARGET}" | cut -d - -f1)'" >> cross_file.txt
echo "cpu = '$(echo "${TARGET}" | cut -d - -f1)'" >> cross_file.txt
echo "endian = 'little'" >> cross_file.txt
echo "[paths]" >> cross_file.txt
echo "prefix = '/usr'" >> cross_file.txt
echo "libdir = 'lib'" >> cross_file.txt
echo "bindir = 'bin'" >> cross_file.txt
echo "[properties]" >> cross_file.txt
echo "needs_exe_wrapper = true" >> cross_file.txt
meson "${COOKBOOK_SOURCE}" . \
--cross-file cross_file.txt \
--buildtype release \
--strip \
-Ddefault_library=static \
-Dglx=disabled \
-Dllvm=enabled \
-Dosmesa=true \
-Dplatforms= \
-Dshader-cache=disabled \
-Dshared-llvm=disabled \
COOKBOOK_MESON_FLAGS=(
-Ddefault_library=static
-Dglx=disabled
-Dllvm=enabled
-Dosmesa=true
-Dplatforms=
-Dshader-cache=disabled
-Dshared-llvm=disabled
-Dshared-glapi=disabled
ninja -v
DESTDIR="${COOKBOOK_STAGE}" ninja install
)
cookbook_meson
# Hack to add LLVM libs
#TODO: only add necessary LLVM libs, not all of them
sed -i "s/ -lOSMesa / -lOSMesa $("${TARGET}-llvm-config" --libs) -lstdc++ /" "${COOKBOOK_STAGE}/usr/lib/pkgconfig/osmesa.pc"
sed -i "s/ -lOSMesa / -lOSMesa $("${LLVM_CONFIG}" --libs) -lstdc++ /" "${COOKBOOK_STAGE}/usr/local/lib/pkgconfig/osmesa.pc"
"""