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
|
||||
|
||||
RUN apt update \
|
||||
&& apt install -y -q \
|
||||
autoconf \
|
||||
automake \
|
||||
gcc \
|
||||
make \
|
||||
autotools-dev \
|
||||
curl \
|
||||
mingw-w64 \
|
||||
mingw-w64-tools \
|
||||
gcc-mingw-w64 \
|
||||
binutils-mingw-w64 \
|
||||
clang \
|
||||
llvm \
|
||||
git
|
||||
RUN apt update -y -q \
|
||||
&& apt upgrade -y -q \
|
||||
&& apt install -y -q \
|
||||
autoconf \
|
||||
automake \
|
||||
cmake \
|
||||
gcc \
|
||||
make \
|
||||
autotools-dev \
|
||||
curl \
|
||||
mingw-w64 \
|
||||
mingw-w64-tools \
|
||||
gcc-mingw-w64 \
|
||||
binutils-mingw-w64 \
|
||||
clang \
|
||||
llvm \
|
||||
git \
|
||||
libxml2-dev \
|
||||
libssl-dev \
|
||||
liblzma-dev \
|
||||
zlib1g-dev
|
||||
|
||||
#Build arguments
|
||||
ARG osxcross_repo="tpoechtrager/osxcross"
|
||||
ARG osxcross_revision="a845375e028d29b447439b0c65dea4a9b4d2b2f6"
|
||||
ARG darwin_sdk_version="10.11"
|
||||
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"
|
||||
ARG osxcross_revision="e0a171828a72a0d7ad4409489033536590008ebf"
|
||||
ARG sdk_version="10.13"
|
||||
|
||||
# ENV available in docker image
|
||||
ENV OSXCROSS_REPO="${osxcross_repo}" \
|
||||
OSXCROSS_REVISION="${osxcross_revision}" \
|
||||
DARWIN_SDK_VERSION="${darwin_sdk_version}" \
|
||||
DARWIN_VERSION="${darwin_version}" \
|
||||
DARWIN_OSX_VERSION_MIN="${darwin_osx_version_min}" \
|
||||
DARWIN_SDK_URL="${darwin_sdk_url}"
|
||||
RUN mkdir -p "/tmp/osxcross" \
|
||||
&& cd "/tmp/osxcross" \
|
||||
&& curl -sLo osxcross.tar.gz "https://codeload.github.com/${osxcross_repo}/tar.gz/${osxcross_revision}" \
|
||||
&& tar --strip=1 -xzf osxcross.tar.gz \
|
||||
&& rm -f osxcross.tar.gz
|
||||
|
||||
RUN mkdir -p "/tmp/osxcross" \
|
||||
&& cd "/tmp/osxcross" \
|
||||
&& curl -sLo osxcross.tar.gz "https://codeload.github.com/${OSXCROSS_REPO}/tar.gz/${OSXCROSS_REVISION}" \
|
||||
&& tar --strip=1 -xzf osxcross.tar.gz \
|
||||
&& rm -f osxcross.tar.gz \
|
||||
&& curl -sLo tarballs/MacOSX${DARWIN_SDK_VERSION}.sdk.tar.xz \
|
||||
"${DARWIN_SDK_URL}" \
|
||||
&& yes "" | SDK_VERSION="${DARWIN_SDK_VERSION}" OSX_VERSION_MIN="${DARWIN_OSX_VERSION_MIN}" ./build.sh \
|
||||
&& 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"
|
||||
COPY MacOSX10.13.sdk.tar.xz /tmp/osxcross/tarballs/
|
||||
|
||||
RUN cd "/tmp/osxcross" \
|
||||
&& UNATTENDED=1 ./build.sh \
|
||||
&& mv target /usr/osxcross \
|
||||
&& mv tools /usr/osxcross/ \
|
||||
&& rm -rf /tmp/osxcross \
|
||||
&& rm -rf "/usr/osxcross/SDK/MacOSX${sdk_version}.sdk/usr/share/man"
|
||||
|
||||
RUN useradd -ms /bin/bash rust
|
||||
|
||||
|
@ -63,11 +57,11 @@ RUN curl https://sh.rustup.rs -sSf -o rustup.sh && \
|
|||
rm rustup.sh
|
||||
|
||||
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 \
|
||||
/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-c++ /usr/local/bin/
|
||||
ADD mac-cc /usr/local/bin/
|
||||
|
@ -76,4 +70,4 @@ ADD win-cc /usr/local/bin
|
|||
|
||||
WORKDIR /workdir
|
||||
|
||||
CMD ["lin-cargo", "build", "--release"]
|
||||
CMD ["cargo", "build", "--release"]
|
||||
|
|
2
mac-c++
2
mac-c++
|
@ -1,2 +1,2 @@
|
|||
#!/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"
|
||||
# these, along with the .cargo/config in mac-cargo, help resolve issues that can
|
||||
# arise with assembly and linking
|
||||
export AR="/usr/osxcross/bin/x86_64-apple-darwin15-ar"
|
||||
export RANLIB="/usr/osxcross/bin/x86_64-apple-darwin15-ranlib"
|
||||
export TOOLCHAIN_PREFIX="/usr/osxcross/bin/x86_64-apple-darwin15-"
|
||||
export AR="/usr/osxcross/bin/x86_64-apple-darwin17-ar"
|
||||
export RANLIB="/usr/osxcross/bin/x86_64-apple-darwin17-ranlib"
|
||||
export TOOLCHAIN_PREFIX="/usr/osxcross/bin/x86_64-apple-darwin17-"
|
||||
|
||||
mkdir -p .cargo
|
||||
if [ -f .cargo/config ]
|
||||
|
@ -27,7 +27,7 @@ fi
|
|||
cat > .cargo/config <<EOF
|
||||
[target.x86_64-apple-darwin]
|
||||
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
|
||||
|
||||
# Build it.
|
||||
|
|
2
mac-cc
2
mac-cc
|
@ -1,2 +1,2 @@
|
|||
#!/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