From 1473ba31430fd6e3facd1d7b02f8aa3366bb8d6a Mon Sep 17 00:00:00 2001 From: iphydf Date: Sun, 1 Dec 2024 09:12:15 +0000 Subject: [PATCH] chore: Support Android 7 (API 24). Also make sure COPY'd files in the windows image are readable by non-root builder image users. --- qtox/docker/Dockerfile.android-builder | 124 ++++++++++++------------- qtox/docker/Dockerfile.windows-builder | 2 + 2 files changed, 62 insertions(+), 64 deletions(-) diff --git a/qtox/docker/Dockerfile.android-builder b/qtox/docker/Dockerfile.android-builder index 8eb4530..feeb63c 100644 --- a/qtox/docker/Dockerfile.android-builder +++ b/qtox/docker/Dockerfile.android-builder @@ -38,28 +38,32 @@ ENV TOOLCHAIN=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64 ENV PATH=$TOOLCHAIN/bin:$PATH ENV SYSROOT=$TOOLCHAIN/sysroot ENV PKG_CONFIG_PATH=$SYSROOT/usr/lib/pkgconfig -ENV CC=$TOOLCHAIN/bin/aarch64-linux-android23-clang -ENV CXX=$TOOLCHAIN/bin/aarch64-linux-android23-clang++ -WORKDIR /work/openssl -RUN wget https://github.com/openssl/openssl/releases/download/openssl-3.4.0/openssl-3.4.0.tar.gz \ - && tar zxf openssl-3.4.0.tar.gz \ +ARG ANDROID_API=24 + +WORKDIR /work/build + +#ARG ANDROID_OPENSSL_ABI=arm +#ARG ANDROID_OPENSSL_ASM=-no-asm +ARG ANDROID_OPENSSL_ABI=arm64 +ARG ANDROID_OPENSSL_ASM= +RUN tar zxf <(wget -O- https://github.com/openssl/openssl/releases/download/openssl-3.4.0/openssl-3.4.0.tar.gz) \ && cd openssl-3.4.0 \ - && ./Configure android-arm64 --prefix=$SYSROOT/usr -no-shared -no-tests -fPIC \ + && ./Configure "android-$ANDROID_OPENSSL_ABI" --prefix="$SYSROOT/usr" -no-shared -no-tests $ANDROID_OPENSSL_ASM -D__ANDROID_API__="$ANDROID_API" -fPIC \ && make -j$(nproc) \ && make install_sw \ - && rm -rf /work/openssl + && rm -rf /work/build -WORKDIR /work -RUN wget https://download.qt.io/archive/qt/6.8/6.8.0/single/qt-everywhere-src-6.8.0.tar.xz \ - && tar Jxf qt-everywhere-src-6.8.0.tar.xz \ - && rm qt-everywhere-src-6.8.0.tar.xz \ - && cd /work/qt-everywhere-src-6.8.0 \ +#ARG ANDROID_ABI=armeabi-v7a +ARG ANDROID_ABI=arm64-v8a +RUN tar Jxf <(wget -O- https://download.qt.io/archive/qt/6.8/6.8.0/single/qt-everywhere-src-6.8.0.tar.xz) \ + && cd qt-everywhere-src-6.8.0 \ && ./configure -prefix "/work/android/qt" \ -qt-host-path /usr \ - -android-abis arm64-v8a \ + -android-abis "$ANDROID_ABI" \ -android-sdk "$ANDROID_SDK_HOME" \ -android-ndk "$ANDROID_NDK_ROOT" \ + -android-ndk-platform "android-$ANDROID_API" \ -openssl-linked \ -nomake examples \ -nomake tests \ @@ -73,20 +77,26 @@ RUN wget https://download.qt.io/archive/qt/6.8/6.8.0/single/qt-everywhere-src-6. && cmake --build . \ && cmake --install . \ && cd - \ - && rm -rf /work/qt-everywhere-src-6.8.0 + && rm -rf /work/build + +#ARG ANDROID_TRIPLE=armv7a-linux-androideabi +ARG ANDROID_TRIPLE=aarch64-linux-android +ENV ANDROID_TRIPLE_API=$ANDROID_TRIPLE$ANDROID_API +ENV CC=$TOOLCHAIN/bin/$ANDROID_TRIPLE_API-clang \ + CXX=$TOOLCHAIN/bin/$ANDROID_TRIPLE_API-clang++ -WORKDIR /work/ffmpeg -RUN wget https://www.ffmpeg.org/releases/ffmpeg-7.1.tar.xz \ - && tar Jxf ffmpeg-7.1.tar.xz \ +#ARG ANDROID_FFMPEG_ABI=armv7a +ARG ANDROID_FFMPEG_ABI=arm64 +RUN tar Jxf <(wget -O- https://www.ffmpeg.org/releases/ffmpeg-7.1.tar.xz) \ && cd ffmpeg-7.1 \ && ./configure \ - --prefix=$SYSROOT/usr \ - --ar=$TOOLCHAIN/bin/llvm-ar \ - --nm=$TOOLCHAIN/bin/llvm-nm \ - --ranlib=$TOOLCHAIN/bin/llvm-ranlib \ - --cross-prefix=$TOOLCHAIN/bin/aarch64-linux-android23- \ + --prefix="$SYSROOT/usr" \ + --ar="$TOOLCHAIN/bin/llvm-ar" \ + --nm="$TOOLCHAIN/bin/llvm-nm" \ + --ranlib="$TOOLCHAIN/bin/llvm-ranlib" \ + --cross-prefix="$TOOLCHAIN/bin/$ANDROID_TRIPLE_API-" \ --target-os=android \ - --arch=arm64 \ + --arch="$ANDROID_FFMPEG_ABI" \ --disable-debug \ --disable-programs \ --disable-protocols \ @@ -121,69 +131,57 @@ RUN wget https://www.ffmpeg.org/releases/ffmpeg-7.1.tar.xz \ --enable-decoder=h264 \ --enable-decoder=mjpeg \ --enable-decoder=rawvideo \ - --sysroot=$SYSROOT \ + --sysroot="$SYSROOT" \ && make -j$(nproc) \ && make install \ - && rm -rf /work/ffmpeg + && rm -rf /work/build -WORKDIR /work/libexif -RUN wget https://github.com/libexif/libexif/releases/download/v0.6.24/libexif-0.6.24.tar.bz2 \ - && tar jxf libexif-0.6.24.tar.bz2 \ +RUN tar jxf <(wget -O- https://github.com/libexif/libexif/releases/download/v0.6.24/libexif-0.6.24.tar.bz2) \ && cd libexif-0.6.24 \ - && ./configure --prefix=$SYSROOT/usr --host=aarch64-linux-android --with-sysroot=$SYSROOT --disable-shared \ + && ./configure --prefix="$SYSROOT/usr" --host="$ANDROID_TRIPLE" --with-sysroot="$SYSROOT" --disable-shared \ && make -j$(nproc) \ && make install \ - && rm -rf /work/libexif + && rm -rf /work/build -WORKDIR /work/libqrencode -RUN wget https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz \ - && tar zxf v4.1.1.tar.gz \ +RUN tar zxf <(wget -O- https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz) \ && cd libqrencode-4.1.1 \ && autoreconf -fi \ - && ./configure --prefix=$SYSROOT/usr --host=aarch64-linux-android --with-sysroot=$SYSROOT --disable-shared --without-png CFLAGS=-fPIC \ + && ./configure --prefix="$SYSROOT/usr" --host="$ANDROID_TRIPLE" --with-sysroot="$SYSROOT" --disable-shared --without-png CFLAGS=-fPIC \ && make -j$(nproc) \ && make install \ - && rm -rf /work/libqrencode + && rm -rf /work/build -WORKDIR /work/libsodium -RUN wget https://github.com/jedisct1/libsodium/releases/download/1.0.20-RELEASE/libsodium-1.0.20.tar.gz \ - && tar zxf libsodium-1.0.20.tar.gz \ +RUN tar zxf <(wget -O- https://github.com/jedisct1/libsodium/releases/download/1.0.20-RELEASE/libsodium-1.0.20.tar.gz) \ && cd libsodium-1.0.20 \ - && ./configure --prefix=$SYSROOT/usr --host=aarch64-linux-android --with-sysroot=$SYSROOT --disable-shared \ + && ./configure --prefix="$SYSROOT/usr" --host="$ANDROID_TRIPLE" --with-sysroot="$SYSROOT" --disable-shared \ && make -j$(nproc) \ && make install \ - && rm -rf /work/libsodium + && rm -rf /work/build -WORKDIR /work/sqlcipher -RUN wget https://github.com/sqlcipher/sqlcipher/archive/refs/tags/v4.6.1.tar.gz \ - && tar zxf v4.6.1.tar.gz \ +RUN tar zxf <(wget -O- https://github.com/sqlcipher/sqlcipher/archive/refs/tags/v4.6.1.tar.gz) \ && cd sqlcipher-4.6.1 \ - && ./configure --prefix=$SYSROOT/usr --host=aarch64-linux-android --with-sysroot=$SYSROOT --disable-shared CFLAGS=-fPIC \ + && ./configure --prefix="$SYSROOT/usr" --host="$ANDROID_TRIPLE" --with-sysroot="$SYSROOT" --disable-shared CFLAGS=-fPIC \ && make -j$(nproc) \ && make install \ - && rm -rf /work/sqlcipher + && rm -rf /work/build -WORKDIR /work/opus -RUN wget https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz \ - && tar zxf opus-1.5.2.tar.gz \ +RUN tar zxf <(wget -O- https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz) \ && cd opus-1.5.2 \ - && ./configure --prefix=$SYSROOT/usr --host=aarch64-linux-android --with-sysroot=$SYSROOT --disable-shared \ + && ./configure --prefix="$SYSROOT/usr" --host="$ANDROID_TRIPLE" --with-sysroot="$SYSROOT" --disable-shared \ && make -j$(nproc) \ && make install \ - && rm -rf /work/opus + && rm -rf /work/build -WORKDIR /work/libvpx -RUN wget https://github.com/webmproject/libvpx/archive/refs/tags/v1.15.0.tar.gz \ - && tar zxf v1.15.0.tar.gz \ +#ARG ANDROID_VPX_ABI=armv7-android-gcc +ARG ANDROID_VPX_ABI=arm64-android-gcc +RUN tar zxf <(wget -O- https://github.com/webmproject/libvpx/archive/refs/tags/v1.15.0.tar.gz) \ && cd libvpx-1.15.0 \ - && ./configure --prefix=$SYSROOT/usr --libc=$SYSROOT --target=arm64-android-gcc --disable-examples --disable-unit-tests --enable-pic \ + && ./configure --prefix="$SYSROOT/usr" --libc="$SYSROOT" --target="$ANDROID_VPX_ABI" --disable-examples --disable-unit-tests --enable-pic \ && make -j$(nproc) \ && make install \ - && rm -rf /work/libvpx + && rm -rf /work/build -WORKDIR /work/openal -RUN wget https://github.com/kcat/openal-soft/releases/download/1.23.1/openal-soft-1.23.1.tar.bz2 \ - && tar jxf openal-soft-1.23.1.tar.bz2 \ +RUN tar jxf <(wget -O- https://github.com/kcat/openal-soft/releases/download/1.23.1/openal-soft-1.23.1.tar.bz2) \ && cd openal-soft-1.23.1 \ && /work/android/qt/bin/qt-cmake \ -DCMAKE_BUILD_TYPE=Release \ @@ -193,21 +191,19 @@ RUN wget https://github.com/kcat/openal-soft/releases/download/1.23.1/openal-sof -H. \ && cmake --build _build \ && cmake --install _build \ - && rm -rf /work/openal + && rm -rf /work/build -WORKDIR /work/toxcore -RUN wget https://github.com/TokTok/c-toxcore/releases/download/v0.2.20/c-toxcore-0.2.20.tar.gz \ - && tar zxf c-toxcore-0.2.20.tar.gz \ +RUN tar zxf <(wget -O- https://github.com/TokTok/c-toxcore/releases/download/v0.2.20/c-toxcore-0.2.20.tar.gz) \ && cd c-toxcore-0.2.20 \ && /work/android/qt/bin/qt-cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX:PATH=$SYSROOT/usr \ + -DCMAKE_INSTALL_PREFIX:PATH="$SYSROOT/usr" \ -DENABLE_SHARED=OFF \ -GNinja \ -B_build \ -H. \ && cmake --build _build \ && cmake --install _build \ - && rm -rf /work/toxcore + && rm -rf /work/build WORKDIR /qtox diff --git a/qtox/docker/Dockerfile.windows-builder b/qtox/docker/Dockerfile.windows-builder index 9fc7115..142440f 100644 --- a/qtox/docker/Dockerfile.windows-builder +++ b/qtox/docker/Dockerfile.windows-builder @@ -245,3 +245,5 @@ RUN mkdir -p /src/gdb && \ RUN mkdir -p /qtox WORKDIR /qtox + +RUN chmod 0644 /build/windows-toolchain.cmake