diff --git a/science/orthanc/Makefile b/science/orthanc/Makefile new file mode 100644 index 000000000000..9e7f31c21893 --- /dev/null +++ b/science/orthanc/Makefile @@ -0,0 +1,57 @@ +# Created by: maintainer.freebsd@xpoundit.com + +PORTNAME= orthanc +DISTVERSION= 1.9.3 +CATEGORIES= science +MASTER_SITES= https://www.orthanc-server.com/downloads/get.php?path=/orthanc/ +DISTNAME= Orthanc-${PORTVERSION} + +MAINTAINER= maintainer.freebsd@xpoundit.com +COMMENT= Lightweight DICOM server for healthcare and medical research + +LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/COPYING + +LIB_DEPENDS= libboost_atomic.so:devel/boost-libs \ + libcivetweb.so:www/civetweb \ + libcurl.so:ftp/curl \ + libdcmtkcharls.so:graphics/dcmtk \ + libgtest.so:devel/googletest \ + libicuuc.so:devel/icu \ + libjsoncpp.so:devel/jsoncpp \ + libpng16.so:graphics/png \ + libpugixml.so:textproc/pugixml \ + libtiff.so:graphics/tiff \ + libuuid.so:misc/e2fsprogs-libuuid + +USES= cmake gnome iconv jpeg lua python:build sqlite ssl +USE_GNOME= libxml2 +USE_LDCONFIG= yes + +WRKSRC= ${WRKDIR}/Orthanc-${PORTVERSION} + +CMAKE_SOURCE_PATH= ${WRKSRC}/OrthancServer +CMAKE_OFF= BUILD_CONNECTIVITY_CHECKS UNIT_TESTS_WITH_HTTP_CONNEXIONS +CMAKE_ON= USE_SYSTEM_BOOST USE_SYSTEM_CIVETWEB USE_SYSTEM_DCMTK \ + USE_SYSTEM_GOOGLE_TEST USE_SYSTEM_JSONCPP USE_SYSTEM_LIBICONV \ + USE_SYSTEM_LIBJPEG USE_SYSTEM_LIBPNG USE_SYSTEM_LUA \ + USE_SYSTEM_OPENSSL USE_SYSTEM_PUGIXML USE_SYSTEM_SQLITE \ + USE_SYSTEM_UUID USE_SYSTEM_ZLIB +CFLAGS+= -DNDEBUG +CXXFLAGS+= -DNDEBUG + +USE_RC_SUBR= orthanc + +USERS= orthanc +GROUPS= orthanc + +PLIST_SUB+= PORTVERSION=${PORTVERSION} + +post-install: + ${MKDIR} ${STAGEDIR}/var/db/orthanc/db/db-v5 + ${MKDIR} ${STAGEDIR}${DATADIR}/plugins + ${MKDIR} ${STAGEDIR}${ETCDIR} + ${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${CMAKE_SOURCE_PATH}/Resources/Configuration.json + ${CP} ${CMAKE_SOURCE_PATH}/Resources/Configuration.json ${STAGEDIR}${ETCDIR}/orthanc.json.sample + +.include diff --git a/science/orthanc/distinfo b/science/orthanc/distinfo new file mode 100644 index 000000000000..ed25e78020f7 --- /dev/null +++ b/science/orthanc/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1620899601 +SHA256 (Orthanc-1.9.3.tar.gz) = 41cc35a3d15ecb0d7b834e8e28a740cc4ffa1f333c019a764228d60e96608960 +SIZE (Orthanc-1.9.3.tar.gz) = 1818313 diff --git a/science/orthanc/files/orthanc.in b/science/orthanc/files/orthanc.in new file mode 100644 index 000000000000..85d6af45d8a1 --- /dev/null +++ b/science/orthanc/files/orthanc.in @@ -0,0 +1,40 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: orthanc +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add these lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# orthanc_enable (bool): Set to NO by default. +# Set it to YES to enable Orthanc. +# orthanc_flags (str): Set to %%ETCDIR%%/orthanc.json +# by default. + +. /etc/rc.subr + +name=orthanc +rcvar=orthanc_enable +desc="Lightweight DICOM server for healthcare and medical research" + +load_rc_config $name + +: ${orthanc_enable:=NO} +: ${orthanc_flags="%%ETCDIR%%/orthanc.json"} + +start_precmd=orthanc_prestart +pidfile=/var/run/orthanc.pid +procname=%%PREFIX%%/sbin/Orthanc +command=/usr/sbin/daemon +command_args=" -f -p ${pidfile} -u orthanc ${procname} ${orthanc_flags}" + +orthanc_prestart() +{ + # Have to empty rc_flags so they don't get passed to daemon(8) + rc_flags="" +} + +run_rc_command "$1" diff --git a/science/orthanc/files/patch-OrthancFramework_Resources_CMake_CivetwebConfiguration.cmake b/science/orthanc/files/patch-OrthancFramework_Resources_CMake_CivetwebConfiguration.cmake new file mode 100644 index 000000000000..b1cd8bd06165 --- /dev/null +++ b/science/orthanc/files/patch-OrthancFramework_Resources_CMake_CivetwebConfiguration.cmake @@ -0,0 +1,64 @@ +--- OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake.orig 2021-05-12 13:54:35 UTC ++++ OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake +@@ -98,32 +98,38 @@ else() + + cmake_reset_check_state() + set(CMAKE_REQUIRED_LIBRARIES dl pthread) +- CHECK_LIBRARY_EXISTS(civetweb mg_start "" HAVE_CIVETWEB_LIB) +- if (NOT HAVE_CIVETWEB_LIB) +- message(FATAL_ERROR "Please install the libcivetweb-dev package") +- endif() + +- link_libraries(civetweb) ++ find_library(CIVETWEB_LIB NAMES civetweb PATHS ++ /usr/lib ++ /usr/local/lib ++ ) + +- # Check whether the system distribution of civetweb contains the +- # patch "../Patches/civetweb-1.13.patch" that allows to disable +- # keep-alive on selected HTTP connections. This is useful to speed +- # up multipart transfers, as encountered in DICOMweb. +- CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE_1) # From "../Patches/civetweb-1.13.patch" +- CHECK_LIBRARY_EXISTS(civetweb mg_disable_connection_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE_2) # From civetweb >= 1.14 +- if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE_1 OR +- CIVETWEB_HAS_DISABLE_KEEP_ALIVE_2) +- add_definitions( +- -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1 +- -DCIVETWEB_HAS_WEBDAV_WRITING=1 +- ) +- message("Performance: Your system-wide distribution of civetweb is configured for best performance") ++ if (CIVETWEB_LIB) ++ CHECK_LIBRARY_EXISTS(${CIVETWEB_LIB} mg_start "" HAVE_CIVETWEB_LIB) ++ if (NOT HAVE_CIVETWEB_LIB) ++ message(FATAL_ERROR "Unable to use mg_start from civetweb library") ++ endif() ++ ++ CHECK_LIBRARY_EXISTS(${CIVETWEB_LIB} mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE) ++ if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE) ++ add_definitions( ++ -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1 ++ -DCIVETWEB_HAS_WEBDAV_WRITING=1 ++ ) ++ message("Performance: Your system-wide distribution of civetweb is configured for best performance") ++ else() ++ message(WARNING "Performance: Your system-wide distribution of civetweb does not feature the mg_disable_keep_alive() function, and WebDAV will only be available for read-only access") ++ add_definitions( ++ -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0 ++ -DCIVETWEB_HAS_WEBDAV_WRITING=0 ++ ) ++ endif() ++ ++ get_filename_component(CIVETWEB_LIB_PATH ${CIVETWEB_LIB} DIRECTORY) ++ link_directories(${CIVETWEB_LIB_PATH}) ++ link_libraries(civetweb) + else() +- message(WARNING "Performance: Your system-wide distribution of civetweb does not feature the mg_disable_keep_alive() function, and WebDAV will only be available for read-only access") +- add_definitions( +- -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0 +- -DCIVETWEB_HAS_WEBDAV_WRITING=0 +- ) ++ message(FATAL_ERROR "Unable to find the civetweb library") + endif() + + unset(CMAKE_REQUIRED_LIBRARIES) # This reset must be after "CHECK_LIBRARY_EXISTS" diff --git a/science/orthanc/files/patch-OrthancServer_Resources_Configuration.json b/science/orthanc/files/patch-OrthancServer_Resources_Configuration.json new file mode 100644 index 000000000000..91f978822db2 --- /dev/null +++ b/science/orthanc/files/patch-OrthancServer_Resources_Configuration.json @@ -0,0 +1,25 @@ +--- OrthancServer/Resources/Configuration.json.orig 2021-01-29 09:36:16 UTC ++++ OrthancServer/Resources/Configuration.json +@@ -10,12 +10,12 @@ + // Path to the directory that holds the heavyweight files (i.e. the + // raw DICOM instances). Backslashes must be either escaped by + // doubling them, or replaced by forward slashes "/". +- "StorageDirectory" : "OrthancStorage", ++ "StorageDirectory" : "/var/db/orthanc/db-v5", + + // Path to the directory that holds the SQLite index (if unset, the + // value of StorageDirectory is used). This index could be stored on + // a RAM-drive or a SSD device for performance reasons. +- "IndexDirectory" : "OrthancStorage", ++ "IndexDirectory" : "/var/db/orthanc/db-v5", + + // Path to the directory where Orthanc stores its large temporary + // files. The content of this folder can be safely deleted once +@@ -53,6 +53,7 @@ + // find shared libraries. Backslashes must be either escaped by + // doubling them, or replaced by forward slashes "/". + "Plugins" : [ ++ "%%PREFIX%%/share/orthanc/plugins/" + ], + + // Maximum number of processing jobs that are simultaneously running diff --git a/science/orthanc/pkg-descr b/science/orthanc/pkg-descr new file mode 100644 index 000000000000..9ab8479c6127 --- /dev/null +++ b/science/orthanc/pkg-descr @@ -0,0 +1,23 @@ +Orthanc aims at providing a simple, yet powerful standalone DICOM server. It +is designed to improve the DICOM flows in hospitals and to support research +about the automated analysis of medical images. Orthanc lets its users focus +on the content of the DICOM files, hiding the complexity of the DICOM format +and of the DICOM protocol. + +Orthanc can turn any computer running Windows, Linux, FreeBSD or OS X into a +DICOM store (in other words, a mini-PACS system). Its architecture is +lightweight and standalone, meaning that no complex database administration +is required, nor the installation of third-party dependencies. + +What makes Orthanc unique is the fact that it provides a RESTful API. Thanks +to this major feature, it is possible to drive Orthanc from any computer +language. The DICOM tags of the stored medical images can be downloaded in +the JSON file format. Furthermore, standard PNG images can be generated +on-the-fly from the DICOM instances by Orthanc. + +Orthanc also features a plugin mechanism to add new modules that extends the +core capabilities of its REST API. A Web viewer, a PostgreSQL database +back-end, a MySQL database back-end, and a reference implementation of +DICOMweb are currently freely available as plugins. + +WWW: https://www.orthanc-server.com/ diff --git a/science/orthanc/pkg-plist b/science/orthanc/pkg-plist new file mode 100644 index 000000000000..3c86361bc527 --- /dev/null +++ b/science/orthanc/pkg-plist @@ -0,0 +1,18 @@ +@owner orthanc +@group orthanc +@mode 700 +@dir %%DATADIR%%/plugins +@dir /var/db/orthanc/db/db-v5 +@dir /var/db/orthanc/db +@dir /var/db/orthanc +@mode 600 +@sample %%ETCDIR%%/orthanc.json.sample +@mode +bin/OrthancRecoverCompressedFile +include/orthanc/OrthancCDatabasePlugin.h +include/orthanc/OrthancCPlugin.h +sbin/Orthanc +%%DATADIR%%/plugins/libModalityWorklists.so +%%DATADIR%%/plugins/libModalityWorklists.so.%%PORTVERSION%% +%%DATADIR%%/plugins/libServeFolders.so +%%DATADIR%%/plugins/libServeFolders.so.%%PORTVERSION%%