fix: use pkg-config wrapper script instead of exporting PKG_CONFIG_PATH (avoids OF Makefile bug)
This commit is contained in:
@ -181,11 +181,29 @@ fi
|
||||
|
||||
cd "$ADDON_DIR/example_basic"
|
||||
GLOBAL_FLAGS="-Wno-error -Wno-reorder -Wno-sign-compare -Wno-delete-non-virtual-dtor -std=c++11 -O0 -fno-tree-vrp"
|
||||
# Point pkg-config to the aarch64 .pc files installed by the :arm64 packages
|
||||
export PKG_CONFIG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig"
|
||||
export PKG_CONFIG_LIBDIR="/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig"
|
||||
|
||||
# The OF Makefile has a bug: it calls `export $(PKG_CONFIG_PATH)` which passes the
|
||||
# VALUE as a variable name under /bin/sh, causing "bad variable name" errors.
|
||||
# Workaround: don't set PKG_CONFIG_PATH in the environment at all.
|
||||
# Instead, create a thin wrapper script and pass it via OF's PKG_CONFIG make variable.
|
||||
PKGCFG_WRAPPER="/usr/local/bin/aarch64-pkg-config"
|
||||
cat > "$PKGCFG_WRAPPER" << 'PKGCFG_EOF'
|
||||
#!/bin/sh
|
||||
exec env \
|
||||
PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig \
|
||||
PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig \
|
||||
PKG_CONFIG_SYSROOT_DIR="" \
|
||||
pkg-config "$@"
|
||||
PKGCFG_EOF
|
||||
chmod +x "$PKGCFG_WRAPPER"
|
||||
|
||||
# Ensure PKG_CONFIG_PATH is not set in our environment (avoid the OF Makefile bug)
|
||||
unset PKG_CONFIG_PATH
|
||||
unset PKG_CONFIG_LIBDIR
|
||||
|
||||
make clean 2>/dev/null || true
|
||||
make -j1 \
|
||||
PKG_CONFIG="$PKGCFG_WRAPPER" \
|
||||
PLATFORM_ARCH=aarch64 \
|
||||
CROSS_COMPILING=1 \
|
||||
CC=aarch64-linux-gnu-gcc \
|
||||
|
||||
Reference in New Issue
Block a user