profiles: introduce XBPS_{,TARGET_}{ENDIAN,LIBC}

Provide new environment variables for simplifaction of template checks:
...ENDIAN defines the (target) machine's endianness: "le" or "be".
...LIBC defines the (target) machine's C library: "glibc" or "musl".

Closes: #13356
Signed-off-by: Jürgen Buchmüller <pullmoll@t-online.de>
This commit is contained in:
Jürgen Buchmüller 2019-08-02 17:30:13 +02:00
parent 0ab586ea43
commit 9b3203401d
No known key found for this signature in database
GPG key ID: DE55AD8DBEBB4EE8
39 changed files with 91 additions and 7 deletions

View file

@ -365,16 +365,24 @@ in this directory such as `${XBPS_BUILDDIR}/${wrksrc}`.
- `XBPS_MACHINE` The machine architecture as returned by `xbps-uhelper arch`.
- `XBPS_ENDIAN` The machine's endianness ("le" for little-endian, "be" for big-endian).
- `XBPS_LIBC` The machine's C library ("glibc" for GNU libc, "musl" for Musl libc).
- `XBPS_WORDSIZE` The machine's word size in bits (32 or 64).
- `XBPS_TARGET_MACHINE` The target machine architecture when cross compiling a package.
- `XBPS_TARGET_ENDIAN` The target machine's endiannes ("le" for little-endian, "be" for big-endian).
- `XBPS_TARGET_LIBC` The target machine's C library ("glibc" for GNU libc, "musl" for Musl libc).
- `XBPS_TARGET_WORDSIZE` The target machine's word size in bits (32 or 64).
- `XBPS_SRCDISTDIR` Full path to where the `source distfiles` are stored, i.e `$XBPS_HOSTDIR/sources`.
- `XBPS_SRCPKGDIR` Full path to the `srcpkgs` directory.
- `XBPS_TARGET_MACHINE` The target machine architecture when cross compiling a package.
- `XBPS_TARGET_WORDSIZE` The target machine's word size in bits (32 or 64).
- `XBPS_FETCH_CMD` The utility to fetch files from `ftp`, `http` of `https` servers.
- `XBPS_WRAPPERDIR` Full path to where xbps-src's wrappers for utilities are stored.

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=musl
XBPS_WORDSIZE=64
XBPS_TARGET_CFLAGS="-march=armv8-a"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=glibc
XBPS_WORDSIZE=64
XBPS_TARGET_CFLAGS="-march=armv8-a"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=musl
XBPS_WORDSIZE=32
XBPS_TARGET_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=glibc
XBPS_WORDSIZE=32
XBPS_TARGET_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=musl
XBPS_WORDSIZE=32
XBPS_TARGET_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=glibc
XBPS_WORDSIZE=32
XBPS_TARGET_CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=musl
XBPS_WORDSIZE=32
XBPS_TARGET_CFLAGS="-mtune=i686"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=glibc
XBPS_WORDSIZE=32
XBPS_TARGET_CFLAGS="-mtune=i686"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=be
XBPS_LIBC=musl
XBPS_WORDSIZE=32
XBPS_TARGET_CFLAGS="-mcpu=powerpc -mno-altivec -mtune=G4 -mlong-double-64"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=be
XBPS_LIBC=glibc
XBPS_WORDSIZE=32
XBPS_TARGET_CFLAGS="-mcpu=powerpc -mno-altivec -mtune=G4"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=be
XBPS_LIBC=musl
XBPS_WORDSIZE=64
XBPS_TARGET_CFLAGS="-mcpu=970 -mtune=power9 -maltivec -mlong-double-64 -mabi=elfv2"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=be
XBPS_LIBC=glibc
XBPS_WORDSIZE=64
XBPS_TARGET_CFLAGS="-mcpu=970 -mtune=power9 -maltivec -mabi=elfv2"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=musl
XBPS_WORDSIZE=64
XBPS_TARGET_CFLAGS="-mcpu=powerpc64le -mtune=power9 -maltivec -mlong-double-64 -mabi=elfv2"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=glibc
XBPS_WORDSIZE=64
XBPS_TARGET_CFLAGS="-mcpu=powerpc64le -mtune=power9 -maltivec -mabi=elfv2"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBLS_LIBC=musl
XBPS_WORDSIZE=64
XBPS_TARGET_CFLAGS="-mtune=generic"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,3 +1,5 @@
XBPS_ENDIAN=le
XBPS_LIBC=glibc
XBPS_WORDSIZE=64
XBPS_TARGET_CFLAGS="-mtune=generic"
XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"

View file

@ -1,4 +1,6 @@
# Cross build profile for ARMv8.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=64
XBPS_TARGET_MACHINE="aarch64-musl"
XBPS_TARGET_QEMU_MACHINE="aarch64"

View file

@ -1,4 +1,6 @@
# Cross build profile for ARMv8.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=glibc
XBPS_TARGET_WORDSIZE=64
XBPS_TARGET_MACHINE="aarch64"
XBPS_TARGET_QEMU_MACHINE="aarch64"

View file

@ -1,4 +1,6 @@
# Cross build profile for ARM GNU EABI5 Soft Float and Musl libc.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="armv5tel-musl"
XBPS_TARGET_QEMU_MACHINE="arm"

View file

@ -1,4 +1,6 @@
# Cross build profile for ARM GNU EABI5 Soft Float.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=glibc
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="armv5tel"
XBPS_TARGET_QEMU_MACHINE="arm"

View file

@ -1,4 +1,6 @@
# Cross build profile for ARM EABI5 Hard Float and Musl libc.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="armv6l-musl"
XBPS_TARGET_QEMU_MACHINE="arm"

View file

@ -1,4 +1,6 @@
# Cross build profile for ARM GNU EABI5 Hard Float.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=glibc
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="armv6l"
XBPS_TARGET_QEMU_MACHINE="arm"

View file

@ -1,4 +1,6 @@
# Cross build profile for ARMv7 EABI Hard Float and Musl libc.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="armv7l-musl"
XBPS_TARGET_QEMU_MACHINE="arm"

View file

@ -1,4 +1,6 @@
# Cross build profile for ARMv7 GNU EABI Hard Float.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=glibc
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="armv7l"
XBPS_TARGET_QEMU_MACHINE="arm"

View file

@ -1,4 +1,6 @@
# Cross build profile for i686 and Musl libc.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="i686-musl"
XBPS_TARGET_QEMU_MACHINE="i386"

View file

@ -1,4 +1,6 @@
# Cross build profile for i686 GNU.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=glibc
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="i686"
XBPS_TARGET_QEMU_MACHINE="i386"

View file

@ -1,4 +1,6 @@
# Cross build profile for MIPS32 BE soft float.
XBPS_TARGET_ENDIAN=be
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="mips-musl"
XBPS_TARGET_QEMU_MACHINE="mips"

View file

@ -1,4 +1,6 @@
# Cross build profile for MIPS32 LE soft float.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="mipsel-musl"
XBPS_TARGET_QEMU_MACHINE="mipsel"

View file

@ -1,4 +1,6 @@
# Cross build profile for MIPS32 LE hardfloat.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="mipselhf-musl"
XBPS_TARGET_QEMU_MACHINE="mipsel"

View file

@ -1,4 +1,6 @@
# Cross build profile for MIPS32 BE hard float.
XBPS_TARGET_ENDIAN=be
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="mipshf-musl"
XBPS_TARGET_QEMU_MACHINE="mips"

View file

@ -1,4 +1,6 @@
# Cross build profile for PowerPC.
XBPS_TARGET_ENDIAN=be
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="ppc-musl"
XBPS_TARGET_QEMU_MACHINE="ppc"

View file

@ -1,4 +1,6 @@
# Cross build profile for PowerPC.
XBPS_TARGET_ENDIAN=be
XBPS_TARGET_LIBC=glibc
XBPS_TARGET_WORDSIZE=32
XBPS_TARGET_MACHINE="ppc"
XBPS_TARGET_QEMU_MACHINE="ppc"

View file

@ -1,4 +1,6 @@
# Cross build profile for ppc64 big-endian musl.
XBPS_TARGET_ENDIAN=be
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=64
XBPS_TARGET_MACHINE="ppc64-musl"
XBPS_TARGET_QEMU_MACHINE="ppc64"

View file

@ -1,4 +1,6 @@
# Cross build profile for ppc64 big-endian GNU.
XBPS_TARGET_ENDIAN=be
XBPS_TARGET_LIBC=glibc
XBPS_TARGET_WORDSIZE=64
XBPS_TARGET_MACHINE="ppc64"
XBPS_TARGET_QEMU_MACHINE="ppc64"

View file

@ -1,4 +1,6 @@
# Cross build profile for ppc64 little-endian musl.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=64
XBPS_TARGET_MACHINE="ppc64le-musl"
XBPS_TARGET_QEMU_MACHINE="ppc64le"

View file

@ -1,4 +1,6 @@
# Cross build profile for ppc64 little-endian GNU.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=glibc
XBPS_TARGET_WORDSIZE=64
XBPS_TARGET_MACHINE="ppc64le"
XBPS_TARGET_QEMU_MACHINE="ppc64le"

View file

@ -1,4 +1,6 @@
# Cross build profile for x86_64 and Musl libc.
XBPS_TARGET_ENDIAN=le
XBPS_TARGET_LIBC=musl
XBPS_TARGET_WORDSIZE=64
XBPS_TARGET_MACHINE="x86_64-musl"
XBPS_TARGET_QEMU_MACHINE="x86_64"

View file

@ -276,8 +276,8 @@ 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"
for f in ${_vars}; do
for f in TARGET_ENDIAN TARGET_LIBC TARGET_WORDSIZE TARGET_MACHINE \
CROSS_TRIPLET CROSS_CFLAGS CROSS_CXXFLAGS TARGET_QEMU_MACHINE; do
eval val="\$XBPS_$f"
if [ -z "$val" ]; then
echo "ERROR: XBPS_$f is not defined!"
@ -286,7 +286,7 @@ setup_pkg() {
done
export XBPS_CROSS_BASE=/usr/$XBPS_CROSS_TRIPLET
export XBPS_TARGET_WORDSIZE
export XBPS_TARGET_ENDIAN XBPS_TARGET_LIBC 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,6 +297,8 @@ 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_ENDIAN=${XBPS_TARGET_ENDIAN:-$XBPS_ENDIAN}
export XBPS_TARGET_LIBC=${XBPS_TARGET_LIBC:-$XBPS_LIBC}
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