all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marius Bakke <mbakke@fastmail.com>
To: 32155@debbugs.gnu.org
Subject: [bug#32155] [PATCH 2/4] gnu: Add stb-image.
Date: Sat, 14 Jul 2018 16:43:53 +0200	[thread overview]
Message-ID: <20180714144355.31152-2-mbakke@fastmail.com> (raw)
In-Reply-To: <20180714144355.31152-1-mbakke@fastmail.com>

* gnu/packages/stb.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register it.
---
 gnu/local.mk         |  1 +
 gnu/packages/stb.scm | 95 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)
 create mode 100644 gnu/packages/stb.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index 9e875263a..5c6fc8e86 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -403,6 +403,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/sssd.scm				\
   %D%/packages/stalonetray.scm			\
   %D%/packages/statistics.scm			\
+  %D%/packages/stb.scm				\
   %D%/packages/storage.scm			\
   %D%/packages/suckless.scm			\
   %D%/packages/swig.scm				\
diff --git a/gnu/packages/stb.scm b/gnu/packages/stb.scm
new file mode 100644
index 000000000..148e8dbdb
--- /dev/null
+++ b/gnu/packages/stb.scm
@@ -0,0 +1,95 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;;
+;;; 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 stb)
+  #:use-module (guix packages)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
+  #:use-module ((guix licenses) #:select (expat public-domain)))
+
+(define stb
+  ;; stb is a collection of libraries developed within the same repository.
+  ;; When updating this, remember to change versions below as appropriate.
+  (let ((commit "e6afb9cbae4064da8c3e69af3ff5c4629579c1d2")
+        (revision "0"))
+    (package
+      (name "stb")
+      (home-page "https://github.com/nothings/stb")
+      (version (git-version "0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url home-page)
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "079nsn9bnb8c0vfq26g5l53q6gzx19a5x9q2nb55mpcljxsgxnmf"))
+                (file-name (git-file-name name version))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:modules ((ice-9 ftw)
+                    (ice-9 regex)
+                    (srfi srfi-26)
+                    ,@%gnu-build-system-modules)
+         #:phases (modify-phases %standard-phases
+                    (delete 'configure)
+                    (delete 'build)
+                    (replace 'check
+                      (lambda _
+                        (invoke "make" "-C" "tests" "CC=gcc")))
+                    (replace 'install
+                      (lambda* (#:key outputs #:allow-other-keys)
+                        (let ((out (assoc-ref outputs "out"))
+                              (files (make-regexp "\\.(c|h|md)$")))
+                          (for-each (lambda (file)
+                                      (install-file file out))
+                                    (scandir "." (cut regexp-exec files <>)))
+                          #t))))))
+      (synopsis "Single file libraries for C/C++")
+      (description
+       "This package contains a variety of small independent libraries for
+the C programming language.")
+      ;; The user can choose either license.
+      (license (list expat public-domain)))))
+
+(define (make-stb-header-package name version description)
+  (package
+    (inherit stb)
+    (name name)
+    (version version)
+    (source #f)
+    (inputs `(("stb" ,stb)))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder (begin
+                   (use-modules (guix build utils))
+                   (let ((stb (assoc-ref %build-inputs "stb"))
+                         (lib (string-join (string-split ,name #\-) "_"))
+                         (out (assoc-ref %outputs "out")))
+                     (install-file (string-append stb "/" lib ".h")
+                                   (string-append out "/include"))
+                     #t))))
+    (description description)))
+
+(define-public stb-image
+  (make-stb-header-package
+   "stb-image" "2.19"
+   "stb-image is a small and self-contained library for image loading or
+decoding from file or memory.  A variety of formats are supported."))
-- 
2.18.0

  reply	other threads:[~2018-07-14 14:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-14 14:41 [bug#32155] [PATCH 0/4] sfml updates Marius Bakke
2018-07-14 14:43 ` [bug#32155] [PATCH 1/4] gnu: sfml: Update to 2.5.0 Marius Bakke
2018-07-14 14:43   ` Marius Bakke [this message]
2018-07-14 14:43   ` [bug#32155] [PATCH 3/4] gnu: Add stb-image-write Marius Bakke
2018-07-14 14:43   ` [bug#32155] [PATCH 4/4] gnu: sfml: Remove all bundled dependencies Marius Bakke
2018-07-14 14:47     ` Marius Bakke
2018-07-17 21:16 ` [bug#32155] [PATCH 0/4] sfml updates Ludovic Courtès
2018-07-17 23:18   ` bug#32155: " Marius Bakke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180714144355.31152-2-mbakke@fastmail.com \
    --to=mbakke@fastmail.com \
    --cc=32155@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.