build_nim.sh and build_rocksdb.sh

This commit is contained in:
Ștefan Talpalaru 2019-06-17 17:08:03 +02:00 committed by zah
parent 1cb1168aec
commit f70f87b78f
2 changed files with 27 additions and 79 deletions

View File

@ -6,7 +6,7 @@ cache:
- sqlite-dll-win32-x86-3240000.zip -> .appveyor.yml
- sqlite-dll-win64-x64-3240000.zip -> .appveyor.yml
- nimbus-deps.zip -> .appveyor.yml
- Nim -> .appveyor.yml
- NimBinaries
matrix:
# We always want 32 and 64-bit compilation
@ -16,6 +16,9 @@ platform:
- x86
- x64
# when multiple CI builds are queued, the tested commit needs to be in the last X commits cloned with "--depth X"
clone_depth: 10
install:
- setlocal EnableExtensions EnableDelayedExpansion
@ -55,52 +58,17 @@ install:
- SET "LMDB_ARCHIVE=LMDB_%LMDB_VER%.tar.gz"
- SET "LMDB_PATH=lmdb-LMDB_%LMDB_VER%\libraries\liblmdb"
- appveyor DownloadFile "%LMDB_URL%\%LMDB_ARCHIVE%" - FileName "%LMDB_ARCHIVE%"
- tar xvf %LMDB_ARCHIVE%
- tar xzf %LMDB_ARCHIVE%
- cd %LMDB_PATH%
- gcc -shared -o lmdb.dll mdb.c midl.c -lntdll
- gcc -march=native -O3 -pipe -shared -o lmdb.dll mdb.c midl.c -lntdll
- cd ..\..\..
- copy %LMDB_PATH%\lmdb.dll %CD%\bin\lmdb.dll
# build nim from our own branch - this to avoid the day-to-day churn and
# regressions of the fast-paced Nim development while maintaining the
# flexibility to apply patches
- SET "NEED_REBUILD="
- IF NOT EXIST "Nim\\.git\\" (
git clone https://github.com/status-im/Nim.git
) ELSE (
( cd Nim ) &
( git pull ) &
( cd .. )
)
# Rebuild Nim if HEAD has moved or if we don't yet have a cached version
- IF NOT EXIST "Nim\\ver.txt" (
SET NEED_REBUILD=1
) ELSE (
( CD Nim ) &
( git rev-parse HEAD > ..\\cur_ver.txt ) &
( fc ver.txt ..\\cur_ver.txt || SET NEED_REBUILD=1 ) &
( cd .. )
)
- IF NOT EXIST "Nim\\bin\\nim.exe" SET NEED_REBUILD=1
- IF NOT EXIST "Nim\\bin\\nimble.exe" SET NEED_REBUILD=1
# after building nim, wipe csources to save on cache space
- IF DEFINED NEED_REBUILD (
cd Nim &
( IF EXIST "csources" rmdir /s /q csources ) &
git clone --depth 1 https://github.com/nim-lang/csources &
cd csources &
( IF "%PLATFORM%" == "x64" ( build64.bat ) else ( build.bat ) ) &
cd .. &
bin\nim c koch &
koch boot -d:release &
koch nimble &
git rev-parse HEAD > ver.txt &
rmdir /s /q csources
)
- curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus/devel/build_nim.sh
- env MAKE="mingw32-make -j2" ARCH_OVERRIDE=%PLATFORM% bash build_nim.sh Nim csources dist/nimble NimBinaries
build_script:
- cd C:\projects\%APPVEYOR_PROJECT_SLUG%

View File

@ -1,63 +1,43 @@
language: c # or other C/C++ variants
sudo: false
language: c
# https://docs.travis-ci.com/user/caching/
#
# Caching the whole nim folder is better than relying on ccache - this way, we
# skip the expensive bootstrap process and linking
cache:
directories:
- nim
- rocksdb
- NimBinaries
- rocksdbCache
git:
# when multiple CI builds are queued, the tested commit needs to be in the last X commits cloned with "--depth X"
depth: 10
matrix:
include:
- os: linux
sudo: required
before_install:
- export INSTALL_PATH=/usr
- export NPROC=$(nproc)
- export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
- os: osx
before_install:
- export INSTALL_PATH=$HOME # included in DYLD_FALLBACK_LIBRARY_PATH
- export NPROC=$(sysctl -n hw.ncpu)
- launchctl setenv LIBRARY_PATH /usr/local/lib # for RocksDB
install:
# build nim from our own branch - this to avoid the day-to-day churn and
# regressions of the fast-paced Nim development while maintaining the
# flexibility to apply patches
#
# check version of remote branch
- "export NIMVER=$(git ls-remote https://github.com/status-im/nim.git HEAD | cut -f 1)"
# after building nim, wipe csources to save on cache space
- "{ [ -f nim/$NIMVER/bin/nim ] && [ -f nim/$NIMVER/bin/nimble ] ; } ||
{ rm -rf nim ;
mkdir -p nim ;
git clone --depth=1 https://github.com/status-im/nim.git nim/$NIMVER ;
cd nim/$NIMVER ;
sh build_all.sh ;
rm -rf csources ;
cd ../.. ;
}"
- "export PATH=$PWD/nim/$NIMVER/bin:$PATH"
- curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus/devel/build_nim.sh
- env MAKE="make -j2" bash build_nim.sh Nim csources dist/nimble NimBinaries
- export PATH=$PWD/Nim/bin:$PATH
# build our own rocksdb to test with a fixed version that we think works
- "export ROCKSDBVER=5.14.2"
- "[ -f rocksdb/rocksdb-$ROCKSDBVER/Makefile ] || { rm -rf rocksdb ; mkdir -p rocksdb; cd rocksdb; wget https://github.com/facebook/rocksdb/archive/v$ROCKSDBVER.tar.gz && tar xvf v$ROCKSDBVER.tar.gz; cd ..; }"
- cd rocksdb/rocksdb-$ROCKSDBVER
- "[ -f util/build_version.cc ] || { make util/build_version.cc ; }" # use cached version if possible
- export NO_UPDATE_BUILD_VERSION=1
- make shared_lib -j$NPROC && sudo make install-shared
- cd ../..
- curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus/devel/build_rocksdb.sh
- bash build_rocksdb.sh rocksdbCache
# no need to cache, lmdb is small and compile very fast
- "export LMDBVER=0.9.22"
- "wget https://github.com/LMDB/lmdb/archive/LMDB_$LMDBVER.tar.gz && tar xvf LMDB_$LMDBVER.tar.gz;"
- cd lmdb-LMDB_$LMDBVER/libraries/liblmdb && make
# no need to cache, lmdb is small and compiles very fast
- export LMDBVER="0.9.22"
- "wget https://github.com/LMDB/lmdb/archive/LMDB_$LMDBVER.tar.gz && tar xzf LMDB_$LMDBVER.tar.gz;"
- cd lmdb-LMDB_$LMDBVER/libraries/liblmdb && make -j2
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sed -i 's| liblmdb.a||' Makefile && sudo make prefix=/usr install; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sudo cp liblmdb.so /usr/local/lib/liblmdb.dylib; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sudo cp -a liblmdb.so /usr/local/lib/liblmdb.dylib; fi
- cd ../../..
script: