diff options
Diffstat (limited to 'gnu/packages/medical.scm')
-rw-r--r-- | gnu/packages/medical.scm | 221 |
1 files changed, 220 insertions, 1 deletions
diff --git a/gnu/packages/medical.scm b/gnu/packages/medical.scm index 8e344b6dd6..71ac450cc0 100644 --- a/gnu/packages/medical.scm +++ b/gnu/packages/medical.scm @@ -20,15 +20,17 @@ ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (gnu packages medical) + #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system cmake) #:use-module (guix build-system pyproject) #:use-module (guix build-system python) #:use-module (guix build-system qt) #:use-module (guix download) #:use-module (guix gexp) + #:use-module (guix git-download) #:use-module (guix hg-download) - #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) + #:use-module (guix utils) #:use-module (gnu packages base) #:use-module (gnu packages bash) ; wrap-program #:use-module (gnu packages boost) @@ -213,3 +215,220 @@ Medicine} server") Communications in Medicine} server with a RESTful API and plugin mechanism for extending its functionality.") (license license:gpl3+))) + +(define-public orthanc-postgresql + ;; No tags provided. + (let ((changeset "ddc98844d931") + (revision "0")) + (package + (name "orthanc-postgresql") + (version (git-version "7.2" revision changeset)) + (source + (origin + (method hg-fetch) + (uri (hg-reference + (url "https://orthanc.uclouvain.be/hg/orthanc-databases") + (changeset changeset))) + (file-name (hg-file-name name version)) + (sha256 + (base32 "1zv2lrj0f3fahmdyiwyj70ayv5ysa3cj33i58fbk7hy2zclrkjzf")))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags + #~(list + ;; Don't try to download the Orthanc source code. + "-DORTHANC_FRAMEWORK_SOURCE=path" + (string-append "-DORTHANC_FRAMEWORK_ROOT=" + #$(package-source (this-package-input "orthanc")) + "/OrthancFramework/Sources")) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ + ;; The PostgreSQL/ subdirectory contains the root + ;; CMakeLists.txt file. + (chdir "PostgreSQL"))) + ;; There is no test target; simply run the binary. + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + ;; The tests rely on a PostgreSQL test server + ;; being available. + (let ((pgdata "/tmp/pgdata") + (host "/tmp") + (port "5432") + ;; This username is hard-coded in tests. + (username "postgres") + (password "") + (database "orthanctest")) + (invoke "initdb" pgdata) + (invoke "pg_ctl" "-D" pgdata + "-o" (string-append "-k " host) + "start") + (invoke "createdb" "-h" host database) + (invoke "createuser" "-h" host username) + ;; The tests include managing Large Objects. + (invoke "psql" "-h" host "-d" database "-c" + (string-append "ALTER ROLE " username + " WITH SUPERUSER;")) + (invoke "./UnitTests" host port username password + database)))))))) + (native-inputs + (list googletest + python)) + (inputs + (list boost + jsoncpp + openssl + orthanc + postgresql + protobuf + unzip + (list util-linux "lib") ; <uuid.h> + zlib)) + (home-page "https://orthanc-server.com") + (synopsis "PostgreSQL plugins for Orthanc") + (description + "This package provides plugins to use PostgreSQL as the database +backend of an Orthanc @acronym{DICOM, Digital Imaging and Communications in +Medicine} server instead of SQLite.") + (license license:agpl3+)))) + +(define-public orthanc-mysql + ;; No tags provided. + (let ((changeset "a6300ccf6683") + (revision "0")) + (package + (name "orthanc-mysql") + (version (git-version "5.2" revision changeset)) + (source + (origin + (method hg-fetch) + (uri (hg-reference + (url "https://orthanc.uclouvain.be/hg/orthanc-databases") + (changeset changeset))) + (file-name (hg-file-name name version)) + (sha256 + (base32 "0hi3bawj117lk7lrxpa6h7vq4hx9jwqb3m5pwn3726hnf4kmp4jc")))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags + #~(list + ;; Don't try to download the Orthanc source code. + "-DORTHANC_FRAMEWORK_SOURCE=path" + (string-append "-DORTHANC_FRAMEWORK_ROOT=" + #$(package-source (this-package-input "orthanc")) + "/OrthancFramework/Sources")) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ + ;; The MySQL/ subdirectory contains the root CMakeLists.txt + ;; file. + (chdir "MySQL"))) + (add-after 'unpack 'fix-mysql-include-path + (lambda _ + ;; Help it find mysql.h, either from mysql in this package or + ;; from mariadb:dev in orthanc-mariadb. + (substitute* "Resources/CMake/MariaDBConfiguration.cmake" + (("/usr/include/mysql") + (string-append #$(this-package-input "mysql") + "/include/mysql"))))) + ;; There is no test target; simply run the binary. + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + ;; The tests rely on a MySQL or MariaDB test server + ;; being available. + (let ((datadir "/tmp/mysql") + (socket "/tmp/mysql/mysqld.sock") + (username "root") + (password "") + (database "orthanctest")) + (invoke "mysqld" "--initialize-insecure" + (string-append "--datadir=" datadir)) + (spawn "mysqld" + (list + "mysqld" + ;; Respect '--datadir'. + "--no-defaults" + (string-append "--datadir=" datadir) + (string-append "--socket=" socket) + ;; For one test. + "--max_allowed_packet=32m")) + (sleep 1) + (invoke "mysql" + (string-append "--socket=" socket) + "-u" username + "-e" "CREATE DATABASE orthanctest;") + (invoke "./UnitTests" socket username password + database)))))))) + (native-inputs + (list googletest + python)) + (inputs + (list boost + curl + jsoncpp + mysql + openssl + orthanc + protobuf + unzip + (list util-linux "lib") ; <uuid.h> + zlib)) + (home-page "https://orthanc-server.com") + (synopsis "MySQL plugins for Orthanc") + (description + "This package provides plugins to use MySQL or MariaDB as the database +backend of an Orthanc @acronym{DICOM, Digital Imaging and Communications in +Medicine} server instead of SQLite.") + (license license:agpl3+)))) + +;; Provide this variant without MySQL to save MariaDB users ~340 MiB +;; of disk space. +(define-public orthanc-mariadb + (package/inherit orthanc-mysql + (name "orthanc-mariadb") + (arguments + (substitute-keyword-arguments (package-arguments orthanc-mysql) + ((#:phases phases) + #~(modify-phases #$phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + ;; The tests rely on a MySQL or MariaDB test server + ;; being available. + (let ((datadir "/tmp/mysql") + (socket "/tmp/mysql/mysqld.sock") + (username "root") + (password "") + (database "orthanctest")) + (invoke "mariadb-install-db" + (string-append "--datadir=" datadir) + "--auth-root-authentication-method=normal") + (spawn "mysqld" + (list + "mysqld" + ;; Respect '--datadir'. + "--no-defaults" + (string-append "--datadir=" datadir) + (string-append "--socket=" socket) + ;; For one test. + "--max-allowed-packet=32m")) + (sleep 1) + (invoke "mysql" + (string-append "--socket=" socket) + "-u" username + "-e" "CREATE DATABASE orthanctest;") + (invoke "./UnitTests" socket username password + database))))))))) + (native-inputs (modify-inputs (package-native-inputs orthanc-mysql) + (prepend mariadb))) ;for tests + (inputs (modify-inputs (package-inputs orthanc-mysql) + (delete "mysql") + (prepend `(,mariadb "dev") + `(,mariadb "lib")))) + (synopsis "MariaDB plugins for Orthanc"))) |