mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-07 23:53:51 +02:00
common/build-helper/meson.sh: only write cross file once
This commit is contained in:
parent
1cce32c070
commit
557b4a73cf
1 changed files with 78 additions and 74 deletions
|
@ -1,13 +1,18 @@
|
||||||
# This build helper writes a Meson cross-file, allowing other build styles
|
# This build helper writes a Meson cross-file, allowing other build styles
|
||||||
# to properly drive cross-builds in Meson when appropriate
|
# to properly drive cross-builds in Meson when appropriate
|
||||||
|
|
||||||
if [ -n "$CROSS_BUILD" ]; then
|
# Action is only taken for cross builds
|
||||||
mkdir -p "${XBPS_WRAPPERDIR}/meson"
|
[ -z "$CROSS_BUILD" ] && return 0
|
||||||
|
|
||||||
_MESON_TARGET_ENDIAN=little
|
# The cross file should only be written once, unless forced
|
||||||
# drop the -musl suffix to the target cpu, meson doesn't recognize it
|
[ -e "${XBPS_WRAPPERDIR}/meson/xbps_meson.cross" ] && [ -z "$XBPS_BUILD_FORCEMODE" ] && return 0
|
||||||
_MESON_TARGET_CPU=${XBPS_TARGET_MACHINE/-musl/}
|
|
||||||
case "$XBPS_TARGET_MACHINE" in
|
mkdir -p "${XBPS_WRAPPERDIR}/meson"
|
||||||
|
|
||||||
|
_MESON_TARGET_ENDIAN=little
|
||||||
|
# drop the -musl suffix to the target cpu, meson doesn't recognize it
|
||||||
|
_MESON_TARGET_CPU=${XBPS_TARGET_MACHINE/-musl/}
|
||||||
|
case "$XBPS_TARGET_MACHINE" in
|
||||||
mips|mips-musl|mipshf-musl)
|
mips|mips-musl|mipshf-musl)
|
||||||
_MESON_TARGET_ENDIAN=big
|
_MESON_TARGET_ENDIAN=big
|
||||||
_MESON_CPU_FAMILY=mips
|
_MESON_CPU_FAMILY=mips
|
||||||
|
@ -37,19 +42,19 @@ if [ -n "$CROSS_BUILD" ]; then
|
||||||
# are the same like 'x86_64' and 'aarch64'
|
# are the same like 'x86_64' and 'aarch64'
|
||||||
_MESON_CPU_FAMILY=${_MESON_TARGET_CPU}
|
_MESON_CPU_FAMILY=${_MESON_TARGET_CPU}
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Tell meson to run binaries with qemu if desired
|
# Tell meson to run binaries with qemu if desired
|
||||||
_MESON_EXE_WRAPPER=""
|
_MESON_EXE_WRAPPER=""
|
||||||
if [[ "${build_helper}" = *qemu* ]]; then
|
if [[ "${build_helper}" = *qemu* ]]; then
|
||||||
_MESON_EXE_WRAPPER="exe_wrapper = '/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static'"
|
_MESON_EXE_WRAPPER="exe_wrapper = '/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Record cross-compiling information in cross file.
|
# Record cross-compiling information in cross file.
|
||||||
#
|
#
|
||||||
# CFLAGS, CXXFLAGS and LDFLAGS are not yet available and
|
# CFLAGS, CXXFLAGS and LDFLAGS are not yet available and
|
||||||
# will be taken from the environment at configure time.
|
# will be taken from the environment at configure time.
|
||||||
cat > "${XBPS_WRAPPERDIR}/meson/xbps_meson.cross" <<-EOF
|
cat > "${XBPS_WRAPPERDIR}/meson/xbps_meson.cross" <<-EOF
|
||||||
[binaries]
|
[binaries]
|
||||||
${_MESON_EXE_WRAPPER:-# exe_wrapper is not set}
|
${_MESON_EXE_WRAPPER:-# exe_wrapper is not set}
|
||||||
c = '${CC}'
|
c = '${CC}'
|
||||||
|
@ -78,5 +83,4 @@ if [ -n "$CROSS_BUILD" ]; then
|
||||||
endian = '${_MESON_TARGET_ENDIAN}'
|
endian = '${_MESON_TARGET_ENDIAN}'
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
unset _MESON_CPU_FAMILY _MESON_TARGET_CPU _MESON_TARGET_ENDIAN _MESON_EXE_WRAPPER
|
unset _MESON_CPU_FAMILY _MESON_TARGET_CPU _MESON_TARGET_ENDIAN _MESON_EXE_WRAPPER
|
||||||
fi
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue