all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 61e7f847a74440b4387eb4b6285614c84e12786c 8739 bytes (raw)
name: gnu/packages/web-xyz.scm 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
 
;;; GNU Guix --- Functional package management for GNU
;;;; TODO should I really add copyright lines for people I copied from??
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>

;;; Copyright © 2019 Florian Pelz <pelzflorian@pelzflorian.de>
;;;
;;; 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 <http://www.gnu.org/licenses/>.

(define-module (gnu packages web-xyz)
  #:use-module (guix build-system gnu)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages pcre)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages web)
  #:use-module (ice-9 match)
  #:use-module ((srfi srfi-1) #:select (delete-duplicates)))

(define-public nginx-mod-accept-language
  (let ((commit "2f69842f83dac77f7d98b41a2b31b13b87aeaba7")
        (revision "1"))
    (package
      (name "nginx-mod-accept-language")
      (version (git-version "0.0.0" ;upstream has no version number
                            revision commit))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://github.com/giom/nginx_accept_language_module.git")
               (commit commit)))
         (file-name (git-file-name name version))
         (sha256
          (base32 "1hjysrl15kh5233w7apq298cc2bp4q1z5mvaqcka9pdl90m0vhbw"))
         (modules '((guix build utils)
                    (ice-9 popen)))
         (snippet
          #~(begin
              ;; the nginx source code is part of the module’s source
              (format #t "decompressing nginx source code~%")
              (call-with-output-file "nginx.tar"
                (lambda (out)
                  (let ((pipe (open-pipe* OPEN_READ
                                          #+(file-append gzip "/bin/gzip") "-cd"
                                          #$(package-source nginx))))
                    (dump-port pipe out)
                    (unless (= (status:exit-val (close-pipe pipe)) 0)
                      (error "gzip decompress failed")))))
              (invoke #+(file-append tar "/bin/tar") "xvf" "nginx.tar"
                      "--strip-components=1")
              (delete-file "nginx.tar")
              #t))))
      (build-system gnu-build-system)
      (inputs `(("openssl" ,openssl)
                ("pcre" ,pcre)
                ("zlib" ,zlib)))
      (arguments
       `(#:tests? #f                      ; no test target
         #:make-flags (list "modules")
         #:modules ((guix build utils)
                    (guix build gnu-build-system)
                    (ice-9 regex)
                    (ice-9 textual-ports))
         #:phases
         (modify-phases %standard-phases
           (add-after 'unpack 'convert-to-dynamic-module
             (lambda _
               (begin
                 (with-atomic-file-replacement "config"
                   (lambda (in out)
                     ;; cf. https://www.nginx.com/resources/wiki/extending/new_config/
                     (format out "ngx_module_type=HTTP~%")
                     (format out "ngx_module_name=\
ngx_http_accept_language_module~%")
                     (let* ((str (get-string-all in))
                            (rx (make-regexp
                                 "NGX_ADDON_SRCS=\"\\$NGX_ADDON_SRCS (.*)\""))
                            (m (regexp-exec rx str))
                            (srcs (match:substring m 1)))
                       (format out (string-append "ngx_module_srcs=\""
                                                  srcs "\"~%")))
                     (format out ". auto/module~%")
                     (format out "ngx_addon_name=$ngx_module_name~%"))))))
           (add-before 'configure 'patch-/bin/sh
             (lambda _
               (substitute* "auto/feature"
                 (("/bin/sh") (which "sh")))
               #t))
           (replace 'configure
             (lambda* (#:key outputs #:allow-other-keys)
               (let ((flags
                      (list ;; A copy of nginx’ flags follows, otherwise we
                            ;; get a binary compatibility error.  FIXME: Code
                            ;; duplication is bad.
                       (string-append "--prefix=" (assoc-ref outputs "out"))
                       "--with-http_ssl_module"
                       "--with-http_v2_module"
                       "--with-pcre-jit"
                       "--with-debug"
                       ;; 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")
                                         ;; Prevent errors when querying
                                         ;; this package on unsupported
                                         ;; platforms, e.g. when running
                                         ;; "guix package --search="
                                         (_                "UNSUPPORTED"))))
                          (string-append "--crossbuild="
                                         system ":" release ":" machine))
                       ;; The following are the args decribed on
                       ;; <https://www.nginx.com/blog/compiling-dynamic-modules-nginx-plus>.
                       ;; Enabling --with-compat here and in the nginx package
                       ;; would ensure binary compatibility even when using
                       ;; different configure options from the main nginx
                       ;; package.  This is not needed for Guix.
                       ;; "--with-compat"
                       "--add-dynamic-module=.")))
                 (setenv "CC" "gcc")
                 (format #t "environment variable `CC' set to `gcc'~%")
                 (format #t "configure flags: ~s~%" flags)
                 (apply invoke "./configure" flags)
                 #t)))
           (replace 'install
             (lambda* (#:key outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))
                      (modules-dir (string-append out "/etc/nginx/modules"))
                      (doc-dir (string-append
                                out "/share/doc/nginx-mod-accept-language")))
                 (mkdir-p modules-dir)
                 (copy-file "objs/ngx_http_accept_language_module.so"
                            (string-append
                             modules-dir "/ngx_http_accept_language_module.so"))
                 (mkdir-p doc-dir)
                 (copy-file "README.textile"
                            (string-append doc-dir "/README.textile"))
                 #t))))))
      (home-page
       "https://www.nginx.com/resources/wiki/modules/accept_language/")
      (synopsis "Nginx module for parsing the Accept-Language HTTP header")
      (description
       "Nginx module that parses the Accept-Language field in HTTP headers and
chooses the most suitable locale for the user from the list of locales
supported at your website.")
      (license (delete-duplicates
                (cons license:bsd-2 ;license of nginx-mod-accept-language
                      (package-license nginx))))))) ;the module’s code is linked
                                        ;statically with nginx, therefore
                                        ;nginx’ licenses apply to its binary

debug log:

solving 61e7f847a7 ...
found 61e7f847a7 in https://yhetil.org/guix/20191007081502.wog4q4wjptvhmejf@pelzflorian.localdomain/

applying [1/1] https://yhetil.org/guix/20191007081502.wog4q4wjptvhmejf@pelzflorian.localdomain/
diff --git a/gnu/packages/web-xyz.scm b/gnu/packages/web-xyz.scm
new file mode 100644
index 0000000000..61e7f847a7

Checking patch gnu/packages/web-xyz.scm...
Applied patch gnu/packages/web-xyz.scm cleanly.

index at:
100644 61e7f847a74440b4387eb4b6285614c84e12786c	gnu/packages/web-xyz.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.