Re: GFortran can’t find system headers

2013-10-17 Thread Ludovic Courtès
Nikita Karetnikov  skribis:

>> Instead, what should do is preserve the arguments; the value associated
>> with #:configure-flags should be changed to replace any
>> --enable-languages=.* flag with yours.  See ‘gcc-boot0’ in base.scm for
>> how to do that.
>
> Are you talking about the ‘substitute-keyword-arguments’ part?

Yes.

>> Alternately, you could turn the current ‘gcc-4.8’ definition into a
>> ‘make-gcc-4.8’ procedure like this:
>
>>   (define* (make-gcc-4.8 #:key languages)
>> (package
>>...
>
>>#:configure-flags ... ,(string-join languages ",")
>
>>...))
>
>>   (define gcc-4.8
>> (make-gcc-4.8 #:languages '("c" "c++")))
>
>> That would probably be easier to work with.
>
> I don’t like the above version because it doesn’t allow to choose the
> version of GCC.

Just add a ‘gcc’ parameter.

> Also, ‘/nix/store/nxpzxlvg5z5qq10wzxrzk9hjyhxyicxq-gfortran-4.8.1/bin’
> contains these programs:
>
> c++ gcc-ranlib i686-pc-linux-gnu-gcc-4.8.1
> cpp gcov   i686-pc-linux-gnu-gcc-ar
> g++ gfortran   i686-pc-linux-gnu-gcc-nm
> gcc i686-pc-linux-gnu-c++  i686-pc-linux-gnu-gcc-ranlib
> gcc-ar  i686-pc-linux-gnu-g++  i686-pc-linux-gnu-gfortran
> gcc-nm  i686-pc-linux-gnu-gcc
>
> Are C++ and C-related programs supposed to be there?

Yes, the C and C++ front-ends are always compiled.

> -(define-public gcc-4.7
> +(define* (inherit-gcc name* version* source* #:key (languages '("c" "c++")))

I would really ‘make-gcc’, or maybe ‘custom-gcc’.

Good news: the stars in these parameter names are no longer needed
(commit 59fbeb8).

>(let* ((stripped? #t)   ; TODO: make this a 
> parameter
>   (maybe-target-tools
>(lambda ()
> @@ -68,13 +68,14 @@ where the OS part is overloaded to denote a specific 
> ABI---into GCC
>  ;; contents of (maybe-target-tools).
>  (list 'quasiquote
>(append
> -   '("--enable-plugin"
> - "--enable-languages=c,c++"
> +   `("--enable-plugin"
> + ,(string-append "--enable-languages="
> + (string-join languages ","))
>   "--disable-multilib"
>  
> - "--with-local-prefix=/no-gcc-local-prefix"
> + "--with-local-prefix=/no-gcc-local-prefix")
>  
> - ,(let ((libc (assoc-ref %build-inputs "libc")))
> +   '(,(let ((libc (assoc-ref %build-inputs "libc")))

I guess this line shouldn’t have changed.

> @@ -200,6 +195,17 @@ Go.  It also includes standard libraries for these 
> languages.")
>(license gpl3+)
>(home-page "http://gcc.gnu.org/";
>  
> +(define-public gcc-4.7
> +  (let ((version "4.7.3"))
> +(inherit-gcc "gcc" version
> + (origin
> +  (method url-fetch)
> +  (uri (string-append "mirror://gnu/gcc/gcc-"
> +  version "/gcc-" version ".tar.bz2"))
> +  (sha256
> +   (base32
> +
> "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g"))

I guess this triggers a complete rebuild, right?  (That means it would
go in ‘core-updates’.)

Using the ‘substitute-keyword-arguments’ hack as in base.scm would allow
you to avoid that.

Also, the ‘origin’ thing should be factorized:

  (define (gcc-source version)
(origin ...))

It’s good that you’re tackling this!  Then we can also build the
Objective-C front-end, and then start GNUstepping.

Thanks,
Ludo’.



Re: GFortran can’t find system headers

2013-10-17 Thread Nikita Karetnikov
> Instead, what should do is preserve the arguments; the value associated
> with #:configure-flags should be changed to replace any
> --enable-languages=.* flag with yours.  See ‘gcc-boot0’ in base.scm for
> how to do that.

Are you talking about the ‘substitute-keyword-arguments’ part?

> Alternately, you could turn the current ‘gcc-4.8’ definition into a
> ‘make-gcc-4.8’ procedure like this:

>   (define* (make-gcc-4.8 #:key languages)
> (package
>...

>#:configure-flags ... ,(string-join languages ",")

>...))

>   (define gcc-4.8
> (make-gcc-4.8 #:languages '("c" "c++")))

> That would probably be easier to work with.

I don’t like the above version because it doesn’t allow to choose the
version of GCC.  I’ve attached my version, how can I make it look
better?

Also, ‘/nix/store/nxpzxlvg5z5qq10wzxrzk9hjyhxyicxq-gfortran-4.8.1/bin’
contains these programs:

c++ gcc-ranlib i686-pc-linux-gnu-gcc-4.8.1
cpp gcov   i686-pc-linux-gnu-gcc-ar
g++ gfortran   i686-pc-linux-gnu-gcc-nm
gcc i686-pc-linux-gnu-c++  i686-pc-linux-gnu-gcc-ranlib
gcc-ar  i686-pc-linux-gnu-g++  i686-pc-linux-gnu-gfortran
gcc-nm  i686-pc-linux-gnu-gcc

Are C++ and C-related programs supposed to be there?

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index cececca..46c4804 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -47,7 +47,7 @@ where the OS part is overloaded to denote a specific ABI---into GCC
  ;; TODO: Add `armel.*gnueabi', `hf', etc.
  '(
 
-(define-public gcc-4.7
+(define* (inherit-gcc name* version* source* #:key (languages '("c" "c++")))
   (let* ((stripped? #t)   ; TODO: make this a parameter
  (maybe-target-tools
   (lambda ()
@@ -68,13 +68,14 @@ where the OS part is overloaded to denote a specific ABI---into GCC
 ;; contents of (maybe-target-tools).
 (list 'quasiquote
   (append
-   '("--enable-plugin"
- "--enable-languages=c,c++"
+   `("--enable-plugin"
+ ,(string-append "--enable-languages="
+ (string-join languages ","))
  "--disable-multilib"
 
- "--with-local-prefix=/no-gcc-local-prefix"
+ "--with-local-prefix=/no-gcc-local-prefix")
 
- ,(let ((libc (assoc-ref %build-inputs "libc")))
+   '(,(let ((libc (assoc-ref %build-inputs "libc")))
 (if libc
 (string-append "--with-native-system-header-dir=" libc
"/include")
@@ -88,15 +89,9 @@ where the OS part is overloaded to denote a specific ABI---into GCC
 
(maybe-target-tools))
 (package
-  (name "gcc")
-  (version "4.7.3")
-  (source (origin
-   (method url-fetch)
-   (uri (string-append "mirror://gnu/gcc/gcc-"
-   version "/gcc-" version ".tar.bz2"))
-   (sha256
-(base32
- "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g"
+  (name name*)
+  (version version*)
+  (source source*)
   (build-system gnu-build-system)
   (inputs `(("gmp" ,gmp)
 ("mpfr" ,mpfr)
@@ -200,6 +195,17 @@ Go.  It also includes standard libraries for these languages.")
   (license gpl3+)
   (home-page "http://gcc.gnu.org/";
 
+(define-public gcc-4.7
+  (let ((version "4.7.3"))
+(inherit-gcc "gcc" version
+ (origin
+  (method url-fetch)
+  (uri (string-append "mirror://gnu/gcc/gcc-"
+  version "/gcc-" version ".tar.bz2"))
+  (sha256
+   (base32
+"1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g"))
+
 (define-public gcc-4.8
   (package (inherit gcc-4.7)
 (version "4.8.1")
@@ -211,6 +217,18 @@ Go.  It also includes standard libraries for these languages.")
   (base32
"04sqn0ds17ys8l6zn7vyyvjz1a7hsk4zb0381vlw9wnr7az48nsl"))
 
+(define-public gfortran-4.8
+  (let ((version "4.8.1"))
+(inherit-gcc "gfortran" version
+ (origin
+  (method url-fetch)
+  (uri (string-append "mirror://gnu/gcc/gcc-"
+  version "/gcc-" version ".tar.bz2"))
+  (sha256
+   (base32
+"04sqn0ds17ys8l6zn7vyyvjz1a7hsk4zb0381vlw9wnr7az48nsl")))
+ #:languages '("fortran"
+
 (define-public isl
   (package
 (name "isl")


pgpHyNQzdGDGR.pgp
Description: PGP signature


Re: GFortran can’t find system headers

2013-10-15 Thread Ludovic Courtès
Nikita Karetnikov  skribis:

> I’m trying to package APL, which requires LAPACK, which requires
> Fortran.

Cool.

> Here’s my attempt to add the last one:
>
> (define-public gfortran-4.8
>   (package (inherit gcc-4.8)
> (name "gfortran")
> (arguments `(#:configure-flags '("--enable-languages=fortran")
>
> I get the following error while trying to build it:
>
> The directory that should contain system headers does not exist:
>   /usr/include

Yes, the problem is that the your ‘arguments’ field above completely
overrides that of ‘gcc-4.8’.

Instead, what should do is preserve the arguments; the value associated
with #:configure-flags should be changed to replace any
--enable-languages=.* flag with yours.  See ‘gcc-boot0’ in base.scm for
how to do that.

Alternately, you could turn the current ‘gcc-4.8’ definition into a
‘make-gcc-4.8’ procedure like this:

  (define* (make-gcc-4.8 #:key languages)
(package
   ...

   #:configure-flags ... ,(string-join languages ",")

   ...))

  (define gcc-4.8
(make-gcc-4.8 #:languages '("c" "c++")))

That would probably be easier to work with.

HTH,
Ludo’.