(define-module (packages komodo komodo) #:use-module (packages komodo cpprestsdk) #:use-module (packages komodo 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 ninja) #: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 (packages komodo komodo-vcpkg-ports) #:use-module (packages komodo libsodium) #:use-module (packages komodo qaterial) #:use-module (packages komodo refl-cpp) #:use-module (packages komodo sortfilterproxymodel) #:use-module (packages komodo spdlog) #:use-module (packages komodo strong-type) #:use-module (packages komodo taskflow-2) #:use-module (packages komodo wally)) ;;; 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 "1svwwly61qy41xcvyz529fcfz6j4h3fgac34v1r4bc7jhjk0wm8a") (define jl777-coins-src "jl777-coins-src/") (define komodo-wallet-hash "1gsw8kiz7r68yhzhvmcgrzaly8981nw9p7n8vmqmhdxl4av41sqd") (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 mm2-hash "1bn2sjcrp9ih44h3p96prnwg74aids7fgzcnlv3c68nan6y2lysi") (define mm2-src "mm2-src/") ;;; 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) (recursive? #t))) (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) (modules '((guix build utils))) (snippet '(begin (substitute* "cmake/antara.cmake" (("if \\(LINUX\\)") "if (NOT LINUX)")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("if \\(EXISTS \\$\\{LINUX_DEPLOY_PATH\\}\\)") "if (NOT EXISTS ${LINUX_DEPLOY_PATH})")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("\"/usr/lib/x86_64-linux-gnu/libsmime3.so\"") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("\"/usr/lib/x86_64-linux-gnu/libssl3.so\"") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("\"/usr/lib/x86_64-linux-gnu/nss/libfreebl3.chk\"") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("\"/usr/lib/x86_64-linux-gnu/nss/libfreebl3.so\"") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("\"/usr/lib/x86_64-linux-gnu/nss/libnssdbm3.chk\"") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("\"/usr/lib/x86_64-linux-gnu/nss/libnssdbm3.so\"") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("\"/usr/lib/x86_64-linux-gnu/nss/libsoftokn3.chk\"") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("\"/usr/lib/x86_64-linux-gnu/nss/libsoftokn3.so\"") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("\"/usr/lib/x86_64-linux-gnu/nss/\"") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("file\\(COPY \\$\\{current_lib\\} DESTINATION \\$\\{PROJECT_LIB_PATH\\}\\)") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("file\\(RENAME \\$\\{CMAKE_SOURCE_DIR\\}\\/\\$\\{DEX_PROJECT_NAME\\}-\\$\\{VERSION_ID\\}-x86_64.AppImage \\$\\{CMAKE_SOURCE_DIR\\}\\/\\$\\{DEX_PROJECT_NAME\\}-linux-\\$\\{VERSION_ID\\}-x86_64.AppImage\\)") "")) (substitute* "cmake/install/linux/linux_post_install.cmake" (("file\\(COPY \\$\\{CMAKE_SOURCE_DIR\\}\\/\\$\\{DEX_PROJECT_NAME\\}-linux-\\$\\{VERSION_ID\\}-x86_64.AppImage DESTINATION \\$\\{TARGET_APP_PATH\\}\\)") "")) (substitute* "cmake/install/linux/dex_install.cmake" (("if \\(LINUX\\)") "if (NOT LINUX)")))))) (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 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")) ;;; ABSTRACTION LAYER -4 (define fix-date `(substitute* "cmake/dependencies.cmake" (("date::date-tz") "date-tz"))) (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_meta"))) (define include-nlohmann `(substitute* "src/core/atomicdex/config/electrum.cfg.hpp" (("STD") "STD\n#include "))) (define link-libraries `(substitute* "cmake/dependencies.cmake" (("ALIAS refl-cpp\\)") (string-append "ALIAS refl-cpp)\n" "add_library(strong_type INTERFACE)\n" "target_link_libraries(strong_type INTERFACE strong_type)\n" "add_library(doom_meta INTERFACE)\n" "target_link_libraries(doom_meta INTERFACE doom_meta)\n" "add_library(SortFilterProxyModel INTERFACE)\n" "target_link_libraries(SortFilterProxyModel INTERFACE SortFilterProxyModel)\n")))) (define remove-unity `(substitute* "src/CMakeLists.txt" (("UNITY_BUILD ON") "UNITY_BUILD ON"))) (define replace-vcpkg `(substitute* "CMakeLists.txt" (("include\\(vcpkg_prerequisites\\)") ,vcpkg-replacement))) ;;; ABSTRACTION LAYER -3 (define cmake-modification `(lambda _ ,replace-vcpkg ,fix-date ,fix-doom-meta ,remove-unity ,include-nlohmann ,link-libraries)) (define entt-komodo-content-hash-get (content-hash (base32 entt-komodo-hash))) (define entt-komodo-git-reference-get (git-reference (url entt-komodo-git-reference-url) (commit entt-komodo-version))) ;;; 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 modify-cmake-configuration `(add-after 'unpack 'delete-vcpkg ,cmake-modification)) ;;; ABSTRACTION LAYER -1 (define date-komodo (package (inherit date) (version "v3.0.0") (source (origin (uri (git-reference (url "https://github.com/KomodoPlatform/date") (commit "cac99da8dc88be719a728dc1b597b0ac307c1800"))) (method git-fetch) (sha256 (base32 "1qvlx6yzjsacj8zwl8k43cm00l1c41xdp1fqm8sq7ilglw06x8jk")))) (arguments (list #:configure-flags '(list "-DUSE_SYSTEM_TZ_DB=ON" "-DBUILD_SHARED_LIBS=ON" "-DBUILD_TZ_LIB=ON" "-DENABLE_DATE_TESTING=ON" "-DCMAKE_BUILD_TYPE=MinSizeRel") #:tests? #f)))) (define 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" "-DCMAKE_BUILD_TYPE=MinSizeRel" "-GNinja")) (define komodo-wallet-phases #~(modify-phases %standard-phases #+modify-cmake-configuration (replace 'build (lambda _ (invoke "ninja" "install"))) ;;(delete 'install) )) ;;; ABSTRACTION LAYER 0 (define komodo-wallet-arguments (list #:phases komodo-wallet-phases #:configure-flags komodo-wallet-configure-flags #:tests? #f)) (define komodo-wallet-description (string-concatenate komodo-wallet-description-lines)) (define komodo-wallet-inputs (list boost cpprestsdk date-komodo doctest doom-meta entt-komodo fmt git libsodium-komodo ninja nlohmann-json openssl perl python qaterial qtcharts qtdeclarative-5 qttools-5 qtsvg-5 qtwebengine-5 range-v3 refl-cpp sortfilterproxymodel 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) (inputs komodo-wallet-inputs) (synopsis komodo-wallet-synopsis) (description komodo-wallet-description) (license license:gpl2) (home-page komodo-wallet-home-page)))