backporting old nginx definition

This commit is contained in:
Jean-François GUILLAUME 2022-04-20 14:59:14 +02:00
parent ee72b59f37
commit f36df6258b
GPG key ID: 38751DAE145EFB5A

View file

@ -18,6 +18,88 @@
#:use-module (glicid packages openldap) #:use-module (glicid packages openldap)
) )
(define-public nginx
(package
(name "nginx")
(version "1.21.6")
(source (origin
(method url-fetch)
(uri (string-append "https://nginx.org/download/nginx-" version ".tar.gz"))
(sha256 (base32 "1bh52jqqcaj5wlh2kvhxr00jhk2hnk8k97ki4pwyj4c8920p1p36"))))
(build-system gnu-build-system)
(inputs (list libxml2 libxslt openssl pcre zlib))
(arguments
`(#:tests? #f
#:phases
(modify-phases %standard-phases
(add-before 'configure 'patch-/bin/sh
(lambda _
(substitute* "auto/feature"
(("/bin/sh") (which "sh")))
#t))
(replace 'configure
;; The configure script is hand-written, not from GNU autotools.
(lambda* (#:key configure-flags inputs outputs #:allow-other-keys)
(let ((flags
(append (list (string-append "--prefix=" (assoc-ref outputs "out"))
"--with-http_ssl_module"
"--with-http_v2_module"
"--with-http_xslt_module"
"--with-http_gzip_static_module"
"--with-http_gunzip_module"
"--with-http_addition_module"
"--with-http_sub_module"
"--with-pcre-jit"
"--with-debug"
"--with-stream"
;; Even when not cross-building, we pass the
;; --crossbuild option to avoid customizing for the
;; kernel version on the build machine.
,(let ((system "Linux") ; uname -s
(release "3.2.0") ; uname -r
;; uname -m
(machine (match (or (%current-target-system)
(%current-system))
("x86_64-linux" "x86_64")
("i686-linux" "i686")
("mips64el-linux" "mips64")
(_ "UNSUPPORTED"))))
(string-append "--crossbuild=" system ":" release ":" machine)
))
configure-flags)))
(setenv "CC" ,(cc-for-target))
(setenv "CFLAGS" ; CPPFLAGS is not respected
(string-append "-I" (assoc-ref inputs "libxml2")
"/include/libxml2"))
(format #t "configure flags: ~s~%" flags)
(apply invoke "./configure" flags)
#t)))
(add-after 'install 'install-man-page
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(man (string-append out "/share/man")))
(install-file "objs/nginx.8" (string-append man "/man8"))
#t)))
(add-after 'install 'fix-root-dirs
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(share (string-append out "/share/nginx")))
(rmdir (string-append out "/logs"))
(mkdir-p share)
(rename-file (string-append out "/conf")
(string-append share "/conf"))
(rename-file (string-append out "/html")
(string-append share "/html"))
#t))))))
(home-page "https://nginx.org")
(synopsis "HTTP and reverse proxy server")
(description
"Nginx (\"engine X\") is a high-performance web and reverse proxy server
created by Igor Sysoev. It can be used both as a stand-alone web server
and as a proxy to reduce the load on back-end HTTP or mail servers.")
(license (list license:bsd-2 license:expat license:bsd-3 license:bsd-4))))
(define-public nginx-ldap-auth-module (define-public nginx-ldap-auth-module
(package (package
(inherit nginx) (inherit nginx)