mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
Merge pull request #1278 from despair86/dev
fix win32 build rules and add to drone ci
This commit is contained in:
commit
36bb43d14a
12 changed files with 113 additions and 14 deletions
|
@ -50,6 +50,80 @@ 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,
|
||||
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/mingw64.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,
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
// Builds a snapshot .deb on a debian-like system by merging into the debian/* or ubuntu/* branch
|
||||
local deb_builder(image, distro, distro_branch, arch='amd64', imaginary_repo=false) = {
|
||||
kind: 'pipeline',
|
||||
|
@ -154,6 +228,10 @@ local mac_builder(name, build_type='Release', werror=true, cmake_extra='', extra
|
|||
cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 -DDOWNLOAD_SODIUM=ON'),
|
||||
debian_pipeline("Debian sid (ARM64)", "debian:sid", arch="arm64"),
|
||||
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="-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="-DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON", lto=false),
|
||||
|
||||
// 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,
|
||||
|
|
|
@ -255,7 +255,9 @@ if(SUBMODULE_CHECK)
|
|||
check_submodule(external/ghc-filesystem)
|
||||
check_submodule(external/date)
|
||||
check_submodule(external/pybind11)
|
||||
check_submodule(external/libuv)
|
||||
if (NOT WIN32) # we grab libuv for windows separately in win32-setup/libuv. see note in cmake/win32.cmake.
|
||||
check_submodule(external/libuv)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -263,7 +265,12 @@ endif()
|
|||
# down loads a broken PythonInterp that loads Python2, but Python2 headers are not C++17 compatible.
|
||||
# So load this here universally so that pybind's more intelligent python finder finds python3.x
|
||||
# (which the crappier loader invoked below then respects).
|
||||
add_subdirectory(external/pybind11 EXCLUDE_FROM_ALL)
|
||||
# however! travis is FUBAR right now so disable it in travis builds
|
||||
if(TRAVIS_CI_SUCKS OR NOT WITH_HIVE)
|
||||
message(WARNING "you're on travis (which is broken garbage) or are compiling without routerhive, we have disabled pybind11, THANKS!")
|
||||
else()
|
||||
add_subdirectory(external/pybind11 EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
if(WITH_TESTS)
|
||||
add_subdirectory(external/googletest EXCLUDE_FROM_ALL)
|
||||
|
|
|
@ -37,6 +37,7 @@ ExternalProject_Add(libsodium_external
|
|||
URL ${LIBSODIUM_URL}
|
||||
URL_HASH ${LIBSODIUM_HASH}
|
||||
CONFIGURE_COMMAND ${SODIUM_CONFIGURE}
|
||||
PATCH_COMMAND patch -p1 -d <SOURCE_DIR> < ${CMAKE_SOURCE_DIR}/win32-setup/libsodium-1.0.18-win32.patch
|
||||
BUILD_COMMAND make -j${PROCESSOR_COUNT}
|
||||
INSTALL_COMMAND ${MAKE}
|
||||
BUILD_BYPRODUCTS ${LIBSODIUM_PREFIX}/lib/libsodium.a ${LIBSODIUM_PREFIX}/include
|
||||
|
|
|
@ -28,8 +28,21 @@ if (NOT STATIC_LINK AND NOT MSVC)
|
|||
message("for release builds, turn on STATIC_LINK in cmake options")
|
||||
endif()
|
||||
|
||||
# win32 is the last platform for which we grab libuv manually
|
||||
# if you want to use the included submodule do
|
||||
# cmake .. -G Ninja -DLIBUV_ROOT=../external/libuv.
|
||||
# otherwise grab mine (github.com/despair86/libuv.git) if you need to run on older hardware
|
||||
# and clone to win32-setup/libuv
|
||||
# then
|
||||
# cmake .. -G Ninja -DLIBUV_ROOT=../win32-setup/libuv
|
||||
# it is literally upward compatible with current windows 10
|
||||
if (STATIC_LINK)
|
||||
set(LIBUV_USE_STATIC ON)
|
||||
if (WOW64_CROSS_COMPILE)
|
||||
link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--large-address-aware,--dynamicbase,--pic-executable,-e,_mainCRTStartup,--subsystem,console:5.00 )
|
||||
else()
|
||||
link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--dynamicbase,--pic-executable,-e,mainCRTStartup )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBUV_ROOT)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(TOOLCHAIN_PREFIX i686-w64-mingw32)
|
||||
set(TOOLCHAIN_SUFFIX "-posix")
|
||||
set(WOW64_CROSS_COMPILE ON)
|
||||
set(LIBSODIUM_CROSS_TARGET i686-w64-mingw32)
|
||||
set(CROSS_TARGET i686-w64-mingw32)
|
||||
|
||||
set(TOOLCHAIN_PATHS
|
||||
/usr/${TOOLCHAIN_PREFIX}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
|
||||
set(TOOLCHAIN_SUFFIX "-posix")
|
||||
set(WIN64_CROSS_COMPILE ON)
|
||||
set(LIBSODIUM_CROSS_TARGET x86_64-w64-mingw32)
|
||||
set(CROSS_TARGET x86_64-w64-mingw32)
|
||||
|
||||
set(TOOLCHAIN_PATHS
|
||||
/usr/${TOOLCHAIN_PREFIX}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace llarp
|
|||
#else
|
||||
const fs::path homedir = getenv("HOME");
|
||||
#endif
|
||||
return homedir / ".lokinet/";
|
||||
return homedir / ".lokinet";
|
||||
}
|
||||
|
||||
inline fs::path
|
||||
|
|
|
@ -116,7 +116,6 @@ win32_tun_io::flush_write()
|
|||
void
|
||||
win32_tun_io::read(byte_t* buf, size_t sz)
|
||||
{
|
||||
DWORD code;
|
||||
asio_evt_pkt* pkt = new asio_evt_pkt;
|
||||
pkt->buf = buf;
|
||||
memset(&pkt->pkt, '\0', sizeof(OVERLAPPED));
|
||||
|
|
|
@ -36,7 +36,6 @@ namespace llarp
|
|||
struct udp_listener : public ev_io
|
||||
{
|
||||
llarp_udp_io* udp;
|
||||
llarp_pkt_list m_RecvPackets;
|
||||
|
||||
udp_listener(int fd, llarp_udp_io* u) : ev_io(fd), udp(u){};
|
||||
|
||||
|
@ -44,9 +43,6 @@ namespace llarp
|
|||
{
|
||||
}
|
||||
|
||||
bool
|
||||
RecvMany(llarp_pkt_list*);
|
||||
|
||||
bool
|
||||
tick();
|
||||
|
||||
|
|
|
@ -70,7 +70,9 @@ typedef struct ip_hdr
|
|||
#define ihl ip_header_len
|
||||
#define protocol ip_protocol
|
||||
#define frag_off ip_frag_offset
|
||||
|
||||
#define tos ip_tos
|
||||
#define ttl ip_ttl
|
||||
#define tot_len ip_total_length
|
||||
#endif
|
||||
|
||||
struct ipv6_header
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace llarp
|
|||
EndpointState::Configure(const NetworkConfig& conf)
|
||||
{
|
||||
if (conf.m_keyfile.has_value())
|
||||
m_Keyfile = *conf.m_keyfile;
|
||||
m_Keyfile = conf.m_keyfile->string();
|
||||
m_SnodeBlacklist = conf.m_snodeBlacklist;
|
||||
m_ExitEnabled = conf.m_AllowExit;
|
||||
m_ExitNode = conf.m_exitNode;
|
||||
|
|
|
@ -28,7 +28,12 @@ namespace llarp
|
|||
{
|
||||
/// aligned buffer that is sz bytes long and aligns to the nearest Alignment
|
||||
template <size_t sz>
|
||||
// Microsoft C malloc(3C) cannot return pointers aligned wider than 8 ffs
|
||||
#ifdef _WIN32
|
||||
struct alignas(uint64_t) AlignedBuffer
|
||||
#else
|
||||
struct alignas(std::max_align_t) AlignedBuffer
|
||||
#endif
|
||||
{
|
||||
static_assert(alignof(std::max_align_t) <= 16, "insane alignment");
|
||||
static_assert(
|
||||
|
|
Loading…
Reference in a new issue