From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Bavier Subject: [PATCH 1/4] build-system/perl: Use Build.PL for builds if present. Date: Thu, 12 Feb 2015 09:58:12 -0600 Message-ID: <1423756695-13378-2-git-send-email-bavier@member.fsf.org> References: <1423756695-13378-1-git-send-email-bavier@member.fsf.org> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLwA0-0003sn-Jc for guix-devel@gnu.org; Thu, 12 Feb 2015 10:58:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLw9v-0006YX-Ju for guix-devel@gnu.org; Thu, 12 Feb 2015 10:58:36 -0500 Received: from mail.centurylink.net ([205.219.233.9]:11973 helo=smtp.centurylink.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLw9v-0006YP-6P for guix-devel@gnu.org; Thu, 12 Feb 2015 10:58:31 -0500 In-Reply-To: <1423756695-13378-1-git-send-email-bavier@member.fsf.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org * guix/build/perl-build-system.scm (configure): Use Build.PL if present. (build, check, install): New procedures. (%standard-phases): Replace build, check, and install phases. * guix/build-system/perl (perl-build): Add make-maker? and module-build-flags arguments. squash: aab6f19: Include make-maker? argument. --- guix/build-system/perl.scm | 4 +++ guix/build/perl-build-system.scm | 59 ++++++++++++++++++++++++++++++-------- 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/guix/build-system/perl.scm b/guix/build-system/perl.scm index c488adb..e0f8643 100644 --- a/guix/build-system/perl.scm +++ b/guix/build-system/perl.scm @@ -75,7 +75,9 @@ (tests? #t) (parallel-build? #t) (parallel-tests? #t) + (make-maker? #f) (make-maker-flags ''()) + (module-build-flags ''()) (phases '(@ (guix build perl-build-system) %standard-phases)) (outputs '("out")) @@ -101,7 +103,9 @@ provides a `Makefile.PL' file as its build system." source)) #:search-paths ',(map search-path-specification->sexp search-paths) + #:make-maker? ,make-maker? #:make-maker-flags ,make-maker-flags + #:module-build-flags ,module-build-flags #:phases ,phases #:system ,system #:test-target "test" diff --git a/guix/build/perl-build-system.scm b/guix/build/perl-build-system.scm index 904daf7..7eb944c 100644 --- a/guix/build/perl-build-system.scm +++ b/guix/build/perl-build-system.scm @@ -29,22 +29,57 @@ ;; ;; Code: -(define* (configure #:key outputs (make-maker-flags '()) +(define* (configure #:key outputs make-maker? + (make-maker-flags '()) (module-build-flags '()) #:allow-other-keys) "Configure the given Perl package." - (let ((out (assoc-ref outputs "out"))) - (if (file-exists? "Makefile.PL") - (let ((args `("Makefile.PL" ,(string-append "PREFIX=" out) - "INSTALLDIRS=site" ,@make-maker-flags))) - (format #t "running `perl' with arguments ~s~%" args) - (zero? (apply system* "perl" args))) - (error "no Makefile.PL found")))) + (let* ((out (assoc-ref outputs "out")) + (args (cond + ;; Prefer to use Module::Build unless otherwise told + ((and (file-exists? "Build.PL") + (not make-maker?)) + `("Build.PL" ,(string-append "--prefix=" out) + "--installdirs=site" ,@module-build-flags)) + ((file-exists? "Makefile.PL") + `("Makefile.PL" ,(string-append "PREFIX=" out) + "INSTALLDIRS=site" ,@make-maker-flags)) + (else (error "no Build.PL or Makefile.PL found"))))) + (format #t "running `perl' with arguments ~s~%" args) + (zero? (apply system* "perl" args)))) + +(define-syntax-rule (define-w/gnu-fallback* (name args ...) body ...) + (define* (name args ... #:rest rest) + (if (access? "Build" X_OK) + (begin body ...) + (apply (assoc-ref gnu:%standard-phases 'name) rest)))) + +(define-w/gnu-fallback* (build) + (zero? (system* "./Build"))) + +(define-w/gnu-fallback* (check #:key target + (tests? (not target)) (test-flags '()) + #:allow-other-keys) + (if tests? + (zero? (apply system* "./Build" "test" test-flags)) + (begin + (format #t "test suite not run~%") + #t))) + +(define-w/gnu-fallback* (install) + (zero? (system* "./Build" "install"))) (define %standard-phases - ;; Everything is as with the GNU Build System except for the `configure' - ;; phase. - (alist-replace 'configure configure - gnu:%standard-phases)) + ;; Everything is as with the GNU Build System except for the `configure', + ;; `build', `check', and `install' phases. + (alist-replace + 'configure configure + (alist-replace + 'build build + (alist-replace + 'check check + (alist-replace + 'install install + gnu:%standard-phases))))) (define* (perl-build #:key inputs (phases %standard-phases) #:allow-other-keys #:rest args) -- 1.7.9.5