From 1eba0f836ed1eb8a5080bd7c4e34ed48e1848be3 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 26 May 2022 11:59:44 -0400 Subject: [PATCH 1/9] replace LLARP_PROTO_VERSION macro --- llarp/constants/proto.hpp | 16 ++++++---------- llarp/constants/version.cpp.in | 2 +- llarp/dht/message.hpp | 2 +- llarp/dht/messages/findintro.cpp | 4 ++-- llarp/dht/messages/gotrouter.cpp | 2 +- llarp/dht/messages/gotrouter.hpp | 2 +- llarp/dht/messages/pubintro.cpp | 2 +- llarp/exit/policy.hpp | 2 +- llarp/iwp/session.cpp | 9 ++++++--- llarp/messages/dht_immediate.cpp | 4 ++-- llarp/messages/discard.hpp | 2 +- llarp/messages/link_intro.cpp | 7 ++++--- llarp/messages/link_message.hpp | 2 +- llarp/messages/relay.cpp | 8 ++++---- llarp/messages/relay_commit.cpp | 12 +++++++----- llarp/messages/relay_status.cpp | 12 +++++++----- llarp/net/address_info.cpp | 4 ++-- llarp/net/address_info.hpp | 2 +- llarp/net/exit_info.hpp | 2 +- llarp/path/path.cpp | 2 +- llarp/path/pathbuilder.cpp | 2 +- llarp/pow.hpp | 2 +- llarp/profiling.hpp | 2 +- llarp/router/router.cpp | 2 +- llarp/router_contact.cpp | 2 +- llarp/router_contact.hpp | 2 +- llarp/router_version.hpp | 2 +- llarp/routing/dht_message.cpp | 2 +- llarp/routing/message.hpp | 2 +- llarp/routing/path_transfer_message.cpp | 2 +- llarp/service/async_key_exchange.cpp | 2 +- llarp/service/identity.hpp | 2 +- llarp/service/info.cpp | 2 +- llarp/service/info.hpp | 2 +- llarp/service/intro.hpp | 2 +- llarp/service/intro_set.hpp | 2 +- llarp/service/protocol.cpp | 2 +- llarp/service/protocol.hpp | 4 ++-- test/router/test_llarp_router_version.cpp | 6 +++--- .../test_llarp_routing_obtainexitmessage.cpp | 2 +- 40 files changed, 74 insertions(+), 70 deletions(-) diff --git a/llarp/constants/proto.hpp b/llarp/constants/proto.hpp index fe2bb03ec..0ed9b53f7 100644 --- a/llarp/constants/proto.hpp +++ b/llarp/constants/proto.hpp @@ -1,13 +1,9 @@ #pragma once -#ifndef LLARP_PROTO_VERSION -#define LLARP_PROTO_VERSION (0) -#endif +namespace llarp::constants +{ + /// current network wide protocol version + // TODO: enum class + constexpr auto proto_version = 0; -#ifndef LLARP_ETH_PROTO -#define LLARP_ETH_PROTO (0xD1CE) -#endif - -#ifndef LLARP_KEYFILE_VERSION -#define LLARP_KEYFILE_VERSION (1) -#endif +} // namespace llarp::constants diff --git a/llarp/constants/version.cpp.in b/llarp/constants/version.cpp.in index 67c3cfa9c..c21cdc8ee 100644 --- a/llarp/constants/version.cpp.in +++ b/llarp/constants/version.cpp.in @@ -16,7 +16,7 @@ namespace llarp { // clang-format off const std::array VERSION{{LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}}; - const std::array ROUTER_VERSION{{LLARP_PROTO_VERSION, LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}}; + const std::array ROUTER_VERSION{{llarp::constants::proto_version, LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}}; const char* const VERSION_STR = LLARP_VERSION_STR; const char* const VERSION_TAG = "@VERSIONTAG@"; const char* const VERSION_FULL = LLARP_NAME "-" LLARP_VERSION_STR "-@VERSIONTAG@"; diff --git a/llarp/dht/message.hpp b/llarp/dht/message.hpp index 338c98c33..13fdd9229 100644 --- a/llarp/dht/message.hpp +++ b/llarp/dht/message.hpp @@ -34,7 +34,7 @@ namespace llarp Key_t From; PathID_t pathID; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; }; IMessage::Ptr_t diff --git a/llarp/dht/messages/findintro.cpp b/llarp/dht/messages/findintro.cpp index 0e21523b7..a898b78c1 100644 --- a/llarp/dht/messages/findintro.cpp +++ b/llarp/dht/messages/findintro.cpp @@ -28,7 +28,7 @@ namespace llarp if (!BEncodeMaybeReadDictInt("T", txID, read, k, val)) return false; - if (!BEncodeMaybeVerifyVersion("V", version, LLARP_PROTO_VERSION, read, k, val)) + if (!BEncodeMaybeVerifyVersion("V", version, llarp::constants::proto_version, read, k, val)) return false; return read; @@ -66,7 +66,7 @@ namespace llarp if (!BEncodeWriteDictInt("T", txID, buf)) return false; // protocol version - if (!BEncodeWriteDictInt("V", LLARP_PROTO_VERSION, buf)) + if (!BEncodeWriteDictInt("V", llarp::constants::proto_version, buf)) return false; return bencode_end(buf); diff --git a/llarp/dht/messages/gotrouter.cpp b/llarp/dht/messages/gotrouter.cpp index 4ab90a7d4..9fcb56c31 100644 --- a/llarp/dht/messages/gotrouter.cpp +++ b/llarp/dht/messages/gotrouter.cpp @@ -73,7 +73,7 @@ namespace llarp return bencode_read_integer(val, &txid); } bool read = false; - if (!BEncodeMaybeVerifyVersion("V", version, LLARP_PROTO_VERSION, read, key, val)) + if (!BEncodeMaybeVerifyVersion("V", version, llarp::constants::proto_version, read, key, val)) return false; return read; diff --git a/llarp/dht/messages/gotrouter.hpp b/llarp/dht/messages/gotrouter.hpp index 259911313..55a74f98e 100644 --- a/llarp/dht/messages/gotrouter.hpp +++ b/llarp/dht/messages/gotrouter.hpp @@ -30,7 +30,7 @@ namespace llarp /// gossip message GotRouterMessage(const RouterContact rc) : IMessage({}), foundRCs({rc}), txid(0) { - version = LLARP_PROTO_VERSION; + version = llarp::constants::proto_version; } GotRouterMessage(const GotRouterMessage& other) diff --git a/llarp/dht/messages/pubintro.cpp b/llarp/dht/messages/pubintro.cpp index 07598f9cc..b36f9b342 100644 --- a/llarp/dht/messages/pubintro.cpp +++ b/llarp/dht/messages/pubintro.cpp @@ -195,7 +195,7 @@ namespace llarp return false; if (!BEncodeWriteDictInt("T", txID, buf)) return false; - if (!BEncodeWriteDictInt("V", LLARP_PROTO_VERSION, buf)) + if (!BEncodeWriteDictInt("V", llarp::constants::proto_version, buf)) return false; return bencode_end(buf); } diff --git a/llarp/exit/policy.hpp b/llarp/exit/policy.hpp index ed8e857fd..de41e1ebc 100644 --- a/llarp/exit/policy.hpp +++ b/llarp/exit/policy.hpp @@ -11,7 +11,7 @@ namespace llarp uint64_t proto = 0; uint64_t port = 0; uint64_t drop = 0; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; bool BDecode(llarp_buffer_t* buf) diff --git a/llarp/iwp/session.cpp b/llarp/iwp/session.cpp index e5ba94a5a..9aa88d01a 100644 --- a/llarp/iwp/session.cpp +++ b/llarp/iwp/session.cpp @@ -24,7 +24,7 @@ namespace llarp } // randomize nounce CryptoManager::instance()->randbytes(pkt.data() + HMACSIZE, TUNNONCESIZE); - pkt[PacketOverhead] = LLARP_PROTO_VERSION; + pkt[PacketOverhead] = llarp::constants::proto_version; pkt[PacketOverhead + 1] = cmd; return pkt; } @@ -653,10 +653,13 @@ namespace llarp LogError("failed to decrypt session data from ", m_RemoteAddr); continue; } - if (pkt[PacketOverhead] != LLARP_PROTO_VERSION) + if (pkt[PacketOverhead] != llarp::constants::proto_version) { LogError( - "protocol version mismatch ", int(pkt[PacketOverhead]), " != ", LLARP_PROTO_VERSION); + "protocol version mismatch ", + int(pkt[PacketOverhead]), + " != ", + llarp::constants::proto_version); itr = msgs.erase(itr); continue; } diff --git a/llarp/messages/dht_immediate.cpp b/llarp/messages/dht_immediate.cpp index 1af4a9c47..2ab9f13e3 100644 --- a/llarp/messages/dht_immediate.cpp +++ b/llarp/messages/dht_immediate.cpp @@ -20,7 +20,7 @@ namespace llarp { if (!bencode_read_integer(buf, &version)) return false; - return version == LLARP_PROTO_VERSION; + return version == llarp::constants::proto_version; } // bad key return false; @@ -54,7 +54,7 @@ namespace llarp return false; // protocol version - if (!bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION)) + if (!bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version)) return false; return bencode_end(buf); diff --git a/llarp/messages/discard.hpp b/llarp/messages/discard.hpp index 2466cb3d0..46d24d429 100644 --- a/llarp/messages/discard.hpp +++ b/llarp/messages/discard.hpp @@ -69,7 +69,7 @@ namespace llarp DataDiscardMessage(const PathID_t& dst, uint64_t s) : P(dst) { S = s; - version = LLARP_PROTO_VERSION; + version = llarp::constants::proto_version; } void diff --git a/llarp/messages/link_intro.cpp b/llarp/messages/link_intro.cpp index f334e2aba..9144baf20 100644 --- a/llarp/messages/link_intro.cpp +++ b/llarp/messages/link_intro.cpp @@ -43,9 +43,10 @@ namespace llarp { if (!bencode_read_integer(buf, &version)) return false; - if (version != LLARP_PROTO_VERSION) + if (version != llarp::constants::proto_version) { - llarp::LogWarn("llarp protocol version mismatch ", version, " != ", LLARP_PROTO_VERSION); + llarp::LogWarn( + "llarp protocol version mismatch ", version, " != ", llarp::constants::proto_version); return false; } llarp::LogDebug("LIM version ", version); @@ -86,7 +87,7 @@ namespace llarp if (!rc.BEncode(buf)) return false; - if (!bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION)) + if (!bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version)) return false; if (!bencode_write_bytestring(buf, "z", 1)) diff --git a/llarp/messages/link_message.hpp b/llarp/messages/link_message.hpp index 9ed1cf2f9..af5af6413 100644 --- a/llarp/messages/link_message.hpp +++ b/llarp/messages/link_message.hpp @@ -17,7 +17,7 @@ namespace llarp { /// who did this message come from or is going to ILinkSession* session = nullptr; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; PathID_t pathid; diff --git a/llarp/messages/relay.cpp b/llarp/messages/relay.cpp index fdbac1a1f..ace3d7df2 100644 --- a/llarp/messages/relay.cpp +++ b/llarp/messages/relay.cpp @@ -25,7 +25,7 @@ namespace llarp if (!BEncodeWriteDictEntry("p", pathid, buf)) return false; - if (!BEncodeWriteDictInt("v", LLARP_PROTO_VERSION, buf)) + if (!BEncodeWriteDictInt("v", llarp::constants::proto_version, buf)) return false; if (!BEncodeWriteDictEntry("x", X, buf)) return false; @@ -40,7 +40,7 @@ namespace llarp bool read = false; if (!BEncodeMaybeReadDictEntry("p", pathid, read, key, buf)) return false; - if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, key, buf)) + if (!BEncodeMaybeVerifyVersion("v", version, llarp::constants::proto_version, read, key, buf)) return false; if (!BEncodeMaybeReadDictEntry("x", X, read, key, buf)) return false; @@ -79,7 +79,7 @@ namespace llarp if (!BEncodeWriteDictEntry("p", pathid, buf)) return false; - if (!BEncodeWriteDictInt("v", LLARP_PROTO_VERSION, buf)) + if (!BEncodeWriteDictInt("v", llarp::constants::proto_version, buf)) return false; if (!BEncodeWriteDictEntry("x", X, buf)) return false; @@ -94,7 +94,7 @@ namespace llarp bool read = false; if (!BEncodeMaybeReadDictEntry("p", pathid, read, key, buf)) return false; - if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, key, buf)) + if (!BEncodeMaybeVerifyVersion("v", version, llarp::constants::proto_version, read, key, buf)) return false; if (!BEncodeMaybeReadDictEntry("x", X, read, key, buf)) return false; diff --git a/llarp/messages/relay_commit.cpp b/llarp/messages/relay_commit.cpp index 900971ecb..3dc67d7a5 100644 --- a/llarp/messages/relay_commit.cpp +++ b/llarp/messages/relay_commit.cpp @@ -29,7 +29,7 @@ namespace llarp return BEncodeReadArray(frames, buf); } bool read = false; - if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, key, buf)) + if (!BEncodeMaybeVerifyVersion("v", version, llarp::constants::proto_version, read, key, buf)) return false; return read; @@ -54,7 +54,7 @@ namespace llarp if (!BEncodeWriteDictArray("c", frames, buf)) return false; // version - if (!bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION)) + if (!bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version)) return false; return bencode_end(buf); @@ -102,9 +102,10 @@ namespace llarp if (!BEncodeWriteDictEntry("u", *nextRC, buf)) return false; } - if (!bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION)) + + if (not bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version)) return false; - if (work && !BEncodeWriteDictEntry("w", *work, buf)) + if (work and not BEncodeWriteDictEntry("w", *work, buf)) return false; return bencode_end(buf); @@ -135,7 +136,8 @@ namespace llarp nextRC = std::make_unique(); return nextRC->BDecode(buffer); } - if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, *key, buffer)) + if (!BEncodeMaybeVerifyVersion( + "v", version, llarp::constants::proto_version, read, *key, buffer)) return false; if (*key == "w") { diff --git a/llarp/messages/relay_status.cpp b/llarp/messages/relay_status.cpp index 0ae3358f0..67dcb3294 100644 --- a/llarp/messages/relay_status.cpp +++ b/llarp/messages/relay_status.cpp @@ -80,7 +80,7 @@ namespace llarp } else if (key == "v") { - if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, key, buf)) + if (!BEncodeMaybeVerifyVersion("v", version, llarp::constants::proto_version, read, key, buf)) { return false; } @@ -115,7 +115,7 @@ namespace llarp if (!BEncodeWriteDictInt("s", status, buf)) return false; // version - if (!bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION)) + if (!bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version)) return false; return bencode_end(buf); @@ -190,7 +190,7 @@ namespace llarp LR_StatusRecord record; record.status = newStatus; - record.version = LLARP_PROTO_VERSION; + record.version = llarp::constants::proto_version; llarp_buffer_t buf(frame.data(), frame.size()); buf.cur = buf.base + EncryptedFrameOverheadSize; @@ -256,7 +256,8 @@ namespace llarp LR_StatusRecord::BEncode(llarp_buffer_t* buf) const { return bencode_start_dict(buf) && BEncodeWriteDictInt("s", status, buf) - && bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION) && bencode_end(buf); + && bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version) + && bencode_end(buf); } bool @@ -269,7 +270,8 @@ namespace llarp if (!BEncodeMaybeReadDictInt("s", status, read, *key, buffer)) return false; - if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, *key, buffer)) + if (!BEncodeMaybeVerifyVersion( + "v", version, llarp::constants::proto_version, read, *key, buffer)) return false; return read; diff --git a/llarp/net/address_info.cpp b/llarp/net/address_info.cpp index 8daf8f8de..d4b8cd398 100644 --- a/llarp/net/address_info.cpp +++ b/llarp/net/address_info.cpp @@ -105,7 +105,7 @@ namespace llarp { if (!bencode_read_integer(buf, &i)) return false; - return i == LLARP_PROTO_VERSION; + return i == llarp::constants::proto_version; } // bad key @@ -149,7 +149,7 @@ namespace llarp return false; /** version */ - if (!bencode_write_uint64_entry(buff, "v", 1, LLARP_PROTO_VERSION)) + if (!bencode_write_uint64_entry(buff, "v", 1, llarp::constants::proto_version)) return false; /** end */ return bencode_end(buff); diff --git a/llarp/net/address_info.hpp b/llarp/net/address_info.hpp index a3bcd02e7..a66f77112 100644 --- a/llarp/net/address_info.hpp +++ b/llarp/net/address_info.hpp @@ -27,7 +27,7 @@ namespace llarp llarp::PubKey pubkey; in6_addr ip = {}; uint16_t port; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; bool BDecode(llarp_buffer_t* buf) diff --git a/llarp/net/exit_info.hpp b/llarp/net/exit_info.hpp index 7265e181a..b3727c4f5 100644 --- a/llarp/net/exit_info.hpp +++ b/llarp/net/exit_info.hpp @@ -21,7 +21,7 @@ namespace llarp IpAddress ipAddress; IpAddress netmask; PubKey pubkey; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; ExitInfo() = default; diff --git a/llarp/path/path.cpp b/llarp/path/path.cpp index c61d9098b..1e0540f0f 100644 --- a/llarp/path/path.cpp +++ b/llarp/path/path.cpp @@ -646,7 +646,7 @@ namespace llarp llarp_buffer_t buf(tmp); // should help prevent bad paths with uninitialized members // FIXME: Why would we get uninitialized IMessages? - if (msg.version != LLARP_PROTO_VERSION) + if (msg.version != llarp::constants::proto_version) return false; if (!msg.BEncode(&buf)) { diff --git a/llarp/path/pathbuilder.cpp b/llarp/path/pathbuilder.cpp index 2b7f4be39..c401965aa 100644 --- a/llarp/path/pathbuilder.cpp +++ b/llarp/path/pathbuilder.cpp @@ -68,7 +68,7 @@ namespace llarp } // build record record.lifetime = path::default_lifetime; - record.version = LLARP_PROTO_VERSION; + record.version = llarp::constants::proto_version; record.txid = hop.txID; record.rxid = hop.rxID; record.tunnelNonce = hop.nonce; diff --git a/llarp/pow.hpp b/llarp/pow.hpp index c1e947c1e..be075ca6c 100644 --- a/llarp/pow.hpp +++ b/llarp/pow.hpp @@ -12,7 +12,7 @@ namespace llarp llarp_time_t timestamp = 0s; llarp_time_t extendedLifetime = 0s; AlignedBuffer<32> nonce; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; ~PoW(); diff --git a/llarp/profiling.hpp b/llarp/profiling.hpp index 03372d3fb..df26b6bcb 100644 --- a/llarp/profiling.hpp +++ b/llarp/profiling.hpp @@ -20,7 +20,7 @@ namespace llarp uint64_t pathTimeoutCount = 0; llarp_time_t lastUpdated = 0s; llarp_time_t lastDecay = 0s; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; bool BEncode(llarp_buffer_t* buf) const; diff --git a/llarp/router/router.cpp b/llarp/router/router.cpp index 2b2a4131c..b6ca5c6ba 100644 --- a/llarp/router/router.cpp +++ b/llarp/router/router.cpp @@ -1210,7 +1210,7 @@ namespace llarp // set router version if service node if (IsServiceNode()) { - _rc.routerVersion = RouterVersion(llarp::VERSION, LLARP_PROTO_VERSION); + _rc.routerVersion = RouterVersion(llarp::VERSION, llarp::constants::proto_version); } _linkManager.ForEachInboundLink([&](LinkLayer_ptr link) { diff --git a/llarp/router_contact.cpp b/llarp/router_contact.cpp index dabbeae85..76dac45fa 100644 --- a/llarp/router_contact.cpp +++ b/llarp/router_contact.cpp @@ -221,7 +221,7 @@ namespace llarp routerVersion = std::optional{}; last_updated = 0s; srvRecords.clear(); - version = LLARP_PROTO_VERSION; + version = llarp::constants::proto_version; } util::StatusObject diff --git a/llarp/router_contact.hpp b/llarp/router_contact.hpp index ccac70d67..53f29bd38 100644 --- a/llarp/router_contact.hpp +++ b/llarp/router_contact.hpp @@ -101,7 +101,7 @@ namespace llarp llarp::AlignedBuffer nickname; llarp_time_t last_updated = 0s; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; std::optional routerVersion; /// should we serialize the exit info? const static bool serializeExit = true; diff --git a/llarp/router_version.hpp b/llarp/router_version.hpp index 80632c328..0df69a7d1 100644 --- a/llarp/router_version.hpp +++ b/llarp/router_version.hpp @@ -57,7 +57,7 @@ namespace llarp private: Version_t m_Version = {{0, 0, 0}}; - int64_t m_ProtoVersion = LLARP_PROTO_VERSION; + int64_t m_ProtoVersion = llarp::constants::proto_version; }; inline std::ostream& diff --git a/llarp/routing/dht_message.cpp b/llarp/routing/dht_message.cpp index a581e5d73..510754049 100644 --- a/llarp/routing/dht_message.cpp +++ b/llarp/routing/dht_message.cpp @@ -39,7 +39,7 @@ namespace llarp return false; if (!BEncodeWriteDictInt("S", S, buf)) return false; - if (!BEncodeWriteDictInt("V", LLARP_PROTO_VERSION, buf)) + if (!BEncodeWriteDictInt("V", llarp::constants::proto_version, buf)) return false; return bencode_end(buf); diff --git a/llarp/routing/message.hpp b/llarp/routing/message.hpp index 8274b956b..6544792d5 100644 --- a/llarp/routing/message.hpp +++ b/llarp/routing/message.hpp @@ -16,7 +16,7 @@ namespace llarp { PathID_t from; uint64_t S{0}; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; IMessage() = default; diff --git a/llarp/routing/path_transfer_message.cpp b/llarp/routing/path_transfer_message.cpp index 8667fbd52..ddb5ac82d 100644 --- a/llarp/routing/path_transfer_message.cpp +++ b/llarp/routing/path_transfer_message.cpp @@ -40,7 +40,7 @@ namespace llarp if (!BEncodeWriteDictEntry("T", T, buf)) return false; - if (!BEncodeWriteDictInt("V", LLARP_PROTO_VERSION, buf)) + if (!BEncodeWriteDictInt("V", llarp::constants::proto_version, buf)) return false; if (!BEncodeWriteDictEntry("Y", Y, buf)) return false; diff --git a/llarp/service/async_key_exchange.cpp b/llarp/service/async_key_exchange.cpp index 43a765a75..bf814daac 100644 --- a/llarp/service/async_key_exchange.cpp +++ b/llarp/service/async_key_exchange.cpp @@ -70,7 +70,7 @@ namespace llarp // set sender self->msg.sender = self->m_LocalIdentity.pub; // set version - self->msg.version = LLARP_PROTO_VERSION; + self->msg.version = llarp::constants::proto_version; // encrypt and sign if (frame->EncryptAndSign(self->msg, K, self->m_LocalIdentity)) self->loop->call([self, frame] { AsyncKeyExchange::Result(self, frame); }); diff --git a/llarp/service/identity.hpp b/llarp/service/identity.hpp index 7fd1b72a7..5278f1af6 100644 --- a/llarp/service/identity.hpp +++ b/llarp/service/identity.hpp @@ -22,7 +22,7 @@ namespace llarp SecretKey signkey; PrivateKey derivedSignKey; PQKeyPair pq; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; VanityNonce vanity; // public service info diff --git a/llarp/service/info.cpp b/llarp/service/info.cpp index ad5191758..3e2d15fd4 100644 --- a/llarp/service/info.cpp +++ b/llarp/service/info.cpp @@ -56,7 +56,7 @@ namespace llarp return false; if (!BEncodeWriteDictEntry("s", signkey, buf)) return false; - if (!BEncodeWriteDictInt("v", LLARP_PROTO_VERSION, buf)) + if (!BEncodeWriteDictInt("v", llarp::constants::proto_version, buf)) return false; if (!vanity.IsZero()) { diff --git a/llarp/service/info.hpp b/llarp/service/info.hpp index cf9a5d757..1a56f13bf 100644 --- a/llarp/service/info.hpp +++ b/llarp/service/info.hpp @@ -20,7 +20,7 @@ namespace llarp public: VanityNonce vanity; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; void RandomizeVanity() diff --git a/llarp/service/intro.hpp b/llarp/service/intro.hpp index 507d0ffc9..36ea34c2a 100644 --- a/llarp/service/intro.hpp +++ b/llarp/service/intro.hpp @@ -17,7 +17,7 @@ namespace llarp PathID_t pathID; llarp_time_t latency = 0s; llarp_time_t expiresAt = 0s; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; util::StatusObject ExtractStatus() const; diff --git a/llarp/service/intro_set.hpp b/llarp/service/intro_set.hpp index 66e88fb14..c39a08404 100644 --- a/llarp/service/intro_set.hpp +++ b/llarp/service/intro_set.hpp @@ -49,7 +49,7 @@ namespace llarp std::optional exitTrafficPolicy; Signature signature; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; bool OtherIsNewer(const IntroSet& other) const diff --git a/llarp/service/protocol.cpp b/llarp/service/protocol.cpp index 8ecf32ac8..0b9939c59 100644 --- a/llarp/service/protocol.cpp +++ b/llarp/service/protocol.cpp @@ -191,7 +191,7 @@ namespace llarp return false; if (!BEncodeMaybeReadDictEntry("T", T, read, key, val)) return false; - if (!BEncodeMaybeVerifyVersion("V", version, LLARP_PROTO_VERSION, read, key, val)) + if (!BEncodeMaybeVerifyVersion("V", version, llarp::constants::proto_version, read, key, val)) return false; if (!BEncodeMaybeReadDictEntry("Z", Z, read, key, val)) return false; diff --git a/llarp/service/protocol.hpp b/llarp/service/protocol.hpp index 1776abba4..4286ce221 100644 --- a/llarp/service/protocol.hpp +++ b/llarp/service/protocol.hpp @@ -45,7 +45,7 @@ namespace llarp Endpoint* handler = nullptr; ConvoTag tag; uint64_t seqno = 0; - uint64_t version = LLARP_PROTO_VERSION; + uint64_t version = llarp::constants::proto_version; /// encode metainfo for lmq endpoint auth std::vector @@ -155,7 +155,7 @@ namespace llarp N.Zero(); Z.Zero(); R = 0; - version = LLARP_PROTO_VERSION; + version = llarp::constants::proto_version; } bool diff --git a/test/router/test_llarp_router_version.cpp b/test/router/test_llarp_router_version.cpp index 6230b2161..57e436347 100644 --- a/test/router/test_llarp_router_version.cpp +++ b/test/router/test_llarp_router_version.cpp @@ -24,14 +24,14 @@ TEST_CASE("Compatibility when protocol unequal", "[RouterVersion]") TEST_CASE("Empty compatibility", "[RouterVersion]") { - llarp::RouterVersion v1({0, 0, 1}, LLARP_PROTO_VERSION); + llarp::RouterVersion v1({0, 0, 1}, llarp::constants::proto_version); CHECK_FALSE(v1.IsCompatableWith(llarp::emptyRouterVersion)); } TEST_CASE("IsEmpty", "[RouterVersion]") { - llarp::RouterVersion notEmpty({0, 0, 1}, LLARP_PROTO_VERSION); + llarp::RouterVersion notEmpty({0, 0, 1}, llarp::constants::proto_version); CHECK_FALSE(notEmpty.IsEmpty()); CHECK(llarp::emptyRouterVersion.IsEmpty()); @@ -39,7 +39,7 @@ TEST_CASE("IsEmpty", "[RouterVersion]") TEST_CASE("Clear", "[RouterVersion]") { - llarp::RouterVersion version({0, 0, 1}, LLARP_PROTO_VERSION); + llarp::RouterVersion version({0, 0, 1}, llarp::constants::proto_version); CHECK_FALSE(version.IsEmpty()); version.Clear(); diff --git a/test/routing/test_llarp_routing_obtainexitmessage.cpp b/test/routing/test_llarp_routing_obtainexitmessage.cpp index 8a5c2ca2b..fca9842e6 100644 --- a/test/routing/test_llarp_routing_obtainexitmessage.cpp +++ b/test/routing/test_llarp_routing_obtainexitmessage.cpp @@ -28,6 +28,6 @@ TEST_CASE_METHOD(LlarpTest<>, "Sign-verify") CHECK(msg.Sign(alice)); CHECK(msg.Verify()); CHECK(msg.I == PubKey{seckey_topublic(alice)}); - CHECK(msg.version == LLARP_PROTO_VERSION); + CHECK(msg.version == llarp::constants::proto_version); CHECK_FALSE(msg.Z.IsZero()); } From f05c2ebc71d9ceca9bd1b1a524c84c89d36c54b4 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 26 May 2022 12:25:55 -0400 Subject: [PATCH 2/9] macro removals clean up version cmake stuff clean up generated cpp version stuff make all the windows rc stuff get generated by cmake bump release motto message properly inject release motto into version --- CMakeLists.txt | 9 +---- cmake/Version.cmake | 43 +++++++++++++++++++---- daemon/CMakeLists.txt | 2 +- llarp/constants/version.cpp.in | 23 ++++-------- llarp/constants/version.h | 24 ------------- llarp/win32/{resource.h => resource.h.in} | 2 ++ llarp/win32/{version.rc => version.rc.in} | 28 ++++++--------- 7 files changed, 57 insertions(+), 74 deletions(-) delete mode 100644 llarp/constants/version.h rename llarp/win32/{resource.h => resource.h.in} (74%) rename llarp/win32/{version.rc => version.rc.in} (64%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a36f117e..007daf6e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,14 +35,7 @@ if(APPLE) set(LOKINET_APPLE_BUILD 0) endif() -set(RELEASE_MOTTO "A Series of Tubes" CACHE STRING "Release motto") - -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}") -endif() +set(RELEASE_MOTTO "The Current Thing" CACHE STRING "Release motto") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") diff --git a/cmake/Version.cmake b/cmake/Version.cmake index 45037a081..c967d53e3 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -1,9 +1,9 @@ +# We do this via a custom command that re-invokes a cmake script because we need the DEPENDS on .git/index so that we will re-run it (to regenerate the commit tag in the version) whenever the current commit changes. If we used a configure_file directly here, it would only re-run when something else causes cmake to re-run. -find_package(Git QUIET) +set(VERSIONTAG "${GIT_VERSION}") set(GIT_INDEX_FILE "${PROJECT_SOURCE_DIR}/.git/index") if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) ) message(STATUS "Found Git: ${GIT_EXECUTABLE}") - add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" COMMAND "${CMAKE_COMMAND}" @@ -12,11 +12,40 @@ if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) ) "-D" "DEST=${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" - "${GIT_INDEX_FILE}") + "${GIT_INDEX_FILE}") + if(WIN32) + add_custom_command( + OUTPUT "${CMAKE_BINARY_DIR}/version.rc" + COMMAND "${CMAKE_COMMAND}" + "-D" "GIT=${GIT_EXECUTABLE}" + "-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" + "-D" "DEST=${CMAKE_BINARY_DIR}/version.rc" + "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" + "${GIT_INDEX_FILE}") + + add_custom_command( + OUTPUT "${CMAKE_BINARY_DIR}/lokinet_resource.h" + COMMAND "${CMAKE_COMMAND}" + "-D" "GIT=${GIT_EXECUTABLE}" + "-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/win32/resource.h.in" + "-D" "DEST=${CMAKE_BINARY_DIR}/lokinet_resource.h" + "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/win32/resource.h.in" + "${GIT_INDEX_FILE}") + endif() else() - message(STATUS "Git was not found! Setting version to to nogit") - set(VERSIONTAG "nogit") - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY) + if(WIN32) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" "${CMAKE_BINARY_DIR}/version.rc" @ONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/resource.h.in" "${CMAKE_BINARY_DIR}/lokinet_resource.h" @ONLY) + endif() endif() -add_custom_target(genversion DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp") +add_custom_target(genversion_cpp DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp") +if(WIN32) + add_custom_target(genversion_rc DEPENDS "${CMAKE_BINARY_DIR}/version.rc" "${CMAKE_BINARY_DIR}/lokinet_resource.h") +else() + add_custom_target(genversion_rc) +endif() +add_custom_target(genversion DEPENDS genversion_cpp genversion_rc) diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index a565bf96f..a65ed660a 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -49,7 +49,7 @@ endif() foreach(exe ${exetargets}) if(WIN32 AND NOT MSVC_VERSION) - target_sources(${exe} PRIVATE ../llarp/win32/version.rc) + target_sources(${exe} PRIVATE ${CMAKE_BINARY_DIR}/version.rc) target_link_libraries(${exe} PRIVATE -static-libstdc++ -static-libgcc --static -Wl,--pic-executable,-e,mainCRTStartup,--subsystem,console:5.00) target_link_libraries(${exe} PRIVATE ws2_32 iphlpapi) elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") diff --git a/llarp/constants/version.cpp.in b/llarp/constants/version.cpp.in index c21cdc8ee..57156338d 100644 --- a/llarp/constants/version.cpp.in +++ b/llarp/constants/version.cpp.in @@ -1,27 +1,16 @@ #include -#include #include -// clang-format off -#define LLARP_STRINGIFY2(val) #val -#define LLARP_STRINGIFY(val) LLARP_STRINGIFY2(val) - -#define LLARP_VERSION_STR \ - LLARP_STRINGIFY(LLARP_VERSION_MAJOR) \ - "." LLARP_STRINGIFY(LLARP_VERSION_MINOR) "." LLARP_STRINGIFY( \ - LLARP_VERSION_PATCH) -#define LLARP_VERSION_FULL LLARP_VERSION_STR "-@VERSIONTAG@" - namespace llarp { // clang-format off - const std::array VERSION{{LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}}; - const std::array ROUTER_VERSION{{llarp::constants::proto_version, LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}}; - const char* const VERSION_STR = LLARP_VERSION_STR; + const std::array VERSION{{@lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@}}; + const std::array ROUTER_VERSION{{llarp::constants::proto_version, @lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@}}; + const char* const VERSION_STR = "@lokinet_VERSION_MAJOR@.@lokinet_VERSION_MINOR@.@lokinet_VERSION_PATCH@"; const char* const VERSION_TAG = "@VERSIONTAG@"; - const char* const VERSION_FULL = LLARP_NAME "-" LLARP_VERSION_STR "-@VERSIONTAG@"; + const char* const VERSION_FULL = "lokinet-@lokinet_VERSION_MAJOR@.@lokinet_VERSION_MINOR@.@lokinet_VERSION_PATCH@-@VERSIONTAG@"; - const char* const RELEASE_MOTTO = LLARP_RELEASE_MOTTO; - const char* const DEFAULT_NETID = LLARP_DEFAULT_NETID; + const char* const RELEASE_MOTTO = "@RELEASE_MOTTO@"; + const char* const DEFAULT_NETID = "lokinet"; // clang-format on } // namespace llarp diff --git a/llarp/constants/version.h b/llarp/constants/version.h deleted file mode 100644 index 30893701e..000000000 --- a/llarp/constants/version.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -// Don't include this file directly but rather go through version.hpp instead. -// This is only here so version.cpp.in and the weird archaic windows build -// recipies can use the version. - -#define LLARP_NAME "lokinet" - -#define LLARP_DEFAULT_NETID "lokinet" - -#ifndef LLARP_RELEASE_MOTTO -#define LLARP_RELEASE_MOTTO "(dev build)" -#endif - -#if defined(_WIN32) && defined(RC_INVOKED) -#define LLARP_VERSION LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH, 0 - -#define MAKE_TRIPLET(X, Y, Z) TRIPLET_CAT(X, ., Y, ., Z) -#define TRIPLET_CAT(X, D1, Y, D2, Z) X##D1##Y##D2##Z - -#define LLARP_VERSION_TRIPLET \ - MAKE_TRIPLET(LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH) - -#endif diff --git a/llarp/win32/resource.h b/llarp/win32/resource.h.in similarity index 74% rename from llarp/win32/resource.h rename to llarp/win32/resource.h.in index d90e55303..477e93b9b 100644 --- a/llarp/win32/resource.h +++ b/llarp/win32/resource.h.in @@ -13,3 +13,5 @@ #define _APS_NEXT_SYMED_VALUE 101 #endif #endif +// clang-format off +#define lokinet_VERSION @lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@, 0 diff --git a/llarp/win32/version.rc b/llarp/win32/version.rc.in similarity index 64% rename from llarp/win32/version.rc rename to llarp/win32/version.rc.in index 8b024dccd..23b4e996d 100644 --- a/llarp/win32/version.rc +++ b/llarp/win32/version.rc.in @@ -6,19 +6,13 @@ // // Microsoft Visual C++ generated resource script. // -#include "resource.h" -#include +#include "lokinet_resource.h" #ifdef __GNUC__ // make windows rc accept this #include #endif ///////////////////////////////////////////////////////////////////////////// // English (United States) resources -#define STRINGIZER(version) #version - -#define VERSION_STRING(version, codename, revision) \ - STRINGIZER(version) "-release [" STRINGIZER(codename) "] (rev-" STRINGIZER(revision) ")" - #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE 1033,1 @@ -56,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION LLARP_VERSION - PRODUCTVERSION LLARP_VERSION + FILEVERSION lokinet_VERSION + PRODUCTVERSION lokinet_VERSION FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x3L @@ -72,15 +66,15 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "Comments", "includes relay/exit functionality, such code is highly experimental on non-Linux targets" - VALUE "CompanyName", "Loki Foundation" - VALUE "FileDescription", "LokiNET daemon for Microsoft® Windows® NT™" - VALUE "FileVersion", VERSION_STRING(LLARP_VERSION_TRIPLET, LLARP_RELEASE_MOTTO, VERSIONTAG) - VALUE "InternalName", "llarpd" - VALUE "LegalCopyright", "Copyright ©2018-2020 Jeff Becker, Rick V for the Loki Foundation. All rights reserved. This software is provided under the terms of the zlib-libpng licence; see the file LICENSE for details." - VALUE "OriginalFilename", "llarpd.exe" + VALUE "Comments", "This comment has invoked its 5th ammendment constitutional right to remain silent" + VALUE "CompanyName", "OPTF" + VALUE "FileDescription", "LokiNET daemon for Windows" + VALUE "FileVersion", "@lokinet_VERSION@" + VALUE "InternalName", "lokinet" + VALUE "LegalCopyright", "Copyright (c) 2018-2022 Jeff Becker, Rick V for the OPTF. This software is provided under the terms of the GPL3; see the file LICENSE for details." + VALUE "OriginalFilename", "lokinet.exe" VALUE "ProductName", "LokiNET for Windows" - VALUE "ProductVersion", VERSION_STRING(LLARP_VERSION_TRIPLET, LLARP_RELEASE_MOTTO, VERSIONTAG) + VALUE "ProductVersion", "@lokinet_VERSION@" END END BLOCK "VarFileInfo" From e480e36f3de45ee50bfe504cf32e26ec5c52cc48 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 27 May 2022 10:14:31 -0400 Subject: [PATCH 3/9] generate windows rc for each executable target so we can set the executable name right for each one --- cmake/Version.cmake | 41 +++++++++++++++++---------------------- daemon/CMakeLists.txt | 2 +- llarp/win32/resource.h.in | 17 ---------------- llarp/win32/version.rc.in | 7 +++++-- 4 files changed, 24 insertions(+), 43 deletions(-) delete mode 100644 llarp/win32/resource.h.in diff --git a/cmake/Version.cmake b/cmake/Version.cmake index c967d53e3..79cc10250 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -12,39 +12,34 @@ if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) ) "-D" "DEST=${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" - "${GIT_INDEX_FILE}") + "${GIT_INDEX_FILE}") if(WIN32) - add_custom_command( - OUTPUT "${CMAKE_BINARY_DIR}/version.rc" - COMMAND "${CMAKE_COMMAND}" - "-D" "GIT=${GIT_EXECUTABLE}" - "-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" - "-D" "DEST=${CMAKE_BINARY_DIR}/version.rc" - "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" - "${GIT_INDEX_FILE}") - - add_custom_command( - OUTPUT "${CMAKE_BINARY_DIR}/lokinet_resource.h" - COMMAND "${CMAKE_COMMAND}" - "-D" "GIT=${GIT_EXECUTABLE}" - "-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/win32/resource.h.in" - "-D" "DEST=${CMAKE_BINARY_DIR}/lokinet_resource.h" - "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/win32/resource.h.in" - "${GIT_INDEX_FILE}") + foreach(exe IN ITEMS lokinet lokinet-vpn lokinet-bootstrap) + set(lokinet_EXE_NAME "${exe}.exe") + add_custom_command( + OUTPUT "${CMAKE_BINARY_DIR}/${exe}.rc" + COMMAND "${CMAKE_COMMAND}" + "-D" "GIT=${GIT_EXECUTABLE}" + "-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" + "-D" "DEST=${CMAKE_BINARY_DIR}/${exe}.rc" + "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" + "${GIT_INDEX_FILE}") + endforeach() endif() else() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY) if(WIN32) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" "${CMAKE_BINARY_DIR}/version.rc" @ONLY) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/resource.h.in" "${CMAKE_BINARY_DIR}/lokinet_resource.h" @ONLY) + foreach(exe IN ITEMS lokinet lokinet-vpn lokinet-bootstrap) + set(lokinet_EXE_NAME "${exe}.exe") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" "${CMAKE_BINARY_DIR}/${exe}.rc" @ONLY) + endforeach() endif() endif() add_custom_target(genversion_cpp DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp") if(WIN32) - add_custom_target(genversion_rc DEPENDS "${CMAKE_BINARY_DIR}/version.rc" "${CMAKE_BINARY_DIR}/lokinet_resource.h") + add_custom_target(genversion_rc DEPENDS "${CMAKE_BINARY_DIR}/lokinet.rc" "${CMAKE_BINARY_DIR}/lokinet-vpn.rc" "${CMAKE_BINARY_DIR}/lokinet-bootstrap.rc") else() add_custom_target(genversion_rc) endif() diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index a65ed660a..233c436ce 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -49,7 +49,7 @@ endif() foreach(exe ${exetargets}) if(WIN32 AND NOT MSVC_VERSION) - target_sources(${exe} PRIVATE ${CMAKE_BINARY_DIR}/version.rc) + target_sources(${exe} PRIVATE ${CMAKE_BINARY_DIR}/${exe}.rc) target_link_libraries(${exe} PRIVATE -static-libstdc++ -static-libgcc --static -Wl,--pic-executable,-e,mainCRTStartup,--subsystem,console:5.00) target_link_libraries(${exe} PRIVATE ws2_32 iphlpapi) elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") diff --git a/llarp/win32/resource.h.in b/llarp/win32/resource.h.in deleted file mode 100644 index 477e93b9b..000000000 --- a/llarp/win32/resource.h.in +++ /dev/null @@ -1,17 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by version.rc -// - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif -// clang-format off -#define lokinet_VERSION @lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@, 0 diff --git a/llarp/win32/version.rc.in b/llarp/win32/version.rc.in index 23b4e996d..d0021caa3 100644 --- a/llarp/win32/version.rc.in +++ b/llarp/win32/version.rc.in @@ -6,7 +6,10 @@ // // Microsoft Visual C++ generated resource script. // -#include "lokinet_resource.h" + +// clang-format off +#define lokinet_VERSION @lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@, 0 + #ifdef __GNUC__ // make windows rc accept this #include #endif @@ -72,7 +75,7 @@ BEGIN VALUE "FileVersion", "@lokinet_VERSION@" VALUE "InternalName", "lokinet" VALUE "LegalCopyright", "Copyright (c) 2018-2022 Jeff Becker, Rick V for the OPTF. This software is provided under the terms of the GPL3; see the file LICENSE for details." - VALUE "OriginalFilename", "lokinet.exe" + VALUE "OriginalFilename", "@lokinet_EXE_NAME@" VALUE "ProductName", "LokiNET for Windows" VALUE "ProductVersion", "@lokinet_VERSION@" END From 065e52ab803818d47fa85ef3ffa3ea4bf354ceb3 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 27 May 2022 11:33:44 -0400 Subject: [PATCH 4/9] move windows nsis parts for cpack into external files --- cmake/win32_installer_deps.cmake | 28 ++++++++++++++++++++-------- win32-setup/extra_create_icons.nsis | 1 + win32-setup/extra_delete_icons.nsis | 1 + win32-setup/extra_install.nsis | 7 +++++++ win32-setup/extra_preinstall.nsis | 6 ++++++ win32-setup/extra_uninstall.nsis | 5 +++++ 6 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 win32-setup/extra_create_icons.nsis create mode 100644 win32-setup/extra_delete_icons.nsis create mode 100644 win32-setup/extra_install.nsis create mode 100644 win32-setup/extra_preinstall.nsis create mode 100644 win32-setup/extra_uninstall.nsis diff --git a/cmake/win32_installer_deps.cmake b/cmake/win32_installer_deps.cmake index 81ea1eac2..825eda90f 100644 --- a/cmake/win32_installer_deps.cmake +++ b/cmake/win32_installer_deps.cmake @@ -27,14 +27,26 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "Lokinet") set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/win32-setup/lokinet.ico") set(CPACK_NSIS_DEFINES "RequestExecutionLevel admin") set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) -set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ifFileExists $INSTDIR\\\\bin\\\\tuntap-install.exe 0 +2\\nExecWait '$INSTDIR\\\\bin\\\\tuntap-install.exe /S'\\nExecWait '$INSTDIR\\\\bin\\\\lokinet.exe --install'\\nExecWait 'sc failure lokinet reset= 60 actions= restart/1000'\\nExecWait '$INSTDIR\\\\bin\\\\lokinet.exe -g C:\\\\ProgramData\\\\lokinet\\\\lokinet.ini'\\nCopyFiles '$INSTDIR\\\\share\\\\bootstrap.signed' C:\\\\ProgramData\\\\lokinet\\\\bootstrap.signed\\n") -set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "ExecWait 'net stop lokinet'\\nExecWait 'taskkill /f /t /im lokinet-gui.exe'\\nExecWait '$INSTDIR\\\\bin\\\\lokinet.exe --remove'\\nRMDir /r /REBOOTOK C:\\\\ProgramData\\\\lokinet") -set(CPACK_NSIS_CREATE_ICONS_EXTRA - "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Lokinet.lnk' '$INSTDIR\\\\share\\\\gui\\\\lokinet-gui.exe'" -) -set(CPACK_NSIS_DELETE_ICONS_EXTRA - "Delete '$SMPROGRAMS\\\\$START_MENU\\\\Lokinet.lnk'" -) + + +function(read_nsis_file filename outvar) + file(STRINGS "${filename}" _outvar) + list(TRANSFORM _outvar REPLACE "\\\\" "\\\\\\\\") + list(JOIN _outvar "\\n" out) + set(${outvar} ${out} PARENT_SCOPE) +endfunction() + +read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_preinstall.nsis" _extra_preinstall) +read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_install.nsis" _extra_install) +read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_uninstall.nsis" _extra_uninstall) +read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_create_icons.nsis" _extra_create_icons) +read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_delete_icons.nsis" _extra_delete_icons) + +set(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS "${_extra_preinstall}") +set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${_extra_install}") +set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${_extra_uninstall}") +set(CPACK_NSIS_CREATE_ICONS_EXTRA "${_extra_create_icons}") +set(CPACK_NSIS_DELETE_ICONS_EXTRA "${_extra_delete_icons}") get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified") diff --git a/win32-setup/extra_create_icons.nsis b/win32-setup/extra_create_icons.nsis new file mode 100644 index 000000000..75cc048f1 --- /dev/null +++ b/win32-setup/extra_create_icons.nsis @@ -0,0 +1 @@ +CreateShortCut '$SMPROGRAMS\$STARTMENU_FOLDER\Lokinet.lnk' '$INSTDIR\share\gui\lokinet-gui.exe' diff --git a/win32-setup/extra_delete_icons.nsis b/win32-setup/extra_delete_icons.nsis new file mode 100644 index 000000000..75cc048f1 --- /dev/null +++ b/win32-setup/extra_delete_icons.nsis @@ -0,0 +1 @@ +CreateShortCut '$SMPROGRAMS\$STARTMENU_FOLDER\Lokinet.lnk' '$INSTDIR\share\gui\lokinet-gui.exe' diff --git a/win32-setup/extra_install.nsis b/win32-setup/extra_install.nsis new file mode 100644 index 000000000..ec07fb540 --- /dev/null +++ b/win32-setup/extra_install.nsis @@ -0,0 +1,7 @@ +ifFileExists $INSTDIR\bin\tuntap-install.exe 0 +2 +ExecWait '$INSTDIR\bin\tuntap-install.exe /S' +ExecWait '$INSTDIR\bin\lokinet.exe --install' +ExecWait 'sc failure lokinet reset= 60 actions= restart/1000' +ExecWait '$INSTDIR\bin\lokinet.exe -g C:\ProgramData\lokinet\lokinet.ini' +CopyFiles '$INSTDIR\share\bootstrap.signed' C:\ProgramData\lokinet\bootstrap.signed + diff --git a/win32-setup/extra_preinstall.nsis b/win32-setup/extra_preinstall.nsis new file mode 100644 index 000000000..de3904f6f --- /dev/null +++ b/win32-setup/extra_preinstall.nsis @@ -0,0 +1,6 @@ +IfFileExists $INSTDIR\bin\lokinet.exe 0 +3 +ExecWait 'net stop lokinet' +ExecWait '$INSTDIR\bin\lokinet.exe --remove' + +IfFileExists $INSTDIR\share\gui\lokinet.exe 0 +2 +ExecWait 'taskkill /f /t /im lokinet-gui.exe' diff --git a/win32-setup/extra_uninstall.nsis b/win32-setup/extra_uninstall.nsis new file mode 100644 index 000000000..ea8664219 --- /dev/null +++ b/win32-setup/extra_uninstall.nsis @@ -0,0 +1,5 @@ +ExecWait 'net stop lokinet' +ExecWait 'taskkill /f /t /im lokinet-gui.exe' +ExecWait '$INSTDIR\bin\lokinet.exe --remove' +RMDir /r /REBOOTOK C:\ProgramData\lokinet + From 1dfc2e883b001641f5054a2bfd6940453d6658f9 Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 30 May 2022 10:29:23 -0400 Subject: [PATCH 5/9] bump verions of all deps bump submodules Fix dynamic version generation - GIT_FOUND OR Git_FOUND wasn't available because we hadn't done a find_package(Git) yet. - required version variables weren't being passed through to the cmake script --- CMakeLists.txt | 4 ++-- cmake/GenVersion.cmake | 2 +- cmake/StaticBuild.cmake | 20 ++++++++++---------- cmake/Version.cmake | 14 ++++++++++---- external/oxen-encoding | 2 +- external/oxen-mq | 2 +- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 007daf6e9..d8bb2bfae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,7 +177,7 @@ endif() option(FORCE_OXENC_SUBMODULE "force using oxen-encoding submodule" OFF) if(NOT FORCE_OXENC_SUBMODULE) - pkg_check_modules(OXENC liboxenc>=1.0.2 IMPORTED_TARGET) + pkg_check_modules(OXENC liboxenc>=1.0.3 IMPORTED_TARGET) endif() if(OXENC_FOUND) @@ -197,7 +197,7 @@ endif() option(FORCE_OXENMQ_SUBMODULE "force using oxenmq submodule" OFF) if(NOT FORCE_OXENMQ_SUBMODULE) - pkg_check_modules(OXENMQ liboxenmq>=1.2.4 IMPORTED_TARGET) + pkg_check_modules(OXENMQ liboxenmq>=1.2.12 IMPORTED_TARGET) endif() if(OXENMQ_FOUND) add_library(oxenmq::oxenmq ALIAS PkgConfig::OXENMQ) diff --git a/cmake/GenVersion.cmake b/cmake/GenVersion.cmake index 21aeab9df..9cda8b8ae 100644 --- a/cmake/GenVersion.cmake +++ b/cmake/GenVersion.cmake @@ -57,4 +57,4 @@ else() endif() endif() -configure_file("${SRC}" "${DEST}") +configure_file("${SRC}" "${DEST}" @ONLY) diff --git a/cmake/StaticBuild.cmake b/cmake/StaticBuild.cmake index c92c733b9..3ddbe9757 100644 --- a/cmake/StaticBuild.cmake +++ b/cmake/StaticBuild.cmake @@ -5,31 +5,31 @@ set(LOCAL_MIRROR "" CACHE STRING "local mirror path/URL for lib downloads") -set(OPENSSL_VERSION 1.1.1m CACHE STRING "openssl version") +set(OPENSSL_VERSION 1.1.1o CACHE STRING "openssl version") set(OPENSSL_MIRROR ${LOCAL_MIRROR} https://www.openssl.org/source CACHE STRING "openssl download mirror(s)") set(OPENSSL_SOURCE openssl-${OPENSSL_VERSION}.tar.gz) -set(OPENSSL_HASH SHA256=f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96 +set(OPENSSL_HASH SHA256=9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f CACHE STRING "openssl source hash") -set(EXPAT_VERSION 2.4.4 CACHE STRING "expat version") +set(EXPAT_VERSION 2.4.8 CACHE STRING "expat version") string(REPLACE "." "_" EXPAT_TAG "R_${EXPAT_VERSION}") set(EXPAT_MIRROR ${LOCAL_MIRROR} https://github.com/libexpat/libexpat/releases/download/${EXPAT_TAG} CACHE STRING "expat download mirror(s)") set(EXPAT_SOURCE expat-${EXPAT_VERSION}.tar.xz) -set(EXPAT_HASH SHA256=b5d25d6e373351c2ed19b562b4732d01d2589ac8c8e9e7962d8df1207cc311b8 +set(EXPAT_HASH SHA256=f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df479dcaf25 CACHE STRING "expat source hash") -set(UNBOUND_VERSION 1.14.0 CACHE STRING "unbound version") +set(UNBOUND_VERSION 1.15.0 CACHE STRING "unbound version") set(UNBOUND_MIRROR ${LOCAL_MIRROR} https://nlnetlabs.nl/downloads/unbound CACHE STRING "unbound download mirror(s)") set(UNBOUND_SOURCE unbound-${UNBOUND_VERSION}.tar.gz) -set(UNBOUND_HASH SHA256=6ef91cbf02d5299eab39328c0857393de7b4885a2fe7233ddfe3c124ff5a89c8 +set(UNBOUND_HASH SHA256=a480dc6c8937447b98d161fe911ffc76cfaffa2da18788781314e81339f1126f CACHE STRING "unbound source hash") -set(SQLITE3_VERSION 3370200 CACHE STRING "sqlite3 version") +set(SQLITE3_VERSION 3380500 CACHE STRING "sqlite3 version") set(SQLITE3_MIRROR ${LOCAL_MIRROR} https://www.sqlite.org/2022 CACHE STRING "sqlite3 download mirror(s)") set(SQLITE3_SOURCE sqlite-autoconf-${SQLITE3_VERSION}.tar.gz) -set(SQLITE3_HASH SHA3_256=3764f471d188ef4e7a70a120f6cb80014dc50bb5fa53406b566508390a32e745 +set(SQLITE3_HASH SHA3_256=ab649fea76f49a6ec7f907f001d87b8bd76dec0679c783e3992284c5a882a98c CACHE STRING "sqlite3 source hash") set(SODIUM_VERSION 1.0.18 CACHE STRING "libsodium version") @@ -62,11 +62,11 @@ set(ZLIB_SOURCE zlib-${ZLIB_VERSION}.tar.gz) set(ZLIB_HASH SHA256=91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9 CACHE STRING "zlib source hash") -set(CURL_VERSION 7.81.0 CACHE STRING "curl version") +set(CURL_VERSION 7.83.1 CACHE STRING "curl version") set(CURL_MIRROR ${LOCAL_MIRROR} https://curl.haxx.se/download https://curl.askapache.com CACHE STRING "curl mirror(s)") set(CURL_SOURCE curl-${CURL_VERSION}.tar.xz) -set(CURL_HASH SHA256=a067b688d1645183febc31309ec1f3cdce9213d02136b6a6de3d50f69c95a7d3 +set(CURL_HASH SHA256=2cb9c2356e7263a1272fd1435ef7cdebf2cd21400ec287b068396deb705c22c4 CACHE STRING "curl source hash") include(ExternalProject) diff --git a/cmake/Version.cmake b/cmake/Version.cmake index 79cc10250..6a9a8e466 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -2,12 +2,18 @@ set(VERSIONTAG "${GIT_VERSION}") set(GIT_INDEX_FILE "${PROJECT_SOURCE_DIR}/.git/index") -if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) ) +find_package(Git) +if(EXISTS "${GIT_INDEX_FILE}" AND ( GIT_FOUND OR Git_FOUND) ) message(STATUS "Found Git: ${GIT_EXECUTABLE}") + set(genversion_args "-DGIT=${GIT_EXECUTABLE}") + foreach(v lokinet_VERSION lokinet_VERSION_MAJOR lokinet_VERSION_MINOR lokinet_VERSION_PATCH RELEASE_MOTTO) + list(APPEND genversion_args "-D${v}=${${v}}") + endforeach() + add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" COMMAND "${CMAKE_COMMAND}" - "-D" "GIT=${GIT_EXECUTABLE}" + ${genversion_args} "-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "-D" "DEST=${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" @@ -15,11 +21,11 @@ if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) ) "${GIT_INDEX_FILE}") if(WIN32) foreach(exe IN ITEMS lokinet lokinet-vpn lokinet-bootstrap) - set(lokinet_EXE_NAME "${exe}.exe") add_custom_command( OUTPUT "${CMAKE_BINARY_DIR}/${exe}.rc" COMMAND "${CMAKE_COMMAND}" - "-D" "GIT=${GIT_EXECUTABLE}" + ${genversion_args} + "-D" "lokinet_EXE_NAME=${exe}.exe" "-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" "-D" "DEST=${CMAKE_BINARY_DIR}/${exe}.rc" "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" diff --git a/external/oxen-encoding b/external/oxen-encoding index b48aef693..79193e58f 160000 --- a/external/oxen-encoding +++ b/external/oxen-encoding @@ -1 +1 @@ -Subproject commit b48aef693b39a2408931c4ba25580648423c81a7 +Subproject commit 79193e58fb26624d40cd2e95156f78160f2b9b3e diff --git a/external/oxen-mq b/external/oxen-mq index 5c72a57ec..eadb37c76 160000 --- a/external/oxen-mq +++ b/external/oxen-mq @@ -1 +1 @@ -Subproject commit 5c72a57eca120750ecf557ce5a668fb38242956b +Subproject commit eadb37c7654150bef18497773718f15ef843734a From 6a2114fa1d6e123e3451d335a343d9917db13288 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Mon, 30 May 2022 14:59:12 -0300 Subject: [PATCH 6/9] Don't be dynamic for win32 rc crap --- cmake/Version.cmake | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/cmake/Version.cmake b/cmake/Version.cmake index 6a9a8e466..a017995eb 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -19,28 +19,17 @@ if(EXISTS "${GIT_INDEX_FILE}" AND ( GIT_FOUND OR Git_FOUND) ) "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${GIT_INDEX_FILE}") - if(WIN32) - foreach(exe IN ITEMS lokinet lokinet-vpn lokinet-bootstrap) - add_custom_command( - OUTPUT "${CMAKE_BINARY_DIR}/${exe}.rc" - COMMAND "${CMAKE_COMMAND}" - ${genversion_args} - "-D" "lokinet_EXE_NAME=${exe}.exe" - "-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" - "-D" "DEST=${CMAKE_BINARY_DIR}/${exe}.rc" - "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" - "${GIT_INDEX_FILE}") - endforeach() - endif() else() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY) - if(WIN32) - foreach(exe IN ITEMS lokinet lokinet-vpn lokinet-bootstrap) - set(lokinet_EXE_NAME "${exe}.exe") - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" "${CMAKE_BINARY_DIR}/${exe}.rc" @ONLY) - endforeach() - endif() +endif() + + +if(WIN32) + foreach(exe IN ITEMS lokinet lokinet-vpn lokinet-bootstrap) + set(lokinet_EXE_NAME "${exe}.exe") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" "${CMAKE_BINARY_DIR}/${exe}.rc" @ONLY) + set_property(SOURCE "${CMAKE_BINARY_DIR}/${exe}.rc" PROPERTY GENERATED 1) + endforeach() endif() add_custom_target(genversion_cpp DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp") From 73a49f54736b69770114f6c404a28d94c9429cce Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 30 May 2022 14:34:54 -0400 Subject: [PATCH 7/9] do not build liblokinet in windows, exe gets too big --- contrib/windows.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/windows.sh b/contrib/windows.sh index 32ec7aaac..7520936e9 100755 --- a/contrib/windows.sh +++ b/contrib/windows.sh @@ -17,7 +17,7 @@ cmake \ -DBUILD_PACKAGE=ON \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_TESTING=OFF \ - -DBUILD_LIBLOKINET=ON \ + -DBUILD_LIBLOKINET=OFF \ -DWITH_TESTS=OFF \ -DNATIVE_BUILD=OFF \ -DSTATIC_LINK=ON \ From 34c3b8d0deafa777fa40e2f7a06689a9c66d26aa Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Mon, 30 May 2022 17:06:27 -0300 Subject: [PATCH 8/9] Add oxen repo to bionic for updated cmake version Also rename the arg from loki_repo to oxen_repo --- .drone.jsonnet | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index d7ead8a5c..87aaf71ff 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -40,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', @@ -61,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', @@ -180,7 +180,7 @@ local linux_cross_pipeline(name, }; // 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) + ')', @@ -197,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 []) + [ @@ -338,7 +338,7 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = { 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), @@ -366,6 +366,7 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = { 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" ' + From 2576b87c5de995cc66ae47e49d2e70f2fa7de16b Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 30 May 2022 09:07:56 -0400 Subject: [PATCH 9/9] version bump to 0.9.9 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8bb2bfae..bf5e6cabd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ endif() project(lokinet - VERSION 0.9.8 + VERSION 0.9.9 DESCRIPTION "lokinet - IP packet onion router" LANGUAGES ${LANGS}) @@ -35,7 +35,7 @@ if(APPLE) set(LOKINET_APPLE_BUILD 0) endif() -set(RELEASE_MOTTO "The Current Thing" CACHE STRING "Release motto") +set(RELEASE_MOTTO "Gluten Free Edition" CACHE STRING "Release motto") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")