From 3b2fd54b516a3df3155e153860b2321d9caee039 Mon Sep 17 00:00:00 2001 From: Marek Paśnikowski Date: Tue, 19 Mar 2024 18:01:12 +0100 Subject: Fully modularize the komodo-wallet definition --- private/komodo/komodo.scm | 157 +++++++++++++++++++++++++++++----------------- 1 file changed, 98 insertions(+), 59 deletions(-) diff --git a/private/komodo/komodo.scm b/private/komodo/komodo.scm index c78a5f7091..1e254a5340 100644 --- a/private/komodo/komodo.scm +++ b/private/komodo/komodo.scm @@ -43,6 +43,65 @@ #+ (local-file "komodo-libsodium-sodiumconfig.cmake.in") "sodiumConfig.cmake.in")))))))) +(define komodo-wallet-version "0.7.0-beta") + +;;; Git References + +(define expected-git-reference + (git-reference (url "https://github.com/TartanLlama/expected") + (commit "v1.1.0") + (recursive? #t))) + +(define komodo-wallet-git-reference + (git-reference (url "https://github.com/KomodoPlatform/komodo-wallet-desktop") + (commit komodo-wallet-version))) + +;;; Hashes + +(define expected-hash + (content-hash "17akrv80h0n4cfmxwvlvbb8ycqza7y3qqygjyphv95rrabqm9r02")) + +(define jl777-coins-hash + (content-hash "1icbd6f8nridzc93vz7hsr5dnkrf328zfsw6rrzifc7nvsr559w8")) + +(define komodo-wallet-hash + (content-hash "0pfkgas0xkixf99zqzyri80ksp89b7dw7hbcgpp60ni2cnchxk2n")) + +(define mm2-hash + (content-hash "1bn2sjcrp9ih44h3p96prnwg74aids7fgzcnlv3c68nan6y2lysi")) + +;;; Package Origins + +(define expected-file-name + (git-file-name "libexpected" "1.1.0")) + +(define expected-patches + (search-patches "libexpected-use-provided-catch2.patch")) + +(define expected-origin + (origin (uri expected-git-reference) + (method git-fetch) + (hash expected-hash) + (file-name expected-file-name) + (patches expected-patches))) + +(define jl777-coins-origin + (origin (uri "https://github.com/KomodoPlatform/coins/archive/master.zip") + (method url-fetch) + (hash jl777-coins-hash))) + +(define komodo-wallet-origin + (origin (uri komodo-wallet-git-reference) + (method git-fetch) + (hash komodo-wallet-hash))) + +(define mm2-origin + (origin (uri "https://sdk.devbuilds.komodo.earth/main/mm2_b0fd99e-linux-x86-64.zip") + (method url-fetch) + (hash mm2-hash))) + +;;; Path Constructors + (define build-deps-prefix "../build/_deps/") (define expected-src "expected-src/") @@ -51,8 +110,6 @@ (define mm2-src "mm2-src/") -(define komodo-wallet-version "0.7.0-beta") - (define build-path-mm2 (string-append build-deps-prefix mm2-src)) @@ -65,67 +122,54 @@ (string-append build-deps-prefix expected-src)) -(define komodo-wallet-configure-flags - '(list "-Wno-dev" - "-DFETCHCONTENT_FULLY_DISCONNECTED=ON")) +;;; Phase Definitions -(define komodo-wallet-git-reference - (git-reference (url "https://github.com/KomodoPlatform/komodo-wallet-desktop") - (commit komodo-wallet-version))) +(define prepare-build-paths + `(string-append "file(MAKE_DIRECTORY \"" ,build-path-expected "\")\n" + "file(MAKE_DIRECTORY \"" ,build-path-jl777-coins "\")\n" + "file(MAKE_DIRECTORY \"" ,build-path-mm2 "\")\n")) -(define komodo-wallet-hash - (content-hash "0pfkgas0xkixf99zqzyri80ksp89b7dw7hbcgpp60ni2cnchxk2n")) +(define prepare-expected-src + `(string-append "file(COPY " ,expected-origin "/ " + "DESTINATION " ,build-path-expected " " + "NO_SOURCE_PERMISSIONS FOLLOW_SYMLINK_CHAIN)\n")) + +(define prepare-jl777-coins-src + `(string-append "file(ARCHIVE_EXTRACT INPUT " ,jl777-coins-origin " " + "DESTINATION " ,build-path-jl777-coins ")\n" + "file(COPY " ,build-path-jl777-coins "/coins-master/ " + "DESTINATION " ,build-path-jl777-coins ")\n")) + +(define prepare-mm2-src + `(string-append "file(ARCHIVE_EXTRACT INPUT " ,mm2-origin " " + "DESTINATION " ,build-path-mm2 ")\n")) -(define delete-vcpkg +(define vcpkg-replacement + `(string-append "\n" + ,prepare-build-paths + ,prepare-expected-src + ,prepare-jl777-coins-src + ,prepare-mm2-src + "\n")) + +(define replace-vcpkg `(substitute* "CMakeLists.txt" (("include\\(vcpkg_prerequisites\\)") - (string-append - "\nfile(MAKE_DIRECTORY \"" ,build-path-expected "\")\n" - "file(MAKE_DIRECTORY \"" ,build-path-jl777-coins "\")\n" - "file(MAKE_DIRECTORY \"" ,build-path-mm2 "\")\n" - "file(COPY " - ,(origin - (uri - (git-reference - (url - "https://github.com/TartanLlama/expected") - (commit "v1.1.0") - (recursive? #t))) - (method git-fetch) - (hash - (content-hash - "17akrv80h0n4cfmxwvlvbb8ycqza7y3qqygjyphv95rrabqm9r02")) - (file-name (git-file-name "libexpected" "1.1.0")) - (patches - (search-patches "libexpected-use-provided-catch2.patch"))) - "/ " " DESTINATION " ,build-path-expected - " NO_SOURCE_PERMISSIONS" - " FOLLOW_SYMLINK_CHAIN)\n" - "file(ARCHIVE_EXTRACT INPUT " - ,(origin - (uri "https://github.com/KomodoPlatform/coins/archive/master.zip") - (method url-fetch) - (hash - (content-hash - "1icbd6f8nridzc93vz7hsr5dnkrf328zfsw6rrzifc7nvsr559w8"))) - " DESTINATION " ,build-path-jl777-coins " )\n" - "file(COPY " ,build-path-jl777-coins "/coins-master/ " - "DESTINATION " ,build-path-jl777-coins ")\n" - "file(ARCHIVE_EXTRACT INPUT " - ,(origin - (uri - "https://sdk.devbuilds.komodo.earth/main/mm2_b0fd99e-linux-x86-64.zip") - (method url-fetch) - (hash - (content-hash - "1bn2sjcrp9ih44h3p96prnwg74aids7fgzcnlv3c68nan6y2lysi"))) - " DESTINATION " ,build-path-mm2 ")\n")))) + ,vcpkg-replacement))) + +;;; Build Arguments + +(define komodo-wallet-configure-flags + '(list "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" + "-Wno-dev")) (define komodo-wallet-phases #~ (modify-phases %standard-phases (add-after 'unpack 'delete-vcpkg - (lambda _ #+ delete-vcpkg)))) + (lambda _ #+ replace-vcpkg)))) + +;;; Package Definitions (define komodo-wallet-arguments (list #:phases komodo-wallet-phases @@ -135,18 +179,13 @@ (string-append "Komodo Wallet is a secure wallet and non-custodial " "decentralized exchange rolled into one application. Store " "your coins, trade peer-to-peer with minimal fees and never " - "control over your digital assets.")) + "give up control over your digital assets.")) (define komodo-wallet-native-inputs (list boost cpprestsdk date doctest entt fmt git libsodium-komodo nlohmann-json openssl qtcharts qtdeclarative-5 qttools-5 qtsvg-5 qtwebengine-5 range-v3 spdlog zlib)) -(define komodo-wallet-origin - (origin (uri komodo-wallet-git-reference) - (method git-fetch) - (hash komodo-wallet-hash))) - (define-public komodo-wallet (package (name "komodo-wallet") -- cgit v1.2.3