common: fix XBPS_{,TARGET_}{ENDIAN,LIBC,WORDSIZE}
My first attempt was not working at all. Signed-off-by: Jürgen Buchmüller <pullmoll@t-online.de>
This commit is contained in:
parent
6a1b977e0c
commit
f1a7dfbfef
38 changed files with 75 additions and 40 deletions
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=64
|
||||
XBPS_TARGET_CFLAGS="-march=armv8-a"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=64
|
||||
XBPS_TARGET_CFLAGS="-march=armv8-a"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=32
|
||||
XBPS_TARGET_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=32
|
||||
XBPS_TARGET_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=32
|
||||
XBPS_TARGET_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=32
|
||||
XBPS_TARGET_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=32
|
||||
XBPS_TARGET_CFLAGS="-mtune=i686"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=32
|
||||
XBPS_TARGET_CFLAGS="-mtune=i686"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=32
|
||||
XBPS_TARGET_CFLAGS="-mcpu=powerpc -mno-altivec -mtune=G4 -mlong-double-64"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=32
|
||||
XBPS_TARGET_CFLAGS="-mcpu=powerpc -mno-altivec -mtune=G4"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=64
|
||||
XBPS_TARGET_CFLAGS="-mcpu=970 -mtune=power9 -maltivec -mlong-double-64 -mabi=elfv2"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=64
|
||||
XBPS_TARGET_CFLAGS="-mcpu=970 -mtune=power9 -maltivec -mabi=elfv2"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=64
|
||||
XBPS_TARGET_CFLAGS="-mcpu=powerpc64le -mtune=power9 -maltivec -mlong-double-64 -mabi=elfv2"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=64
|
||||
XBPS_TARGET_CFLAGS="-mcpu=powerpc64le -mtune=power9 -maltivec -mabi=elfv2"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=64
|
||||
XBPS_TARGET_CFLAGS="-mtune=generic"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
XBPS_WORDSIZE=64
|
||||
XBPS_TARGET_CFLAGS="-mtune=generic"
|
||||
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
|
||||
XBPS_TARGET_FFLAGS=""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ARMv8.
|
||||
XBPS_TARGET_WORDSIZE=64
|
||||
|
||||
XBPS_TARGET_MACHINE="aarch64-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="aarch64"
|
||||
XBPS_CROSS_TRIPLET="aarch64-linux-musl"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ARMv8.
|
||||
XBPS_TARGET_WORDSIZE=64
|
||||
|
||||
XBPS_TARGET_MACHINE="aarch64"
|
||||
XBPS_TARGET_QEMU_MACHINE="aarch64"
|
||||
XBPS_CROSS_TRIPLET="aarch64-linux-gnu"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ARM GNU EABI5 Soft Float and Musl libc.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="armv5tel-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="arm"
|
||||
XBPS_CROSS_TRIPLET="arm-linux-musleabi"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ARM GNU EABI5 Soft Float.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="armv5tel"
|
||||
XBPS_TARGET_QEMU_MACHINE="arm"
|
||||
XBPS_CROSS_TRIPLET="arm-linux-gnueabi"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ARM EABI5 Hard Float and Musl libc.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="armv6l-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="arm"
|
||||
XBPS_CROSS_TRIPLET="arm-linux-musleabihf"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ARM GNU EABI5 Hard Float.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="armv6l"
|
||||
XBPS_TARGET_QEMU_MACHINE="arm"
|
||||
XBPS_CROSS_TRIPLET="arm-linux-gnueabihf"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ARMv7 EABI Hard Float and Musl libc.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="armv7l-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="arm"
|
||||
XBPS_CROSS_TRIPLET="armv7l-linux-musleabihf"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ARMv7 GNU EABI Hard Float.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="armv7l"
|
||||
XBPS_TARGET_QEMU_MACHINE="arm"
|
||||
XBPS_CROSS_TRIPLET="armv7l-linux-gnueabihf"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for i686 and Musl libc.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="i686-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="i386"
|
||||
XBPS_CROSS_TRIPLET="i686-linux-musl"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for i686 GNU.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="i686"
|
||||
XBPS_TARGET_QEMU_MACHINE="i386"
|
||||
XBPS_CROSS_TRIPLET="i686-pc-linux-gnu"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for MIPS32 BE soft float.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="mips-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="mips"
|
||||
XBPS_CROSS_TRIPLET="mips-linux-musl"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for MIPS32 LE soft float.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="mipsel-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="mipsel"
|
||||
XBPS_CROSS_TRIPLET="mipsel-linux-musl"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for MIPS32 LE hardfloat.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="mipselhf-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="mipsel"
|
||||
XBPS_CROSS_TRIPLET="mipsel-linux-muslhf"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for MIPS32 BE hard float.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="mipshf-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="mips"
|
||||
XBPS_CROSS_TRIPLET="mips-linux-muslhf"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for PowerPC.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="ppc-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="ppc"
|
||||
XBPS_CROSS_TRIPLET="powerpc-linux-musl"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for PowerPC.
|
||||
XBPS_TARGET_WORDSIZE=32
|
||||
|
||||
XBPS_TARGET_MACHINE="ppc"
|
||||
XBPS_TARGET_QEMU_MACHINE="ppc"
|
||||
XBPS_CROSS_TRIPLET="powerpc-linux-gnu"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ppc64 big-endian musl.
|
||||
XBPS_TARGET_WORDSIZE=64
|
||||
|
||||
XBPS_TARGET_MACHINE="ppc64-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="ppc64"
|
||||
XBPS_CROSS_TRIPLET="powerpc64-linux-musl"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ppc64 big-endian GNU.
|
||||
XBPS_TARGET_WORDSIZE=64
|
||||
|
||||
XBPS_TARGET_MACHINE="ppc64"
|
||||
XBPS_TARGET_QEMU_MACHINE="ppc64"
|
||||
XBPS_CROSS_TRIPLET="powerpc64-linux-gnu"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ppc64 little-endian musl.
|
||||
XBPS_TARGET_WORDSIZE=64
|
||||
|
||||
XBPS_TARGET_MACHINE="ppc64le-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="ppc64le"
|
||||
XBPS_CROSS_TRIPLET="powerpc64le-linux-musl"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for ppc64 little-endian GNU.
|
||||
XBPS_TARGET_WORDSIZE=64
|
||||
|
||||
XBPS_TARGET_MACHINE="ppc64le"
|
||||
XBPS_TARGET_QEMU_MACHINE="ppc64le"
|
||||
XBPS_CROSS_TRIPLET="powerpc64le-linux-gnu"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Cross build profile for x86_64 and Musl libc.
|
||||
XBPS_TARGET_WORDSIZE=64
|
||||
|
||||
XBPS_TARGET_MACHINE="x86_64-musl"
|
||||
XBPS_TARGET_QEMU_MACHINE="x86_64"
|
||||
XBPS_CROSS_TRIPLET="x86_64-linux-musl"
|
||||
|
|
|
@ -246,6 +246,52 @@ unset_package_funcs() {
|
|||
done
|
||||
}
|
||||
|
||||
get_endian() {
|
||||
local arch="${1%-*}"
|
||||
|
||||
case "$arch" in
|
||||
aarch64) echo "le";;
|
||||
armv5tel) echo "le";;
|
||||
armv6l) echo "le";;
|
||||
armv7l) echo "le";;
|
||||
i686) echo "le";;
|
||||
mipsel*) echo "le";;
|
||||
mips*) echo "be";;
|
||||
ppc64le) echo "le";;
|
||||
ppc64) echo "be";;
|
||||
ppc) echo "be";;
|
||||
x86_64) echo "le";;
|
||||
esac
|
||||
}
|
||||
|
||||
get_libc() {
|
||||
local arch="${1%-*}"
|
||||
|
||||
if [ "${arch}" = "$1" ]; then
|
||||
echo "glibc"
|
||||
else
|
||||
echo "${1#${arch}-}"
|
||||
fi
|
||||
}
|
||||
|
||||
get_wordsize() {
|
||||
local arch="${1%-*}"
|
||||
|
||||
case "$arch" in
|
||||
aarch64) echo "64";;
|
||||
armv5tel) echo "32";;
|
||||
armv6l) echo "32";;
|
||||
armv7l) echo "32";;
|
||||
i686) echo "32";;
|
||||
mipsel*) echo "32";;
|
||||
mips*) echo "32";;
|
||||
ppc64le) echo "64";;
|
||||
ppc64) echo "64";;
|
||||
ppc) echo "32";;
|
||||
x86_64) echo "64";;
|
||||
esac
|
||||
}
|
||||
|
||||
get_subpkgs() {
|
||||
local f
|
||||
|
||||
|
@ -276,7 +322,7 @@ setup_pkg() {
|
|||
if [ -n "$cross" ]; then
|
||||
source_file $XBPS_CROSSPFDIR/${cross}.sh
|
||||
|
||||
_vars="TARGET_WORDSIZE TARGET_MACHINE CROSS_TRIPLET CROSS_CFLAGS CROSS_CXXFLAGS TARGET_QEMU_MACHINE"
|
||||
_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
|
||||
|
@ -286,7 +332,6 @@ setup_pkg() {
|
|||
done
|
||||
|
||||
export XBPS_CROSS_BASE=/usr/$XBPS_CROSS_TRIPLET
|
||||
export XBPS_TARGET_WORDSIZE
|
||||
export XBPS_TARGET_QEMU_MACHINE
|
||||
|
||||
XBPS_INSTALL_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_INSTALL_CMD -c /host/repocache -r $XBPS_CROSS_BASE"
|
||||
|
@ -297,7 +342,6 @@ setup_pkg() {
|
|||
XBPS_UHELPER_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE xbps-uhelper -r $XBPS_CROSS_BASE"
|
||||
XBPS_CHECKVERS_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE xbps-checkvers -r $XBPS_CROSS_BASE --repository=$XBPS_REPOSITORY"
|
||||
else
|
||||
export XBPS_TARGET_WORDSIZE=${XBPS_TARGET_WORDSIZE:-$XBPS_WORDSIZE}
|
||||
export XBPS_TARGET_MACHINE=${XBPS_ARCH:-$XBPS_MACHINE}
|
||||
unset XBPS_CROSS_BASE XBPS_CROSS_LDFLAGS XBPS_CROSS_FFLAGS
|
||||
unset XBPS_CROSS_CFLAGS XBPS_CROSS_CXXFLAGS XBPS_CROSS_CPPFLAGS
|
||||
|
@ -312,6 +356,13 @@ setup_pkg() {
|
|||
XBPS_CHECKVERS_XCMD="$XBPS_CHECKVERS_CMD"
|
||||
fi
|
||||
|
||||
export XBPS_ENDIAN=$(get_endian ${XBPS_MACHINE})
|
||||
export XBPS_TARGET_ENDIAN=$(get_endian ${XBPS_TARGET_MACHINE})
|
||||
export XBPS_LIBC=$(get_libc ${XBPS_MACHINE})
|
||||
export XBPS_TARGET_LIBC=$(get_libc ${XBPS_TARGET_MACHINE})
|
||||
export XBPS_WORDSIZE=$(get_wordsize ${XBPS_MACHINE})
|
||||
export XBPS_TARGET_WORDSIZE=$(get_wordsize ${XBPS_TARGET_MACHINE})
|
||||
|
||||
export XBPS_INSTALL_XCMD XBPS_QUERY_XCMD XBPS_RECONFIGURE_XCMD \
|
||||
XBPS_REMOVE_XCMD XBPS_RINDEX_XCMD XBPS_UHELPER_XCMD
|
||||
|
||||
|
|
Loading…
Reference in a new issue