Skip to content

Commit

Permalink
Try #1112: --target *android* --target *none*
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Nov 5, 2022
2 parents 35a1e17 + b0c868a commit 8ac0bec
Show file tree
Hide file tree
Showing 14 changed files with 268 additions and 114 deletions.
20 changes: 17 additions & 3 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ main() {
popd

rm -rf "${td}"

return
fi

# `cross build` test for the other targets
Expand Down Expand Up @@ -166,7 +164,7 @@ main() {
fi

# Test C++ support
if (( ${CPP:-0} )); then
if (( ${STD:-0} )) && (( ${CPP:-0} )); then
td="$(mkcargotemp -d)"

git clone --depth 1 https://github.com/cross-rs/rust-cpp-hello-word "${td}"
Expand Down Expand Up @@ -197,6 +195,22 @@ main() {

rm -rf "${td}"
fi

# tst cmake support
td="$(mkcargotemp -d)"

git clone --depth 1 https://github.com/cross-rs/rust-cmake-hello-world "${td}"

pushd "${td}"
retry cargo fetch
if (( ${STD:-0} )) && (( ${RUN:-0} )); then
cross_run --target "${TARGET}"
else
"${CROSS[@]}" build --lib --target "${TARGET}" ${CROSS_FLAGS}
fi
popd

rm -rf "${td}"
}

cross_run() {
Expand Down
36 changes: 21 additions & 15 deletions docker/Dockerfile.aarch64-linux-android
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,34 @@ COPY android $PYTHON_TMPDIR
RUN /android-system.sh arm64

ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
ENV CROSS_ANDROID_ARCH=aarch64
ENV CROSS_ANDROID_TARGET=aarch64-linux-android
COPY android-symlink.sh /
RUN /android-symlink.sh aarch64 aarch64-linux-android
RUN /android-symlink.sh aarch64 $CROSS_ANDROID_TARGET

COPY android-runner /

COPY android.cmake /opt/android.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/android.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$CROSS_ANDROID_TARGET-gcc" \
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER="/android-runner aarch64" \
AR_aarch64_linux_android=aarch64-linux-android-ar \
AS_aarch64_linux_android=aarch64-linux-android-as \
CC_aarch64_linux_android=aarch64-linux-android-gcc \
CXX_aarch64_linux_android=aarch64-linux-android-g++ \
LD_aarch64_linux_android=aarch64-linux-android-ld \
NM_aarch64_linux_android=aarch64-linux-android-nm \
OBJCOPY_aarch64_linux_android=aarch64-linux-android-objcopy \
OBJDUMP_aarch64_linux_android=aarch64-linux-android-objdump \
RANLIB_aarch64_linux_android=aarch64-linux-android-ranlib \
READELF_aarch64_linux_android=aarch64-linux-android-readelf \
SIZE_aarch64_linux_android=aarch64-linux-android-size \
STRINGS_aarch64_linux_android=aarch64-linux-android-strings \
STRIP_aarch64_linux_android=aarch64-linux-android-strip \
AR_aarch64_linux_android="$CROSS_ANDROID_TARGET-ar" \
AS_aarch64_linux_android="$CROSS_ANDROID_TARGET-as" \
CC_aarch64_linux_android="$CROSS_ANDROID_TARGET-gcc" \
CXX_aarch64_linux_android="$CROSS_ANDROID_TARGET-g++" \
LD_aarch64_linux_android="$CROSS_ANDROID_TARGET-ld" \
NM_aarch64_linux_android="$CROSS_ANDROID_TARGET-nm" \
OBJCOPY_aarch64_linux_android="$CROSS_ANDROID_TARGET-objcopy" \
OBJDUMP_aarch64_linux_android="$CROSS_ANDROID_TARGET-objdump" \
RANLIB_aarch64_linux_android="$CROSS_ANDROID_TARGET-ranlib" \
READELF_aarch64_linux_android="$CROSS_ANDROID_TARGET-readelf" \
SIZE_aarch64_linux_android="$CROSS_ANDROID_TARGET-size" \
STRINGS_aarch64_linux_android="$CROSS_ANDROID_TARGET-strings" \
STRIP_aarch64_linux_android="$CROSS_ANDROID_TARGET-strip" \
BINDGEN_EXTRA_CLANG_ARGS_aarch64_linux_android="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include"/ \
RUST_TEST_THREADS=1 \
Expand Down
36 changes: 21 additions & 15 deletions docker/Dockerfile.arm-linux-androideabi
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,34 @@ COPY android $PYTHON_TMPDIR
RUN /android-system.sh arm

ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
ENV CROSS_ANDROID_ARCH=armv5te
ENV CROSS_ANDROID_TARGET=arm-linux-androideabi
COPY android-symlink.sh /
RUN /android-symlink.sh arm arm-linux-androideabi
RUN /android-symlink.sh arm $CROSS_ANDROID_TARGET

COPY android-runner /

COPY android.cmake /opt/android.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/android.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER="$CROSS_ANDROID_TARGET-gcc" \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER="/android-runner arm" \
AR_arm_linux_androideabi=arm-linux-androideabi-ar \
AS_arm_linux_androideabi=arm-linux-androideabi-as \
CC_arm_linux_androideabi=arm-linux-androideabi-gcc \
CXX_arm_linux_androideabi=arm-linux-androideabi-g++ \
LD_arm_linux_androideabi=arm-linux-androideabi-ld \
NM_arm_linux_androideabi=arm-linux-androideabi-nm \
OBJCOPY_arm_linux_androideabi=arm-linux-androideabi-objcopy \
OBJDUMP_arm_linux_androideabi=arm-linux-androideabi-objdump \
RANLIB_arm_linux_androideabi=arm-linux-androideabi-ranlib \
READELF_arm_linux_androideabi=arm-linux-androideabi-readelf \
SIZE_arm_linux_androideabi=arm-linux-androideabi-size \
STRINGS_arm_linux_androideabi=arm-linux-androideabi-strings \
STRIP_arm_linux_androideabi=arm-linux-androideabi-strip \
AR_arm_linux_androideabi="$CROSS_ANDROID_TARGET-ar" \
AS_arm_linux_androideabi="$CROSS_ANDROID_TARGET-as" \
CC_arm_linux_androideabi="$CROSS_ANDROID_TARGET-gcc" \
CXX_arm_linux_androideabi="$CROSS_ANDROID_TARGET-g++" \
LD_arm_linux_androideabi="$CROSS_ANDROID_TARGET-ld" \
NM_arm_linux_androideabi="$CROSS_ANDROID_TARGET-nm" \
OBJCOPY_arm_linux_androideabi="$CROSS_ANDROID_TARGET-objcopy" \
OBJDUMP_arm_linux_androideabi="$CROSS_ANDROID_TARGET-objdump" \
RANLIB_arm_linux_androideabi="$CROSS_ANDROID_TARGET-ranlib" \
READELF_arm_linux_androideabi="$CROSS_ANDROID_TARGET-readelf" \
SIZE_arm_linux_androideabi="$CROSS_ANDROID_TARGET-size" \
STRINGS_arm_linux_androideabi="$CROSS_ANDROID_TARGET-strings" \
STRIP_arm_linux_androideabi="$CROSS_ANDROID_TARGET-strip" \
BINDGEN_EXTRA_CLANG_ARGS_arm_linux_androideabi="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include/" \
RUST_TEST_THREADS=1 \
Expand Down
36 changes: 21 additions & 15 deletions docker/Dockerfile.armv7-linux-androideabi
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,34 @@ COPY android $PYTHON_TMPDIR
RUN /android-system.sh arm

ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
ENV CROSS_ANDROID_ARCH=armv7-a
ENV CROSS_ANDROID_TARGET=arm-linux-androideabi
COPY android-symlink.sh /
RUN /android-symlink.sh arm arm-linux-androideabi
RUN /android-symlink.sh arm $CROSS_ANDROID_TARGET

COPY android-runner /

COPY android.cmake /opt/android.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/android.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="$CROSS_ANDROID_TARGET-gcc" \
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_RUNNER="/android-runner arm" \
AR_armv7_linux_androideabi=arm-linux-androideabi-ar \
AS_armv7_linux_androideabi=arm-linux-androideabi-as \
CC_armv7_linux_androideabi=arm-linux-androideabi-gcc \
CXX_armv7_linux_androideabi=arm-linux-androideabi-g++ \
LD_armv7_linux_androideabi=arm-linux-androideabi-ld \
NM_armv7_linux_androideabi=arm-linux-androideabi-nm \
OBJCOPY_armv7_linux_androideabi=arm-linux-androideabi-objcopy \
OBJDUMP_armv7_linux_androideabi=arm-linux-androideabi-objdump \
RANLIB_armv7_linux_androideabi=arm-linux-androideabi-ranlib \
READELF_armv7_linux_androideabi=arm-linux-androideabi-readelf \
SIZE_armv7_linux_androideabi=arm-linux-androideabi-size \
STRINGS_armv7_linux_androideabi=arm-linux-androideabi-strings \
STRIP_armv7_linux_androideabi=arm-linux-androideabi-strip \
AR_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-ar" \
AS_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-as" \
CC_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-gcc" \
CXX_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-g++" \
LD_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-ld" \
NM_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-nm" \
OBJCOPY_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-objcopy" \
OBJDUMP_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-objdump" \
RANLIB_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-ranlib" \
READELF_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-readelf" \
SIZE_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-size" \
STRINGS_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-strings" \
STRIP_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-strip" \
BINDGEN_EXTRA_CLANG_ARGS_armv7_linux_androideabi="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include/" \
RUST_TEST_THREADS=1 \
Expand Down
36 changes: 21 additions & 15 deletions docker/Dockerfile.i686-linux-android
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,34 @@ COPY android $PYTHON_TMPDIR
RUN /android-system.sh x86

ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
ENV CROSS_ANDROID_ARCH=i686
ENV CROSS_ANDROID_TARGET=i686-linux-android
COPY android-symlink.sh /
RUN /android-symlink.sh i386 i686-linux-android
RUN /android-symlink.sh i386 $CROSS_ANDROID_TARGET

COPY android-runner /

COPY android.cmake /opt/android.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/android.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
ENV CARGO_TARGET_I686_LINUX_ANDROID_LINKER="$CROSS_ANDROID_TARGET-gcc" \
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER="/android-runner i686" \
AR_i686_linux_android=i686-linux-android-ar \
AS_i686_linux_android=i686-linux-android-as \
CC_i686_linux_android=i686-linux-android-gcc \
CXX_i686_linux_android=i686-linux-android-g++ \
LD_i686_linux_android=i686-linux-android-ld \
NM_i686_linux_android=i686-linux-android-nm \
OBJCOPY_i686_linux_android=i686-linux-android-objcopy \
OBJDUMP_i686_linux_android=i686-linux-android-objdump \
RANLIB_i686_linux_android=i686-linux-android-ranlib \
READELF_i686_linux_android=i686-linux-android-readelf \
SIZE_i686_linux_android=i686-linux-android-size \
STRINGS_i686_linux_android=i686-linux-android-strings \
STRIP_i686_linux_android=i686-linux-android-strip \
AR_i686_linux_android="$CROSS_ANDROID_TARGET-ar" \
AS_i686_linux_android="$CROSS_ANDROID_TARGET-as" \
CC_i686_linux_android="$CROSS_ANDROID_TARGET-gcc" \
CXX_i686_linux_android="$CROSS_ANDROID_TARGET-g++" \
LD_i686_linux_android="$CROSS_ANDROID_TARGET-ld" \
NM_i686_linux_android="$CROSS_ANDROID_TARGET-nm" \
OBJCOPY_i686_linux_android="$CROSS_ANDROID_TARGET-objcopy" \
OBJDUMP_i686_linux_android="$CROSS_ANDROID_TARGET-objdump" \
RANLIB_i686_linux_android="$CROSS_ANDROID_TARGET-ranlib" \
READELF_i686_linux_android="$CROSS_ANDROID_TARGET-readelf" \
SIZE_i686_linux_android="$CROSS_ANDROID_TARGET-size" \
STRINGS_i686_linux_android="$CROSS_ANDROID_TARGET-strings" \
STRIP_i686_linux_android="$CROSS_ANDROID_TARGET-strip" \
BINDGEN_EXTRA_CLANG_ARGS_i686_linux_android="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include/" \
LIBZ_SYS_STATIC=1 \
Expand Down
18 changes: 13 additions & 5 deletions docker/Dockerfile.thumbv6m-none-eabi
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

COPY qemu.sh /
RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi && \
/qemu.sh arm
libnewlib-arm-none-eabi \
libstdc++-arm-none-eabi-newlib

COPY qemu.sh /
RUN /qemu.sh arm

COPY newlib.cmake /opt/newlib.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/newlib.cmake
ENV CROSS_NEWLIB_OBJECT_FLAGS="-ffunction-sections -fdata-sections -mthumb -march=armv6s-m"

ENV QEMU_CPU=cortex-m3 \
ENV QEMU_CPU=cortex-m1 \
AR_thumbv6m_none_eabi=arm-none-eabi-ar \
CC_thumbv6m_none_eabi=arm-none-eabi-gcc \
CXX_thumbv6m_none_eabi=arm-none-eabi-g++ \
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER=qemu-arm
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER=qemu-arm \
CROSS_NEWLIB_ARCH=armv6-m \
CROSS_NEWLIB_TARGET=arm-none-eabi
16 changes: 12 additions & 4 deletions docker/Dockerfile.thumbv7em-none-eabi
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

COPY qemu.sh /
RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi && \
/qemu.sh arm
libnewlib-arm-none-eabi \
libstdc++-arm-none-eabi-newlib

COPY qemu.sh /
RUN /qemu.sh arm

COPY newlib.cmake /opt/newlib.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/newlib.cmake
ENV CROSS_NEWLIB_OBJECT_FLAGS="-ffunction-sections -fdata-sections -mthumb -march=armv7e-m"

ENV QEMU_CPU=cortex-m4 \
AR_thumbv7em_none_eabi=arm-none-eabi-ar \
CC_thumbv7em_none_eabi=arm-none-eabi-gcc \
CXX_thumbv7em_none_eabi=arm-none-eabi-g++ \
CARGO_TARGET_THUMBV7EM_NONE_EABI_RUNNER=qemu-arm
CARGO_TARGET_THUMBV7EM_NONE_EABI_RUNNER=qemu-arm \
CROSS_NEWLIB_ARCH=armv7e-m \
CROSS_NEWLIB_TARGET=arm-none-eabi
16 changes: 12 additions & 4 deletions docker/Dockerfile.thumbv7em-none-eabihf
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

COPY qemu.sh /
RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi && \
/qemu.sh arm
libnewlib-arm-none-eabi \
libstdc++-arm-none-eabi-newlib

COPY qemu.sh /
RUN /qemu.sh arm

COPY newlib.cmake /opt/newlib.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/newlib.cmake
ENV CROSS_NEWLIB_OBJECT_FLAGS="-ffunction-sections -fdata-sections -mthumb -mfloat-abi=hard -march=armv7e-m -mfpu=fpv4-sp-d16"

ENV QEMU_CPU=cortex-m4 \
AR_thumbv7em_none_eabihf=arm-none-eabi-ar \
CC_thumbv7em_none_eabihf=arm-none-eabi-gcc \
CXX_thumbv7em_none_eabihf=arm-none-eabi-g++ \
CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUNNER=qemu-arm
CARGO_TARGET_THUMBV7EM_NONE_EABIHF_RUNNER=qemu-arm \
CROSS_NEWLIB_ARCH=armv7e-m \
CROSS_NEWLIB_TARGET=arm-none-eabi
16 changes: 12 additions & 4 deletions docker/Dockerfile.thumbv7m-none-eabi
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh

COPY qemu.sh /
RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi && \
/qemu.sh arm
libnewlib-arm-none-eabi \
libstdc++-arm-none-eabi-newlib

COPY qemu.sh /
RUN /qemu.sh arm

COPY newlib.cmake /opt/newlib.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/newlib.cmake
ENV CROSS_NEWLIB_OBJECT_FLAGS="-ffunction-sections -fdata-sections -mthumb -march=armv7-m"

ENV QEMU_CPU=cortex-m3 \
AR_thumbv7m_none_eabi=arm-none-eabi-ar \
CC_thumbv7m_none_eabi=arm-none-eabi-gcc \
CXX_thumbv7m_none_eabi=arm-none-eabi-g++ \
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER=qemu-arm
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER=qemu-arm \
CROSS_NEWLIB_ARCH=armv7-m \
CROSS_NEWLIB_TARGET=arm-none-eabi
Loading

0 comments on commit 8ac0bec

Please sign in to comment.