Subject: Perl-build-system does not honor #:module-build-flags or #:configure-flags

From: [email-masked]
Date: Fri, 07 Dec 2018 02:58:29 -0800

Hi

I'm trying hard to package perl-term-readline-gnu but have failed so
far. :D

See the attached patch for my addition to perl-build-system that did not
help.

The Makefile in the source says:

# Usage: perl Makefile.PL [--prefix=...] [--includedir=...]
[--libdir=...]                                       
#               [OPTIMIZE=...] 

The build failure (with or without my modifications to the build-system)
is:

starting phase `configure'
running `perl' with arguments ("Makefile.PL"
"PREFIX=/gnu/store/w4wb4wd1kjj6gmxlix0i3jj47v0izijh-perl-term-readline-gnu-1.35"
"INSTALLDIRS=site" "NO_PERLLOCAL=1")
Could not find neither libtermcap.a, libncurses.a, or libcurses.
Backtrace:
           4 (primitive-load "/gnu/store/vgfkdlnwks28vk50mg0xjl8iaf9…")
In ice-9/eval.scm:
   191:35  3 (_ _)
In srfi/srfi-1.scm:
    640:9  2 (for-each #<procedure 8298510 at /gnu/store/wy2ja4vrrn…> …)
In
/gnu/store/wy2ja4vrrnakwhabsn87ngsb3bqqm5fx-module-import/guix/build/gnu-build-system.scm:
   799:31  1 (_ _)
In
/gnu/store/wy2ja4vrrnakwhabsn87ngsb3bqqm5fx-module-import/guix/build/utils.scm:
    616:6  0 (invoke _ . _)

/gnu/store/wy2ja4vrrnakwhabsn87ngsb3bqqm5fx-module-import/guix/build/utils.scm:616:6:
In procedure invoke:
Throw to key `srfi-34' with args `(#<condition &invoke-error [program:
"perl" arguments: ("Makefile.PL"
"PREFIX=/gnu/store/w4wb4wd1kjj6gmxlix0i3jj47v0izijh-perl-term-rea\
dline-gnu-1.35" "INSTALLDIRS=site" "NO_PERLLOCAL=1") exit-status: 1
term-signal: #f stop-signal: #f] 80a8e60>)'.
note: keeping build directory
`/tmp/guix-build-perl-term-readline-gnu-1.35.drv-17'
builder for
`/gnu/store/n6dcbwrfag9klwysrfdkj2j05cr9710i-perl-term-readline-gnu-1.35.drv'
failed with exit code 1
build of
/gnu/store/n6dcbwrfag9klwysrfdkj2j05cr9710i-perl-term-readline-gnu-1.35.drv
failed
View build log at
'/var/log/guix/drvs/n6/dcbwrfag9klwysrfdkj2j05cr9710i-perl-term-readline-gnu-1.35.drv.bz2'.
cannot build derivation
`/gnu/store/pz0zrnpsvip0yxyd18cjazibsrlpf29h-youtube-viewer-cli-3.4.1.drv':
1 dependencies couldn't be built
guix build: error: build failed: build of
`/gnu/store/pz0zrnpsvip0yxyd18cjazibsrlpf29h-youtube-viewer-cli-3.4.1.drv'
failed

-- 
Cheers 
Swedebugia

From 2afd42c1631793fc5c186b82fbdbb3964f6ae464 Mon Sep 17 00:00:00 2001
From: swedebugia <[email-masked]>
Date: Fri, 7 Dec 2018 12:14:37 +0100
Subject: [PATCH] gnu: Add perl-term-readline-gnu -- flags not honored

---
 gnu/packages/perl.scm      | 37 ++++++++++++++++++++++++++++++++++++-
 guix/build-system/perl.scm |  3 ++-
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index cbdf070e8..d41182962 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -51,7 +51,8 @@
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages perl-web)
-  #:use-module (gnu packages pkg-config))
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages readline))
 
 ;;;
 ;;; Please: Try to add new module packages in alphabetic order.
@@ -8115,6 +8116,40 @@ other terminal related features, including retrieval/modification of the
 screen size, and retrieval/modification of the control characters.")
     (license (package-license perl))))
 
+(define-public perl-term-readline-gnu
+  (package
+   (name "perl-term-readline-gnu")
+   (version "1.35")
+   (source
+    (origin
+      (method url-fetch)
+      (uri (string-append
+            "mirror://cpan/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-"
+            version
+            ".tar.gz"))
+      (sha256
+       (base32
+        "09cixf93w9y443jj291viw3r292xskihx3af65pnbkb7mga34pap"))))
+   (build-system perl-build-system)
+   (arguments
+    '(#:configure-flags '("--test"
+                             ;;(string-append "-libdir=" (getenv
+                                        ;;"LIBRARY_PATH"))
+                          )
+      #:module-build-flags '("--test"
+                             ;;(string-append "-libdir=" (getenv
+                                        ;;"LIBRARY_PATH"))
+                             )))
+   (native-inputs
+    `(("perl-module-build" ,perl-module-build)
+      ("readline" ,readline)))
+   (home-page
+    "https://metacpan.org/release/Term-ReadLine-Gnu")
+   (synopsis
+    "Perl extension for the GNU Readline/History Library")
+   (description "This module enables support for the GNU Readline/History Library.")
+   (license perl-license)))
+
 (define-public perl-term-size-any
   (package
     (name "perl-term-size-any")
diff --git a/guix/build-system/perl.scm b/guix/build-system/perl.scm
index 06af1dd20..a06cf5b44 100644
--- a/guix/build-system/perl.scm
+++ b/guix/build-system/perl.scm
@@ -78,6 +78,7 @@
 
 (define* (perl-build store name inputs
                      #:key
+                     (configure-flags ''())
                      (search-paths '())
                      (tests? #t)
                      (parallel-build? #t)
@@ -111,6 +112,7 @@ provides a `Makefile.PL' file as its build system."
                    #:make-maker? ,make-maker?
                    #:make-maker-flags ,make-maker-flags
                    #:module-build-flags ,module-build-flags
+                   #:configure-flags ,configure-flags
                    #:phases ,phases
                    #:system ,system
                    #:test-target "test"
@@ -119,7 +121,6 @@ provides a `Makefile.PL' file as its build system."
                    #:parallel-tests? ,parallel-tests?
                    #:outputs %outputs
                    #:inputs %build-inputs)))
-
   (define guile-for-build
     (match guile
       ((? package?)
-- 
2.19.2