From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukas Gradl Subject: Re: [PATCH] Add googletest Date: Thu, 02 Jun 2016 08:51:40 -0500 Message-ID: <87lh2nem1f.fsf@openmailbox.org> References: <874m9fwa0k.fsf@openmailbox.org> <87lh2q2v1u.fsf@openmailbox.org> <20160531214400.GA22303@jasmine> <20160601044829.GA20978@debian-netbook> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8T2Q-0003BP-LI for guix-devel@gnu.org; Thu, 02 Jun 2016 09:51:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8T2M-00005I-U0 for guix-devel@gnu.org; Thu, 02 Jun 2016 09:51:53 -0400 Received: from mail2.openmailbox.org ([62.4.1.33]:38147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8T2M-000056-Gg for guix-devel@gnu.org; Thu, 02 Jun 2016 09:51:50 -0400 In-Reply-To: <20160601044829.GA20978@debian-netbook> (Efraim Flashner's message of "Wed, 1 Jun 2016 07:48:29 +0300") 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" To: Efraim Flashner Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain Hi Efraim, Thank you for your review! Efraim Flashner writes: > On Tue, May 31, 2016 at 05:44:00PM -0400, Leo Famulari wrote: >> On Tue, May 31, 2016 at 08:53:17AM -0500, Lukas Gradl wrote: >> > * gnu/packages/check.scm (googletest): New variable. >> >> Awesome, thanks for this patch! >> >> > + (build-system cmake-build-system) >> >> I noticed in the README.md that upstream suggests use of GNU Make unless >> building from a Git checkout. Did you try that? >> >> > + (native-inputs >> > + `(("python-2" ,python-2))) >> >> The README also suggests that this is only necessary for building from >> Git, although it's worth finding out what they mean by "re-generating >> certain source files from templates". We prefer to re-build "generated" >> source files since they are not really "source files" in many cases. >> >> > + (replace 'install >> > + (lambda _ >> > + (let ((out (assoc-ref %outputs "out"))) >> > + (and >> > + (mkdir-p (string-append out "/lib")) >> > + (mkdir-p (string-append out "/include")) >> > + (zero? >> > + (system* "cp" "-r" >> > + "../googletest-release-1.7.0/include" >> > + out)) >> > + (zero? (system* "cp" "libgtest.a" "libgtest_main.a" >> > + (string-append out "/lib")))))))))) >> >> I think these uses of (system*) could be replaced by (copy-recursively) >> and (install-file), respectively. >> > > I haven't tried building this package yet > > (and -> you can probably switch this for a (begin OK, this is done. > googletest-release-1.7.0 -> > (string-append "../google-release-" version "/include") I seem to have some trouble with that. The package passes all phases except for "install". When it reaches install I get the following error: ---8<--- cut here -------------------- start --->8--- Start 40: gtest_xml_outfiles_test 40/41 Test #40: gtest_xml_outfiles_test ............ Passed 0.19 sec Start 41: gtest_xml_output_unittest 41/41 Test #41: gtest_xml_output_unittest .......... Passed 0.12 sec 100% tests passed, 0 tests failed out of 41 Total Test time (real) = 4.68 sec phase `check' succeeded after 6.7 seconds starting phase `install' Backtrace: In ice-9/boot-9.scm: 157: 13 [catch #t # ...] In unknown file: ?: 12 [apply-smob/1 #] In ice-9/boot-9.scm: 63: 11 [call-with-prompt prompt0 ...] In ice-9/eval.scm: 432: 10 [eval # #] In ice-9/boot-9.scm: 2401: 9 [save-module-excursion #] 4050: 8 [#] 1724: 7 [%start-stack load-stack #] 1729: 6 [#] In unknown file: ?: 5 [primitive-load "/gnu/store/yjwm79h6b6fswb9wdy2ak8b1bdz6s7hw-googletest-1.7.0-guile-builder"] In ice-9/eval.scm: 387: 4 [eval # ()] In srfi/srfi-1.scm: 830: 3 [every1 # ...] In /gnu/store/915kgcfqqasrnf18rhznc77z96i01i6d-module-import/guix/build/gnu-build-system.scm: 593: 2 [# #] In ice-9/eval.scm: 387: 1 [eval # #] In unknown file: ?: 0 [string-append "../googletest-release-" # "/include"] ERROR: In procedure string-append: ERROR: In procedure string-append: Wrong type (expecting string): # builder for `/gnu/store/ljnpvx73fqdg455nh1kj2ac2i3k9jy3r-googletest-1.7.0.drv' failed with exit code 1 @ build-failed /gnu/store/ljnpvx73fqdg455nh1kj2ac2i3k9jy3r-googletest-1.7.0.drv - 1 builder for `/gnu/store/ljnpvx73fqdg455nh1kj2ac2i3k9jy3r-googletest-1.7.0.drv' failed with exit code 1 guix build: error: build failed: build of `/gnu/store/ljnpvx73fqdg455nh1kj2ac2i3k9jy3r-googletest-1.7.0.drv' failed lukas@serenity$ ---8<--- cut here -------------------- end ----->8--- The patch that created this error is attached. I am not sure what is happening here. Is all of the code in the argument of modify phases executed in a different scope where "version" is something else? I do not quite understand this. > (zero? (system* "cp" "libgtest.a" "libgtest_main.a" > won't this just copy libgtest.a to libgtest_main.a ? I am not sure, but if it behaves like invoking "cp" on the command line, then it should copy both of these to the directory that is on the next line: + (zero? (system* "cp" "libgtest.a" "libgtest_main.a" + (string-append out "/lib")))))))))) I replaced all these statements with (install-file ...) and (copy-recursively ...) as mentioned by Leo. Thank you for your help! Best, Lukas --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-Add-googletest.patch Content-Transfer-Encoding: quoted-printable >From c0cea38f6ccb281aa105aba00b3da3e4a5c8f7ef Mon Sep 17 00:00:00 2001 From: Lukas Gradl Date: Thu, 2 Jun 2016 08:38:23 -0500 Subject: [PATCH] gnu: Add googletest. * gnu/packages/check.scm (googletest): New variable. --- gnu/packages/check.scm | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm index 9eef7a9..576ef61 100644 --- a/gnu/packages/check.scm +++ b/gnu/packages/check.scm @@ -5,6 +5,7 @@ ;;; Copyright =C2=A9 2015 Andreas Enge ;;; Copyright =C2=A9 2016 Efraim Flashner ;;; Copyright =C2=A9 2016 Roel Janssen +;;; Copyright =C2=A9 2016 Lukas Gradl ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,6 +25,7 @@ (define-module (gnu packages check) #:use-module (gnu packages) #:use-module (gnu packages autotools) + #:use-module (gnu packages python) #:use-module (guix licenses) #:use-module (guix packages) #:use-module (guix download) @@ -193,3 +195,45 @@ in the code. Cppcheck primarily detects the types of = bugs that the compilers normally do not detect. The goal is to detect only real errors in the code (i.e. have zero false positives).") (license gpl3+))) + +(define-public googletest + (package + (name "googletest") + (version "1.7.0") + (source + (origin + (method url-fetch) + (uri + (string-append + "https://github.com/google/googletest/archive/release-" + version ".tar.gz")) + (sha256 + (base32 + "1k0nf1l9cb3prdmsvaajl5i31bx86c1mw0d5jgzykz7rzm36afpp")))) + (build-system cmake-build-system) + (native-inputs + `(("python-2" ,python-2))) + (arguments + `(#:configure-flags + '("-Dgtest_build_tests=3DON") + #:phases + (modify-phases %standard-phases + (replace 'install + (lambda _ + (let ((out (assoc-ref %outputs "out")) + (version version)) + (begin + (mkdir-p (string-append out "/lib")) + (mkdir-p (string-append out "/include")) + (install-file "libgtest.a" (string-append out "/lib")) + (install-file "libgtest_main.a" (string-append out "/lib"= )) + (copy-recursively + (string-append "../googletest-release-" version "/includ= e") + (string-append out "/lib"))))))))) + (home-page "https://github.com/google/googletest/") + (synopsis "Test discovery and XUnit test framework") + (description "Google Test features an XUnit test framework, automated = test +discovery, death tests, assertions, parameterized tests and XML test report +generation.") + (license bsd-3))) +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 --=20 2.7.4 --=-=-=--