|
1 |
| -FROM rustembedded/cross:x86_64-unknown-linux-musl |
| 1 | +FROM brainstorm/cross-x86_64-unknown-linux-musl:upstream |
2 | 2 |
|
3 |
| -ENV MUSL_CROSS_MAKE_VERSION 0.9.9 |
| 3 | +ENV DEBIAN_FRONTEND noninteractive |
4 | 4 | ENV PKG_CONFIG_ALLOW_CROSS 1
|
5 |
| -ENV LZMA_VERSION 5.2.5 |
6 |
| -ENV ZLIB_VERSION 1.2.11 |
7 |
| -ENV OPENSSL_VERSION 1_1_1g |
8 |
| -ENV CURL_VERSION 7.70.0 |
9 | 5 |
|
10 | 6 | ENV LIBCLANG_PATH /usr/lib/llvm-10/lib
|
11 | 7 | ENV LLVM_CONFIG_PATH /usr/bin
|
12 | 8 |
|
13 |
| - |
14 |
| -# The default includes and packages from the Ubuntu distro that cross uses will generate all sorts of linux-headers related include errors, see: |
15 |
| -# https://github.com/rust-bio/rust-htslib/pull/184#commitcomment-37496651 |
16 |
| -# Those are the packages installed, hopefully someone will find a good way to use the distro ones instead of compiling everything under /usr/local :/ |
17 |
| -# apt-get install -y libssl-dev libcurl4-openssl-dev zlib1g-dev libbz2-dev liblzma-dev musl musl-dev musl-tools linux-libc-dev linux-headers-4.15.0-20-generic |
18 |
| - |
19 |
| -# Install basics to locally compile htslib dependencies |
20 |
| -RUN apt-get update && \ |
21 |
| - apt-get install -y build-essential autoconf automake autotools-dev git wget |
| 9 | +WORKDIR /root |
22 | 10 |
|
23 | 11 | # Otherwise LLVM bump below fails
|
24 | 12 | RUN apt-get install -y wget gnupg lsb-release software-properties-common apt-transport-https ca-certificates
|
25 | 13 |
|
26 | 14 | # Autodetect and fetch latest LLVM repos for the current distro, avoids LLVM warnings and other issues, might generate slower builds for now though, see:
|
27 | 15 | # https://www.phoronix.com/scan.php?page=news_item&px=Rust-Hurt-On-LLVM-10
|
28 | 16 | RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
|
29 |
| -#RUN apt-get install -y libssl-dev libcurl4-openssl-dev zlib1g-dev \ |
30 |
| -# libbz2-dev liblzma-dev musl musl-dev musl-tools # htslib deps |
31 |
| - |
32 |
| -# Remove pre-installed musl, to avoid cross-musl-make interference |
33 |
| -RUN apt-get remove -y musl |
34 |
| - |
35 |
| -# For now we'll have to go nuts and not only build musl-1.2.0 from scratch but all the other libs too... |
36 |
| -# Updated musl-cross toolchain that does not fail on OpenSSL: https://github.com/openssl/openssl/issues/7207 |
37 |
| -WORKDIR /root |
38 |
| -RUN wget https://github.com/richfelker/musl-cross-make/archive/v$MUSL_CROSS_MAKE_VERSION.tar.gz \ |
39 |
| - && tar xvfz v$MUSL_CROSS_MAKE_VERSION.tar.gz |
40 |
| -WORKDIR /root/musl-cross-make-$MUSL_CROSS_MAKE_VERSION |
41 |
| -COPY config-musl-cross-make.mak config.mak |
42 |
| -RUN make -j40 install && cd .. && rm v$MUSL_CROSS_MAKE_VERSION.tar.gz |
43 |
| - #&& rm -rf musl-cross-make-* |
44 |
| - |
45 |
| -# Now we assume we have a properly configured musl-cross... |
46 |
| -ENV PATH "/usr/local/musl/bin:$PATH" |
47 |
| -ENV CFLAGS "-fPIC" |
48 |
| -ENV CROSS_COMPILE x86_64-linux-musl- |
49 |
| -ENV CC ${CROSS_COMPILE}cc |
50 |
| -ENV AR ${CROSS_COMPILE}ar |
51 |
| -ENV RANLIB ${CROSS_COMPILE}ranlib |
52 |
| -ENV CXX ${CROSS_COMPILE}g++ |
53 |
| -ENV CPPFLAGS "-I/usr/local/musl/include -I/usr/local/include" |
54 |
| -ENV LDFLAGS "-L/usr/local/musl/lib -L/usr/local/lib" |
55 |
| - |
56 |
| -# .. and carry on with the htslib deps |
57 |
| -WORKDIR /root |
58 |
| -RUN git clone --depth 1 https://github.com/ebiggers/libdeflate.git && \ |
59 |
| - cd libdeflate && make -j40 CFLAGS="-fPIC -O3" PREFIX="/usr/local/musl" install && \ |
60 |
| - cd .. && rm -rf libdeflate |
61 |
| -RUN git clone https://github.com/cloudflare/zlib cloudflare-zlib && \ |
62 |
| - cd cloudflare-zlib && ./configure --static --prefix=/usr/local/musl && \ |
63 |
| - make install && cd .. && rm -rf cloudflare-zlib |
64 |
| -#RUN wget https://www.zlib.net/zlib-$ZLIB_VERSION.tar.gz \ |
65 |
| -# && tar xvfz zlib-$ZLIB_VERSION.tar.gz \ |
66 |
| -# && cd zlib-$ZLIB_VERSION \ |
67 |
| -# && ./configure --static --prefix=/usr/local/musl \ |
68 |
| -# && make -j40 install |
69 |
| -RUN git clone git://sourceware.org/git/bzip2 \ |
70 |
| - && cd bzip2 \ |
71 |
| - && make -j40 CC=$CC AR=$AR RANLIB=$RANLIB CFLAGS=$CFLAGS bzip2 \ |
72 |
| - && make PREFIX=/usr/local/musl -j40 bzip2 \ |
73 |
| - && make -j40 install && cd .. && rm -rf bzip2 |
74 |
| -RUN wget https://tukaani.org/xz/xz-$LZMA_VERSION.tar.bz2 \ |
75 |
| - && tar xvfj xz-$LZMA_VERSION.tar.bz2 \ |
76 |
| - && cd xz-$LZMA_VERSION \ |
77 |
| - && ./configure --prefix=/usr/local/musl \ |
78 |
| - --enable-static --disable-shared \ |
79 |
| - --host x86_64-unknown-linux-musl \ |
80 |
| - && make -j40 install && cd .. && rm -rf xz-$LZMA_VERSION xz-$LZMA_VERSION.tar.bz2 |
81 |
| - |
82 |
| -# A few gems from: https://wiki.openssl.org/index.php/Compilation_and_Installation |
83 |
| -# "OpenSSL has been around a long time, and it carries around a lot of cruft" |
84 |
| -# "SSLv2 is completely broken, and you should disable it during configuration" |
85 |
| -# "You should specify both --prefix and --openssldir to ensure make install works as expected." |
86 |
| -# |
87 |
| -# And also this: |
88 |
| -# https://github.com/openssl/openssl/issues/11362 |
89 |
| -# |
90 |
| -# And having to redefine AR,CC & RANLIB because otherwise, this: |
91 |
| -# |
92 |
| -# make[1]: x86_64-linux-musl-x86_64-linux-musl-ar: Command not found |
93 |
| -RUN wget https://github.com/openssl/openssl/archive/OpenSSL_$OPENSSL_VERSION.tar.gz \ |
94 |
| - && tar xvfz OpenSSL_$OPENSSL_VERSION.tar.gz && cd openssl-OpenSSL_$OPENSSL_VERSION \ |
95 |
| - && ./Configure --prefix=/usr/local/musl --openssldir=/usr/local/musl \ |
96 |
| - --with-zlib-lib=/usr/local/lib/zlib-$ZLIB_VERSION linux-x86_64 \ |
97 |
| - no-shared no-dso no-gost no-engine no-ssl2 no-srp no-srtp no-tests zlib \ |
98 |
| - no-weak-ssl-ciphers \ |
99 |
| - && make AR=x86_64-linux-musl-ar \ |
100 |
| - CC=x86_64-linux-musl-cc \ |
101 |
| - -j40 \ |
102 |
| - && make RANLIB=x86_64-linux-musl-ranlib -j40 install && cd .. \ |
103 |
| - && rm -rf OpenSSL_$OPENSSL_VERSION.tar.gz openssl-OpenSSL_$OPENSSL_VERSION |
104 |
| - |
105 |
| -RUN wget https://curl.haxx.se/download/curl-$CURL_VERSION.tar.gz \ |
106 |
| - && tar xvfz curl-$CURL_VERSION.tar.gz && cd curl-$CURL_VERSION \ |
107 |
| - && ./configure --prefix=/usr/local/musl --host x86_64-linux-musl \ |
108 |
| - --with-ssl=/usr/local/musl --with-zlib=/usr/local/musl --enable-static \ |
109 |
| - --disable-dict --disable-ftp --disable-gopher --disable-imap \ |
110 |
| - --disable-pop3 --disable-rtsp --disable-smb --disable-smtp --disable-telnet \ |
111 |
| - --disable-tftp --disable-ntlm --disable-ldap \ |
112 |
| - && make -j40 install && cd .. \ |
113 |
| - && rm -rf curl-$CURL_VERSION.tar.gz curl-$CURL_VERSION |
114 |
| - |
115 |
| -# To cater Rust's openssl-sys needs... |
116 |
| -ENV OPENSSL_DIR /usr/local/musl |
117 |
| - |
118 |
| -# Hack to force ld stick to musl on the hts-sys/build.rs side, otherwise: |
119 |
| -# = note: /usr/bin/ld: /target/debug/deps/liblibloading-689161fea10b6234.rlib(global_static.o): unable to initialize decompress status for section .debug_info |
120 |
| -RUN rm /usr/bin/ld && ln -sf /usr/local/musl/bin/x86_64-linux-musl-ld /usr/bin/ld |
121 |
| - |
122 |
| -# Prepare rustup and toolchain locally for easy manual intervention in this container |
123 |
| -#RUN wget https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init \ |
124 |
| -# && chmod +x rustup-init \ |
125 |
| -# && ./rustup-init -y \ |
126 |
| -# && . $HOME/.cargo/env \ |
127 |
| -# && rustup target add x86_64-unknown-linux-musl |
128 |
| - |
129 |
| -CMD ["bash"] |
0 commit comments