File: Dockerfile

package info (click to toggle)
rust-nettle-sys 2.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 312 kB
  • sloc: ansic: 58; makefile: 4
file content (52 lines) | stat: -rw-r--r-- 1,705 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Source docker file. Needs to match up with HOST_ARCH
FROM japaric/arm-linux-androideabi:v0.1.14

# Target architecture. See https://github.com/rust-embedded/cross#supported-targets
# for a list of all supported targets.
ENV HOST_ARCH=arm-linux-androideabi

# Version of the nettle dependencies to build.
ENV GMP_VERSION=6.1.2 \
    NETTLE_VERSION=3.4.1

# Additional cross compiler config
# Android needs the following:
ENV CFLAGS="-fPIE -fPIC" \
    LDFLAGS="-pie" \
    PATH="/tmp/android-ndk/bin:${PATH}" \
    PKG_CONFIG_ALLOW_CROSS=1 \
    PKG_CONFIG_PATH=/tmp/prefix/lib/pkgconfig

# Install deps
RUN DEBIAN_FRONTEND=noninteractive \
    apt update -yy && \
    apt install -yy m4 wget libclang1

# Cross compile GMP
RUN cd /tmp && \
    wget https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.bz2 && \
    tar xvf gmp-${GMP_VERSION}.tar.bz2 && \
    cd gmp-${GMP_VERSION} && \
    AR="${HOST_ARCH}-ar" \
    AS="${HOST_ARCH}-clang" \
    CC="${HOST_ARCH}-clang" \
    CXX="${HOST_ARCH}-clang++" \
    LD="${HOST_ARCH}-ld" \
    STRIP="${HOST_ARCH}-strip" ./configure --host=${HOST_ARCH} --prefix=/tmp/prefix && \
    make && make install

# Cross compile Nettle
RUN cd /tmp && \
    wget https://ftp.gnu.org/gnu/nettle/nettle-${NETTLE_VERSION}.tar.gz && \
    tar xvf nettle-${NETTLE_VERSION}.tar.gz && \
    cd nettle-${NETTLE_VERSION} && \
    AR="${HOST_ARCH}-ar" \
    AS="${HOST_ARCH}-clang" \
    CC="${HOST_ARCH}-clang" \
    CXX="${HOST_ARCH}-clang++" \
    LD="${HOST_ARCH}-ld" \
    STRIP="${HOST_ARCH}-strip" ./configure --host=${HOST_ARCH} --prefix=/tmp/prefix \
      --with-lib-path=/tmp/prefix/lib \
      --with-include-path=/tmp/prefix/include && \
    make && make install