Fix cross platform build
This commit is contained in:
parent
32afc14efe
commit
a9d5d174cf
3 changed files with 20 additions and 21 deletions
15
Dockerfile
15
Dockerfile
|
|
@ -1,21 +1,14 @@
|
|||
FROM debian
|
||||
|
||||
ENV PATH=$PATH:/opt/Nim/bin:/root/.nimble/bin
|
||||
ENV PATH=$PATH:/root/.nimble/bin
|
||||
|
||||
RUN apt update && \
|
||||
apt -y install libc-dev gcc curl git perl mingw-w64 libzip-dev \
|
||||
apt -y install libc-dev gcc curl git perl mingw-w64 libzip-dev wget \
|
||||
&& \
|
||||
rm -rf /var/cache/apt/;
|
||||
|
||||
RUN mkdir -p /opt && cd /opt && \
|
||||
curl -LO https://github.com/nim-lang/Nim/archive/v0.18.0.tar.gz && \
|
||||
tar zxf v0.18.0.tar.gz && rm -f v0.18.0.tar.gz && \
|
||||
mv Nim-0.18.0 Nim && cd Nim && \
|
||||
git clone --depth 1 git://github.com/nim-lang/csources && \
|
||||
cd csources && sh build.sh && \
|
||||
cd .. && ./bin/nim c koch && ./koch boot -d:release && \
|
||||
nim e install_nimble.nims && \
|
||||
rm -rf /opt/Nim/tests;
|
||||
RUN apt -y install xz-utils make
|
||||
RUN CHOOSENIM_CHOOSE_VERSION="0.18.0" curl https://nim-lang.org/choosenim/init.sh -sSf | bash -s -- "-y"
|
||||
|
||||
ADD scripts /scripts
|
||||
ADD project /src
|
||||
|
|
|
|||
|
|
@ -7,11 +7,8 @@ cp -Rp * /workdir/linux/
|
|||
rm -rf /workdir/linux/src/nimcache
|
||||
cd /workdir/linux
|
||||
|
||||
nimble c --cpu:amd64 --os:linux --opt:speed --embedsrc --threads:on --checks:on -c -d:release src/*.nim
|
||||
cd src
|
||||
cp /opt/Nim/lib/nimbase.h nimcache
|
||||
gcc -o linux.exe nimcache/*.c
|
||||
cp linux.exe $my_pwd/dist/
|
||||
nim c --cpu:amd64 --os:linux --opt:speed --embedsrc --threads:on --checks:on -d:release src/*.nim
|
||||
cp src/docker_nim_dev_example $my_pwd/dist/linux.exe
|
||||
echo "Copied linux.exe to $my_pwd/dist"
|
||||
|
||||
cd $my_pwd
|
||||
|
|
|
|||
|
|
@ -7,12 +7,21 @@ cp -Rp * /workdir/windows/
|
|||
rm -rf /workdir/windows/src/nimcache
|
||||
cd /workdir/windows
|
||||
|
||||
nimble c --cpu:amd64 --os:windows --opt:speed --embedsrc --threads:on --checks:on -c -d:release src/*.nim
|
||||
cd src
|
||||
cp /opt/Nim/lib/nimbase.h nimcache/
|
||||
x86_64-w64-mingw32-gcc --save-temps nimcache/*.c -o windows.exe
|
||||
wget https://zlib.net/zlib-1.2.11.tar.gz
|
||||
tar -xf zlib-1.2.11.tar.gz
|
||||
|
||||
cd zlib-1.2.11/
|
||||
|
||||
# Replace the prefix with our custom one
|
||||
sed -i.bak "s/PREFIX =/PREFIX = x86_64-w64-mingw32-/g" win32/Makefile.gcc
|
||||
|
||||
PREFIXDIR=/usr/x86_64-w64-mingw32 BINARY_PATH=$PREFIXDIR/bin INCLUDE_PATH=$PREFIXDIR/include LIBRARY_PATH=$PREFIXDIR/lib SHARED_MODE=1 make -f win32/Makefile.gcc
|
||||
|
||||
cd /workdir/windows
|
||||
|
||||
nim c --cpu:amd64 --os:windows --opt:speed --embedsrc --threads:on --checks:on --gcc.exe:x86_64-w64-mingw32-gcc --gcc.linkerexe:x86_64-w64-mingw32-gcc -d:release --passL:"-L/workdir/windows/zlib-1.2.11/ -lzlib1" --passC:"-I/workdir/windows/zlib-1.2.11/" src/*.nim
|
||||
cp src/docker_nim_dev_example.exe $my_pwd/dist/windows.exe
|
||||
|
||||
cp windows.exe $my_pwd/dist/
|
||||
echo "Copied windows.exe to $my_pwd/dist"
|
||||
|
||||
cd $my_pwd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue