Skip to content

Commit

Permalink
Use prebuilt linkers
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
  • Loading branch information
JohnTitor committed Nov 3, 2022
1 parent 98a97b3 commit 3c5aa92
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 39 deletions.
33 changes: 2 additions & 31 deletions ci/android-install-ndk.sh
Expand Up @@ -6,36 +6,7 @@ NDK=android-ndk-r21d
wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux-x86_64.zip
unzip -q ${NDK}-linux-x86_64.zip

case "$1" in
arm)
arch=arm
api=28
;;
armv7)
arch=arm
api=28
;;
aarch64)
arch=arm64
api=28
;;
i686)
arch=x86
api=28
;;
x86_64)
arch=x86_64
api=28
;;
*)
echo "invalid arch: $1"
exit 1
;;
esac;

python3 ${NDK}/build/tools/make_standalone_toolchain.py \
--install-dir "/android/ndk-${1}" \
--arch "${arch}" \
--api ${api}
mkdir -p /android/ndk-${1}/bin
mv ${NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/* /android/ndk-${1}/bin

rm -rf ./${NDK}-linux-x86_64.zip ./${NDK}
4 changes: 2 additions & 2 deletions ci/docker/arm-linux-androideabi/Dockerfile
Expand Up @@ -28,9 +28,9 @@ RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi28-clang \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
CC_arm_linux_androideabi=arm-linux-androideabi-gcc \
CC_arm_linux_androideabi=armv7a-linux-androideabi28-clang \
HOME=/tmp

ADD runtest-android.rs /tmp/runtest.rs
Expand Down
9 changes: 5 additions & 4 deletions ci/docker/i686-linux-android/Dockerfile
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:22.04

RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install -y --no-install-recommends libc6-dev gcc
RUN apt-get install -y --no-install-recommends linux-libc-dev:i386 gcc
RUN apt-get install -y --no-install-recommends \
file \
wget \
Expand All @@ -12,7 +12,8 @@ RUN apt-get install -y --no-install-recommends \
unzip \
expect \
openjdk-8-jre \
libstdc++6:i386 \
libstdc++-10-dev:i386 \
libc++-dev:i386 \
libpulse0

WORKDIR /android/
Expand All @@ -28,9 +29,9 @@ RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android28-clang \
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \
CC_i686_linux_android=i686-linux-android-gcc \
CC_i686_linux_android=i686-linux-android28-clang \
HOME=/tmp

ADD runtest-android.rs /tmp/runtest.rs
Expand Down
4 changes: 2 additions & 2 deletions libc-test/src/cmsg.c
Expand Up @@ -2,9 +2,9 @@
#include <sys/socket.h>

// Since the cmsg(3) macros are macros instead of functions, they aren't
// available to FFI. libc must reimplement them, which is error-prone. This
// available to FFI. libc must reimplement them, which is error-prone. This
// file provides FFI access to the actual macros so they can be tested against
// the Rust reimplementations.
// the Rust re-implementation.

struct cmsghdr *cmsg_firsthdr(struct msghdr *msgh) {
return CMSG_FIRSTHDR(msgh);
Expand Down

0 comments on commit 3c5aa92

Please sign in to comment.