diff mbox series

[bug#57625,1/3] gnu: Add libgc-private-headers-for-pnet.

Message ID 620a920f-c95a-ada1-714c-dc39fc95c5a9@disroot.org
State New
Headers show
Series WIP: Add pnet. | expand

Commit Message

Adam Faiz Sept. 6, 2022, 3:34 p.m. UTC
From feec1f999877de9ae411653c76bbf144cc6c7b2d Mon Sep 17 00:00:00 2001
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Tue, 6 Sep 2022 14:08:33 +0800
Subject: [PATCH 1/3] gnu: Add libgc-private-headers-for-pnet.

* gnu/packages/bdw-gc.scm (libgc-private-headers-for-pnet): New private 
variable.
---
  gnu/packages/bdw-gc.scm | 36 ++++++++++++++++++++++++++++++++++++
  1 file changed, 36 insertions(+)

  (define-public libatomic-ops
    (package
      (name "libatomic-ops")

base-commit: 9fa3e90789203109f6f86ab41b48c65f15451d4e

Comments

M Sept. 6, 2022, 4:55 p.m. UTC | #1
On 06-09-2022 17:34, Adam Faiz via Guix-patches via wrote:
> +(define-public libgc-private-headers-for-pnet
> +  (hidden-package
> +   (package
> +     (name "libgc-private-headers")
> +     (version (package-version libgc))
> +     (source (origin
> +               (method url-fetch)
> +               (uri (string-append 
> "https://github.com/ivmai/bdwgc/releases"
> +                                   "/download/v" version "/gc-" 
> version ".tar.gz"))
> +               (sha256
> +                (base32
> + "1798rp3mcfkgs38ynkbg2p47bq59pisrc6mn0l20pb5iczf0ssj3")))) 

Try (source (package-source libgc)) instead.  That way, the hash and URL 
remains correct even if libgc is updated.

         '(("include/config.h.in" "include/private/config.h")

I'd think you need to install include/config.h instead (*).

+     (license (x11-style (string-append home-page "license.txt"))))))

(license (package-license libgc)), in case the license of libgc ever 
changes.

(*) Untested proposal:

(define-public libgc-all-headers ; TODO(core-updates) merge into libgc
   (package
     (inherit libgc)
     (name "libgc-all-headers")
     (outputs "out")
     (arguments
       (append (package-arguments libgc)
         (list #:imported-modules
                '((guix build gnu-build-system) (guix build 
copy-build-system))
                #:phases
                #~(modify-phases
                        (add-after 'install 'delete-library
                          (lambda _
                            (delete-file-recursively (string-append 
#$output "/lib"))))
                        (add-after 'install 'delete-private-header
                          (lambda _
                            (delete-file-recursively (string-append 
#$output "/lib"))))
                        (add-after 'install 'install-private
                          (lambda arguments
                            ((@ (guix build copy-build-system) install)
                             (append (list #:install-plan 
'(("include/config.h" [...]) [...]))
                                           arguments))))))))
     (synopsis ...)
     (description ...)))

Also, why a hidden package?

Greetings,
Maxime.
Adam Faiz Sept. 7, 2022, 2:48 a.m. UTC | #2
On 9/7/22 00:55, Maxime Devos wrote:
> Also, why a hidden package? 
> Greetings,
> Maxime.
I wasn't sure if the package would be useful being exposed to the user 
interface, since it's specific to pnet's needs.

> (*) Untested proposal:
> 
> (define-public libgc-all-headers ; TODO(core-updates) merge into libgc
>   (package
>     (inherit libgc)
>     (name "libgc-all-headers")
>     (outputs "out")
>     (arguments
>       (append (package-arguments libgc)
>         (list #:imported-modules
>                '((guix build gnu-build-system) (guix build copy-build-system))
>                #:phases
>                #~(modify-phases
>                        (add-after 'install 'delete-library
>                          (lambda _
>                            (delete-file-recursively (string-append #$output "/lib"))))

>                        (add-after 'install 'delete-private-header
>                          (lambda _
>                            (delete-file-recursively (string-append #$output "/lib"))))
Why is 'delete-private-header the same as 'delete-library?
Was it a typo, and supposed to delete something else("include/private"?)
>                        (add-after 'install 'install-private
>                          (lambda arguments
>                            ((@ (guix build copy-build-system) install)
>                             (append (list #:install-plan '(("include/config.h" [...]) [...]))
>                                           arguments))))))))
>     (synopsis ...)
>     (description ...)))
Thanks, this looks much better than what I wrote. I didn't know how I 
could inherit it from libgc. I can use this in the V1 for this patch.
diff mbox series

Patch

diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm
index 268f0703b8..3bf2a8f2f6 100644
--- a/gnu/packages/bdw-gc.scm
+++ b/gnu/packages/bdw-gc.scm
@@ -26,6 +26,7 @@  (define-module (gnu packages bdw-gc)
    #:use-module (guix packages)
    #:use-module (guix download)
    #:use-module (guix utils)
+  #:use-module (guix build-system copy)
    #:use-module (guix build-system gnu)
    #:use-module (gnu packages pkg-config)
    #:use-module (gnu packages hurd))
@@ -122,6 +123,41 @@  (define-public libgc/back-pointers
         ,@(package-arguments libgc)))
      (synopsis "The BDW garbage collector, with back-pointer tracking")))

+(define-public libgc-private-headers-for-pnet
+  (hidden-package
+   (package
+     (name "libgc-private-headers")
+     (version (package-version libgc))
+     (source (origin
+               (method url-fetch)
+               (uri (string-append 
"https://github.com/ivmai/bdwgc/releases"
+                                   "/download/v" version "/gc-" version 
".tar.gz"))
+               (sha256
+                (base32
+                 "1798rp3mcfkgs38ynkbg2p47bq59pisrc6mn0l20pb5iczf0ssj3"))))
+     (build-system copy-build-system)
+     (arguments
+      '(#:install-plan
+        '(("include/config.h.in" "include/private/config.h")
+          ("include/gc_tiny_fl.h" "include/private/gc_tiny_fl.h")
+          ("include/gc_mark.h" "include/private/gc_mark.h")
+          ("include/private/gcconfig.h" "include/private/gcconfig.h")
+          ("include/private/gc_hdrs.h" "include/private/gc_hdrs.h")
+          ("include/private/gc_atomic_ops.h" 
"include/private/gc_atomic_ops.h")
+          ("include/private/gc_locks.h" "include/private/gc_locks.h")
+          ("include/private/gc_priv.h" "include/private/gc_priv.h"))
+        #:phases
+        (modify-phases %standard-phases
+          (add-after 'unpack 'fix-includes
+            (lambda _
+              (substitute* "include/private/gc_priv.h"
+                (("#include .*/gc_tiny_fl.h") "#include <gc_tiny_fl.h>")
+                (("#include .*/gc_mark.h") "#include <gc_mark.h>")))))))
+     (synopsis "Private headers of libgc for pnet")
+     (description "Private headers in libgc that are used in pnet.")
+     (home-page "https://www.hboehm.info/gc/")
+     (license (x11-style (string-append home-page "license.txt"))))))
+