Install and get osxcross working
This commit is contained in:
parent
835f95d377
commit
ac8f95f9d0
4 changed files with 44 additions and 50 deletions
82
Dockerfile
82
Dockerfile
|
@ -2,53 +2,47 @@ FROM debian:buster-slim
|
||||||
|
|
||||||
ARG RUST_VER=1.35.0
|
ARG RUST_VER=1.35.0
|
||||||
|
|
||||||
RUN apt update \
|
RUN apt update -y -q \
|
||||||
&& apt install -y -q \
|
&& apt upgrade -y -q \
|
||||||
autoconf \
|
&& apt install -y -q \
|
||||||
automake \
|
autoconf \
|
||||||
gcc \
|
automake \
|
||||||
make \
|
cmake \
|
||||||
autotools-dev \
|
gcc \
|
||||||
curl \
|
make \
|
||||||
mingw-w64 \
|
autotools-dev \
|
||||||
mingw-w64-tools \
|
curl \
|
||||||
gcc-mingw-w64 \
|
mingw-w64 \
|
||||||
binutils-mingw-w64 \
|
mingw-w64-tools \
|
||||||
clang \
|
gcc-mingw-w64 \
|
||||||
llvm \
|
binutils-mingw-w64 \
|
||||||
git
|
clang \
|
||||||
|
llvm \
|
||||||
|
git \
|
||||||
|
libxml2-dev \
|
||||||
|
libssl-dev \
|
||||||
|
liblzma-dev \
|
||||||
|
zlib1g-dev
|
||||||
|
|
||||||
#Build arguments
|
#Build arguments
|
||||||
ARG osxcross_repo="tpoechtrager/osxcross"
|
ARG osxcross_repo="tpoechtrager/osxcross"
|
||||||
ARG osxcross_revision="a845375e028d29b447439b0c65dea4a9b4d2b2f6"
|
ARG osxcross_revision="e0a171828a72a0d7ad4409489033536590008ebf"
|
||||||
ARG darwin_sdk_version="10.11"
|
ARG sdk_version="10.13"
|
||||||
ARG darwin_osx_version_min="10.7"
|
|
||||||
ARG darwin_version="15"
|
|
||||||
ARG darwin_sdk_url="https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.11.sdk.tar.xz"
|
|
||||||
|
|
||||||
# ENV available in docker image
|
RUN mkdir -p "/tmp/osxcross" \
|
||||||
ENV OSXCROSS_REPO="${osxcross_repo}" \
|
&& cd "/tmp/osxcross" \
|
||||||
OSXCROSS_REVISION="${osxcross_revision}" \
|
&& curl -sLo osxcross.tar.gz "https://codeload.github.com/${osxcross_repo}/tar.gz/${osxcross_revision}" \
|
||||||
DARWIN_SDK_VERSION="${darwin_sdk_version}" \
|
&& tar --strip=1 -xzf osxcross.tar.gz \
|
||||||
DARWIN_VERSION="${darwin_version}" \
|
&& rm -f osxcross.tar.gz
|
||||||
DARWIN_OSX_VERSION_MIN="${darwin_osx_version_min}" \
|
|
||||||
DARWIN_SDK_URL="${darwin_sdk_url}"
|
|
||||||
|
|
||||||
RUN mkdir -p "/tmp/osxcross" \
|
COPY MacOSX10.13.sdk.tar.xz /tmp/osxcross/tarballs/
|
||||||
&& cd "/tmp/osxcross" \
|
|
||||||
&& curl -sLo osxcross.tar.gz "https://codeload.github.com/${OSXCROSS_REPO}/tar.gz/${OSXCROSS_REVISION}" \
|
RUN cd "/tmp/osxcross" \
|
||||||
&& tar --strip=1 -xzf osxcross.tar.gz \
|
&& UNATTENDED=1 ./build.sh \
|
||||||
&& rm -f osxcross.tar.gz \
|
&& mv target /usr/osxcross \
|
||||||
&& curl -sLo tarballs/MacOSX${DARWIN_SDK_VERSION}.sdk.tar.xz \
|
&& mv tools /usr/osxcross/ \
|
||||||
"${DARWIN_SDK_URL}" \
|
&& rm -rf /tmp/osxcross \
|
||||||
&& yes "" | SDK_VERSION="${DARWIN_SDK_VERSION}" OSX_VERSION_MIN="${DARWIN_OSX_VERSION_MIN}" ./build.sh \
|
&& rm -rf "/usr/osxcross/SDK/MacOSX${sdk_version}.sdk/usr/share/man"
|
||||||
&& mv target /usr/osxcross \
|
|
||||||
&& mv tools /usr/osxcross/ \
|
|
||||||
&& ln -sf ../tools/osxcross-macports /usr/osxcross/bin/omp \
|
|
||||||
&& ln -sf ../tools/osxcross-macports /usr/osxcross/bin/osxcross-macports \
|
|
||||||
&& ln -sf ../tools/osxcross-macports /usr/osxcross/bin/osxcross-mp \
|
|
||||||
&& rm -rf /tmp/osxcross \
|
|
||||||
&& rm -rf "/usr/osxcross/SDK/MacOSX${DARWIN_SDK_VERSION}.sdk/usr/share/man"
|
|
||||||
|
|
||||||
RUN useradd -ms /bin/bash rust
|
RUN useradd -ms /bin/bash rust
|
||||||
|
|
||||||
|
@ -63,11 +57,11 @@ RUN curl https://sh.rustup.rs -sSf -o rustup.sh && \
|
||||||
rm rustup.sh
|
rm rustup.sh
|
||||||
|
|
||||||
ENV PATH $PATH:/home/rust/.cargo/bin:/usr/osxcross/bin
|
ENV PATH $PATH:/home/rust/.cargo/bin:/usr/osxcross/bin
|
||||||
|
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/osxcross/lib
|
||||||
|
|
||||||
RUN cp /usr/x86_64-w64-mingw32/lib/*crt2.o \
|
RUN cp /usr/x86_64-w64-mingw32/lib/*crt2.o \
|
||||||
/home/rust/.rustup/toolchains/1.35.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/
|
/home/rust/.rustup/toolchains/1.35.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/
|
||||||
|
|
||||||
ADD lin-cargo /usr/local/bin/
|
|
||||||
ADD mac-cargo /usr/local/bin/
|
ADD mac-cargo /usr/local/bin/
|
||||||
ADD mac-c++ /usr/local/bin/
|
ADD mac-c++ /usr/local/bin/
|
||||||
ADD mac-cc /usr/local/bin/
|
ADD mac-cc /usr/local/bin/
|
||||||
|
@ -76,4 +70,4 @@ ADD win-cc /usr/local/bin
|
||||||
|
|
||||||
WORKDIR /workdir
|
WORKDIR /workdir
|
||||||
|
|
||||||
CMD ["lin-cargo", "build", "--release"]
|
CMD ["cargo", "build", "--release"]
|
||||||
|
|
2
mac-c++
2
mac-c++
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
exec /usr/osxcross/bin/o64-clang++ -mmacosx-version-min=10.11 -target x86_64-apple-darwin15 -mlinker-version=242 -B /usr/x86_64-apple-darwin15/bin -isysroot /usr/osxcross/SDK/MacOSX10.11.sdk $*
|
exec /usr/osxcross/bin/o64-clang++ -mmacosx-version-min=10.13 -target x86_64-apple-darwin17 -mlinker-version=242 -B /usr/x86_64-apple-darwin17/bin -isysroot /usr/osxcross/SDK/MacOSX10.13.sdk $*
|
||||||
|
|
|
@ -14,9 +14,9 @@ export CXX="mac-c++"
|
||||||
export CPP="mac-cc -E"
|
export CPP="mac-cc -E"
|
||||||
# these, along with the .cargo/config in mac-cargo, help resolve issues that can
|
# these, along with the .cargo/config in mac-cargo, help resolve issues that can
|
||||||
# arise with assembly and linking
|
# arise with assembly and linking
|
||||||
export AR="/usr/osxcross/bin/x86_64-apple-darwin15-ar"
|
export AR="/usr/osxcross/bin/x86_64-apple-darwin17-ar"
|
||||||
export RANLIB="/usr/osxcross/bin/x86_64-apple-darwin15-ranlib"
|
export RANLIB="/usr/osxcross/bin/x86_64-apple-darwin17-ranlib"
|
||||||
export TOOLCHAIN_PREFIX="/usr/osxcross/bin/x86_64-apple-darwin15-"
|
export TOOLCHAIN_PREFIX="/usr/osxcross/bin/x86_64-apple-darwin17-"
|
||||||
|
|
||||||
mkdir -p .cargo
|
mkdir -p .cargo
|
||||||
if [ -f .cargo/config ]
|
if [ -f .cargo/config ]
|
||||||
|
@ -27,7 +27,7 @@ fi
|
||||||
cat > .cargo/config <<EOF
|
cat > .cargo/config <<EOF
|
||||||
[target.x86_64-apple-darwin]
|
[target.x86_64-apple-darwin]
|
||||||
linker = "/usr/local/bin/mac-cc"
|
linker = "/usr/local/bin/mac-cc"
|
||||||
ar = "/usr/osxcross/bin/x86_64-apple-darwin15-ar"
|
ar = "/usr/osxcross/bin/x86_64-apple-darwin17-ar"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Build it.
|
# Build it.
|
||||||
|
|
2
mac-cc
2
mac-cc
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
exec /usr/osxcross/bin/o64-clang -mmacosx-version-min=10.11 -target x86_64-apple-darwin15 -mlinker-version=242 -B /usr/x86_64-apple-darwin15/bin -isysroot /usr/osxcross/SDK/MacOSX10.11.sdk $*
|
exec /usr/osxcross/bin/o64-clang -mmacosx-version-min=10.13 -target x86_64-apple-darwin17 -mlinker-version=242 -B /usr/x86_64-apple-darwin17/bin -isysroot /usr/osxcross/SDK/MacOSX10.13.sdk $*
|
||||||
|
|
Loading…
Reference in a new issue