Skip to content

Commit

Permalink
Merge pull request #1924 from oxen-io/dev
Browse files Browse the repository at this point in the history
v0.9.9
  • Loading branch information
jagerman committed May 30, 2022
2 parents ad201a4 + 229e127 commit 440b547
Show file tree
Hide file tree
Showing 267 changed files with 4,319 additions and 7,333 deletions.
95 changes: 80 additions & 15 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ local submodules = {
commands: submodule_commands,
};

// cmake options for static deps mirror
local ci_mirror_opts = '-DLOCAL_MIRROR=https://oxen.rocks/deps ';

local apt_get_quiet = 'apt-get -o=Dpkg::Use-Pty=0 -q';

// Regular build on a debian-like system:
Expand All @@ -37,7 +40,7 @@ local debian_pipeline(name,
extra_cmds=[],
jobs=6,
tests=true,
loki_repo=false,
oxen_repo=false,
allow_fail=false) = {
kind: 'pipeline',
type: 'docker',
Expand All @@ -58,7 +61,7 @@ local debian_pipeline(name,
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata',
] + (
if loki_repo then [
if oxen_repo then [
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y lsb-release',
'cp contrib/deb.oxen.io.gpg /etc/apt/trusted.gpg.d',
'echo deb http://deb.oxen.io $$(lsb_release -sc) main >/etc/apt/sources.list.d/oxen.list',
Expand All @@ -72,7 +75,7 @@ local debian_pipeline(name,
'cmake .. -DWITH_SETCAP=OFF -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE=' + build_type + ' ' +
(if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') +
'-DWITH_LTO=' + (if lto then 'ON ' else 'OFF ') +
(if tests then '' else '-DWITH_TESTS=OFF ') +
'-DWITH_TESTS=' + (if tests then 'ON ' else 'OFF ') +
cmake_extra,
'VERBOSE=1 make -j' + jobs,
]
Expand All @@ -98,7 +101,7 @@ local apk_builder(name, image, extra_cmds=[], allow_fail=false, jobs=6) = {
commands: [
'VERBOSE=1 JOBS=' + jobs + ' NDK=/usr/lib/android-ndk ./contrib/android.sh',
'git clone https://github.com/oxen-io/lokinet-flutter-app lokinet-mobile',
'cp -av lokinet-jni-*/* lokinet-mobile/lokinet_lib/android/src/main/jniLibs/',
'cp -av build-android/out/* lokinet-mobile/lokinet_lib/android/src/main/jniLibs/',
'cd lokinet-mobile',
'flutter build apk --debug',
'cd ..',
Expand Down Expand Up @@ -140,14 +143,44 @@ local windows_cross_pipeline(name,
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y build-essential cmake git pkg-config ccache g++-mingw-w64-x86-64-posix nsis zip automake libtool',
'update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix',
'update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix',
'VERBOSE=1 JOBS=' + jobs + ' ./contrib/windows.sh',
'VERBOSE=1 JOBS=' + jobs + ' ./contrib/windows.sh ' + ci_mirror_opts,
] + extra_cmds,
},
],
};

// linux cross compile on debian
local linux_cross_pipeline(name,
cross_targets,
arch='amd64',
build_type='Release',
cmake_extra='',
extra_cmds=[],
jobs=6,
allow_fail=false) = {
kind: 'pipeline',
type: 'docker',
name: name,
platform: { arch: arch },
trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
steps: [
submodules,
{
name: 'build',
image: docker_base + 'debian-stable-cross',
pull: 'always',
[if allow_fail then 'failure']: 'ignore',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' }, CROSS_TARGETS: std.join(':', cross_targets) },
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'VERBOSE=1 JOBS=' + jobs + ' ./contrib/cross.sh ' + std.join(' ', cross_targets) + (if std.length(cmake_extra) > 0 then ' -- ' + cmake_extra else ''),
],
},
],
};

// 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', loki_repo=true) = {
local deb_builder(image, distro, distro_branch, arch='amd64', oxen_repo=true) = {
kind: 'pipeline',
type: 'docker',
name: 'DEB (' + distro + (if arch == 'amd64' then '' else '/' + arch) + ')',
Expand All @@ -164,7 +197,7 @@ local deb_builder(image, distro, distro_branch, arch='amd64', loki_repo=true) =
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
] + (if loki_repo then [
] + (if oxen_repo then [
'cp contrib/deb.oxen.io.gpg /etc/apt/trusted.gpg.d',
'echo deb http://deb.oxen.io $${distro} main >/etc/apt/sources.list.d/oxen.list',
] else []) + [
Expand Down Expand Up @@ -240,7 +273,29 @@ local mac_builder(name,
// basic system headers. WTF apple:
'export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"',
'ulimit -n 1024', // because macos sets ulimit to 256 for some reason yeah idk
'./contrib/mac.sh',
'./contrib/mac.sh ' + ci_mirror_opts,
] + extra_cmds,
},
],
};

local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
kind: 'pipeline',
type: 'docker',
name: name,
platform: { arch: 'amd64' },
trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
steps: [
submodules,
{
name: 'build',
image: image,
pull: 'always',
[if allow_fail then 'failure']: 'ignore',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
commands: [
'cmake -S . -B build-docs',
'make -C build-docs doc',
] + extra_cmds,
},
],
Expand All @@ -265,6 +320,10 @@ local mac_builder(name,
],
}],
},
// documentation builder
docs_pipeline('Documentation',
docker_base + 'docbuilder',
extra_cmds=['UPLOAD_OS=docs ./contrib/ci/drone-static-upload.sh']),

// Various debian builds
debian_pipeline('Debian sid (amd64)', docker_base + 'debian-sid'),
Expand All @@ -279,11 +338,17 @@ local mac_builder(name,
docker_base + 'ubuntu-bionic',
deps=['g++-8'] + default_deps_nocxx,
cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8',
loki_repo=true),
oxen_repo=true),

// ARM builds (ARM64 and armhf)
debian_pipeline('Debian sid (ARM64)', docker_base + 'debian-sid', arch='arm64', jobs=4),
debian_pipeline('Debian stable (armhf)', docker_base + 'debian-stable/arm32v7', arch='arm64', jobs=4),

// cross compile targets
linux_cross_pipeline('Cross Compile (mips)', cross_targets=['mips-linux-gnu', 'mipsel-linux-gnu']),
linux_cross_pipeline('Cross Compile (arm/arm64)', cross_targets=['arm-linux-gnueabihf', 'aarch64-linux-gnu']),
linux_cross_pipeline('Cross Compile (ppc64le)', cross_targets=['powerpc64le-linux-gnu']),

// android apk builder
apk_builder('android apk', docker_base + 'flutter', extra_cmds=['UPLOAD_OS=android ./contrib/ci/drone-static-upload.sh']),

Expand All @@ -301,11 +366,12 @@ local mac_builder(name,
deps=['g++-8', 'python3-dev', 'automake', 'libtool'],
lto=true,
tests=false,
oxen_repo=true,
cmake_extra='-DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON ' +
'-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 ' +
'-DCMAKE_CXX_FLAGS="-march=x86-64 -mtune=haswell" ' +
'-DCMAKE_C_FLAGS="-march=x86-64 -mtune=haswell" ' +
'-DNATIVE_BUILD=OFF -DWITH_SYSTEMD=OFF -DWITH_BOOTSTRAP=OFF',
'-DNATIVE_BUILD=OFF -DWITH_SYSTEMD=OFF -DWITH_BOOTSTRAP=OFF -DBUILD_LIBLOKINET=OFF',
extra_cmds=[
'../contrib/ci/drone-check-static-libs.sh',
'../contrib/ci/drone-static-upload.sh',
Expand All @@ -331,11 +397,10 @@ local mac_builder(name,
cmake_extra='-DWITH_HIVE=ON'),

// Deb builds:
deb_builder(docker_base + 'debian-sid-debhelper', 'sid', 'debian/sid'),
deb_builder(docker_base + 'debian-bullseye-debhelper', 'bullseye', 'debian/bullseye'),
deb_builder(docker_base + 'ubuntu-impish-debhelper', 'impish', 'ubuntu/impish'),
deb_builder(docker_base + 'ubuntu-focal-debhelper', 'focal', 'ubuntu/focal'),
deb_builder(docker_base + 'debian-sid-debhelper', 'sid', 'debian/sid', arch='arm64'),
deb_builder(docker_base + 'debian-sid-builder', 'sid', 'debian/sid'),
deb_builder(docker_base + 'debian-bullseye-builder', 'bullseye', 'debian/bullseye'),
deb_builder(docker_base + 'ubuntu-jammy-builder', 'jammy', 'ubuntu/jammy'),
deb_builder(docker_base + 'debian-sid-builder', 'sid', 'debian/sid', arch='arm64'),

// Macos builds:
mac_builder('macOS (Release)'),
Expand Down
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
path = external/pybind11
url = https://github.com/pybind/pybind11
branch = stable
[submodule "external/clang-format-hooks"]
path = external/clang-format-hooks
url = https://github.com/barisione/clang-format-hooks/
[submodule "external/sqlite_orm"]
path = external/sqlite_orm
url = https://github.com/fnc12/sqlite_orm
Expand All @@ -35,3 +32,7 @@
[submodule "external/ngtcp2"]
path = external/ngtcp2
url = https://github.com/ngtcp2/ngtcp2.git
branch = v0.1.0
[submodule "external/oxen-encoding"]
path = external/oxen-encoding
url = https://github.com/oxen-io/oxen-encoding.git
61 changes: 42 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Has to be set before `project()`, and ignored on non-macos:
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "macOS deployment target (Apple clang only)")

option(BUILD_DAEMON "build lokinet daemon and associated utils" ON)


set(LANGS C CXX)
if(APPLE)
if(APPLE AND BUILD_DAEMON)
set(LANGS ${LANGS} OBJC Swift)
endif()

Expand All @@ -22,7 +25,7 @@ endif()


project(lokinet
VERSION 0.9.8
VERSION 0.9.9
DESCRIPTION "lokinet - IP packet onion router"
LANGUAGES ${LANGS})

Expand All @@ -32,16 +35,15 @@ if(APPLE)
set(LOKINET_APPLE_BUILD 0)
endif()

set(RELEASE_MOTTO "A Series of Tubes" CACHE STRING "Release motto")
set(RELEASE_MOTTO "Gluten Free Edition" CACHE STRING "Release motto")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

add_definitions(-DLLARP_VERSION_MAJOR=${lokinet_VERSION_MAJOR})
add_definitions(-DLLARP_VERSION_MINOR=${lokinet_VERSION_MINOR})
add_definitions(-DLLARP_VERSION_PATCH=${lokinet_VERSION_PATCH})
if(RELEASE_MOTTO AND CMAKE_BUILD_TYPE MATCHES "[Rr][Ee][Ll][Ee][Aa][Ss][Ee]")
add_definitions(-DLLARP_RELEASE_MOTTO="${RELEASE_MOTTO}")
set(DEFAULT_WITH_BOOTSTRAP ON)
if(APPLE)
set(DEFAULT_WITH_BOOTSTRAP OFF)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

# Core options
option(USE_AVX2 "enable avx2 code" OFF)
Expand All @@ -57,12 +59,16 @@ option(WITH_COVERAGE "generate coverage data" OFF)
option(USE_SHELLHOOKS "enable shell hooks on compile time (dangerous)" OFF)
option(WARNINGS_AS_ERRORS "treat all warnings as errors. turn off for development, on for release" OFF)
option(TRACY_ROOT "include tracy profiler source" OFF)
option(WITH_TESTS "build unit tests" ON)
option(WITH_TESTS "build unit tests" OFF)
option(WITH_HIVE "build simulation stubs" OFF)
option(BUILD_PACKAGE "builds extra components for making an installer (with 'make package')" OFF)
option(WITH_BOOTSTRAP "build lokinet-bootstrap tool" ${DEFAULT_WITH_BOOTSTRAP})

include(cmake/enable_lto.cmake)

option(CROSS_PLATFORM "cross compiler platform" "Linux")
option(CROSS_PREFIX "toolchain cross compiler prefix" "")

option(BUILD_STATIC_DEPS "Download, build, and statically link against core dependencies" OFF)
option(STATIC_LINK "link statically against dependencies" ${BUILD_STATIC_DEPS})
if(BUILD_STATIC_DEPS AND NOT STATIC_LINK)
Expand Down Expand Up @@ -95,7 +101,6 @@ include(cmake/target_link_libraries_system.cmake)
include(cmake/add_import_library.cmake)
include(cmake/add_log_tag.cmake)
include(cmake/libatomic.cmake)
include(cmake/link_dep_libs.cmake)

if (STATIC_LINK)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
Expand Down Expand Up @@ -170,19 +175,36 @@ if(NOT TARGET sodium)
export(TARGETS sodium NAMESPACE sodium:: FILE sodium-exports.cmake)
endif()

option(FORCE_OXENC_SUBMODULE "force using oxen-encoding submodule" OFF)
if(NOT FORCE_OXENC_SUBMODULE)
pkg_check_modules(OXENC liboxenc>=1.0.3 IMPORTED_TARGET)
endif()

if(OXENC_FOUND)
if(NOT TARGET PkgConfig::OXENC AND CMAKE_VERSION VERSION_LESS "3.21")
# Work around cmake bug 22180 (PkgConfig::OXENC not set if no flags needed):
add_library(_empty_oxenc INTERFACE)
add_library(oxenc::oxenc ALIAS _empty_oxenc)
else()
add_library(oxenc::oxenc ALIAS PkgConfig::OXENC)
endif()
message(STATUS "Found system liboxenc ${OXENC_VERSION}")
else()
message(STATUS "using oxen-encoding submodule")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/oxen-encoding)
add_library(oxenc::oxenc ALIAS oxenc)
endif()

option(FORCE_OXENMQ_SUBMODULE "force using oxenmq submodule" OFF)
if(NOT FORCE_OXENMQ_SUBMODULE)
pkg_check_modules(OXENMQ liboxenmq>=1.2.4)
pkg_check_modules(OXENMQ liboxenmq>=1.2.12 IMPORTED_TARGET)
endif()
if(OXENMQ_FOUND)
add_library(oxenmq INTERFACE)
link_dep_libs(oxenmq INTERFACE "${OXENMQ_LIBRARY_DIRS}" ${OXENMQ_LIBRARIES})
target_include_directories(oxenmq INTERFACE ${OXENMQ_INCLUDE_DIRS})
add_library(oxenmq::oxenmq ALIAS oxenmq)
add_library(oxenmq::oxenmq ALIAS PkgConfig::OXENMQ)
message(STATUS "Found system liboxenmq ${OXENMQ_VERSION}")
else()
message(STATUS "using oxenmq submodule")
add_subdirectory(${CMAKE_SOURCE_DIR}/external/oxen-mq)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/oxen-mq)
endif()


Expand Down Expand Up @@ -327,8 +349,9 @@ endif()

add_subdirectory(crypto)
add_subdirectory(llarp)
add_subdirectory(daemon)

if(BUILD_DAEMON)
add_subdirectory(daemon)
endif()

if(WITH_HIVE)
add_subdirectory(pybind)
Expand Down
15 changes: 1 addition & 14 deletions LICENSE.txt → LICENSE
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
LokiNET is the reference implementation of LLARP (Low Latency Anonymous
Routing Protocol).

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Copyright (c) 2018-2020 The Loki Project
Copyright (c) 2018-2020 Jeff Becker
Windows NT port and portions Copyright (c) 2018-2020 Rick V.


GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Expand Down Expand Up @@ -684,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
2 changes: 1 addition & 1 deletion cmake/GenVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ else()
endif()
endif()

configure_file("${SRC}" "${DEST}")
configure_file("${SRC}" "${DEST}" @ONLY)
Loading

0 comments on commit 440b547

Please sign in to comment.