Patchwork [1/2] gnu: Add btrfs-progs/static.

login
register
mail settings
Submitter David Craven
Date Nov. 30, 2016, 6:36 p.m.
Message ID <20161130183635.6513-1-david@craven.ch>
Download mbox | patch
Permalink /patch/18076/
State New
Headers show

Comments

David Craven - Nov. 30, 2016, 6:36 p.m.
* gnu/packages/linux.scm (btrfs-progs/static): New variable.
---
 gnu/packages/linux.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
Ludovic Courtès - Dec. 3, 2016, 3:15 p.m.
David Craven <david@craven.ch> skribis:

> * gnu/packages/linux.scm (btrfs-progs/static): New variable.

[...]

> +(define-public btrfs-progs/static
> +  (package
> +    (name "btrfs-progs-static")
> +    (version (package-version btrfs-progs))
> +    (build-system trivial-build-system)
> +    (source #f)
> +    (arguments
> +     `(#:modules ((guix build utils))

Add #:disallowed-references () to make sure you get the desired effect.

OK with this change, thanks!

Ludo’.
David Craven - Dec. 3, 2016, 9:41 p.m.
> Add #:allowed-references () to make sure you get the desired effect.

Isn't this a key of the gnu-build-system?
Ludovic Courtès - Dec. 5, 2016, 8:51 p.m.
David Craven <david@craven.ch> skribis:

>> Add #:allowed-references () to make sure you get the desired effect.
>
> Isn't this a key of the gnu-build-system?

Oh indeed (and this is ridiculous).  Sorry for the confusion.

Ludo’.

Patch

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index a4639bd..8b6cce4 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -2714,6 +2714,36 @@  easy administration.")
     ;; GPL2: Everything else.
     (license (list license:gpl2 license:gpl2+))))
 
+(define-public btrfs-progs/static
+  (package
+    (name "btrfs-progs-static")
+    (version (package-version btrfs-progs))
+    (build-system trivial-build-system)
+    (source #f)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 ftw)
+                      (srfi srfi-26))
+
+         (let* ((btrfs  (assoc-ref %build-inputs "btrfs-progs:static"))
+                (out    (assoc-ref %outputs "out"))
+                (source (string-append btrfs "/bin/btrfs.static"))
+                (target (string-append out "/bin/btrfs")))
+           (mkdir-p (dirname target))
+           (copy-file source target)
+           (remove-store-references target)
+           (chmod target #o555)))))
+    (inputs `(("btrfs-progs:static" ,btrfs-progs "static")))
+    (synopsis "Statically-linked btrfs command from btrfsprogs")
+    (description
+     "This package provides statically-linked command of btrfs taken
+from the btrfsprogs package.  It is meant to be used in initrds.")
+    (home-page (package-home-page btrfs-progs))
+    (license (package-license btrfs-progs))))
+
 (define-public freefall
   (package
     (name "freefall")