unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: gcj: remove broken symlink and stump binaries.
@ 2015-04-30 15:37 Ricardo Wurmus
  2015-04-30 16:05 ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2015-04-30 15:37 UTC (permalink / raw)
  To: Guix-devel

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

This patch adds a build phase to GCJ removing a broken symlink and a
couple of non-functional binaries, such as "gcc" or "g++".

In a GCJ build these binaries are useless as GCJ is a GCC built only
with Java support.  When GCJ is installed alongside gcc-toolchain, for
example, there would be conflicts with GCJ's "gcc" stump binary
shadowing the usable "gcc" binary from gcc-toolchain.

Removing these binaries should be harmless as users of GCJ are unlikely
to use "gcc" but "gcj" directly.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-gcj-Remove-broken-symlink-and-conflicting-files.patch --]
[-- Type: text/x-patch, Size: 2104 bytes --]

From 99b56cf4b17b1dbed7977dbce6e3c81fa4115aa7 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Thu, 30 Apr 2015 17:11:39 +0200
Subject: [PATCH] gnu: gcj: Remove broken symlink and conflicting files.

* gnu/packages/gcc.scm (gcj)[arguments]: Add a build phase to remove a broken
  symlink and generic stump binaries.
---
 gnu/packages/gcc.scm | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index e712e43..3ea65a9 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -435,7 +435,29 @@ Go.  It also includes runtime support libraries for these languages.")
                   (string-append jvm "/lib/tools.jar")))
                (chmod target #o755)
                #t))
-           ,phases))))))
+           (alist-cons-after
+            'install 'remove-broken-or-conflicting-files
+            (lambda _
+              (let ((out (assoc-ref %outputs "out")))
+                (for-each delete-file
+                          (map (cut string-append out <>)
+                               '("/lib/jvm/jre/lib/amd64/libjawt.so"
+                                 "/bin/c++"
+                                 "/bin/cpp"
+                                 "/bin/g++"
+                                 "/bin/gcc"
+                                 "/bin/gcc-ar"
+                                 "/bin/gcc-nm"
+                                 "/bin/gcc-ranlib"
+                                 "/bin/x86_64-unknown-linux-gnu-c++"
+                                 "/bin/x86_64-unknown-linux-gnu-g++"
+                                 "/bin/x86_64-unknown-linux-gnu-gcc"
+                                 "/bin/x86_64-unknown-linux-gnu-gcc-4.8.4"
+                                 "/bin/x86_64-unknown-linux-gnu-gcc-ar"
+                                 "/bin/x86_64-unknown-linux-gnu-gcc-nm"
+                                 "/bin/x86_64-unknown-linux-gnu-gcc-ranlib"))))
+              #t)
+            ,phases)))))))
 
 (define ecj-bootstrap-4.8
   (origin
-- 
2.1.0


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

* Re: [PATCH] gnu: gcj: remove broken symlink and stump binaries.
  2015-04-30 15:37 [PATCH] gnu: gcj: remove broken symlink and stump binaries Ricardo Wurmus
@ 2015-04-30 16:05 ` Ludovic Courtès
  2015-04-30 16:29   ` Ricardo Wurmus
  2015-05-02 16:14   ` Ricardo Wurmus
  0 siblings, 2 replies; 6+ messages in thread
From: Ludovic Courtès @ 2015-04-30 16:05 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix-devel

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

> This patch adds a build phase to GCJ removing a broken symlink and a
> couple of non-functional binaries, such as "gcc" or "g++".
>
> In a GCJ build these binaries are useless as GCJ is a GCC built only
> with Java support.  When GCJ is installed alongside gcc-toolchain, for
> example, there would be conflicts with GCJ's "gcc" stump binary
> shadowing the usable "gcc" binary from gcc-toolchain.
>
> Removing these binaries should be harmless as users of GCJ are unlikely
> to use "gcc" but "gcj" directly.

Sounds good.

> From 99b56cf4b17b1dbed7977dbce6e3c81fa4115aa7 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Thu, 30 Apr 2015 17:11:39 +0200
> Subject: [PATCH] gnu: gcj: Remove broken symlink and conflicting files.
>
> * gnu/packages/gcc.scm (gcj)[arguments]: Add a build phase to remove a broken
>   symlink and generic stump binaries.

[...]

> +                (for-each delete-file
> +                          (map (cut string-append out <>)
> +                               '("/lib/jvm/jre/lib/amd64/libjawt.so"
> +                                 "/bin/c++"
> +                                 "/bin/cpp"
> +                                 "/bin/g++"
> +                                 "/bin/gcc"
> +                                 "/bin/gcc-ar"
> +                                 "/bin/gcc-nm"
> +                                 "/bin/gcc-ranlib"
> +                                 "/bin/x86_64-unknown-linux-gnu-c++"
> +                                 "/bin/x86_64-unknown-linux-gnu-g++"
> +                                 "/bin/x86_64-unknown-linux-gnu-gcc"
> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-4.8.4"
> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-ar"
> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-nm"
> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-ranlib"))))

This is specific to x86_64-linux-gnu though.  Wouldn’t it be better to
use a white list instead, or maybe keep it a black list but use
find-files and regexps?

Thanks,
Ludo’.

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

* Re: [PATCH] gnu: gcj: remove broken symlink and stump binaries.
  2015-04-30 16:05 ` Ludovic Courtès
@ 2015-04-30 16:29   ` Ricardo Wurmus
  2015-05-02 16:14   ` Ricardo Wurmus
  1 sibling, 0 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2015-04-30 16:29 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel


Ludovic Courtès writes:

>> +                (for-each delete-file
>> +                          (map (cut string-append out <>)
>> +                               '("/lib/jvm/jre/lib/amd64/libjawt.so"
>> +                                 "/bin/c++"
>> +                                 "/bin/cpp"
>> +                                 "/bin/g++"
>> +                                 "/bin/gcc"
>> +                                 "/bin/gcc-ar"
>> +                                 "/bin/gcc-nm"
>> +                                 "/bin/gcc-ranlib"
>> +                                 "/bin/x86_64-unknown-linux-gnu-c++"
>> +                                 "/bin/x86_64-unknown-linux-gnu-g++"
>> +                                 "/bin/x86_64-unknown-linux-gnu-gcc"
>> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-4.8.4"
>> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-ar"
>> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-nm"
>> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-ranlib"))))
>
> This is specific to x86_64-linux-gnu though.  Wouldn’t it be better to
> use a white list instead, or maybe keep it a black list but use
> find-files and regexps?

Argh, you are of course right about this.  I'll update this to use
find-files instead.

~~ Ricardo

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

* Re: [PATCH] gnu: gcj: remove broken symlink and stump binaries.
  2015-04-30 16:05 ` Ludovic Courtès
  2015-04-30 16:29   ` Ricardo Wurmus
@ 2015-05-02 16:14   ` Ricardo Wurmus
  2015-05-02 18:26     ` Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2015-05-02 16:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

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


Ludovic Courtès writes:

>> +                (for-each delete-file
>> +                          (map (cut string-append out <>)
>> +                               '("/lib/jvm/jre/lib/amd64/libjawt.so"
>> +                                 "/bin/c++"
>> +                                 "/bin/cpp"
>> +                                 "/bin/g++"
>> +                                 "/bin/gcc"
>> +                                 "/bin/gcc-ar"
>> +                                 "/bin/gcc-nm"
>> +                                 "/bin/gcc-ranlib"
>> +                                 "/bin/x86_64-unknown-linux-gnu-c++"
>> +                                 "/bin/x86_64-unknown-linux-gnu-g++"
>> +                                 "/bin/x86_64-unknown-linux-gnu-gcc"
>> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-4.8.4"
>> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-ar"
>> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-nm"
>> +                                 "/bin/x86_64-unknown-linux-gnu-gcc-ranlib"))))
>
> This is specific to x86_64-linux-gnu though.  Wouldn’t it be better to
> use a white list instead, or maybe keep it a black list but use
> find-files and regexps?

Attached is a new patch using find-files and regular expressions.  The
results look fine in the REPL, but I have not yet finished compiling the
gcj package (it takes a very long time on my machine).

~~ Ricardo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-gcj-Remove-broken-symlink-and-conflicting-files.patch --]
[-- Type: text/x-patch, Size: 1409 bytes --]

From 86f2b4e7f182b5ea734eea4d72ef868b6a25f7eb Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Thu, 30 Apr 2015 17:11:39 +0200
Subject: [PATCH] gnu: gcj: Remove broken symlink and conflicting files.

* gnu/packages/gcc.scm (gcj)[arguments]: Add a build phase to remove a broken
  symlink and generic stump binaries.
---
 gnu/packages/gcc.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index e712e43..aa3e046 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -435,7 +435,18 @@ Go.  It also includes runtime support libraries for these languages.")
                   (string-append jvm "/lib/tools.jar")))
                (chmod target #o755)
                #t))
-           ,phases))))))
+           (alist-cons-after
+            'install 'remove-broken-or-conflicting-files
+            (lambda _
+              (let ((out (assoc-ref %outputs "out")))
+                (for-each
+                 delete-file
+                 (append (find-files (string-append out "/lib/jvm/jre/lib")
+                                     "libjawt.so")
+                         (find-files (string-append out "/bin")
+                                     ".*(c\\+\\+|cpp|g\\+\\+|gcc.*)"))))
+              #t)
+            ,phases)))))))
 
 (define ecj-bootstrap-4.8
   (origin
-- 
2.1.0


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

* Re: [PATCH] gnu: gcj: remove broken symlink and stump binaries.
  2015-05-02 16:14   ` Ricardo Wurmus
@ 2015-05-02 18:26     ` Ludovic Courtès
  2015-05-02 19:09       ` Ricardo Wurmus
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2015-05-02 18:26 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix-devel

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

> From 86f2b4e7f182b5ea734eea4d72ef868b6a25f7eb Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Thu, 30 Apr 2015 17:11:39 +0200
> Subject: [PATCH] gnu: gcj: Remove broken symlink and conflicting files.
>
> * gnu/packages/gcc.scm (gcj)[arguments]: Add a build phase to remove a broken
>   symlink and generic stump binaries.

LGTM, please push to core-updates!

Thanks,
Ludo'.

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

* Re: [PATCH] gnu: gcj: remove broken symlink and stump binaries.
  2015-05-02 18:26     ` Ludovic Courtès
@ 2015-05-02 19:09       ` Ricardo Wurmus
  0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2015-05-02 19:09 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel


Ludovic Courtès writes:

> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
>
>> From 86f2b4e7f182b5ea734eea4d72ef868b6a25f7eb Mon Sep 17 00:00:00 2001
>> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
>> Date: Thu, 30 Apr 2015 17:11:39 +0200
>> Subject: [PATCH] gnu: gcj: Remove broken symlink and conflicting files.
>>
>> * gnu/packages/gcc.scm (gcj)[arguments]: Add a build phase to remove a broken
>>   symlink and generic stump binaries.
>
> LGTM, please push to core-updates!

Pushed to core-updates.

~~ Ricardo

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

end of thread, other threads:[~2015-05-02 19:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-30 15:37 [PATCH] gnu: gcj: remove broken symlink and stump binaries Ricardo Wurmus
2015-04-30 16:05 ` Ludovic Courtès
2015-04-30 16:29   ` Ricardo Wurmus
2015-05-02 16:14   ` Ricardo Wurmus
2015-05-02 18:26     ` Ludovic Courtès
2015-05-02 19:09       ` Ricardo Wurmus

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).