From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpvRh-0002iG-1k for guix-patches@gnu.org; Thu, 07 Sep 2017 07:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpvRb-0003Ez-3v for guix-patches@gnu.org; Thu, 07 Sep 2017 07:58:09 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:45201) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dpvRa-0003Ev-VN for guix-patches@gnu.org; Thu, 07 Sep 2017 07:58:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dpvRa-0003iQ-LF for guix-patches@gnu.org; Thu, 07 Sep 2017 07:58:02 -0400 Subject: [bug#28045] [PATCH] gnu: Add openfoam Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <1504105724.3260.10.camel@tourbillion-technology.com> <20170906212801.4311-1-pgarlick@tourbillion-technology.com> Date: Thu, 07 Sep 2017 13:57:10 +0200 In-Reply-To: <20170906212801.4311-1-pgarlick@tourbillion-technology.com> (Paul Garlick's message of "Wed, 6 Sep 2017 22:28:01 +0100") Message-ID: <87r2viwwkp.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Paul Garlick Cc: 28045@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Paul, I made the modifications below (mostly cosmetic) and built it locally. However, the resulting layout, with /OpenFOAM-4.1 at the root and essentially all the source tree beneath it, is unsatisfying. Would it be possible to follow a layout closer to what we usually do: /gnu/store/=E2=80=A6-openfoam-4.1 bin/ lib/ share/ etc/ If the answer is =E2=80=9Cno=E2=80=9D, or if that would take an unreasonabl= e amount of work which should really be upstream=E2=80=99s job, then I can understand a= nd we can make an exception. Or perhaps there=E2=80=99s a middle ground we could find? For instance, we install the tree to lib/openfoam-4.1, and then create bin/ as a symlink to lib/openfoam-4.1/platforms/linux64GccDPInt32Opt/bin? Would that work? Thank you! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable commit e334cc116c976aa13c5be61eedd895fb790fec83 Author: Ludovic Court=C3=A8s Date: Thu Sep 7 10:56:15 2017 +0200 openfoam fixlet diff --git a/gnu/packages/patches/openfoam-4.1-cleanup.patch b/gnu/packages= /patches/openfoam-4.1-cleanup.patch index 590db5982..fc2107e0b 100644 --- a/gnu/packages/patches/openfoam-4.1-cleanup.patch +++ b/gnu/packages/patches/openfoam-4.1-cleanup.patch @@ -1,7 +1,7 @@ -# This patch removes all need for the ThirdParty files of OpenFOAM +# This patch removes all need for the ThirdParty files of OpenFOAM. =20 -# Derived from easybuild patch: Ward Poelmans -# Modified for GNU Guix: Paul Garlick +# Derived from EasyBuild patch by Ward Poelmans . +# Modified for GNU Guix by Paul Garlick . =20 diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipula= tion/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/m= anipulation/setSet/Allwmake --- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/= setSet/Allwmake @@ -76,7 +76,7 @@ diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL = OpenFOAM-4.x-version-4. diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.= x-version-4.1/etc/config.sh/gperftools --- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools 2016-10-16 16:11= :45.000000000 +0200 +++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools 2017-04-10 14:51:01.= 473221230 +0200 -@@ -29,13 +29,13 @@ +@@ -29,13 +29,5 @@ # #------------------------------------------------------------------------= ------ =20 @@ -88,14 +88,6 @@ diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gper= ftools OpenFOAM-4.x-vers - -export PATH=3D$GPERFTOOLS_ARCH_PATH/bin:$PATH -export LD_LIBRARY_PATH=3D$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH -+# version=3Dsvn -+# gperftools_install=3D$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER -+# -+# GPERFTOOLS_VERSION=3Dgperftools-$version -+# GPERFTOOLS_ARCH_PATH=3D$gperftools_install/$GPERFTOOLS_VERSION -+# -+# export PATH=3D$GPERFTOOLS_ARCH_PATH/bin:$PATH -+# export LD_LIBRARY_PATH=3D$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH =20 #------------------------------------------------------------------------= ------ diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-ver= sion-4.1/etc/config.sh/metis @@ -166,12 +158,11 @@ diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/de= compose/scotchDecomp/Make/o diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x= -version-4.1/wmake/makefiles/general --- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general +++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general -@@ -33,7 +33,7 @@ +@@ -33,7 +33,6 @@ # The Makefile uses a POSIX shell #------------------------------------------------------------------------= ------ =20=20 -SHELL =3D /bin/sh -+# SHELL =3D /bin/sh =20=20 =20=20 #------------------------------------------------------------------------= ------ diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm index 3446d72c6..ff2aa69b6 100644 --- a/gnu/packages/simulation.scm +++ b/gnu/packages/simulation.scm @@ -56,14 +56,14 @@ (version "4.1") (source (origin - (method url-fetch) - (uri (string-append + (method url-fetch) + (uri (string-append "http://dl.openfoam.org/source/" (string-map (lambda (x) (if (eq? x #\.) #\- x)) version))) - (file-name (string-append name "-" version ".tar.gz")) - (sha256 - (base32 "1hgh2kw7fqv4bfachhbjhw16v8j35jbv6s576fmz4ka2q4ks4wg3")) - (patches (search-patches "openfoam-4.1-cleanup.patch")))) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 "1hgh2kw7fqv4bfachhbjhw16v8j35jbv6s576fmz4ka2q4ks4wg3")) + (patches (search-patches "openfoam-4.1-cleanup.patch")))) (build-system gnu-build-system) (inputs `(("boost" ,boost) @@ -85,106 +85,116 @@ ("gnuplot" ,gnuplot) ("openmpi" ,openmpi))) (arguments - `(#:strip-directories (list (string-append + `( ;; Executable files and shared libraries are located in the 'platf= orms' + ;; subdirectory. + #:strip-directories (list (string-append "OpenFOAM-" ,version "/platforms/linux64GccDPInt32Opt/bin") (string-append "OpenFOAM-" ,version "/platforms/linux64GccDPInt32Opt/lib")) - ; executable files and shared libraries are - ; located in the 'platforms' subdirectory - #:validate-runpath? #f ; '#:elf-directories' is not recognised here - #:tests? #f ; no tests to run - #:phases (modify-phases %standard-phases - (add-after 'unpack 'rename-build-directory - (lambda _ - (use-modules (ice-9 ftw)) - (use-modules (ice-9 regex)) - (chdir "..") - ;; use 'OpenFOAM-version' convention to match pathname expecta= tions - ;; in the build phase - (let ((unpack-dir (string-append - (getcwd) "/" - (list-ref (scandir (getcwd) (lambda (name) - (string-match "^OpenFOAM" name))) 0))) - (build-dir (string-append - (getcwd) "/OpenFOAM-" ,version))) - (rename-file unpack-dir build-dir) ; re-name build directory - (chdir (basename build-dir))) ; move to build directory - #t)) - (add-after 'patch-source-shebangs 'set-environment-variables - (lambda _ - (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch= "))) - ;; set variables to define store paths - (for-each (lambda (library) - (setenv (string-append - (string-upcase library) "_ROOT") - (assoc-ref %build-inputs library))) librar= ies)) - ;; set variables to define package versions - (setenv "SCOTCHVERSION" ,(package-version scotch)) - (setenv "METISVERSION" ,(package-version metis)) - #t)) - (delete 'configure) ; no configure phase - (replace 'build - (lambda _ - ;; compile OpenFOAM libraries and applications - (zero? (system (format #f - "source ./etc/bashrc && ./Allwmake -j~a" - (parallel-job-count)))))) - (add-after 'build 'update-configuration-files - (lambda _ - ;; record store paths and package versions in configuration fi= les - (substitute* "etc/config.sh/CGAL" - (("$BOOST_ROOT") (getenv "BOOST_ROOT"))) - (substitute* "etc/config.sh/CGAL" - (("$CGAL_ROOT") (getenv "CGAL_ROOT"))) - (substitute* "etc/config.sh/metis" - (("$METIS_ROOT") (getenv "METIS_ROOT"))) - (substitute* "etc/config.sh/metis" - (("$METISVERSION") (getenv "METISVERSION"))) - (substitute* "etc/config.sh/scotch" - (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT"))) - (substitute* "etc/config.sh/scotch" - (("$SCOTCHVERSION") (getenv "SCOTCHVERSION"))) - (substitute* "etc/config.sh/settings" - (("$GMP_ROOT") (getenv "GMP_ROOT"))) - (substitute* "etc/config.sh/settings" - (("$MPFR_ROOT") (getenv "MPFR_ROOT"))) - ;; reset lockDir variable to refer to write-enabled directory - (substitute* "wmake/wmake" - ((" lockDir=3D.*$") - " lockDir=3D$HOME/.$WM_PROJECT/.wmake\n")) - (substitute* "wmake/wmakeScheduler" - (("lockDir=3D.*$") - "lockDir=3D$HOME/.$WM_PROJECT/.wmake\n")) - (substitute* "wmake/wmakeSchedulerUptime" - (("lockDir=3D.*$") - "lockDir=3D$HOME/.$WM_PROJECT/.wmake\n")) - #t)) - (replace 'install - (lambda _ - ;; use 'OpenFOAM-version' convention - (let ((install-dir (string-append - %output "/OpenFOAM-" ,version))) - (mkdir-p install-dir) ; create install directory - ;; move contents of build directory to install directory - (copy-recursively "." install-dir))))))) - ;; Note: tutorial files are installed read-only in /gnu/store. - ;; To allow write permissions on files copied from the store a - ;; 'chmod' step is needed before running the applications. For - ;; example, from a user's login: - ;; $ source $GUIX_PROFILE/OpenFOAM-4.1/etc/bashrc - ;; $ mkdir -p $FOAM_RUN - ;; $ cd $FOAM_RUN - ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzdaily . - ;; $ cd pitzdaily - ;; $ chmod -R u+w . - ;; $ blockMesh + #:validate-runpath? #f ; '#:elf-directories' is not recognised = here + #:tests? #f ; no tests to run + + #:modules ((ice-9 ftw) + (ice-9 regex) + (guix build gnu-build-system) + (guix build utils)) + + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'rename-build-directory + (lambda _ + (chdir "..") + ;; Use 'OpenFOAM-version' convention to match file name + ;; expectations in the build phase. + (let ((unpack-dir (string-append + (getcwd) "/" + (car (scandir (getcwd) + (lambda (name) + (string-match "^OpenFOAM" + name)))))) + (build-dir (string-append + (getcwd) "/OpenFOAM-" ,version))) + (rename-file unpack-dir build-dir) ; re-name build directory + (chdir (basename build-dir)) ; move to build directory + #t))) + (add-after 'patch-source-shebangs 'set-environment-variables + (lambda _ + (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotc= h"))) + ;; set variables to define store paths + (for-each (lambda (library) + (setenv (string-append + (string-upcase library) "_ROOT") + (assoc-ref %build-inputs library))) lib= raries)) + ;; set variables to define package versions + (setenv "SCOTCHVERSION" ,(package-version scotch)) + (setenv "METISVERSION" ,(package-version metis)) + #t)) + (delete 'configure) ; no configure phase + (replace 'build + (lambda _ + ;; compile OpenFOAM libraries and applications + (zero? (system (format #f + "source ./etc/bashrc && ./Allwmake -j~= a" + (parallel-job-count)))))) + (add-after 'build 'update-configuration-files + (lambda _ + ;; record store paths and package versions in configuration f= iles + (substitute* "etc/config.sh/CGAL" + (("$BOOST_ROOT") (getenv "BOOST_ROOT"))) + (substitute* "etc/config.sh/CGAL" + (("$CGAL_ROOT") (getenv "CGAL_ROOT"))) + (substitute* "etc/config.sh/metis" + (("$METIS_ROOT") (getenv "METIS_ROOT"))) + (substitute* "etc/config.sh/metis" + (("$METISVERSION") (getenv "METISVERSION"))) + (substitute* "etc/config.sh/scotch" + (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT"))) + (substitute* "etc/config.sh/scotch" + (("$SCOTCHVERSION") (getenv "SCOTCHVERSION"))) + (substitute* "etc/config.sh/settings" + (("$GMP_ROOT") (getenv "GMP_ROOT"))) + (substitute* "etc/config.sh/settings" + (("$MPFR_ROOT") (getenv "MPFR_ROOT"))) + ;; reset lockDir variable to refer to write-enabled directory + (substitute* "wmake/wmake" + ((" lockDir=3D.*$") + " lockDir=3D$HOME/.$WM_PROJECT/.wmake\n")) + (substitute* "wmake/wmakeScheduler" + (("lockDir=3D.*$") + "lockDir=3D$HOME/.$WM_PROJECT/.wmake\n")) + (substitute* "wmake/wmakeSchedulerUptime" + (("lockDir=3D.*$") + "lockDir=3D$HOME/.$WM_PROJECT/.wmake\n")) + #t)) + (replace 'install + (lambda _ + ;; use 'OpenFOAM-version' convention + (let ((install-dir (string-append + %output "/OpenFOAM-" ,version))) + (mkdir-p install-dir) ; create install directo= ry + ;; move contents of build directory to install directory + (copy-recursively "." install-dir) + #t)))))) + + ;; Note: tutorial files are installed read-only in /gnu/store. + ;; To allow write permissions on files copied from the store a + ;; 'chmod' step is needed before running the applications. For + ;; example, from a user's login: + ;; $ source $GUIX_PROFILE/OpenFOAM-4.1/etc/bashrc + ;; $ mkdir -p $FOAM_RUN + ;; $ cd $FOAM_RUN + ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzdaily . + ;; $ cd pitzdaily + ;; $ chmod -R u+w . + ;; $ blockMesh (native-search-paths - ;; define the FOAM_INST_DIR variable + ;; Define the FOAM_INST_DIR variable. (list (search-path-specification (variable "FOAM_INST_DIR") - (files '("."))))) + (files '(".")) + (separator #f)))) ;single entry (synopsis "Framework for numerical simulation of fluid flow") (description "OpenFOAM provides a set of solvers and methods for tackl= ing problems in the field of Computational Fluid Dynamics (CFD). It is writte= n in --=-=-=--