unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Add libiberty.
@ 2015-06-27  9:49 Ricardo Wurmus
  2015-06-28  9:06 ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2015-06-27  9:49 UTC (permalink / raw)
  To: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

GCC 4.8.4 is the last GCC containing libiberty.a.  The attached patch
adds a package generator that creates a libiberty package for a given
GCC package.  It also adds a libiberty package for the default “gcc”.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-libiberty.patch --]
[-- Type: text/x-patch, Size: 1963 bytes --]

From 848a6b91a48abcfdc2eb0d9bbde6a0f22b019090 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Sat, 27 Jun 2015 11:47:04 +0200
Subject: [PATCH] gnu: Add libiberty.

* gnu/packages/gcc.scm (make-libiberty, libiberty): New variables.
---
 gnu/packages/gcc.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 4fc2e63..aba8565 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -373,6 +373,41 @@ using compilers other than GCC."
 (define-public libstdc++-4.9
   (make-libstdc++ gcc-4.9))
 
+(define (make-libiberty gcc)
+  "Return a libiberty package based on GCC."
+  (package
+    (inherit gcc)
+    (name "libiberty")
+    (arguments
+     `(#:out-of-source? #t
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'chdir
+                     (lambda _
+                       (chdir "libiberty")
+                       #t))
+         (replace
+          'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let* ((out     (assoc-ref outputs "out"))
+                   (lib     (string-append out "/lib/"))
+                   (include (string-append out "/include/")))
+              (mkdir-p lib)
+              (mkdir-p include)
+              (copy-file "libiberty.a"
+                         (string-append lib "libiberty.a"))
+              (copy-file "../include/libiberty.h"
+                         (string-append include "libiberty.h"))
+              #t))))))
+    (inputs '())
+    (outputs '("out"))
+    (native-inputs '())
+    (propagated-inputs '())
+    (synopsis "Collection of subroutines used by various GNU programs")))
+
+(define-public libiberty
+  (make-libiberty gcc))
+
 (define* (custom-gcc gcc name languages #:key (separate-lib-output? #t))
   "Return a custom version of GCC that supports LANGUAGES."
   (package (inherit gcc)
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add libiberty.
  2015-06-27  9:49 [PATCH] Add libiberty Ricardo Wurmus
@ 2015-06-28  9:06 ` Ludovic Courtès
  2015-06-28 10:31   ` Ricardo Wurmus
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2015-06-28  9:06 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix-devel

Ricardo Wurmus <rekado@elephly.net> skribis:

> From 848a6b91a48abcfdc2eb0d9bbde6a0f22b019090 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <rekado@elephly.net>
> Date: Sat, 27 Jun 2015 11:47:04 +0200
> Subject: [PATCH] gnu: Add libiberty.
>
> * gnu/packages/gcc.scm (make-libiberty, libiberty): New variables.

It’s a problem that so many packages depend on libiberty, which is
supposed to be internal to a few GNU packages.  Binutils and GDB used to
install it as well but they no longer do.

> +    (synopsis "Collection of subroutines used by various GNU programs")))

Maybe add a short description.

> +(define-public libiberty
> +  (make-libiberty gcc))

s/gcc/gcc-4.8/ if 4.8 is the last package installing it.

OK to push with these changes.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add libiberty.
  2015-06-28  9:06 ` Ludovic Courtès
@ 2015-06-28 10:31   ` Ricardo Wurmus
  2015-06-28 20:24     ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2015-06-28 10:31 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

>> +    (synopsis "Collection of subroutines used by various GNU programs")))
>
> Maybe add a short description.

Okay.

>> +(define-public libiberty
>> +  (make-libiberty gcc))
>
> s/gcc/gcc-4.8/ if 4.8 is the last package installing it.

I wanted to provide a default libiberty package for the default “gcc”.
Otherwise any change to the default GCC version would require packages
to update their libiberty input.

GCC 4.8 actually installs libiberty somewhere in the “lib” output of
gcc-4.8, but GCC 4.9 does not, nor does GCC 5.1.  Is there a problem
with “libiberty” as defined above, following whatever GCC version is set
as the default?

~~ Ricardo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add libiberty.
  2015-06-28 10:31   ` Ricardo Wurmus
@ 2015-06-28 20:24     ` Ludovic Courtès
  2015-06-29  6:27       ` Ricardo Wurmus
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2015-06-28 20:24 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix-devel

Ricardo Wurmus <rekado@elephly.net> skribis:

>>> +    (synopsis "Collection of subroutines used by various GNU programs")))
>>
>> Maybe add a short description.
>
> Okay.
>
>>> +(define-public libiberty
>>> +  (make-libiberty gcc))
>>
>> s/gcc/gcc-4.8/ if 4.8 is the last package installing it.
>
> I wanted to provide a default libiberty package for the default “gcc”.
> Otherwise any change to the default GCC version would require packages
> to update their libiberty input.
>
> GCC 4.8 actually installs libiberty somewhere in the “lib” output of
> gcc-4.8, but GCC 4.9 does not, nor does GCC 5.1.  Is there a problem
> with “libiberty” as defined above, following whatever GCC version is set
> as the default?

Oh you mean that 4.9 and 5.1 install it as well, just not in the “lib”
output, right?

Then that is fine, indeed.

Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add libiberty.
  2015-06-28 20:24     ` Ludovic Courtès
@ 2015-06-29  6:27       ` Ricardo Wurmus
  2015-06-29  8:33         ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2015-06-29  6:27 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel


>>>> +(define-public libiberty
>>>> +  (make-libiberty gcc))
>>>
>>> s/gcc/gcc-4.8/ if 4.8 is the last package installing it.
>>
>> I wanted to provide a default libiberty package for the default “gcc”.
>> Otherwise any change to the default GCC version would require packages
>> to update their libiberty input.
>>
>> GCC 4.8 actually installs libiberty somewhere in the “lib” output of
>> gcc-4.8, but GCC 4.9 does not, nor does GCC 5.1.  Is there a problem
>> with “libiberty” as defined above, following whatever GCC version is set
>> as the default?
>
> Oh you mean that 4.9 and 5.1 install it as well, just not in the “lib”
> output, right?

No, I mean that although 4.9 and 5.1 include the sources of libiberty
neither of them install it as a library in *any* of their outputs.

With 4.8 a package depending on libiberty could add

  ("gcc" ,gcc-4.8 "lib")

as an input, but with 4.9 and 5.1 there does not seem to be any way to
get libiberty but to explicitly install it.  This is what the new
“libiberty” package is supposed to do.

Following the GCC version automatically dependent on whatever value the
variable "gcc" has is just a bonus to simplify upgrades to the default
version of GCC (as the recent move from 4.8 to 4.9).

~~ Ricardo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add libiberty.
  2015-06-29  6:27       ` Ricardo Wurmus
@ 2015-06-29  8:33         ` Ludovic Courtès
  2015-06-29  8:47           ` Ricardo Wurmus
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2015-06-29  8:33 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix-devel

Ricardo Wurmus <rekado@elephly.net> skribis:

>>>>> +(define-public libiberty
>>>>> +  (make-libiberty gcc))
>>>>
>>>> s/gcc/gcc-4.8/ if 4.8 is the last package installing it.
>>>
>>> I wanted to provide a default libiberty package for the default “gcc”.
>>> Otherwise any change to the default GCC version would require packages
>>> to update their libiberty input.
>>>
>>> GCC 4.8 actually installs libiberty somewhere in the “lib” output of
>>> gcc-4.8, but GCC 4.9 does not, nor does GCC 5.1.  Is there a problem
>>> with “libiberty” as defined above, following whatever GCC version is set
>>> as the default?
>>
>> Oh you mean that 4.9 and 5.1 install it as well, just not in the “lib”
>> output, right?
>
> No, I mean that although 4.9 and 5.1 include the sources of libiberty
> neither of them install it as a library in *any* of their outputs.
>
> With 4.8 a package depending on libiberty could add
>
>   ("gcc" ,gcc-4.8 "lib")
>
> as an input, but with 4.9 and 5.1 there does not seem to be any way to
> get libiberty but to explicitly install it.  This is what the new
> “libiberty” package is supposed to do.

OK.

> Following the GCC version automatically dependent on whatever value the
> variable "gcc" has is just a bonus to simplify upgrades to the default
> version of GCC (as the recent move from 4.8 to 4.9).

I don’t get it.  If we use ‘gcc’ instead of ‘gcc-4.8’, it doesn’t work,
because ‘gcc’ is currently an alias for ‘gcc-4.9’.

This is why I suggested using ‘gcc-4.8’ explicitly: We know it’s the
last version that installs libiberty.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add libiberty.
  2015-06-29  8:33         ` Ludovic Courtès
@ 2015-06-29  8:47           ` Ricardo Wurmus
  2015-06-29 12:00             ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2015-06-29  8:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

>> Following the GCC version automatically dependent on whatever value the
>> variable "gcc" has is just a bonus to simplify upgrades to the default
>> version of GCC (as the recent move from 4.8 to 4.9).
>
> I don’t get it.  If we use ‘gcc’ instead of ‘gcc-4.8’, it doesn’t work,
> because ‘gcc’ is currently an alias for ‘gcc-4.9’.

What do you mean by "it doesn't work"?  I'm not seeing any problem.

> This is why I suggested using ‘gcc-4.8’ explicitly: We know it’s the
> last version that installs libiberty.

Maybe it is easier to understand what I mean if I also talk about the
specific case that made me write a libiberty package.

I have a package "powertabeditor" whose executable links with
"libiberty.a".  When we were using GCC 4.8 I just had to add

    ("gcc" ,gcc-4.8 "lib")

as an input.  Now that GCC 4.9 is the default, I don't want
"powertabeditor" to depend on the "lib" output of gcc-4.8 anymore.  I
also don't want to explicitly ask for GCC 4.8, because I have no problem
using the default GCC.  I'm only interested in getting "libiberty.a".  I
want the default GCC's version of "libiberty.a".

Alas, the current default (4.9) does not install "libiberty.a".  That is
why I wrote the function "make-libiberty" to generate a "libiberty"
package given a certain version of GCC.  For "powertabeditor" I just
want to use the current defaults for both GCC and "libiberty.a".

With "gcc" being an alias for "gcc-4.9" (which is the default GCC) and
"libiberty" being generated from the sources of this very same GCC I
have exactly what I wanted.

If I needed a specific version of libiberty, say the one included with
GCC 4.8, I would define libiberty-4.8 such:

    (define-public libiberty-4.8
      (make-libiberty gcc-4.8))

If I needed the 4.9 version I'd do:

    (define-public libiberty-4.9
      (make-libiberty gcc-4.9))

This works because all GCC sources include the sources for libiberty
(although only with 4.8 libiberty.a is built and installed).

But if all I want is the version of libiberty that *matches* the current
*default* GCC I'd use the package defined thus:

    (define-public libiberty
      (make-libiberty gcc))

Does this make any sense?

~~ Ricardo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add libiberty.
  2015-06-29  8:47           ` Ricardo Wurmus
@ 2015-06-29 12:00             ` Ludovic Courtès
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2015-06-29 12:00 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> Alas, the current default (4.9) does not install "libiberty.a".  That is
> why I wrote the function "make-libiberty" to generate a "libiberty"
> package given a certain version of GCC.  For "powertabeditor" I just
> want to use the current defaults for both GCC and "libiberty.a".

Ooooh, my bad, I had overlooked what ‘make-libiberty’ actually does
(somehow I thought it was simply copying libiberty.a from gcc’s output.)
Apologies for the confusion!

So yes, the patch looks good to me, please push.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-06-29 12:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-27  9:49 [PATCH] Add libiberty Ricardo Wurmus
2015-06-28  9:06 ` Ludovic Courtès
2015-06-28 10:31   ` Ricardo Wurmus
2015-06-28 20:24     ` Ludovic Courtès
2015-06-29  6:27       ` Ricardo Wurmus
2015-06-29  8:33         ` Ludovic Courtès
2015-06-29  8:47           ` Ricardo Wurmus
2015-06-29 12:00             ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).