(define-module (throne deps) #:use-module (guix packages) #:use-module (guix git-download) #:use-module (guix download) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix gexp) #:use-module (guix utils) #:use-module (gnu packages base) #:use-module (gnu packages qt) #:use-module (gnu packages cpp) #:use-module (gnu packages protobuf) #:use-module (gnu packages databases) #:use-module (gnu packages commencement) #:use-module (gnu packages sdl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages compression) #:use-module (gnu packages elf) #:export (throne)) (define quirc (package (name "quirc") (version "1.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/dlbeer/quirc.git") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1pbym7cf34z9za31bdpbi52snklp11jal4axddbk5pppl9hbznnd")))) (build-system gnu-build-system) (native-inputs (list gcc-toolchain pkg-config sdl12-compat)) (arguments (list #:tests? #f #:phases #~(modify-phases %standard-phases (delete 'configure) (replace 'build (lambda _ (invoke "make" "CC=gcc" "libquirc.so"))) (replace 'install (lambda _ (let ((out (assoc-ref %outputs "out"))) (mkdir-p (string-append out "/lib")) (mkdir-p (string-append out "/include")) (install-file "libquirc.so.1.2" (string-append out "/lib")) (symlink (string-append out "/lib/libquirc.so.1.2") (string-append out "/lib/libquirc.so.1")) (symlink (string-append out "/lib/libquirc.so.1.2") (string-append out "/lib/libquirc.so")) (install-file "lib/quirc.h" (string-append out "/include")))))))) (synopsis "QR code recognition library") (description "Quirc is a QR code recognition library.") (home-page "https://github.com/dlbeer/quirc") (license license:isc))) (define fkyaml (package (name "fkyaml") (version "0.4.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/fktn-k/fkYAML.git") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1aq658bj2bay31j5300pyxwc2aqpnx4ycgr684b7bb1kcvm4a80i")))) (build-system cmake-build-system) (arguments (list #:tests? #f)) (synopsis "Header-only YAML library for C++") (description "fkYAML is a header-only YAML library for C++.") (home-page "https://github.com/fktn-k/fkYAML") (license license:expat))) (define simple-protobuf (package (name "simple-protobuf") (version "0.0.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/tonda-kriz/simple-protobuf.git") (commit "master"))) (file-name (git-file-name name version)) (sha256 (base32 "1l66dd57b8f6whmaf023b9w1kfqpvqx7nr8gn7y5rq0s0afpsz7k")))) (build-system cmake-build-system) (arguments (list #:tests? #f)) (synopsis "Simple protobuf implementation") (description "Simple protobuf implementation.") (home-page "https://github.com/tonda-kriz/simple-protobuf") (license license:expat))) (define srslist (origin (method url-fetch) (uri "https://raw.githubusercontent.com/throneproj/routeprofiles/rule-set/srslist.h") (sha256 (base32 "0c3lnd3s524wihiln5pr8iyrj0jwsyjc346mm2kfsp86kapw3dw8")))) (define throne-core (origin (method url-fetch) (uri "https://github.com/throneproj/Throne/releases/download/1.2.4/Throne-1.2.4-linux-amd64.zip") (sha256 (base32 "13j47z829frk6qs5d6znsxx8kl4gymbhj3y8fpbjpgk6iprr07cj")))) (define throne (package (name "throne") (version "1.2.4") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/throneproj/Throne.git") (commit version) (recursive? #t))) (file-name (git-file-name name version)) (sha256 (base32 "1w137s2hcvdqvk67yhyddbc8klb8z6l0b3y7y2b3g9pb33gr8dkw")))) (build-system cmake-build-system) (native-inputs `(("pkg-config" ,pkg-config) ("srslist.h" ,srslist) ("throne-core" ,throne-core) ("unzip" ,unzip) ("patchelf" ,patchelf) ("glibc" ,glibc))) (inputs (list qtbase qtdeclarative qtsvg qttools abseil-cpp protobuf qhotkey quirc fkyaml sqlitecpp simple-protobuf)) (arguments (list #:tests? #f #:validate-runpath? #f #:configure-flags #~'("-DNKR_PACKAGE=true") #:phases #~(modify-phases %standard-phases (add-after 'unpack 'patch-core-path (lambda _ (substitute* '("src/global/Configs.cpp" "src/ui/mainWindow/mainwindow_setup.cpp") (("auto fn = QApplication::applicationDirPath\\(\\) \\+ \"/ThroneCore\";") "auto fn = QFileInfo::exists(\"/run/privileged/bin/ThroneCore\") ? QString(\"/run/privileged/bin/ThroneCore\") : QApplication::applicationDirPath() + \"/ThroneCore\";") (("auto core_path = QApplication::applicationDirPath\\(\\) \\+ \"/\";") "auto core_path = QFileInfo::exists(\"/run/privileged/bin/ThroneCore\") ? QString(\"/run/privileged/bin/ThroneCore\") : QApplication::applicationDirPath() + \"/\";") (("core_path \\+= \"ThroneCore\";") "if (!QFileInfo::exists(\"/run/privileged/bin/ThroneCore\")) core_path += \"ThroneCore\";")))) (add-after 'unpack 'fetch-srslist (lambda _ (copy-file (assoc-ref %build-inputs "srslist.h") "srslist.h"))) (replace 'install (lambda _ (let* ((out (assoc-ref %outputs "out")) (bin (string-append out "/bin")) (libexec (string-append out "/libexec")) (core-archive (assoc-ref %build-inputs "throne-core")) (core-path "throne-core/ThroneCore") (glibc-path (assoc-ref %build-inputs "glibc"))) (mkdir-p bin) (mkdir-p libexec) (copy-file "Throne" (string-append libexec "/Throne")) (chmod (string-append libexec "/Throne") #o555) (symlink "/run/privileged/bin/Throne" (string-append bin "/Throne")) (mkdir-p "throne-core") (invoke "unzip" "-q" "-j" core-archive "Throne/ThroneCore" "-d" "throne-core") (invoke "patchelf" "--set-interpreter" (string-append glibc-path "/lib/ld-linux-x86-64.so.2") core-path) (copy-file core-path (string-append libexec "/ThroneCore")) (chmod (string-append libexec "/ThroneCore") #o555))))))) (synopsis "Qt desktop proxy utility") (description "Throne is a Qt-based desktop proxy utility.") (home-page "https://github.com/throneproj/Throne") (license license:gpl3))) throne