(define-module (komodo) #:use-module (cpprestsdk) #:use-module (doom-meta) #:use-module (gnu packages) #:use-module (gnu packages autotools) #:use-module (gnu packages boost) #:use-module (gnu packages calendar) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages cpp) #:use-module (gnu packages crypto) #:use-module (gnu packages game-development) #:use-module (gnu packages logging) #:use-module (gnu packages perl) #:use-module (gnu packages pretty-print) #:use-module (gnu packages python) #:use-module (gnu packages qt) #:use-module (gnu packages tls) #:use-module (gnu packages version-control) #:use-module (guix build utils) #:use-module (guix build-system cmake) #:use-module (guix build-system copy) #:use-module (guix build-system gnu) #:use-module (guix build-system qt) #:use-module (guix download) #:use-module (guix gexp) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (refl-cpp) #:use-module (strong-type) #:use-module (taskflow-2)) ;;; DATA LAYER (define build-deps-prefix "../build/_deps/") (define entt-komodo-version "v3.5.1") (define entt-komodo-git-reference-url "https://github.com/KomodoPlatform/entt") (define entt-komodo-hash "16lqn4sa4yqkywqp35y0ydqwn8jsz0q98m4xyi352sppq0x3x941") (define expected-hash "17akrv80h0n4cfmxwvlvbb8ycqza7y3qqygjyphv95rrabqm9r02") (define expected-src "expected-src/") (define jl777-coins-hash "1icbd6f8nridzc93vz7hsr5dnkrf328zfsw6rrzifc7nvsr559w8") (define jl777-coins-src "jl777-coins-src/") (define komodo-wallet-hash "0rc33ivcmgqnlzvx5z589wlcdr2ivj645mrzvcvlan33lqf04441") (define komodo-wallet-home-page "https://atomicdex.io/") (define komodo-wallet-description-lines (list "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 give up control over your " "digital assets.")) (define komodo-wallet-name "komodo-wallet") (define komodo-wallet-synopsis-lines (list "Komodo Wallet Desktop GUI")) (define komodo-wallet-version "0.7.1-beta") (define libsodium-files-source "ports/libsodium/") (define libsodium-files-target ".") (define libsodium-komodo-hash "135z5xx0cksqhka3dk9nz5zhiqvp1bdsmar7l2ajy0528w86gssc") (define libsodium-komodo-files-commit "main") (define libsodium-komodo-files-url "https://github.com/KomodoPlatform/vcpkg-custom-ports.git") (define libsodium-komodo-files-hash "0nw78mmncjbgl7cjpbcy9wkch7hlqaavr03n9ls6nkjacx3klyy6") (define libsodium-komodo-git-reference-commit "1.0.18") (define libsodium-komodo-git-reference-url "https://github.com/jedisct1/libsodium") (define mm2-hash "1bn2sjcrp9ih44h3p96prnwg74aids7fgzcnlv3c68nan6y2lysi") (define mm2-src "mm2-src/") (define wally-description-lines (list "Wally is a cross-platform, cross-language collection of useful " "primitives for cryptocurrency wallets.")) (define wally-git-url "https://github.com/KomodoPlatform/libwally-core.git") (define wally-hash "1c3w3qdg4l30wvijzi1rf4p0jynwdpb99x717h4v2i6fw140sz7f") (define wally-home-page "https://github.com/ElementsProject/libwally-core") (define wally-name "wally") (define wally-synopsis-lines (list "Useful primitives for wallets")) (define wally-version "release_0.7.7") ;;; ABSTRACTION LAYER -8 (define expected-file-name (git-file-name "libexpected" "1.1.0")) (define expected-git-reference (git-reference (url "https://github.com/TartanLlama/expected") (commit "v1.1.0") (recursive? #t))) (define expected-patches (search-patches "libexpected-use-provided-catch2.patch")) (define komodo-wallet-git-reference (git-reference (url "https://github.com/KomodoPlatform/komodo-wallet-desktop") (commit komodo-wallet-version))) (define expected-content-hash (content-hash (base32 expected-hash))) (define jl777-coins-content-hash (content-hash (base32 jl777-coins-hash))) (define komodo-wallet-content-hash (content-hash (base32 komodo-wallet-hash))) (define mm2-content-hash (content-hash (base32 mm2-hash))) ;;; ABSTRACTION LAYER -7 (define build-path-mm2 (string-append build-deps-prefix mm2-src)) (define build-path-jl777-coins (string-append build-deps-prefix jl777-coins-src)) (define build-path-expected (string-append build-deps-prefix expected-src)) (define expected-origin (origin (uri expected-git-reference) (method git-fetch) (hash expected-content-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-content-hash))) (define komodo-wallet-origin (origin (uri komodo-wallet-git-reference) (method git-fetch) (hash komodo-wallet-content-hash))) (define mm2-origin (origin (uri "https://sdk.devbuilds.komodo.earth/main/mm2_b0fd99e-linux-x86-64.zip") (method url-fetch) (hash mm2-content-hash))) ;;; ABSTRACTION LAYER -6 (define libsodium-files `(list ,libsodium-files-source ,libsodium-files-target)) (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 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")) ;;; ABSTRACTION LAYER -5 (define vcpkg-replacement `(string-append "\n" ,prepare-build-paths ,prepare-expected-src ,prepare-jl777-coins-src ,prepare-mm2-src "\n")) (define libsodium-komodo-file-transfer `(copy-recursively (assoc-ref inputs "libsodium-komodo-files") ".")) (define libsodium-komodo-files-content-hash (content-hash (base32 libsodium-komodo-files-hash))) (define libsodium-komodo-files-git-reference (git-reference (url libsodium-komodo-files-url) (commit libsodium-komodo-files-commit))) (define libsodium-komodo-files-install-plan `(list ,libsodium-files)) ;;; ABSTRACTION LAYER -4 (define libsodium-komodo-content-hash (content-hash (base32 libsodium-komodo-hash))) (define libsodium-komodo-files-arguments (list #:install-plan libsodium-komodo-files-install-plan)) (define libsodium-komodo-files-origin (origin (uri libsodium-komodo-files-git-reference) (method git-fetch) (hash libsodium-komodo-files-content-hash))) (define libsodium-komodo-transfer-files `(add-after 'unpack 'transfer-files (lambda* (#:key inputs #:allow-other-keys) ,libsodium-komodo-file-transfer))) (define fix-date `(substitute* "cmake/dependencies.cmake" (("date-tz") "date"))) (define fix-doom-meta `(substitute* (list "vendor/antara-gaming_sdk/modules/event/CMakeLists.txt" "vendor/antara-gaming_sdk/modules/ecs/CMakeLists.txt") (("doom::meta") "doom"))) (define replace-vcpkg `(substitute* "CMakeLists.txt" (("include\\(vcpkg_prerequisites\\)") ,vcpkg-replacement))) (define wally-git-commit wally-version) (define wally-hash-get (content-hash (base32 wally-hash))) ;;; ABSTRACTION LAYER -3 (define cmake-modification `(lambda _ ,replace-vcpkg ,fix-date ,fix-doom-meta)) (define entt-komodo-content-hash-get (content-hash (base32 entt-komodo-hash))) (define libsodium-komodo-files (package (inherit libsodium) (name "libsodium-komodo-files") (source libsodium-komodo-files-origin) (build-system copy-build-system) (arguments libsodium-komodo-files-arguments))) (define libsodium-komodo-phases `(modify-phases %standard-phases ,libsodium-komodo-transfer-files)) (define entt-komodo-git-reference-get (git-reference (url entt-komodo-git-reference-url) (commit entt-komodo-version))) (define libsodium-komodo-git-reference (git-reference (url libsodium-komodo-git-reference-url) (commit libsodium-komodo-git-reference-commit))) (define wally-git-reference-get (git-reference (url wally-git-url) (commit wally-git-commit))) ;;; ABSTRACTION LAYER -2 (define entt-komodo-origin-get (origin (uri entt-komodo-git-reference-get) (method git-fetch) (hash entt-komodo-content-hash-get))) (define get-wally-name wally-name) (define get-wally-origin (origin (uri wally-git-reference-get) (method git-fetch) (hash wally-hash-get))) (define get-wally-version wally-version) (define libsodium-komodo-arguments (list #:phases libsodium-komodo-phases)) (define libsodium-komodo-native-inputs-get (list autoconf automake libsodium-komodo-files libtool python)) (define libsodium-komodo-origin-get (origin (uri libsodium-komodo-git-reference) (method git-fetch) (hash libsodium-komodo-content-hash))) (define modify-cmake-configuration `(add-after 'unpack 'delete-vcpkg ,cmake-modification)) (define wally-description-get (string-concatenate wally-description-lines)) (define wally-home-page-get wally-home-page) (define wally-native-inputs-get (list autoconf automake libtool python python-2)) (define wally-synopsis-get (string-concatenate wally-synopsis-lines)) ;;; ABSTRACTION LAYER -1 (define-public entt-komodo (package (inherit entt) (name "entt-komodo") (version entt-komodo-version) (source entt-komodo-origin-get) (arguments (list #:configure-flags '(list "-DBUILD_TESTING=OFF" "-DFIND_GTEST_PACKAGE=OFF" "-DBUILD_DOCS=OFF") #:tests? #f)))) (define komodo-wallet-configure-flags '(list "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-Wno-dev")) (define komodo-wallet-phases #~(modify-phases %standard-phases #+modify-cmake-configuration)) (define libsodium-komodo (package (inherit libsodium) (name "libsodium-komodo") (source libsodium-komodo-origin-get) (build-system cmake-build-system) (arguments libsodium-komodo-arguments) (native-inputs libsodium-komodo-native-inputs-get))) (define spdlog-1.8 (package (inherit spdlog) (version "1.8.5") (source (origin (uri (git-reference (url "https://github.com/gabime/spdlog") (commit (string-append "v" version)))) (method git-fetch) (file-name (git-file-name "spdlog" version)) (sha256 (base32 "179krvg5sad6dviqpcjwg6czzknnilqszrg1d0fgp12h6sy66vqg")))) (arguments (list #:configure-flags '(list "-DSPDLOG_BUILD_BENCH=OFF" "-DSPDLOG_BUILD_SHARED=OFF") #:tests? #f)))) (define wally (package (name get-wally-name) (version get-wally-version) (source get-wally-origin) (build-system gnu-build-system) (native-inputs wally-native-inputs-get) (synopsis wally-synopsis-get) (description wally-description-get) (license license:expat) (home-page wally-home-page-get))) ;;; ABSTRACTION LAYER 0 (define komodo-wallet-arguments (list #:phases komodo-wallet-phases #:configure-flags komodo-wallet-configure-flags)) (define komodo-wallet-description (string-concatenate komodo-wallet-description-lines)) (define komodo-wallet-native-inputs (list boost cpprestsdk date doctest doom-meta entt-komodo fmt git libsodium-komodo nlohmann-json openssl perl python qtcharts qtdeclarative-5 qttools-5 qtsvg-5 qtwebengine-5 range-v3 refl-cpp spdlog-1.8 strong-type taskflow-2 wally zlib)) (define komodo-wallet-synopsis (string-concatenate komodo-wallet-synopsis-lines)) ;;; SURFACE LAYER (define-public komodo-wallet (package (name komodo-wallet-name) (version komodo-wallet-version) (source komodo-wallet-origin) (build-system qt-build-system) (arguments komodo-wallet-arguments) (native-inputs komodo-wallet-native-inputs) (synopsis komodo-wallet-synopsis) (description komodo-wallet-description) (license license:gpl2) (home-page komodo-wallet-home-page)))