diff --git a/scripts/README.md b/scripts/README.md index 3787ea3fe..ff06115b0 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -48,3 +48,7 @@ to avoid the relatively large download:: cd scripts # where all CI things are docker build -t deltachat/coredeps docker-coredeps docker build -t deltachat/doxygen docker-doxygen + +Additionally, you can install qemu and build arm64 docker image: + apt-get install qemu binfmt-support qemu-user-static + docker build -t deltachat/coredeps-arm64 docker-coredeps-arm64 diff --git a/scripts/docker-coredeps-arm64/Dockerfile b/scripts/docker-coredeps-arm64/Dockerfile new file mode 100644 index 000000000..63d5a94ca --- /dev/null +++ b/scripts/docker-coredeps-arm64/Dockerfile @@ -0,0 +1,21 @@ +FROM quay.io/pypa/manylinux2014_aarch64 + +# Configure ld.so/ldconfig and pkg-config +RUN echo /usr/local/lib64 > /etc/ld.so.conf.d/local.conf && \ + echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf +ENV PKG_CONFIG_PATH /usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig + +# Install a recent Perl, needed to install the openssl crate +ADD deps/build_perl.sh /builder/build_perl.sh +RUN rm /usr/bin/perl +RUN mkdir tmp1 && cd tmp1 && bash /builder/build_perl.sh && cd .. && rm -r tmp1 + +ENV PIP_DISABLE_PIP_VERSION_CHECK 1 + +# Install python tools (auditwheels,tox, ...) +ADD deps/build_python.sh /builder/build_python.sh +RUN mkdir tmp1 && cd tmp1 && bash /builder/build_python.sh && cd .. && rm -r tmp1 + +# Install Rust +ADD deps/build_rust.sh /builder/build_rust.sh +RUN mkdir tmp1 && cd tmp1 && bash /builder/build_rust.sh && cd .. && rm -r tmp1 diff --git a/scripts/docker-coredeps-arm64/deps/build_openssl.sh b/scripts/docker-coredeps-arm64/deps/build_openssl.sh new file mode 100755 index 000000000..6f609186f --- /dev/null +++ b/scripts/docker-coredeps-arm64/deps/build_openssl.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e -x + +OPENSSL_VERSION=1.1.1a +OPENSSL_SHA256=fc20130f8b7cbd2fb918b2f14e2f429e109c31ddd0fb38fc5d71d9ffed3f9f41 + +curl -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz +echo "${OPENSSL_SHA256} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c - +tar xzf openssl-${OPENSSL_VERSION}.tar.gz +cd openssl-${OPENSSL_VERSION} +./config shared no-ssl2 no-ssl3 -fPIC --prefix=/usr/local + +sed -i "s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=200/" Makefile && \ +sed -i "s/^SHLIB_MINOR=.*/SHLIB_MINOR=0.0/" Makefile && \ +sed -i "s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=200.0.0/" Makefile + +make depend +make +make install_sw install_ssldirs +ldconfig -v | grep ssl diff --git a/scripts/docker-coredeps-arm64/deps/build_perl.sh b/scripts/docker-coredeps-arm64/deps/build_perl.sh new file mode 100755 index 000000000..2440ee815 --- /dev/null +++ b/scripts/docker-coredeps-arm64/deps/build_perl.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +PERL_VERSION=5.30.0 +# PERL_SHA256=7e929f64d4cb0e9d1159d4a59fc89394e27fa1f7004d0836ca0d514685406ea8 +curl -O https://www.cpan.org/src/5.0/perl-${PERL_VERSION}.tar.gz +# echo "${PERL_SHA256} perl-${PERL_VERSION}.tar.gz" | sha256sum -c - +tar -xzf perl-${PERL_VERSION}.tar.gz +cd perl-${PERL_VERSION} + +./Configure -de +make +make install diff --git a/scripts/docker-coredeps-arm64/deps/build_python.sh b/scripts/docker-coredeps-arm64/deps/build_python.sh new file mode 100755 index 000000000..a5e980b2a --- /dev/null +++ b/scripts/docker-coredeps-arm64/deps/build_python.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -x -e + +# we use the python3.6 environment as the base environment +/opt/python/cp36-cp36m/bin/pip install tox devpi-client auditwheel + +pushd /usr/bin + +ln -s /opt/_internal/cpython-3.6.*/bin/tox +ln -s /opt/_internal/cpython-3.6.*/bin/devpi +ln -s /opt/_internal/cpython-3.6.*/bin/auditwheel + +popd diff --git a/scripts/docker-coredeps-arm64/deps/build_rust.sh b/scripts/docker-coredeps-arm64/deps/build_rust.sh new file mode 100755 index 000000000..f82ce0357 --- /dev/null +++ b/scripts/docker-coredeps-arm64/deps/build_rust.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e -x + +# Install Rust +# +# Path from https://forge.rust-lang.org/infra/other-installation-methods.html +# +# Avoid using rustup here as it depends on reading /proc/self/exe and +# has problems running under QEMU. +curl "https://static.rust-lang.org/dist/rust-1.50.0-$(uname -m)-unknown-linux-gnu.tar.gz" | tar xz +cd "rust-1.50.0-$(uname -m)-unknown-linux-gnu" +./install.sh --prefix=/usr --components=rustc,cargo,"rust-std-$(uname -m)-unknown-linux-gnu" +rustc --version +cd .. +rm -fr "rust-1.50.0-$(uname -m)-unknown-linux-gnu" diff --git a/scripts/docker-coredeps/Dockerfile b/scripts/docker-coredeps/Dockerfile index 98febb4d5..13d2fce0f 100644 --- a/scripts/docker-coredeps/Dockerfile +++ b/scripts/docker-coredeps/Dockerfile @@ -5,7 +5,7 @@ RUN echo /usr/local/lib64 > /etc/ld.so.conf.d/local.conf && \ echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf ENV PKG_CONFIG_PATH /usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig -# Install a recent Perl, needed to install the openssl crate +# Install a recent Perl, needed to install the openssl crate ADD deps/build_perl.sh /builder/build_perl.sh RUN rm /usr/bin/perl RUN mkdir tmp1 && cd tmp1 && bash /builder/build_perl.sh && cd .. && rm -r tmp1 diff --git a/scripts/docker-coredeps/deps/build_rust.sh b/scripts/docker-coredeps/deps/build_rust.sh index e9d285afa..11f296ad9 100755 --- a/scripts/docker-coredeps/deps/build_rust.sh +++ b/scripts/docker-coredeps/deps/build_rust.sh @@ -3,9 +3,9 @@ set -e -x # Install Rust -curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.50.0-x86_64-unknown-linux-gnu -y +curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain "1.50.0-$(uname -m)-unknown-linux-gnu" -y export PATH=/root/.cargo/bin:$PATH rustc --version # remove some 300-400 MB that we don't need for automated builds -rm -rf /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-gnu/share +rm -rf "/root/.rustup/toolchains/1.50.0-$(uname -m)-unknown-linux-gnu/share"