Commit Graph

295 Commits

Author SHA1 Message Date
Jason Rhinelander
cdd57ac09b fix unbound ssl linking 2020-06-16 21:18:13 -03:00
Thomas Winget
0ecdf60777 static build fixes in cmake stuff
I hate cmake so much.
2020-06-16 18:52:20 -04:00
Linux User
e6bcbf47b4
patch libsodium for windows the cmake way 2020-06-12 15:19:11 -05:00
Rick V
adf253e800
picflags differ slightly on native vs wow64 builds 2020-06-12 15:19:10 -05:00
Rick V
45890133bc
LIBUV_ROOT override for win32
emit PIC code (.reloc) on win32 for aslr
2020-06-12 15:18:57 -05:00
Jason Rhinelander
83fc7de237 Get processor count properly 2020-06-10 14:53:57 -03:00
Jeff Becker
fbb7c0d6f9
add forgotten file 2020-05-23 16:07:20 -04:00
Jeff Becker
6af498092b
exit traffic via loki addresses 2020-05-23 16:07:19 -04:00
Jason Rhinelander
a484ccffc2 static curl build fixes
- fix ldap disabling flag
- disable a ton of protocols (include ldap, properly)
- remove INSTALL_COMMAND (the default seems to work fine)
- disable --quiet so we can see the configuration summary
2020-05-23 14:02:04 -03:00
Jason Rhinelander
7d5a99d820
Merge pull request #1284 from majestrate/toggle-lto-2020-05-20
add WITH_LTO option to disble lto on compile time
2020-05-20 20:45:36 -03:00
Jeff Becker
a6d17dcd16
add WITH_LTO option to disble lto on compile time 2020-05-20 19:29:49 -04:00
Jason Rhinelander
ebd2142114 Don't use std::optional::value() because f u macos
This replaces all use of std::optional's `opt.value()` with `*opt`
because macOS is great and the ghost of Steve Jobs says that actually
supporting std::optional's value() method is not for chumps before macOS
10.14.  So don't use it because Apple is great.

Pretty much all of our use of it actually is done better with operator*
anyway (since operator* doesn't do a check that the optional has a
value).

Also replaced *most* of the `has_value()` calls with direct bool
context, except for one in the config section which looked really
confusing at a glance without a has_value().
2020-05-20 19:18:28 -03:00
Jason Rhinelander
be9ddf2ae1 Bring back ghc::filesystem for broke AF macos
macOS doesn't provide `<filesystem>` support when targetting anything
earlier than 10.15.
2020-05-20 19:18:27 -03:00
Jason Rhinelander
b4fce0e3ee curl: use ccache; disabled lots of other crap
brotli and libpsl both got autodetected on my system, so explicitly
disable them (and a bunch of other crap from --configure).

Build with ccache.
2020-05-17 23:31:41 -03:00
Jason Rhinelander
fa794e64cd Build libsodium with ccache and fPIC
fPIC is needed in case we are building a shared liblokinet (within which
we want the static libsodium).
2020-05-17 23:31:41 -03:00
Jason Rhinelander
c5faa86926 cmake refactor
Refactors many things in cmake to improve and simplify:

- don't use variable indirection for target names; target names are
*already* a variable of sorts.  (e.g. ${UTIL_LIB} is now just
lokinet-util).  cmake/basic_definitions.cmake is now gone.

- fix LTO enabling to use the standard cmake (3.9+) LTO mechanism rather
than shoving a bunch of flag hacks through link_libraries and
add_compile_options.  This also now enables LTO when building a shared
library (because previously the -flto hacks were only turned on in the
static code for some reason).

- build liblokinet as *either* shared library or static library, but not
both.  Building both makes things more complicated because they had
different names (lokinet-shared or lokinet-static) and seems pointless:
you generally want one or the other.  Now there is just the liblokinet
target, which will be shared or static depending on the value of
BUILD_SHARED_LIBS.

- Simplify lokinet-cryptography AVX2 code: just build *one* library, and
add in the additional AVX2 files when possible, rather than building two
and needing to merge them.

- Compress STATIC_LINK and STATIC_LINK_RUNTIME into just STATIC_LINK.
It makes no sense to use one of these (_RUNTIME) on Windows and the
other on non-Windows when they appear to try to do the same thing.

- remove a bunch of annotations from `endif(FOO)` -> `endif()`.

- move all the tuntap compilation code (including OS-specific source
file selection) into vendor/CMakeLists.txt and build tuntap as an
intermediate OBJECT library rather than keeping a global variable in 5
different files.

- move release motto define to root cmake; it made no sense being
duplicated in both unix.cmake and win32.cmake

- fix add_log_tag to not stomp on any existing source compile flags with
its definition.  Also use proper compile definition property instead of
cramming it into compile flags.

- make optimization/linker flags less hacky.  There's no reason for us
to force particular optimization flags because the cmake build type
already does that (e.g. -DCMAKE_BUILD_TYPE=Release does -O3).  Not doing
that also silences a bunch of cmake warnings because it thinks "-O0 -g3"
etc.  are link libraries (which is reasonable: that's what the code was
telling cmake they are).

- sets the default build type to RelWithDebInfo which gives us `-O2 -g`
if you don't specify a build type.

- Move PIC up (so that the things loaded in unix.cmake, notably libuv,
have it set).

- Add a custom `curl` interface library that carries the correct link
target and include paths for curl (system or bundled).
2020-05-17 23:31:23 -03:00
Jeff Becker
64157d5d44 track libcurl and libuv with cmake, add libuv submodule 2020-05-17 14:53:28 -03:00
Jeff Becker
abc1f67430
check for std::optional as macos can be broke af sometimes 2020-05-15 09:40:24 -04:00
Jeff Becker
5a24d2deef
add check for std::filesystem 2020-05-15 09:32:24 -04:00
cathugger
0bb43d98c7
fix GenVersion.cmake
* rev-parse --short without any argument defaults to 8 chars
* truncation is absolutely moot here
* rev-list --abbrev-commit also uses 8 chars by default

because of length mismatch (COMMIT - 9 chars, TAGGEDCOMMIT - 8 chars) it always was mismatching them even when it should've been detecting that it's at release tag.
cut out explicit lengths and leave everything to use defaults, because they work (they both rely on the same core.abbrev setting so no length mismatch should happen).
2020-05-06 14:26:15 +00:00
Jason Rhinelander
1697bf90fe C++17
Compiles with C++17, replaces ghc::filesystem with std::filesystem,
nonstd::optional with std::optional, and llarp::string_view with
std::string_view.
2020-05-01 17:43:27 -03:00
Jeff Becker
783e72da73
fix ci for win32 2020-04-22 12:55:05 -04:00
Stephen Shelton
67f023cf8a
Use install(PROGRAMS... instead of isntall(FILES... 2020-04-21 17:37:10 -06:00
Jason Rhinelander
3048ccf3f8 Set -mmacosx-version-min the cmake way 2020-04-21 20:01:24 -03:00
Jeff
edc0d1a3ed
Merge pull request #1225 from majestrate/macos-cpack-setup-and-bootstrap-2020-04-10
macos cpack installer infra
2020-04-21 14:50:16 -04:00
Stephen Shelton
0b1c57f650 Include macos uninstall script 2020-04-21 00:28:27 -03:00
Jason Rhinelander
9f208d2b6c Pass CMAKE_PREFIX_PATH through to lokinet-gui
Needed to build against the right Qt
2020-04-20 21:51:01 -03:00
Rick V
96fc3cdd55
fix pybind 2020-04-20 19:09:21 -05:00
Jason Rhinelander
216b807cb3 Notarize has an "a" in it 2020-04-20 00:28:32 -03:00
Jason Rhinelander
8d74407d11 codesigning and notarization
Codesigns and notarizes the package.  Requires a bunch of stuff to
actually get this working.  (see contrib/macos-signing.txt).

I'm currently also building with

    -DLOKINET_GUI_REPO=https://github.com/jagerman/loki-network-control-panel.git -DLOKINET_GUI_CHECKOUT=cmake

because it needs the camke-ification PR for the control panel to
properly sign everything there.
2020-04-19 23:18:48 -03:00
Jason Rhinelander
0032f1fdde Add simple installer readme 2020-04-19 23:18:48 -03:00
Jason Rhinelander
daf0174e53 Change mac install prefix to /opt/lokinet
/usr/local is probably going to get stomped on by homebrew.
2020-04-19 23:18:48 -03:00
Jason Rhinelander
93311fbc99 Build lokinet-gui with ExternalProject
Also installs it without the extra hack by specifying ../../Applications
for the destination.  (This definitely feels kind of nasty, but it works).
2020-04-19 23:16:23 -03:00
Jason Rhinelander
3dd3d48fbb Consolidate cmake vars & definitions
CMake will set version variables itself if you give the version in the
project(), which is cleaner.  Also removes some (nearly) duplicate
definitions and settings added in basic_definitions.cmake for unknown
reasons.

Removes some redundant settings (name, description, version) from the
cpack settings which already default to the values from the project()
call.
2020-04-19 23:16:23 -03:00
Stephen Shelton
c20d5b186d Bundle gui in mac installer 2020-04-19 23:16:23 -03:00
Stephen Shelton
dd3121d8ac MacOS installer / runtime nonsense 2020-04-19 23:16:23 -03:00
Jeff Becker
31f74b5ffb macos post install script that bootstraps, generates configs and registers plist 2020-04-19 23:16:23 -03:00
Jeff Becker
c36b6a409c
move version to cmake so docs can access it 2020-04-07 13:16:22 -04:00
Jeff Becker
3e7acb72e1
more docs, make doxygen work 2020-04-07 13:16:22 -04:00
Jeff Becker
7455a1956d
make apple builds build for older versions and embrace the bitrot 2020-04-06 08:44:35 -04:00
Jeff Becker
9428689939
fix up cpack for macos 2020-04-03 10:14:19 -04:00
Jeff Becker
aae260fbea
more macos installer bits 2020-04-02 11:53:14 -04:00
Jeff Becker
3b26b8b24d
make gitlab pump out 32 bit installers, no lto for builds as that is cursed for now. 2020-04-02 11:08:08 -04:00
Jeff Becker
9e696e131e
make installer pull in tuntap driver 2020-04-02 11:08:07 -04:00
Jeff Becker
f335aaa847
set license 2020-04-02 11:08:07 -04:00
Jeff Becker
2190da8c81
cpack win32 2020-04-02 11:08:07 -04:00
Jason Rhinelander
3b0927ce13
Merge pull request #1140 from despair86/cmake-cleanup
some light cmake cleanup for win32
2020-03-04 11:44:10 -04:00
Rick V
3ca50b3619
missing branch on option 2020-03-03 15:33:12 -06:00
Rick V
d22af469a4
some win32 cmake cleanup
also removes MSVC rules (we don't support MSVC)
2020-03-03 15:33:11 -06:00
Rick V
dbc559d4ff
finally fix cross-LTO on windows builds 2020-03-03 15:33:10 -06:00
Rick V
4cd7a22ca3
fix libsodium cross compile 2020-03-03 15:33:04 -06:00
Jeff Becker
0a6c91b26c
operator presidence 2020-03-03 06:54:21 -05:00
Jeff Becker
d44a96769a
allow building from source tarballs 2020-03-03 06:54:21 -05:00
despair
8a27e3972d
we need XPG7 on netbsd 2020-02-25 15:48:53 -06:00
Jason Rhinelander
7ab6220a41 Older cmake workaround 2020-02-06 17:13:57 -04:00
Jason Rhinelander
5a4700d868 Use ExternalProject to build downloaded libsodium 2020-02-06 16:27:51 -04:00
Jason Rhinelander
73239f4c39 Use glob to find sodium source files
Manually changing the list every time we want to change the libsodium
version is painful.

I tested this glob against libsodium 1.0.17 and verified it produces the
same set of files (aside from the generated version.h), and that in
1.0.18 it produces the same set modulo upstream files removed/added.
2020-02-02 22:12:29 -04:00
Jason Rhinelander
b72a4296b7 Fix libsodium 1.0.18 URL 2020-02-02 21:37:09 -04:00
Jason Rhinelander
2b93ccb393 Bump libsodium required version to 1.0.18
We use crypto_core_ed25519_scalar_mul which is only exported by
libsodium >= 1.0.18.
2020-02-02 16:38:48 -04:00
Jeff Becker
da5eb913e9
use proper cmake call 2020-01-07 18:14:26 -05:00
Jeff Becker
fde0ca374f
i hate curl 2020-01-07 18:14:25 -05:00
Jeff Becker
336a748695
make it build in normal mode too 2020-01-07 18:14:25 -05:00
Jeff Becker
80cbddde7b
fixups for review 2020-01-07 18:14:25 -05:00
Jeff Becker
2ce592e4af
static link with docs 2020-01-07 18:14:25 -05:00
Ryan Tharp
20ce679c3a macos release needs the include path 2019-12-23 07:15:51 +00:00
Ryan Tharp
b21b0b49d0 support LIBCURL_ROOT, disable LIBUV includes 2019-12-23 06:55:02 +00:00
Ryan Tharp
6001215a23 bring in all updates from STATIC_RUNTIME 2019-12-23 06:55:02 +00:00
Rick V
a62a75d640
nit 2019-12-16 12:11:07 -06:00
Rick V
9fa9209114
don't be aggressive
remove libcurl packaging rules. We still build it, but ship only the curl.exe
2019-12-16 11:28:47 -06:00
Rick V
d1b9b89812
add note
add libuv build

add its dependent libraries to the final link line
2019-12-16 11:28:46 -06:00
Rick V
6d49ffd60b
include all platform dependencies transitively 2019-12-16 11:28:46 -06:00
Jeff Becker
ab183665ab
freebsd fix 2019-12-16 09:02:39 -05:00
Stephen Shelton
332f33b049 Remove FS_LIB conditionals 2019-12-12 12:58:46 -07:00
Stephen Shelton
5ce260fce1 Use vendored fs::filesystem on all platforms 2019-12-12 12:29:03 -07:00
Jason Rhinelander
638fb25b47 Put version info into a compiled file
This rewrites the version info using lokid's approach of compiling it
into a .cpp file that gets generated as part of the build (*not* during
the configure stage).

Among other things, this means that changing the version no longer
invalidates ccache or cmake dependencies, and because it depends on
`.git/index` git commits will cause the version to be regenerated,
making the commit tag more reliable (currently if you rebuild without
running cmake your git commit tag doesn't update).
2019-12-11 22:40:07 -04:00
Jeff Becker
abf9544ddc
make libuv on win32 work 2019-12-11 16:05:40 -05:00
Jason Rhinelander
8d2c22fc72 Replace cppbackport with ghc-filesystem
From https://github.com/gulrak/filesystem which is more up-to-date and
looks better maintained than cppbackport.
2019-12-06 20:41:22 -04:00
Jeff Becker
8bac293dc7
fix patching command 2019-11-05 08:09:17 -05:00
Jeff Becker
01dbd329bd
add forgotten file 2019-11-05 06:52:40 -05:00
Jeff Becker
25c820f166
add compile time override for libsodium tarball url using -DSODIUM_TARBALL_URL=https://whatever/tarball.tar.gz 2019-11-01 11:05:09 -04:00
Rick V
c63d0b5be2
add cmake rule to patch libsodium on windows
# Conflicts:
#	crypto/CMakeLists.txt
2019-10-31 17:08:34 -05:00
Jason Rhinelander
ac3cd441ac Fix download hash verification & version string
Fix hash verification in downloaded libsodium package.

Fix @VERSION@ expansion in sodium/version.h (but don't set it globally
because VERSION is far too generic a variable to be leaving set).
2019-10-31 18:01:36 -03:00
Jason Rhinelander
57ccb1fd5c Move sodium download into separate cmake include 2019-10-31 17:49:08 -03:00
Rick V
9b9ea6e6d0
make that a universal rule 2019-10-30 18:02:32 -05:00
Rick V
b473f17231
lto not supported for cross compile targets 2019-10-30 18:02:30 -05:00
Rick V
c00b083be7
grab everything and the kitchen sink at build time instead
will finish testing this once the new release is stable
2019-10-30 18:02:29 -05:00
Rick V
b2c23f2c71
a. GCC LTO requires specifiying CXXFLAGS in LDFLAGS
b. not my fault your machine doesn't link pthread properly
2019-10-30 18:02:29 -05:00
Jason Rhinelander
0774213e87 Fix cmake sodium version check 2019-10-30 13:25:23 -03:00
Jeff Becker
e0a9059d8c
use PACKAGE_FIND_VERFSION 2019-10-29 13:42:34 -04:00
Jeff Becker
7fbb8e25bb
set version in FindLibsodium.cmake 2019-10-29 13:14:29 -04:00
Jeff Becker
f38240f945
devendor libsodium by default except for android 2019-10-29 12:01:58 -04:00
Stephen Shelton
961c8dbddf Prevent in-source-builds with cmake macro 2019-10-24 13:21:45 -06:00
Michael
77b4efd78b
fixup ios 2019-10-07 00:52:04 +01:00
Jeff
8f46a62aa6
Merge pull request #847 from michael-loki/ios_wip
Distinct ios build
2019-09-30 15:00:17 -04:00
Jeff
0aab04d1b2
Merge pull request #843 from michael-loki/fix_static_link
Fix static link with gcc
2019-09-30 07:54:30 -04:00
Michael
fadedb4a7b
Distinct ios build 2019-09-30 09:59:34 +01:00
Michael
a5858c770f
Fix static link with gcc 2019-09-24 09:29:11 +00:00
Rick V
94e9305d54
fix static build 2019-09-23 21:22:31 -05:00
Jeff
35230adbe5
Merge pull request #833 from majestrate/gut-utp-2019-09-19
remove libutp and all such code related to utp
2019-09-19 16:48:36 -04:00
jeff
1853b28590 remove libutp and all such code related to utp 2019-09-19 11:36:05 -04:00
Michael
6719a1790c
Statically link releases 2019-09-18 21:33:08 +01:00
Rick V
5ecc76a332
if cppbackport is built, make that consistent too 2019-09-03 08:02:32 -05:00
Rick V
89f92d3aed
new cmake module 2019-09-03 08:02:32 -05:00
Rick V
4246caf8a1
add build option for constrained node ops and make sure everything is now target-optimised in all configurations (allows debugging on the target using the debug build config)
link libatomic if we're targeting 486

link libatomic.a if we're targeting windows

idk what the hell MSVC does for -arch:IA32

we already set the c++14 flag early on

strip target selection flags from MSVC builds and clang-cl

c++14 does not propagate to compile tests
2019-09-03 08:02:04 -05:00
Rick V
b3a975ff8e
sun fix
fix testing on sun
2019-08-27 06:53:08 -05:00
Jeff
e7796a7ba4
Merge pull request #784 from michael-loki/shadow_fixes
Partial fixes for shadow
2019-08-26 20:42:15 -04:00
Michael
7d39f84ef3
Partial fixes for shadow 2019-08-26 23:10:48 +00:00
Rick V
3f6f636bbf
reeeee 2019-08-26 03:32:32 -05:00
Jeff
d8e4f5e6fc
Merge pull request #779 from michael-loki/find_libatomic
Find libatomic via cmake magics
2019-08-19 07:37:58 -04:00
Michael
e7c48e57e9
Fix on compilers which aren't C++11 by default 2019-08-18 22:54:33 +00:00
Michael
7dfbb41e0d
Find libatomic fix cmake magics 2019-08-17 13:20:16 +01:00
Michael
429284aedc
Fix static linking on macOS 2019-08-17 12:33:07 +01:00
Michael
6e5cab971f
make windows fixes 2019-08-13 10:02:48 +01:00
Michael
16cdfbd5f0
clang-tidy modernize pass 2019-08-12 16:52:58 +01:00
Rick V
c5aaefa7e7
this is getting hairy 2019-08-01 22:53:22 -05:00
Rick V
54d4932d74
why isn't cmake picking this up 2019-08-01 22:45:46 -05:00
Rick V
609a9a1c31
fix netbsd 2019-08-01 21:39:51 -05:00
Rick V
3782479276
fix sun 2019-08-01 21:39:49 -05:00
Rick V
b7ffe37ffb
add make windows config command line 2019-08-01 21:39:48 -05:00
Michael
614b669fd5
Abandon debian 2019-07-29 21:31:26 +01:00
Michael
df498c7bf8
try to make some windows 2019-07-29 21:31:26 +01:00
Jeff Becker
43cb62af16
fix android compile, have makefile pull in libuv for cmake on android 2019-07-24 11:25:40 -04:00
Michael
82958de2d7
Tidy up cmake files 2019-07-22 00:58:45 +01:00
Michael
65af2c4266
Normalise build 2019-07-21 17:08:26 +01:00
Michael
4806e52f62
Try to silence some warnings to reduce noise 2019-07-21 16:57:11 +01:00
Michael
2cc180b6a4
Add FindLibUV and migrate 2019-07-13 14:06:34 +01:00
Michael
2acb163083
Fix llvm 8 build 2019-07-06 14:46:25 +01:00
Michael
a2326efa37
Revert "Merge pull request #679 from tewinget/revert-config-refactor"
This reverts commit 2996a7f29c, reversing
changes made to 10df3bd4b3.
2019-07-06 14:46:25 +01:00
Thomas Winget
d044d60101 Reverts #678 #677 and #669 with hashes:
10df3bd
766ece8
979f095

See those commits for further details
2019-07-02 11:02:20 -04:00
Michael
bd78471dae
Move ini parser as well 2019-07-02 01:58:38 +01:00
Michael
80d1e4aef9
Add in-source version of std::filesystem::permissions 2019-07-02 00:01:25 +01:00
Michael
59e8a7316f
Revert "Merge pull request #668 from michael-loki/remove_cppbackport"
This reverts commit 33142d5005, reversing
changes made to 408a652a01.
2019-07-01 10:33:03 +01:00
Michael
07377b8d5f
Find libuv for Ryan 2019-06-28 12:08:43 +01:00
Michael
1639c58cb6
Remove cppbackport from vendor dir 2019-06-27 16:25:44 +01:00
Jeff Becker
c63dbe7e48
fix freebsd build 2019-06-25 09:51:17 -04:00
Jeff Becker
e265661adb
try fixing issue number 17 (not done) 2019-06-24 12:48:48 -04:00
Rick V
68862cc830
we libuv now 2019-06-13 21:21:44 -05:00
Rick V
271cfcb64e
remove all disused platform-specific event loops
(cherry picked from commit 94d00a169ba7934ef719cc38fe0ca1eff8e1b675)
2019-06-13 21:02:57 -05:00
Rick V
7788d6ec3c
fix windows
lto stuff remains for now
since native builds work

(cherry picked from commit 37814472af5e7c35d514bae16d19b08050765d52)

i'm not porting the UNIX-tier cppfs thing

(cherry picked from commit d6edbd789534d4fd0bce6c8c2418347cd80bebdb)

none of this had to be specified directly ffs

(cherry picked from commit 5dbefa7131a6fe0b2006c90ecdba7e466fdd1ecc)

stop breaking shit reee

(cherry picked from commit 14be89902ccc75a7fc21863593da393ca976d0d4)
2019-05-05 23:01:51 -05:00
Michael
8c570653ee
Refactor top level cmake file into multiple components 2019-04-30 00:48:48 +01:00
Michael
0b4d787042
More work on router docker image
- Multi-stage docker build (final image only 15MB!)
- Build in release mode
    - Fix bug with release mode
    - Fix compiler being dumb AF
    - Disable FORTIFY for now
- Enable LTO when making a staticly linked release
- Fix some gcc specific warnings
- Refactor cmake stuff into multiple files
2019-04-28 17:04:52 +01:00
Michael
4143472a17
Add cmake module to target a library as 'system', and fix a few warnings 2019-04-25 00:27:31 +01:00
Jeff Becker
edc477b071
update build files again 2018-05-29 10:45:37 -04:00
Jeff Becker
812bb6e0c0
update build files 2018-05-29 10:29:46 -04:00
Jeff Becker
63150549fc
start moving to cmake 2018-05-16 09:56:51 -04:00