From da682825df0d07e05d4d4bc370ff7a486be3d8a5 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Mon, 7 Nov 2016 21:25:31 +0000 Subject: [PATCH] gnu: Add varnish. * gnu/packages/web.scm (varnish): New variable. --- gnu/packages/web.scm | 71 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index 230238737e..f558396b44 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -19,7 +19,7 @@ ;;; Copyright © 2016, 2017, 2018 Tobias Geerinckx-Rice ;;; Copyright © 2016 Bake Timmons ;;; Copyright © 2017 Thomas Danckaert -;;; Copyright © 2017 Marius Bakke +;;; Copyright © 2017, 2018 Marius Bakke ;;; Copyright © 2017 Kei Kebreau ;;; Copyright © 2017 Petter ;;; Copyright © 2017 Pierre Langlois @@ -110,6 +110,7 @@ (define-module (gnu packages web) #:use-module (gnu packages pcre) #:use-module (gnu packages pkg-config) #:use-module (gnu packages qt) + #:use-module (gnu packages readline) #:use-module (gnu packages valgrind) #:use-module (gnu packages xml) #:use-module (gnu packages curl) @@ -4996,6 +4997,74 @@ (define-public stunnel deployments.") (license l:gpl2+))) +(define-public varnish + (package + (name "varnish") + (home-page "https://varnish-cache.org/") + (version "6.0.0") + (source (origin + (method url-fetch) + (uri (string-append home-page "_downloads/varnish-" version ".tgz")) + (sha256 + (base32 + "1vhbdch33m6ig4ijy57zvrramhs9n7cba85wd8rizgxjjnf87cn7")))) + (build-system gnu-build-system) + (arguments + `(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib") + ;; Use absolute path of GCC so it's found at runtime. + (string-append "PTHREAD_CC=" + (assoc-ref %build-inputs "gcc") + "/bin/gcc") + "--localstatedir=/var") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-/bin/sh + (lambda _ + (substitute* '("bin/varnishtest/vtc_varnish.c" + "bin/varnishtest/vtc_process.c" + "bin/varnishd/mgt/mgt_vcc.c") + (("/bin/sh") (which "sh"))) + #t)) + (add-before 'install 'patch-Makefile + (lambda _ + (substitute* "Makefile" + ;; Do not create /var/varnish during install. + (("^install-data-am: install-data-local") "install-data-am: ")) + #t)) + (add-after 'install 'wrap-varnishd + ;; Varnish uses GCC to compile VCL, so wrap it with required GCC + ;; environment variables to avoid propagating them to profiles. + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (varnishd (string-append out "/sbin/varnishd")) + (PATH (string-append (assoc-ref inputs "binutils") "/bin")) + (LIBRARY_PATH (string-append (assoc-ref inputs "libc") "/lib"))) + (wrap-program varnishd + ;; Add binutils to PATH so gcc finds the 'as' executable. + `("PATH" ":" prefix (,PATH)) + ;; Make sure 'crti.o' et.al is found. + `("LIBRARY_PATH" ":" prefix (,LIBRARY_PATH))) + #t)))))) + (native-inputs + `(("pkg-config" ,pkg-config) + ("rst2man" ,python-docutils))) + (inputs + `(("jemalloc" ,jemalloc) + ("ncurses" ,ncurses) + ("pcre" ,pcre) + ("python" ,python-wrapper) + ("readline" ,readline))) + (synopsis "Web application accelerator") + (description + "Varnish is a high-performance HTTP accelerator. It acts as a caching +reverse proxy and load balancer. You install it in front of any server that +speaks HTTP and configure it to cache the contents through an extensive +configuration language.") + (license (list l:bsd-2 ;main distribution + l:zlib ;lib/libvgz/* + l:public-domain ;bin/varnishncsa/as64.c, include/miniobj.h + l:bsd-3)))) ;include/vqueue.h, lib/libvarnishcompat/daemon.c + (define-public xinetd (package (name "xinetd")