Fix cross platform build

This commit is contained in:
Joey Yakimowich-Payne 2018-08-08 15:05:36 +09:00
commit a9d5d174cf
3 changed files with 20 additions and 21 deletions

View file

@ -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

View file

@ -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