Add cat-avatar-generator

Julien LepillerFri Jan 12 22:09:29+0100 2018

d999238

Add cat-avatar-generator

more/packages/web.scm unknown status 1

1+
;;; GNU Guix --- Functional package management for GNU
2+
;;; Copyright ?? 2013, 2014, 2015 Ludovic Court??s <ludo@gnu.org>
3+
;;; Copyright ?? 2014, 2015 Mark H Weaver <mhw@netris.org>
4+
;;; Copyright ?? 2014 Eric Bavier <bavier@member.fsf.org>
5+
;;; Copyright ?? 2016 Efraim Flashner <efraim@flashner.co.il>
6+
;;; Copyright ?? 2016 Jan Nieuwenhuizen <janneke@gnu.org>
7+
;;; Copyright ?? 2017 Kei Kebreau <kei@openmailbox.org>
8+
;;;
9+
;;; This file is part of GNU Guix.
10+
;;;
11+
;;; GNU Guix is free software; you can redistribute it and/or modify it
12+
;;; under the terms of the GNU General Public License as published by
13+
;;; the Free Software Foundation; either version 3 of the License, or (at
14+
;;; your option) any later version.
15+
;;;
16+
;;; GNU Guix is distributed in the hope that it will be useful, but
17+
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18+
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19+
;;; GNU General Public License for more details.
20+
;;;
21+
;;; You should have received a copy of the GNU General Public License
22+
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
23+
24+
(define-module (more packages web)
25+
  #:use-module (guix packages)
26+
  #:use-module (guix download)
27+
  #:use-module (guix git-download)
28+
  #:use-module (guix build-system trivial)
29+
  #:use-module (gnu packages)
30+
  #:use-module ((guix licenses) #:prefix license:))
31+
32+
(define-public cat-avatar-generator
33+
  (package
34+
    (name "cat-avatar-generator")
35+
    (version "1")
36+
    (source (origin
37+
              (method git-fetch)
38+
              (uri (git-reference
39+
                     (url "https://framagit.org/Deevad/cat-avatar-generator.git")
40+
                     (commit "71c0c662742cafe8afd2d2d50ec84243113e35ad")))
41+
              (file-name (string-append name "-" version))
42+
              (sha256
43+
               (base32
44+
                "0s7b5whqsmfa57prbgl66ym551kg6ly0z14h5dgrlx4lqm70y2yw"))))
45+
    (build-system trivial-build-system)
46+
    (arguments
47+
     `(#:modules ((guix build utils)
48+
                  (srfi srfi-1)
49+
                  (srfi srfi-26))
50+
       #:builder
51+
       (begin
52+
         (use-modules (guix build utils)
53+
                      (srfi srfi-1)
54+
                      (srfi srfi-26))
55+
         (let ((source (assoc-ref %build-inputs "source"))
56+
               (php-dir (string-append %output "/share/web/" ,name "/")))
57+
           ;; The cache directory must not be in the store, but in a writable
58+
           ;; location.  The webserver will give us this location.
59+
           (copy-recursively source php-dir)
60+
           (substitute* (string-append php-dir "/cat-avatar-generator.php")
61+
             (("\\$cachepath = .*")
62+
              "if(isset($_SERVER['CACHE_DIR']))
63+
$cachepath = $_SERVER['CACHE_DIR'];
64+
else
65+
die('You need to set the CACHE_DIR variable first.');"))))))
66+
    (home-page "")
67+
    (synopsis "")
68+
    (description "")
69+
    ;; expat for the code, CC-BY 4.0 for the artwork
70+
    (license (list license:expat
71+
                   license:cc-by4.0))))