From 537838c8664bf16763dea1a2d83f70f873eb0536 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Sun, 26 Dec 2021 10:38:49 -0700 Subject: [PATCH] Added non-functional starsector package and working lib-ledger-core package) --- homelab.scm | 65 +++++++++++++++++++++++++++++ ledger-secp256k1.patch | 95 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 ledger-secp256k1.patch diff --git a/homelab.scm b/homelab.scm index d42a69f..cbe6336 100644 --- a/homelab.scm +++ b/homelab.scm @@ -1,10 +1,25 @@ (define-module (homelab) #:use-module ((guix licenses) #:prefix licenses:) + #:use-module (nonguix licenses) + #:use-module (gnu packages) #:use-module (gnu packages autotools) + #:use-module (gnu packages java) + #:use-module (gnu packages xorg) + #:use-module (gnu packages gl) + #:use-module (gnu packages audio) + #:use-module (gnu packages kerberos) + #:use-module (gnu packages tls) + #:use-module (gnu packages crypto) #:use-module (guix utils) + #:use-module (guix git-download) #:use-module (guix git) + #:use-module (guix gexp) + #:use-module (guix build-system cmake) + #:use-module (guix download) + #:use-module (guix extracting-download) #:use-module (guix build-system gnu) #:use-module (guix build-system copy) + #:use-module (gnu packages compression) #:use-module (guix packages)) (define-public test @@ -22,6 +37,35 @@ (home-page "http://home.noahmetz.xyz") (license licenses:gpl3+))) +(define-public lib-ledger-core + (package + (name "lib-ledger-core") + (version "4.2.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/LedgerHQ/lib-ledger-core.git") + (commit version) + (recursive? #t))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1qmn8ivysdx2j9y65y6alfmd57f7xnh9j6i6fjwijadj2lgxwxza")) + (patches (search-patches "ledger-secp256k1.patch")))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags + #~`("-DSYS_OPENSSL=ON" + ,(string-append "-DOPENSSL_ROOT_DIR=" #$openssl) + ,(string-append "-DOPENSSL_INCLUDE_DIR=" #$openssl "/include") + ,(string-append "-DOPENSSL_SSL_LIBRARIES=" #$openssl "/lib")) + #:tests? #f)) + (inputs (list (list openssl "static") (list openssl "out") libsecp256k1 mit-krb5)) + (synopsis "C++ Library for Ledger Hardware Wallets") + (description "C++ Library for Ledger Hardware Wallets") + (home-page "https://www.ledger.com/") + (license licenses:expat))) + (define-public vim-guile (package (name "vim-guile") @@ -68,3 +112,24 @@ - Write documentation - Maintain a diary - Export everything to HTML"))) + +(define-public starsector + (package + (name "starsector") + (version "0.95.1a-RC6") + (source (origin + (method url-fetch) + (uri (string-append "https://s3.amazonaws.com/fractalsoftworks/starsector/starsector_linux-" version ".zip")) + (sha256 + (base32 "14zxzs7xfrrq3apiyslk2cy29yp6qirikwbzanmka74a37aqpa1x")))) + (native-inputs (list unzip)) + (inputs (list openjdk17 libxcursor libxrandr libxxf86vm mesa openal)) + (propagated-inputs (list xrandr)) + (build-system copy-build-system) + (arguments + '(#:install-plan + '(("." "share/starsector")))) + (synopsis "A space game.") + (description "A very good space game. You will spend hours playing.") + (home-page "https://fractalsoftworks.com") + (license nonfree))) diff --git a/ledger-secp256k1.patch b/ledger-secp256k1.patch new file mode 100644 index 0000000..c4cd311 --- /dev/null +++ b/ledger-secp256k1.patch @@ -0,0 +1,95 @@ +diff --git a/core/lib/CMakeLists.txt b/core/lib/CMakeLists.txt +index 3e25309e4..984765bf9 100644 +--- a/core/lib/CMakeLists.txt ++++ b/core/lib/CMakeLists.txt +@@ -6,7 +6,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + #list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/leveldb") + + +-include(ProjectSecp256k1) + add_subdirectory(bigd) + add_subdirectory(fmt) + if (SYS_OPENSSL) +diff --git a/core/src/CMakeLists.txt b/core/src/CMakeLists.txt +index 78f018827..53a877c84 100644 +--- a/core/src/CMakeLists.txt ++++ b/core/src/CMakeLists.txt +@@ -143,10 +143,7 @@ target_compile_definitions(ledger-core-interface INTERFACE SPDLOG_WCHAR_FILENAME + target_link_libraries(ledger-core-interface INTERFACE spdlog) + + #Secp256k1 +-target_link_libraries(ledger-core-interface INTERFACE +- "${CMAKE_SOURCE_DIR}/core/lib/secp256k1/lib/${CMAKE_STATIC_LIBRARY_PREFIX}secp256k1${CMAKE_STATIC_LIBRARY_SUFFIX}") +-link_directories("${CMAKE_SOURCE_DIR}/core/lib/secp256k1/lib") +-add_dependencies(ledger-core-interface INTERFACE secp256k1) ++target_link_libraries(ledger-core-interface INTERFACE secp256k1) + + target_link_libraries(ledger-core-interface INTERFACE ethash) + +@@ -194,7 +191,6 @@ target_include_directories(ledger-core-interface INTERFACE ../lib/leveldb/includ + target_include_directories(ledger-core-interface INTERFACE ../lib/boost) + target_include_directories(ledger-core-interface INTERFACE ../lib/cereal/) + target_include_directories(ledger-core-interface INTERFACE ../lib/date/) +-target_include_directories(ledger-core-interface INTERFACE ../lib/secp256k1) + target_include_directories(ledger-core-interface INTERFACE ../lib/ethash/src) + target_include_directories(ledger-core-interface INTERFACE ../lib/CRCpp/inc) + +diff --git a/core/src/crypto/SECP256k1Point.cpp b/core/src/crypto/SECP256k1Point.cpp +index 254b437f8..02cdedafe 100644 +--- a/core/src/crypto/SECP256k1Point.cpp ++++ b/core/src/crypto/SECP256k1Point.cpp +@@ -31,7 +31,7 @@ + #include "SECP256k1Point.hpp" + #include "../utils/Exception.hpp" + #include +-#include ++#include + #include + + namespace ledger { +diff --git a/core/src/crypto/SECP256k1Point.hpp b/core/src/crypto/SECP256k1Point.hpp +index 96ecbfb8c..808c23470 100644 +--- a/core/src/crypto/SECP256k1Point.hpp ++++ b/core/src/crypto/SECP256k1Point.hpp +@@ -31,7 +31,7 @@ + #ifndef LEDGER_CORE_SECP256K1POINT_HPP + #define LEDGER_CORE_SECP256K1POINT_HPP + +-#include ++#include + #include "../math/BigInt.h" + #include + +diff --git a/core/src/crypto/Secp256k1Api.cpp b/core/src/crypto/Secp256k1Api.cpp +index 4fb261156..7403c93f2 100644 +--- a/core/src/crypto/Secp256k1Api.cpp ++++ b/core/src/crypto/Secp256k1Api.cpp +@@ -5,7 +5,7 @@ + #include "Secp256k1Api.h" + #include "utils/Exception.hpp" + #include "utils/hex.h" +-#include "include/secp256k1.h" ++#include "secp256k1.h" + + namespace ledger { + namespace core { +@@ -84,4 +84,4 @@ namespace ledger { + return std::make_shared(); + } + } +-} +\ No newline at end of file ++} +diff --git a/core/src/crypto/Secp256k1Api.h b/core/src/crypto/Secp256k1Api.h +index a8752147d..bd610f428 100644 +--- a/core/src/crypto/Secp256k1Api.h ++++ b/core/src/crypto/Secp256k1Api.h +@@ -6,7 +6,7 @@ + #define LEDGER_CORE_SECP256K1API_H + + #include +-#include ++#include + + namespace ledger { + namespace core {