diff --git a/.drone.jsonnet b/.drone.jsonnet index 2fa46475e..8566477f3 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -2,6 +2,9 @@ local default_deps_base='libsystemd-dev python3-dev libcurl4-openssl-dev libuv1- local default_deps_nocxx='libsodium-dev ' + default_deps_base; // libsodium-dev needs to be >= 1.0.18 local default_deps='g++ ' + default_deps_nocxx; // g++ sometimes needs replacement +local default_windows_deps='mingw-w64-binutils mingw-w64-gcc mingw-w64-crt mingw-w64-headers mingw-w64-winpthreads perl'; // deps for windows cross compile + + local submodules = { name: 'submodules', image: 'drone/git', @@ -50,51 +53,15 @@ local debian_pipeline(name, image, ], }; -// 32-bit windows build on alpine: -local alpine_wow64_pipeline(name, image, - arch='amd64', - deps='mingw-w64-binutils mingw-w64-gcc mingw-w64-crt mingw-w64-headers mingw-w64-winpthreads', - build_type='Release', - lto=false, - werror=false, - cmake_extra='', - extra_cmds=[], - allow_fail=false) = { - kind: 'pipeline', - type: 'docker', - name: name, - platform: { arch: arch }, - trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } }, - steps: [ - submodules, - { - name: 'build', - image: image, - [if allow_fail then "failure"]: "ignore", - environment: { SSH_KEY: { from_secret: "SSH_KEY" } }, - commands: [ - 'apk add cmake git ninja pkgconf ccache patch make ' + deps, - 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', - 'mkdir build', - 'cd build', - 'cmake .. -G Ninja -DCMAKE_EXE_LINKER_FLAGS=-fstack-protector -DLIBUV_ROOT=$PWD/../win32-setup/libuv -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw32.cmake -DCMAKE_BUILD_TYPE='+build_type+' ' + - (if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') + - (if lto then '' else '-DWITH_LTO=OFF ') + - cmake_extra, - 'ninja -v', - ] + extra_cmds, - } - ], -}; - -// 64-bit windows build on alpine: -local alpine_win32_pipeline(name, image, +// windows cross compile on alpine linux +local windows_cross_pipeline(name, image, arch='amd64', - deps='mingw-w64-binutils mingw-w64-gcc mingw-w64-crt mingw-w64-headers mingw-w64-winpthreads', + deps=default_windows_deps, build_type='Release', - lto=false, + lto=true, werror=false, cmake_extra='', + toolchain='mingw32', extra_cmds=[], allow_fail=false) = { kind: 'pipeline', @@ -114,9 +81,10 @@ local alpine_win32_pipeline(name, image, 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', 'mkdir build', 'cd build', - 'cmake .. -G Ninja -DCMAKE_EXE_LINKER_FLAGS=-fstack-protector -DLIBUV_ROOT=$PWD/../win32-setup/libuv -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw64.cmake -DCMAKE_BUILD_TYPE='+build_type+' ' + + 'cmake .. -G Ninja -DCMAKE_CROSSCOMPILE=ON -DCMAKE_EXE_LINKER_FLAGS=-fstack-protector -DLIBUV_ROOT=$PWD/../win32-setup/libuv -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/'+toolchain+'.cmake -DCMAKE_BUILD_TYPE='+build_type+' ' + (if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') + (if lto then '' else '-DWITH_LTO=OFF ') + + "-DBUILD_STATIC_DEPS=ON -DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON" + cmake_extra, 'ninja -v', ] + extra_cmds, @@ -230,8 +198,14 @@ local mac_builder(name, build_type='Release', werror=true, cmake_extra='', extra debian_pipeline("Debian buster (armhf)", "arm32v7/debian:buster", arch="arm64", cmake_extra='-DDOWNLOAD_SODIUM=ON'), // Windows builds (WOW64 and native) - alpine_win32_pipeline("win32 on alpine (amd64)", "alpine:edge", cmake_extra="-DBUILD_STATIC_DEPS=ON -DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON", lto=false), - alpine_wow64_pipeline("win32 on alpine (i386)", "i386/alpine:edge", cmake_extra="-DBUILD_STATIC_DEPS=ON -DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON", lto=false), + windows_cross_pipeline("win32 on alpine (amd64)", "alpine:edge", + toolchain='mingw64', extra_cmds=[ + '../contrib/ci/drone-static-upload.sh' + ]), + windows_cross_pipeline("win32 on alpine (i386)", "i386/alpine:edge", + toolchain='mingw32', extra_cmds=[ + '../contrib/ci/drone-static-upload.sh' + ]), // Static build (on bionic) which gets uploaded to builds.lokinet.dev: debian_pipeline("Static (bionic amd64)", "ubuntu:bionic", deps='g++-8 python3-dev', lto=true, diff --git a/contrib/ci/drone-static-upload.sh b/contrib/ci/drone-static-upload.sh index c639e0506..fd609da21 100755 --- a/contrib/ci/drone-static-upload.sh +++ b/contrib/ci/drone-static-upload.sh @@ -29,8 +29,11 @@ else fi mkdir -v "$base" -mv -v daemon/lokinet "$base" -cp -av ../lokinet-bootstrap "$base" +# copy lokinet-bootstrap.ps1 and lokinet.exe if we are a windows build +test -e daemon/lokinet.exe && cp -av daemon/lokinet.exe ../lokinet-bootstrap.ps1 "$base" +# copy lokinet-bootstrap shell script and built binary if we aren't a windows build +test -e daemon/lokinet && cp -av daemon/lokinet ../lokinet-bootstrap "$base" +# tar dat shiz up yo tar cJvf "${base}.tar.xz" "$base" upload_to="builds.lokinet.dev/${DRONE_REPO// /_}/${DRONE_BRANCH// /_}"