;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see .
(define-module (gnu packages nx)
#:use-module (guix build utils)
#:use-module (guix build-system gnu)
#:use-module (guix git-download)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages commencement)
#:use-module (gnu packages glib)
#:use-module (gnu packages gtk)
#:use-module (gnu packages image)
#:use-module (gnu packages onc-rpc)
#:use-module (gnu packages patchutils)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg))
(define-public nx-libs
(package
(name "nx-libs")
(version "3.5.99.27")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ArcticaProject/nx-libs")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "0ykbza39ksycpyydaiwwbp7hkmdk96v7b36pn989k39lhfwnn8kz"))))
(build-system gnu-build-system)
(arguments
`(#:tests? #f ;; no tests in this project
#:phases (modify-phases %standard-phases
(delete 'configure)
(add-before 'build 'replace-shebang-nxdialog
(lambda _
(substitute* "nxdialog/bin/nxdialog"
(("#!/usr/bin/env python")
(string-append "#!"
(which "python3"))))))
(add-before 'build 'fix-makefile
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(etc (string-append out "/etc")))
(mkdir-p etc)
(substitute* "Makefile"
(("^gzip -f") "gzip -f -n") ;; reproducible build
(("/usr/local")
out)
(("/etc/nxagent")
etc)
(("./configure")
(string-append "CONFIG_SHELL="
(which "sh")
" SHELL="
(which "sh")
" "
(which "sh")
" ./configure")))
(substitute* '("nx-X11/config/cf/site.def")
(("#include ")
(string-append "#include " "\n"
"#define BourneShell "
(which "sh")))
(("/usr/local")
out))
;; Workaround the following error during the build
;; process: invalid input: ("_" #)
(substitute* '("nx-X11/Makefile")
(("which")
"echo"))
#t)))
(replace 'build
(lambda _
(invoke "make" "IMAKE_DEFINES=\"-DUseTIRPC=1\"") #t))
(add-before 'validate-runpath 'link-libraries
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(lib (string-append out "/lib"))
(lib-nx-x11 (string-append lib "/nx/X11")))
;; TODO: Should I use symlink instead of install-file ?
(for-each (lambda (file)
(install-file file lib-nx-x11))
(list (string-append lib "/libXcomp.so.3")
(string-append lib
"/libXcompshad.so.3")
(string-append lib "/libNX_X11.so.6")))
#t))))))
(inputs (list perl
python
python-pygobject
gtk+))
(native-inputs (list autoconf
automake
libtool
pkg-config
libpng
libjpeg-turbo
xkbcomp
libxfont
libxdamage
libxrandr
libxtst
libxext
libxcomposite
libxinerama
libxpm
libxml2
font-util
pixman
gccmakedep
imake
quilt
libtirpc
gcc-toolchain))
(synopsis "NX remote desktop library")
(description
"NX technology also known as NX or NoMachine is a protocol that enables
remote desktop access. It's maintained by the artica project, x2go
developers and TheQVD.")
(home-page "https://github.com/ArcticaProject/nx-libs")
(license license:gpl2)))