diff --git a/.drone.jsonnet b/.drone.jsonnet index 54951b7b6f..436a039eec 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -1,6 +1,6 @@ -local default_deps_base='libsystemd-dev python3-dev libuv1-dev libunbound-dev nettle-dev libssl-dev libevent-dev libsqlite3-dev libcurl4-openssl-dev'; +local default_deps_base='libsystemd-dev python3-dev libuv1-dev libunbound-dev nettle-dev libssl-dev libevent-dev libsqlite3-dev libcurl4-openssl-dev make'; 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_deps='g++ ' + default_deps_nocxx; local default_windows_deps='mingw-w64 zip nsis'; local docker_base = 'registry.oxen.rocks/lokinet-ci-'; @@ -49,20 +49,20 @@ local debian_pipeline(name, image, ] else [] ) + [ 'eatmydata ' + apt_get_quiet + ' dist-upgrade -y', - 'eatmydata ' + apt_get_quiet + ' install -y gdb cmake git ninja-build pkg-config ccache ' + deps, + 'eatmydata ' + apt_get_quiet + ' install -y gdb cmake git pkg-config ccache ' + deps, 'mkdir build', 'cd build', - 'cmake .. -G Ninja -DWITH_SETCAP=OFF -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE='+build_type+' ' + + '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 ') + cmake_extra, - 'ninja -j' + jobs + ' -v', + 'VERBOSE=1 make -j' + jobs, '../contrib/ci/drone-gdb.sh ./test/testAll --use-colour yes', ] + extra_cmds, } ], }; -local apk_builder(name, image, extra_cmds=[], allow_fail=false) = { +local apk_builder(name, image, extra_cmds=[], allow_fail=false, jobs=6) = { kind: 'pipeline', type: 'docker', name: name, @@ -76,11 +76,7 @@ local apk_builder(name, image, extra_cmds=[], allow_fail=false) = { [if allow_fail then "failure"]: "ignore", environment: { SSH_KEY: { from_secret: "SSH_KEY" }, ANDROID: "android" }, commands: [ - "cd android", - "rm -f local.properties", - "echo 'sdk.dir=/usr/lib/android-sdk' >> local.properties", - "echo 'ndk.dir=/usr/lib/android-ndk' >> local.properties", - "GRADLE_USER_HOME=/cache/gradle/${DRONE_STAGE_MACHINE} gradle --no-daemon assembleDebug", + 'VERBOSE=1 JOBS='+jobs+' NDK=/usr/lib/android-ndk ./contrib/android.sh' ] + extra_cmds } ] @@ -113,17 +109,10 @@ local windows_cross_pipeline(name, image, 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections', apt_get_quiet + ' update', apt_get_quiet + ' install -y eatmydata', - 'eatmydata ' + apt_get_quiet + ' install -y build-essential cmake git ninja-build pkg-config ccache g++-mingw-w64-x86-64-posix nsis zip automake libtool', + 'eatmydata ' + apt_get_quiet + ' install -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', - 'mkdir build', - 'cd build', - 'cmake .. -G Ninja -DCMAKE_EXE_LINKER_FLAGS=-fstack-protector -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw'+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=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON" + - cmake_extra, - 'ninja -j' + jobs + ' -v package', + 'VERBOSE=1 JOBS=' + jobs + ' ./contrib/windows.sh' ] + extra_cmds, } ], @@ -204,9 +193,9 @@ local mac_builder(name, 'ulimit -n 1024', // because macos sets ulimit to 256 for some reason yeah idk 'mkdir build', 'cd build', - 'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fcolor-diagnostics -DCMAKE_BUILD_TYPE='+build_type+' ' + + 'cmake .. -DCMAKE_CXX_FLAGS=-fcolor-diagnostics -DCMAKE_BUILD_TYPE='+build_type+' ' + (if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') + cmake_extra, - 'ninja -j' + jobs + ' -v', + 'VERBOSE=1 make -j' + jobs, './test/testAll --use-colour yes', ] + extra_cmds, } @@ -254,12 +243,12 @@ local mac_builder(name, ], jobs=4), // android apk builder - apk_builder("android apk", "registry.oxen.rocks/lokinet-ci-android", extra_cmds=['UPLOAD_OS=anrdoid ../contrib/ci/drone-static-upload.sh']), - + apk_builder("android apk", "registry.oxen.rocks/lokinet-ci-android", extra_cmds=['UPLOAD_OS=android ./contrib/ci/drone-static-upload.sh']), + // Windows builds (x64) windows_cross_pipeline("Windows (amd64)", docker_base+'debian-win32-cross', toolchain='64', extra_cmds=[ - '../contrib/ci/drone-static-upload.sh' + './contrib/ci/drone-static-upload.sh' ]), // Static build (on bionic) which gets uploaded to builds.lokinet.dev: diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ff002b260..ea26515914 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ if(CCACHE_PROGRAM) endif() project(lokinet - VERSION 0.9.3 + VERSION 0.9.4 DESCRIPTION "lokinet - IP packet onion router" LANGUAGES C CXX) @@ -67,6 +67,11 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo) endif() +if(BUILD_STATIC_DEPS AND STATIC_LINK) + message(STATUS "we are building static deps so we won't build shared libs") + set(BUILD_SHARED_LIBS OFF) +endif() + include(CheckCXXSourceCompiles) include(CheckLibraryExists) set(CMAKE_CXX_STANDARD 17) diff --git a/android/.gitignore b/android/.gitignore deleted file mode 100644 index b8e7e769af..0000000000 --- a/android/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -gen -tests -bin -libs -log* -obj -.gradle -.idea -.externalNativeBuild -ant.properties -local.properties -build.sh -android.iml -build -gradle -gradlew -gradlew.bat -gradle.properties \ No newline at end of file diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml deleted file mode 100755 index 082852b42e..0000000000 --- a/android/AndroidManifest.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index 3fd2265396..0000000000 --- a/android/build.gradle +++ /dev/null @@ -1,81 +0,0 @@ -buildscript { - repositories { - mavenCentral() - jcenter() - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:4.0.1' - } -} - -apply plugin: 'com.android.application' - - -repositories { - jcenter() - maven { - url 'https://maven.google.com' - } - google() -} - -android { - compileSdkVersion 28 - defaultConfig { - applicationId "network.loki.lokinet" - targetSdkVersion 28 - minSdkVersion 23 - versionCode 1 - versionName '0.8.4' - externalNativeBuild { - cmake { - targets "lokinet-android" - arguments "-DWITH_LTO=OFF", "-DCXXOPTS_BUILD_TESTS=OFF","-DWITH_TESTS=OFF", "-DCMAKE_CROSSCOMPILING=ON", "-DNATIVE_BUILD=OFF", "-DANDROID=ON", "-DANDROID_STL=c++_static", "-DBUILD_STATIC_DEPS=ON", "-DBUILD_SHARED_LIBS=OFF", "-DSTATIC_LINK=ON", "-DANDROID_ARM_MODE=arm", "-DFORCE_OXENMQ_SUBMODULE=ON", "-DBUILD_LIBLOKINET=OFF" - cppFlags "-std=c++17" - abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' - // abiFilters 'armeabi-v7a' - // abiFilters 'arm64-v8a', 'x86_64', 'armeabi-v7a' - } - } - - - } - externalNativeBuild { - cmake { - path "../CMakeLists.txt" - } - } - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['src'] - res.srcDirs = ['res'] - jniLibs.srcDirs = ['libs'] - assets.srcDirs = ['assets'] - } - } - signingConfigs { - jeff { - storeFile file("jeff-apk.jks") - keyAlias "jeff-apk" - } - } - buildTypes { - release { - minifyEnabled true - //signingConfig signingConfigs.jeff - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt' - debuggable false - } - debug { - // jniDebuggable true - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - - diff --git a/android/build.xml b/android/build.xml deleted file mode 100644 index ffe9081c87..0000000000 --- a/android/build.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android/proguard-project.txt b/android/proguard-project.txt deleted file mode 100644 index f2fe1559a2..0000000000 --- a/android/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/android/project.properties b/android/project.properties deleted file mode 100644 index 919ca9c3b2..0000000000 --- a/android/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-28 diff --git a/android/readme.md b/android/readme.md deleted file mode 100644 index 647032dead..0000000000 --- a/android/readme.md +++ /dev/null @@ -1,33 +0,0 @@ -# lokinet android - -this directory contains basic stuff for lokinet on android. - -## Prerequsites - -To build you need the following: - -* Gradle (6.x) -* Android SDK (latest version) -* Android NDK (latest version) - -## Building - -Next set up the path to Android SDK and NDK in `local.properties` - -``` -sdk.dir=/path/to/android/sdk -ndk.dir=/path/to/android/ndk -``` - -Then build: - - $ gradle assemble - -This fetches a large amount (several dozen Gigabytes) of files from some -server somewhere dumping it on your filesystem to make the thing do the -building, then proceeds to peg all your cores for several dozen minutes -while it does the required incantations to build 2 apks. - -The build outputs apks to to subdirectories in `build/outputs/apk/` -one called `debug` for debug builds and one called `release` for release builds. - diff --git a/android/res/drawable/icon.png b/android/res/drawable/icon.png deleted file mode 100644 index 30ad9ddcb1..0000000000 Binary files a/android/res/drawable/icon.png and /dev/null differ diff --git a/android/res/layout/activity_perms_asker.xml b/android/res/layout/activity_perms_asker.xml deleted file mode 100644 index 4afe5c037a..0000000000 --- a/android/res/layout/activity_perms_asker.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - -