build-style/cmake: set CMAKE_CROSSCOMPILING_EMULATOR

This commit is contained in:
John 2019-03-23 06:48:59 +01:00 committed by John Zimmermann
parent c79d2e16a2
commit 01d11a4938
22 changed files with 27 additions and 2 deletions

View file

@ -2,6 +2,7 @@
# This helper is for templates using cmake.
#
do_configure() {
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
local cmake_args=
[ ! -d ${cmake_builddir:=build} ] && mkdir -p ${cmake_builddir}
cd ${cmake_builddir}
@ -28,6 +29,7 @@ SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER ${CC})
SET(CMAKE_CXX_COMPILER ${CXX})
SET(CMAKE_CROSSCOMPILING TRUE)
SET(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static)
SET(CMAKE_SYSTEM_PROCESSOR ${_CMAKE_SYSTEM_PROCESSOR})
@ -65,6 +67,7 @@ _EOF
}
do_build() {
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
: ${make_cmd:=make}
cd ${cmake_builddir:=build}
@ -92,6 +95,7 @@ do_check() {
}
do_install() {
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
: ${make_cmd:=make}
: ${make_install_target:=install}

View file

@ -1,6 +1,7 @@
# Cross build profile for ARMv8.
XBPS_TARGET_MACHINE="aarch64-musl"
XBPS_TARGET_QEMU_MACHINE="aarch64"
XBPS_CROSS_TRIPLET="aarch64-linux-musl"
XBPS_CROSS_CFLAGS="-march=armv8-a"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for ARMv8.
XBPS_TARGET_MACHINE="aarch64"
XBPS_TARGET_QEMU_MACHINE="aarch64"
XBPS_CROSS_TRIPLET="aarch64-linux-gnu"
XBPS_CFLAGS="-O2 -pipe" # XXX not yet supported: -fstack-protector-strong
XBPS_CXXFLAGS="$XBPS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for ARM GNU EABI5 Soft Float and Musl libc.
XBPS_TARGET_MACHINE="armv5tel-musl"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="arm-linux-musleabi"
XBPS_CROSS_CFLAGS="-march=armv5te -msoft-float -mfloat-abi=soft"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for ARM GNU EABI5 Soft Float.
XBPS_TARGET_MACHINE="armv5tel"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="arm-linux-gnueabi"
XBPS_CROSS_CFLAGS="-march=armv5te -msoft-float -mfloat-abi=soft"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for ARM EABI5 Hard Float and Musl libc.
XBPS_TARGET_MACHINE="armv6l-musl"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="arm-linux-musleabihf"
XBPS_CROSS_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for ARM GNU EABI5 Hard Float.
XBPS_TARGET_MACHINE="armv6l"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="arm-linux-gnueabihf"
XBPS_CROSS_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for ARMv7 EABI Hard Float and Musl libc.
XBPS_TARGET_MACHINE="armv7l-musl"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="armv7l-linux-musleabihf"
XBPS_CROSS_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for ARMv7 GNU EABI Hard Float.
XBPS_TARGET_MACHINE="armv7l"
XBPS_TARGET_QEMU_MACHINE="arm"
XBPS_CROSS_TRIPLET="armv7l-linux-gnueabihf"
XBPS_CROSS_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for i686 and Musl libc.
XBPS_TARGET_MACHINE="i686-musl"
XBPS_TARGET_QEMU_MACHINE="i386"
XBPS_CROSS_TRIPLET="i686-linux-musl"
XBPS_CROSS_CFLAGS="-march=i686"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for i686 GNU.
XBPS_TARGET_MACHINE="i686"
XBPS_TARGET_QEMU_MACHINE="i386"
XBPS_CROSS_TRIPLET="i686-pc-linux-gnu"
XBPS_CROSS_CFLAGS="-march=i686"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for MIPS32 BE soft float.
XBPS_TARGET_MACHINE="mips-musl"
XBPS_TARGET_QEMU_MACHINE="mips"
XBPS_CROSS_TRIPLET="mips-linux-musl"
XBPS_CROSS_CFLAGS="-mtune=mips32r2 -mabi=32 -msoft-float"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for MIPS32 LE soft float.
XBPS_TARGET_MACHINE="mipsel-musl"
XBPS_TARGET_QEMU_MACHINE="mipsel"
XBPS_CROSS_TRIPLET="mipsel-linux-musl"
XBPS_CROSS_CFLAGS="-mtune=mips32r2 -mabi=32 -msoft-float"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for MIPS32 LE hardfloat.
XBPS_TARGET_MACHINE="mipselhf-musl"
XBPS_TARGET_QEMU_MACHINE="mipsel"
XBPS_CROSS_TRIPLET="mipsel-linux-muslhf"
XBPS_CROSS_CFLAGS="-mtune=mips32r2 -mabi=32 -mhard-float"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for MIPS32 BE hard float.
XBPS_TARGET_MACHINE="mipshf-musl"
XBPS_TARGET_QEMU_MACHINE="mips"
XBPS_CROSS_TRIPLET="mips-linux-muslhf"
XBPS_CROSS_CFLAGS="-mtune=mips32r2 -mabi=32 -mhard-float"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for PowerPC.
XBPS_TARGET_MACHINE="ppc-musl"
XBPS_TARGET_QEMU_MACHINE="ppc"
XBPS_CROSS_TRIPLET="powerpc-linux-musl"
XBPS_CROSS_CFLAGS="-mcpu=powerpc -mno-altivec -mtune=G4 -mlong-double-64"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for PowerPC.
XBPS_TARGET_MACHINE="ppc"
XBPS_TARGET_QEMU_MACHINE="ppc"
XBPS_CROSS_TRIPLET="powerpc-linux-gnu"
XBPS_CROSS_CFLAGS="-mcpu=powerpc -mno-altivec -mtune=G4"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for ppc64 big-endian musl.
XBPS_TARGET_MACHINE="ppc64-musl"
XBPS_TARGET_QEMU_MACHINE="ppc64"
XBPS_CROSS_TRIPLET="powerpc64-linux-musl"
XBPS_CROSS_CFLAGS="-mcpu=970 -mtune=power9 -maltivec -mlong-double-64 -mabi=elfv2"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for ppc64 little-endian musl.
XBPS_TARGET_MACHINE="ppc64le-musl"
XBPS_TARGET_QEMU_MACHINE="ppc64le"
XBPS_CROSS_TRIPLET="powerpc64le-linux-musl"
XBPS_CROSS_CFLAGS="-mcpu=powerpc64le -mtune=power9 -maltivec -mlong-double-64 -mabi=elfv2"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for ppc64 little-endian GNU.
XBPS_TARGET_MACHINE="ppc64le"
XBPS_TARGET_QEMU_MACHINE="ppc64le"
XBPS_CROSS_TRIPLET="powerpc64le-linux-gnu"
XBPS_CROSS_CFLAGS="-mcpu=powerpc64le -mtune=power9 -maltivec -mabi=elfv2"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -1,6 +1,7 @@
# Cross build profile for x86_64 and Musl libc.
XBPS_TARGET_MACHINE="x86_64-musl"
XBPS_TARGET_QEMU_MACHINE="x86_64"
XBPS_CROSS_TRIPLET="x86_64-linux-musl"
XBPS_CROSS_CFLAGS="-mtune=generic"
XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"

View file

@ -284,7 +284,7 @@ setup_pkg() {
basepkg=${pkg%-32bit}
# Start with a sane environment
unset -v PKG_BUILD_OPTIONS XBPS_CROSS_CFLAGS XBPS_CROSS_CXXFLAGS XBPS_CROSS_FFLAGS XBPS_CROSS_CPPFLAGS XBPS_CROSS_LDFLAGS
unset -v PKG_BUILD_OPTIONS XBPS_CROSS_CFLAGS XBPS_CROSS_CXXFLAGS XBPS_CROSS_FFLAGS XBPS_CROSS_CPPFLAGS XBPS_CROSS_LDFLAGS XBPS_TARGET_QEMU_MACHINE
unset -v subpackages run_depends build_depends host_build_depends
unset_package_funcs
@ -294,7 +294,7 @@ setup_pkg() {
if [ -n "$cross" ]; then
source_file $XBPS_CROSSPFDIR/${cross}.sh
_vars="TARGET_MACHINE CROSS_TRIPLET CROSS_CFLAGS CROSS_CXXFLAGS"
_vars="TARGET_MACHINE CROSS_TRIPLET CROSS_CFLAGS CROSS_CXXFLAGS TARGET_QEMU_MACHINE"
for f in ${_vars}; do
eval val="\$XBPS_$f"
if [ -z "$val" ]; then
@ -304,6 +304,7 @@ setup_pkg() {
done
export XBPS_CROSS_BASE=/usr/$XBPS_CROSS_TRIPLET
export XBPS_TARGET_QEMU_MACHINE="$XBPS_TARGET_QEMU_MACHINE"
XBPS_INSTALL_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_INSTALL_CMD -c /host/repocache -r $XBPS_CROSS_BASE"
XBPS_QUERY_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_QUERY_CMD -c /host/repocache -r $XBPS_CROSS_BASE"