unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#66262] [PATCH 0/3] Update openfoam and fix bugs
       [not found] <cover.1695977095.git.reza@housseini.me>
@ 2023-09-29  9:00 ` reza via Guix-patches via
  2023-09-29  9:39   ` [bug#66262] [PATCH v2 0/3] Update openfoam reza via Guix-patches via
                     ` (10 more replies)
       [not found] ` <08d37437f0611551d403bb7da15d78c94fe3791f.1695977095.git.reza@housseini.me>
                   ` (2 subsequent siblings)
  3 siblings, 11 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-09-29  9:00 UTC (permalink / raw)
  To: 66262; +Cc: reza

This patch series fixes a bug in openfoam-org which expects the source folder
name to be in a specific format. It also uses now a factory function
openfoam-package to generate the openfoam-org and openfoam-com package because
the version string used in an inherited package is fixed to version of the
parent package. The factory function now cleans the source tree which is
incorporated into the package making the build reproducible.

The packages openfoam-org and openfoam-com were also update to version 11 and
2306 respectively.

Reza Housseini (3):
  gnu: Add openfoam-package.
  gnu: openfoam-org: Update to 11.
  gnu: openfoam-com: Update to 2306.

 gnu/packages/simulation.scm | 691 +++++++++++++++++++-----------------
 1 file changed, 366 insertions(+), 325 deletions(-)


base-commit: b2c28de020483a52f0a4f118ea40da17c2c9e5a2
-- 
2.41.0






^ permalink raw reply	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH 1/3] gnu: Add openfoam-package.
       [not found] ` <08d37437f0611551d403bb7da15d78c94fe3791f.1695977095.git.reza@housseini.me>
@ 2023-09-29  9:03   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-09-29  9:03 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-package): Add factory function to
generate openfoam packages. Improve build tree clean up.
---
 gnu/packages/simulation.scm | 295 ++++++++++++++++++++++++++++++++++++
 1 file changed, 295 insertions(+)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 1dd6dc63f7..0d52434fac 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -431,6 +431,301 @@ (define-public openfoam-com
     (synopsis "Framework for numerical simulation of fluid flow (from openfoam.com)")
     (home-page "https://www.openfoam.com")))
 
+(define* (openfoam-package source version name home-page synopsis)
+  (let* ((install-path (string-append "share/OpenFOAM-" version))
+         (paraview-version (version-major+minor (package-version paraview)))
+         (pv-plugin-path
+          (string-append install-path
+                         "/platforms/linux64GccDPInt32Opt/lib/paraview-"
+                         paraview-version)))
+    (package
+      (name name)
+      (version version)
+      (source source)
+      (build-system gnu-build-system)
+      (native-search-paths
+       (list (search-path-specification
+	      (variable "WM_PROJECT_DIR")
+	      (files `(,install-path)))
+             ;; add PV_PLUGIN_PATH to LD_LIBRARY_PATH so paraview
+             ;; finds the OpenFOAM PV plugins
+             (search-path-specification
+	      (variable "LD_LIBRARY_PATH")
+	      (files `(,pv-plugin-path)))))
+      (inputs (list boost
+		    cgal
+		    git
+		    gmp
+		    libxt
+		    metis
+		    mpfr
+		    ncurses
+		    openmpi
+		    openssh
+		    paraview
+		    pt-scotch32
+		    readline
+		    scotch
+		    zlib))
+      (native-inputs (list bison
+		           flex
+		           ;; paraview plugin dependencies
+		           cli11
+		           cmake-minimal
+		           cgns
+		           curl
+		           double-conversion
+		           eigen
+		           expat
+		           ffmpeg
+		           fmt
+		           freetype
+		           gdal
+		           gl2ps
+		           glew
+		           gmsh
+		           hdf5
+		           jsoncpp
+		           libjpeg-turbo
+		           libogg
+		           libpng
+		           libharu
+		           libtheora
+		           libtiff
+		           libx11
+		           libxml2
+		           lz4
+		           netcdf
+		           nlohmann-json
+		           proj
+		           protobuf
+		           pugixml
+		           python
+		           python-mpi4py
+		           qtbase-5
+		           qtsvg-5
+		           qttools-5
+		           qtwebengine-5
+		           qtxmlpatterns
+		           utfcpp
+		           vtk
+		           xz))
+      (propagated-inputs (list gnuplot))
+      (outputs '("debug" ;~60MB
+	         "out"))
+      (arguments
+       (list
+        ;; Executable files and shared libraries are located in the 'platforms'
+        ;; subdirectory.
+        #:strip-directories
+        #~(list (string-append "OpenFOAM-" #$version "/platforms/linux64GccDPInt32Opt/bin")
+	        (string-append "OpenFOAM-" #$version "/platforms/linux64GccDPInt32Opt/lib"))
+
+        #:modules
+        '((ice-9 ftw)
+          (ice-9 regex)
+          (ice-9 string-fun)
+          (srfi srfi-1)
+          (guix build gnu-build-system)
+          (guix build utils))
+
+        #:phases
+        #~(modify-phases %standard-phases
+	    (add-before 'build 'patch-HOME-path
+	      (lambda _
+	        (setenv "HOME" "/tmp") #t))
+	    (add-before 'build 'patch-scotch
+	      (lambda _
+	        (substitute* "etc/config.sh/scotch"
+	          (("^export SCOTCH_VERSION=scotch_.*$")
+	           (string-append "export SCOTCH_VERSION=scotch_"
+			          #$(package-version pt-scotch32) "\n"))
+	          (("^export SCOTCH_ARCH_PATH=.*$")
+	           (string-append "export SCOTCH_ARCH_PATH=" #$pt-scotch32 "\n")))
+	        #t))
+	    (add-before 'build 'patch-mpi
+	      (lambda _
+	        (let* ((mpi-version #$(package-version openmpi)))
+	          ;; specify openmpi type
+	          (substitute* "etc/bashrc"
+		    (("WM_MPLIB=SYSTEMOPENMPI")
+		     "WM_MPLIB=OPENMPI"))
+	          (substitute* "etc/config.sh/mpi"
+		    (("export FOAM_MPI=openmpi-.*$")
+		     (string-append "export FOAM_MPI=openmpi-"
+				    mpi-version "\n"))
+		    (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
+		     (string-append "export MPI_ARCH_PATH=" #$openmpi "\n"))))
+	        #t))
+	    (add-before 'build 'patch-paraview
+	      (lambda _
+	        (substitute* "etc/config.sh/paraview"
+	          (("^export ParaView_VERSION=.*$")
+	           (string-append "export ParaView_VERSION="
+			          #$(package-version paraview) "\n"))
+	          (("^export ParaView_DIR=.*$")
+	           (string-append "export ParaView_DIR=" #$paraview "\n"))
+                  (("export ParaView_GL=mesa") "export ParaView_GL=system"))
+	        #t))
+	    (add-before 'build 'add-rpaths
+	      (lambda _
+	        (letrec* ((libraries '("boost"
+				       "cgal"
+				       "gmp"
+				       "metis"
+				       "mpfr"
+				       "scotch"
+				       "pt-scotch32"
+ 				       "openmpi"
+				       "zlib"
+				       "paraview"))
+		          (rpaths
+		           (fold-right (lambda (lib rpaths)
+				         (string-append rpaths
+						        "-rpath="
+						        (assoc-ref %build-inputs lib)
+						        "/lib,")) "" libraries))
+		          (openfoam-lib
+		           (string-append #$output
+				          "/share/OpenFOAM-" #$version
+				          "/platforms/linux64GccDPInt32Opt/lib"))
+		          (ldflags
+		           (string-append "-Wl,"
+				          rpaths
+				          "-rpath="
+				          openfoam-lib
+				          ","
+				          "-rpath="
+				          openfoam-lib
+				          "/dummy,"
+				          "-rpath="
+				          openfoam-lib
+				          "/paraview-"
+				          #$(version-major+minor (package-version
+							          paraview)))))
+	          (substitute* "wmake/rules/linux64Gcc/c++"
+		    (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
+		     (string-append all " " ldflags)))) #t))
+	    (add-before 'build 'add-vtk-include-path
+	      (lambda _
+	        (let* ((vtk-version #$(version-major+minor
+				       (package-version vtk)))
+		       (vtk-inc (string-append #$vtk "/include/vtk-" vtk-version))
+		       (vtk-inc-flag (string-append "-I" vtk-inc)))
+	          (substitute* "wmake/rules/linux64Gcc/c++"
+		    (("\\$\\(LIB_HEADER_DIRS\\)" all)
+		     (string-append all " " vtk-inc-flag " "))))
+	        #t))
+	    (delete 'configure) ;no configure phase
+	    (replace 'build
+	      (lambda _
+	        ;; compile OpenFOAM libraries and applications
+	        (invoke "bash" "-c"
+		        (format #f
+			        "source ./etc/bashrc && ./Allwmake -j~a"
+			        (parallel-job-count)))))
+	    (add-after 'build 'cleanup
+	      ;; Avoid unnecessary, voluminous object and dep files.
+	      (lambda _
+	        (when (file-exists? "platforms/linux64GccDPInt32Opt/src")
+	          (delete-file-recursively
+	           "platforms/linux64GccDPInt32Opt/src"))
+	        (when (file-exists?
+		       "platforms/linux64GccDPInt32OptOPENMPI")
+	          (delete-file-recursively
+	           "platforms/linux64GccDPInt32OptOPENMPI"))
+	        (for-each delete-file
+		          (find-files "." "\\.o$"))
+                ;; Remove spurious files in src tree
+                (invoke "bash" "-c" "source ./etc/bashrc && wclean all")
+                #t))
+	    (replace 'check
+	      (lambda* (#:key tests? #:allow-other-keys)
+	        (when tests?
+	          (when (file-exists? "test")
+		    (with-directory-excursion "test"
+		      (invoke "bash" "-c"
+			      (format #f
+				      "source ../etc/bashrc && ./Allrun -j~a"
+				      (parallel-job-count)))
+                      ;; cleanup
+                      (invoke "bash" "-c"
+			      "source ../etc/bashrc && ./Allclean")))
+	          ;; too many tutorials are failing
+	          ;; (with-directory-excursion "tutorials"
+	          ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
+	          ) #t))
+	    (add-before 'install 'set-paths
+	      (lambda _
+	        (let ((install-path (string-append #$output
+					           "/share/OpenFOAM-" #$version)))
+	          (substitute* "etc/bashrc"
+		    (("^\\[ \"\\$BASH\".*$") "")
+		    (("^export FOAM_INST_DIR=\\$\\(cd.*$")
+		     (string-append "export FOAM_INST_DIR=" install-path "\n"))
+		    (("^export FOAM_INST_DIR=\\$HOME.*$") "")))
+	        #t))
+	    (replace 'install
+	      (lambda* (#:key outputs inputs #:allow-other-keys)
+	        (let ((install-path (string-append #$output
+					           "/share/OpenFOAM-" #$version)))
+	          (mkdir-p install-path) ;create install directory
+	          ;; move contents of build directory to install directory
+	          (copy-recursively "." install-path))))
+	    (add-after 'install 'add-symbolic-link
+	      (lambda _
+	        (let* ((bin (string-append #$output "/bin"))
+		       (lib (string-append #$output "/lib"))
+		       (openfoam (string-append #$output
+					        "/share/OpenFOAM-" #$version))
+		       (build-bin (string-append openfoam
+					         "/platforms/linux64GccDPInt32Opt/bin"))
+		       (build-lib (string-append openfoam
+					         "/platforms/linux64GccDPInt32Opt/lib"))
+		       (foam-bin (string-append openfoam "/bin")))
+	          ;; add symbolic links in standard 'bin' directory
+	          (mkdir-p bin)
+	          (for-each (lambda (file)
+			      (unless (member file
+					      '("." ".."))
+			        (symlink (string-append build-bin "/"
+						        file)
+				         (string-append bin "/" file))))
+			    (scandir build-bin))
+	          (for-each (lambda (file)
+			      (unless (member file
+					      '("." ".."))
+			        (symlink (string-append foam-bin "/"
+						        file)
+				         (string-append bin "/" file))))
+			    (scandir foam-bin))
+	          ;; add symbolic link for standard 'lib' directory
+	          (symlink build-lib lib)) #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 $WM_PROJECT_DIR/etc/bashrc
+      ;; $ mkdir -p $FOAM_RUN
+      ;; $ cd $FOAM_RUN
+      ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
+      ;; $ cd pitzDaily
+      ;; $ chmod -R u+w .
+      ;; $ blockMesh
+      (synopsis synopsis)
+      (description
+       "OpenFOAM provides a set of solvers and methods for tackling
+problems in the field of Computational Fluid Dynamics (CFD).  It is written in
+C++.  Governing equations such as the Navier-Stokes equations can be solved in
+integral form.  Physical processes such as phase change, droplet transport and
+chemical reaction can be modelled.  Numerical methods are included to deal with
+sharp gradients, such as those encountered in flows with shock waves and flows
+with gas/liquid interfaces.  Large problems may be split into smaller, connected
+problems for efficient solution on parallel systems.")
+      (license license:gpl3+)
+      (home-page home-page))))
+
 (define-public open-simulation-interface
   (package
     (name "open-simulation-interface")
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH 2/3] gnu: openfoam-org: Update to 11.
       [not found] ` <3c9e2eabdc2f10db9d2a51d82203fcefd5e5e218.1695977095.git.reza@housseini.me>
@ 2023-09-29  9:03   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-09-29  9:03 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Update to 11. Use
openfoam-package factory function to create package.
---
 gnu/packages/simulation.scm | 364 ++++++------------------------------
 1 file changed, 54 insertions(+), 310 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 0d52434fac..3db58813d3 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -87,316 +87,6 @@ (define-module (gnu packages simulation)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1))
 
-(define-public openfoam-org
-  (package
-    (name "openfoam-org")
-    (version "10.20230119")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/OpenFOAM/OpenFOAM-"
-                                  (version-major version) "/archive/"
-                                  (second (string-split version #\.))
-                                  ".tar.gz"))
-              (sha256
-               (base32
-                "1aw2vb5s7frg942ngd5x5x2dm67liyg6czff56qi567mshccpy46"))
-              (modules '((guix build utils)))
-              (snippet `(begin
-                          ;; patch shell paths
-                          (substitute* (list "wmake/src/Makefile"
-                                             "wmake/makefiles/general")
-                            (("/bin/sh")
-                             "sh"))
-                          (substitute* "etc/bashrc"
-                            ;; only go back one folder level
-                            (("\\$\\(dirname \\$\\{BASH_SOURCE:-\\$0\\}\\)/../..")
-                             "$(dirname ${BASH_SOURCE:-$0})/..")
-                            ;; do not use openfoam folder convention
-                            (("^export WM_PROJECT_DIR=.*$")
-                             (string-append
-                              "export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR\n"))
-                            ;; do not source bash_completion (gives error)
-                            (("^.*bash_completion.*$" all)
-                             (string-append "#" all))
-                            ;; set same version as guix package
-                            (("^export WM_PROJECT_VERSION=.*$")
-                             (string-append "export WM_PROJECT_VERSION="
-                                            ,version "\n")))
-                          ;; add expand flag to RunFunctions
-                          (substitute* "bin/tools/RunFunctions"
-                            (("foamDictionary (.*)" all args)
-                             (string-append "foamDictionary -expand " args)))
-                          ;; disable failing test
-                          (substitute* "test/postProcessing/channel/Allrun"
-                            (("^.*getApplication.*$" all)
-                             (string-append "#" all "\n")))))))
-    (build-system gnu-build-system)
-    (inputs (list boost
-                  cgal
-                  git
-                  gmp
-                  libxt
-                  metis
-                  mpfr
-                  ncurses
-                  openmpi
-                  openssh
-                  paraview
-                  pt-scotch32
-                  readline
-                  zlib))
-    (native-inputs (list bison
-                         flex
-                         ;; paraview plugin dependencies
-                         cli11
-                         cmake-minimal
-                         cgns
-                         curl
-                         double-conversion
-                         eigen
-                         expat
-                         ffmpeg
-                         fmt
-                         freetype
-                         gdal
-                         gl2ps
-                         glew
-                         gmsh
-                         hdf5
-                         jsoncpp
-                         libjpeg-turbo
-                         libogg
-                         libpng
-                         libharu
-                         libtheora
-                         libtiff
-                         libx11
-                         libxml2
-                         lz4
-                         netcdf
-                         nlohmann-json
-                         proj
-                         protobuf
-                         pugixml
-                         python
-                         python-mpi4py
-                         qtbase-5
-                         qtsvg-5
-                         qttools-5
-                         qtwebengine-5
-                         qtxmlpatterns
-                         utfcpp
-                         vtk
-                         xz))
-    (propagated-inputs (list gnuplot))
-    (outputs '("debug" ;~60MB
-               "out"))
-    (arguments
-     (list
-      ;; Executable files and shared libraries are located in the 'platforms'
-      ;; subdirectory.
-      #:strip-directories
-      #~(list "share/OpenFOAM/platforms/linux64GccDPInt32Opt/bin"
-              "share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib")
-
-      #:modules
-      '((ice-9 ftw)
-        (ice-9 regex)
-        (ice-9 string-fun)
-        (srfi srfi-1)
-        (guix build gnu-build-system)
-        (guix build utils))
-
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-before 'build 'patch-HOME-path
-            (lambda _
-              (setenv "HOME" "/tmp") #t))
-          (add-before 'build 'patch-scotch
-            (lambda _
-              (substitute* "etc/config.sh/scotch"
-                (("^export SCOTCH_VERSION=scotch_.*$")
-                 (string-append "export SCOTCH_VERSION=scotch_"
-                                #$(package-version pt-scotch32) "\n"))
-                (("^export SCOTCH_ARCH_PATH=.*$")
-                 (string-append "export SCOTCH_ARCH_PATH="
-                                (assoc-ref %build-inputs "pt-scotch32")
-                                "\n"))) #t))
-          (add-before 'build 'patch-mpi
-            (lambda _
-              (let* ((mpi-path (assoc-ref %build-inputs "openmpi"))
-                     (mpi-version #$(package-version openmpi)))
-                ;; specify openmpi type
-                (substitute* "etc/bashrc"
-                  (("WM_MPLIB=SYSTEMOPENMPI")
-                   "WM_MPLIB=OPENMPI"))
-                (substitute* "etc/config.sh/mpi"
-                  (("export FOAM_MPI=openmpi-.*$")
-                   (string-append "export FOAM_MPI=openmpi-"
-                                  mpi-version "\n"))
-                  (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
-                   (string-append "export MPI_ARCH_PATH=" mpi-path
-                                  "\n")))) #t))
-          (add-before 'build 'patch-paraview
-            (lambda _
-              (substitute* "etc/config.sh/paraview"
-                (("^export ParaView_VERSION=.*$")
-                 (string-append "export ParaView_VERSION="
-                                #$(package-version paraview) "\n"))
-                (("^export ParaView_DIR=.*$")
-                 (string-append "export ParaView_DIR="
-                                (assoc-ref %build-inputs "paraview")
-                                "\n"))) #t))
-          (add-before 'build 'add-rpaths
-            (lambda _
-              (letrec* ((libraries '("boost" "cgal"
-                                     "gmp"
-                                     "metis"
-                                     "mpfr"
-                                     "pt-scotch32"
-                                     "openmpi"
-                                     "zlib"
-                                     "paraview"))
-                        (rpaths
-                         (fold-right (lambda (library rpaths)
-                                       (string-append rpaths
-                                                      "-rpath="
-                                                      (assoc-ref
-                                                       %build-inputs library)
-                                                      "/lib,")) "" libraries))
-                        (openfoam-lib
-                         (string-append #$output
-                                        "/share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib"))
-                        (ldflags
-                         (string-append "-Wl,"
-                                        rpaths
-                                        "-rpath="
-                                        openfoam-lib
-                                        ","
-                                        "-rpath="
-                                        openfoam-lib
-                                        "/dummy,"
-                                        "-rpath="
-                                        openfoam-lib
-                                        "/paraview-"
-                                        #$(version-major+minor (package-version
-                                                                paraview)))))
-                (substitute* "wmake/rules/linux64Gcc/c++"
-                  (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
-                   (string-append all " " ldflags)))) #t))
-          (add-before 'build 'add-vtk-include-path
-            (lambda _
-              (let* ((vtk-version #$(version-major+minor
-                                     (package-version vtk)))
-                     (vtk-root (assoc-ref %build-inputs "vtk"))
-                     (vtk-inc (string-append vtk-root "/include/vtk-" vtk-version))
-                     (vtk-inc-flag (string-append "-I" vtk-inc)))
-                (substitute* "wmake/rules/linux64Gcc/c++"
-                  (("\\$\\(LIB_HEADER_DIRS\\)" all)
-                   (string-append all " " vtk-inc-flag " "))))
-              #t))
-          (delete 'configure) ;no configure phase
-          (replace 'build
-            (lambda _
-              ;; compile OpenFOAM libraries and applications
-              (invoke "bash" "-c"
-                      (format #f
-                              "source ./etc/bashrc && ./Allwmake -j~a"
-                              (parallel-job-count)))))
-          (add-after 'build 'cleanup
-            ;; Avoid unnecessary, voluminous object and dep files.
-            (lambda _
-              (when (file-exists? "platforms/linux64GccDPInt32Opt/src")
-                (delete-file-recursively
-                 "platforms/linux64GccDPInt32Opt/src"))
-              (when (file-exists?
-                     "platforms/linux64GccDPInt32OptOPENMPI")
-                (delete-file-recursively
-                 "platforms/linux64GccDPInt32OptOPENMPI"))
-              (for-each delete-file
-                        (find-files "." "\\.o$")) #t))
-          (replace 'check
-            (lambda* (#:key tests? #:allow-other-keys)
-              (when tests?
-                (when (file-exists? "test")
-                  (with-directory-excursion "test"
-                    (invoke "bash" "-c"
-                            (format #f
-                                    "source ../etc/bashrc && ./Allrun -j~a"
-                                    (parallel-job-count)))))
-                ;; too many tutorials are failing
-                ;; (with-directory-excursion "tutorials"
-                ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
-                ) #t))
-          (replace 'install
-            (lambda _
-              (let ((install-dir (string-append #$output
-                                                "/share/OpenFOAM")))
-                (mkdir-p install-dir) ;create install directory
-                ;; move contents of build directory to install directory
-                (copy-recursively "." install-dir))))
-          (add-after 'install 'add-symbolic-link
-            (lambda _
-              (let* ((bin (string-append #$output "/bin"))
-                     (lib (string-append #$output "/lib"))
-                     (openfoam (string-append #$output
-                                              "/share/OpenFOAM"))
-                     (build-bin (string-append openfoam
-                                               "/platforms/linux64GccDPInt32Opt/bin"))
-                     (build-lib (string-append openfoam
-                                               "/platforms/linux64GccDPInt32Opt/lib"))
-                     (foam-bin (string-append openfoam "/bin")))
-                ;; add symbolic links in standard 'bin' directory
-                (mkdir-p bin)
-                (for-each (lambda (file)
-                            (unless (member file
-                                            '("." ".."))
-                              (symlink (string-append build-bin "/"
-                                                      file)
-                                       (string-append bin "/" file))))
-                          (scandir build-bin))
-                (for-each (lambda (file)
-                            (unless (member file
-                                            '("." ".."))
-                              (symlink (string-append foam-bin "/"
-                                                      file)
-                                       (string-append bin "/" file))))
-                          (scandir foam-bin))
-                ;; add symbolic link for standard 'lib' directory
-                (symlink build-lib lib)) #t)))))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "WM_PROJECT_DIR")
-            (separator #f)
-            (files '("share/OpenFOAM")))))
-    ;; 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 $(dirname $(which blockMesh))/../../../etc/bashrc
-    ;; $ mkdir -p $FOAM_RUN
-    ;; $ cd $FOAM_RUN
-    ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
-    ;; $ cd pitzDaily
-    ;; $ chmod -R u+w .
-    ;; $ blockMesh
-    (synopsis "Framework for numerical simulation of fluid flow")
-    (description
-     "OpenFOAM provides a set of solvers and methods for tackling
-problems in the field of Computational Fluid Dynamics (CFD).  It is written in
-C++.  Governing equations such as the Navier-Stokes equations can be solved in
-integral form.  Physical processes such as phase change, droplet transport and
-chemical reaction can be modelled.  Numerical methods are included to deal with
-sharp gradients, such as those encountered in flows with shock waves and flows
-with gas/liquid interfaces.  Large problems may be split into smaller, connected
-problems for efficient solution on parallel systems.")
-    (license license:gpl3+)
-    (home-page "https://openfoam.org")))
-
-(define-public openfoam
-  (deprecated-package "openfoam" openfoam-org))
-
 (define-public openfoam-com
   ;; This is a fork of 'openfoam-org', maintained separately.
   (package
@@ -726,6 +416,60 @@ (define* (openfoam-package source version name home-page synopsis)
       (license license:gpl3+)
       (home-page home-page))))
 
+(define-public openfoam-org
+  (let* ((version "11")
+         (name "openfoam-org")
+         (source (origin
+                   (method url-fetch)
+                   (uri (string-append "https://github.com/OpenFOAM/OpenFOAM-"
+                                       (version-major version)
+                                       "/archive/"
+                                       "version-"
+                                       (version-major version)
+                                       ".tar.gz"))
+                   (sha256 (base32
+                            "1h70a5ni2psx7bcx2xg6aqraj2kkbfn8mflh2akbp6k9mmpgih7b"))
+                   (modules '((guix build utils)))
+                   (snippet `(begin
+                               ;; patch shell paths
+                               (substitute* (list "wmake/src/Makefile"
+                                                  "wmake/makefiles/general")
+                                 (("/bin/sh")
+                                  "sh"))
+                               (substitute* "etc/bashrc"
+                                 ;; only go back one folder level
+                                 (("\\$\\(dirname \\$\\{BASH_SOURCE:-\\$0\\}\\)/../..")
+                                  "$(dirname ${BASH_SOURCE:-$0})/..")
+                                 ;; do not use openfoam folder convention
+                                 (("^export WM_PROJECT_DIR=.*$")
+                                  (string-append
+                                   "export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR
+"))
+                                 ;; do not source bash_completion (gives error)
+                                 (("^.*bash_completion.*$" all)
+                                  (string-append "#" all))
+                                 ;; set same version as guix package
+                                 (("^export WM_PROJECT_VERSION=.*$")
+                                  (string-append "export WM_PROJECT_VERSION="
+                                                 ,version "\n")))
+                               ;; add expand flag to RunFunctions
+                               (substitute* "bin/tools/RunFunctions"
+                                 (("foamDictionary (.*)" all args)
+                                  (string-append "foamDictionary -expand "
+                                                 args)))
+                               ;; disable failing test
+                               (substitute* "test/postProcessing/channel/Allrun"
+                                 (("^.*getApplication.*$" all)
+                                  (string-append "#" all "\n")))))))
+         (home-page "https://openfoam.org")
+         (synopsis "Framework for numerical simulation of fluid flow")
+         (template (openfoam-package source version name home-page synopsis)))
+    (package
+      (inherit template))))
+
+(define-public openfoam
+  (deprecated-package "openfoam" openfoam-org))
+
 (define-public open-simulation-interface
   (package
     (name "open-simulation-interface")
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH 3/3] gnu: openfoam-com: Update to 2306.
       [not found] ` <c648aabf51e10ae1063dec75068dc71d54d36ba9.1695977095.git.reza@housseini.me>
@ 2023-09-29  9:03   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-09-29  9:03 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation (openfoam-com): Update to 2306. Use openfoam-package
factory function to create package.
---
 gnu/packages/simulation.scm | 70 +++++++++++++++++++------------------
 1 file changed, 36 insertions(+), 34 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 3db58813d3..7dd6bd3141 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -87,40 +87,6 @@ (define-module (gnu packages simulation)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1))
 
-(define-public openfoam-com
-  ;; This is a fork of 'openfoam-org', maintained separately.
-  (package
-    (inherit openfoam-org)
-    (name "openfoam-com")
-    (version "2212")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://develop.openfoam.com"
-                                  "/Development/openfoam/-/archive/OpenFOAM-v"
-                                  version
-                                  "/openfoam-OpenFOAM-v"
-                                  version
-                                  ".tar.gz"))
-              (sha256
-               (base32
-                "0i9039hfz9gvgymkdjhjvvn5500zha3cpdbpqrzfrfi8lbz10is2"))
-              (modules '((guix build utils)))
-              (snippet `(begin
-                          (substitute* "etc/bashrc"
-                            ;; set same version as guix package
-			    (("^export WM_PROJECT_VERSION=.*$")
-			     (string-append "export WM_PROJECT_VERSION="
-					    ,version "\n")))
-                          ;; patch shell paths
-                          (substitute* (list "src/OSspecific/POSIX/POSIX.C"
-                                             "wmake/src/Makefile"
-                                             "wmake/makefiles/general"
-                                             "wmake/makefiles/info")
-                            (("/bin/sh")
-                             "sh"))))))
-    (synopsis "Framework for numerical simulation of fluid flow (from openfoam.com)")
-    (home-page "https://www.openfoam.com")))
-
 (define* (openfoam-package source version name home-page synopsis)
   (let* ((install-path (string-append "share/OpenFOAM-" version))
          (paraview-version (version-major+minor (package-version paraview)))
@@ -470,6 +436,42 @@ (define-public openfoam-org
 (define-public openfoam
   (deprecated-package "openfoam" openfoam-org))
 
+(define-public openfoam-com
+  ;; This is a fork of 'openfoam-org', maintained separately.
+  (let* ((version "2306")
+         (name "openfoam-com")
+         (source (origin
+                   (method url-fetch)
+                   (uri (string-append "https://develop.openfoam.com"
+                                       "/Development/openfoam/-/archive/OpenFOAM-v"
+                                       version
+                                       "/openfoam-OpenFOAM-v"
+                                       version
+                                       ".tar.gz"))
+                   (sha256 (base32
+                            "0zlkp48vygl2a5cyl0mfpj8dsb5bffviq96rg3kws1l6ni40v7jr"))
+                   (modules '((guix build utils)))
+                   (snippet `(begin
+                               (substitute* "etc/bashrc"
+                                 ;; set same version as guix package
+                                 (("^export WM_PROJECT_VERSION=.*$")
+                                  (string-append "export WM_PROJECT_VERSION="
+                                                 ,version "\n")))
+                               ;; patch shell paths
+                               (substitute* (list
+                                             "src/OSspecific/POSIX/POSIX.C"
+                                             "wmake/src/Makefile"
+                                             "wmake/makefiles/general"
+                                             "wmake/makefiles/info")
+                                 (("/bin/sh")
+                                  "sh"))))))
+         (home-page "https://www.openfoam.com")
+         (synopsis
+          "Framework for numerical simulation of fluid flow (from openfoam.com)")
+         (template (openfoam-package source version name home-page synopsis)))
+    (package
+      (inherit template))))
+
 (define-public open-simulation-interface
   (package
     (name "open-simulation-interface")
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v2 0/3] Update openfoam
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
@ 2023-09-29  9:39   ` reza via Guix-patches via
  2023-10-10  6:25   ` [bug#66262] [PATCH v3 0/3] Remove paraview plugin search path reza via Guix-patches via
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-09-29  9:39 UTC (permalink / raw)
  To: 66262; +Cc: reza

Forgot to rebase to master.

Reza Housseini (3):
  gnu: Add openfoam-package.
  gnu: openfoam-org: Update to 11.
  gnu: openfoam-com: Update to 2306.

 gnu/packages/simulation.scm | 709 +++++++++++++++++++-----------------
 1 file changed, 366 insertions(+), 343 deletions(-)


base-commit: 1b0ec97bce2db93ec4159a13fb0a184f012df4fe
-- 
2.41.0





^ permalink raw reply	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v2 1/3] gnu: Add openfoam-package.
       [not found] ` <8f684396d68f2748f0b5e9ea832e483438cf195d.1695980074.git.reza@housseini.me>
@ 2023-09-29  9:39   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-09-29  9:39 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-package): Add factory function to
generate openfoam packages. Improve build tree clean up.
---
 gnu/packages/simulation.scm | 295 ++++++++++++++++++++++++++++++++++++
 1 file changed, 295 insertions(+)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index b2fb123815..ab4f7c124f 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -450,6 +450,301 @@ (define-public openfoam-com
     (synopsis "Framework for numerical simulation of fluid flow (from openfoam.com)")
     (home-page "https://www.openfoam.com")))
 
+(define* (openfoam-package source version name home-page synopsis)
+  (let* ((install-path (string-append "share/OpenFOAM-" version))
+         (paraview-version (version-major+minor (package-version paraview)))
+         (pv-plugin-path
+          (string-append install-path
+                         "/platforms/linux64GccDPInt32Opt/lib/paraview-"
+                         paraview-version)))
+    (package
+      (name name)
+      (version version)
+      (source source)
+      (build-system gnu-build-system)
+      (native-search-paths
+       (list (search-path-specification
+	      (variable "WM_PROJECT_DIR")
+	      (files `(,install-path)))
+             ;; add PV_PLUGIN_PATH to LD_LIBRARY_PATH so paraview
+             ;; finds the OpenFOAM PV plugins
+             (search-path-specification
+	      (variable "LD_LIBRARY_PATH")
+	      (files `(,pv-plugin-path)))))
+      (inputs (list boost
+		    cgal
+		    git
+		    gmp
+		    libxt
+		    metis
+		    mpfr
+		    ncurses
+		    openmpi
+		    openssh
+		    paraview
+		    pt-scotch32
+		    readline
+		    scotch
+		    zlib))
+      (native-inputs (list bison
+		           flex
+		           ;; paraview plugin dependencies
+		           cli11
+		           cmake-minimal
+		           cgns
+		           curl
+		           double-conversion
+		           eigen
+		           expat
+		           ffmpeg
+		           fmt
+		           freetype
+		           gdal
+		           gl2ps
+		           glew
+		           gmsh
+		           hdf5
+		           jsoncpp
+		           libjpeg-turbo
+		           libogg
+		           libpng
+		           libharu
+		           libtheora
+		           libtiff
+		           libx11
+		           libxml2
+		           lz4
+		           netcdf
+		           nlohmann-json
+		           proj
+		           protobuf
+		           pugixml
+		           python
+		           python-mpi4py
+		           qtbase-5
+		           qtsvg-5
+		           qttools-5
+		           qtwebengine-5
+		           qtxmlpatterns
+		           utfcpp
+		           vtk
+		           xz))
+      (propagated-inputs (list gnuplot))
+      (outputs '("debug" ;~60MB
+	         "out"))
+      (arguments
+       (list
+        ;; Executable files and shared libraries are located in the 'platforms'
+        ;; subdirectory.
+        #:strip-directories
+        #~(list (string-append "OpenFOAM-" #$version "/platforms/linux64GccDPInt32Opt/bin")
+	        (string-append "OpenFOAM-" #$version "/platforms/linux64GccDPInt32Opt/lib"))
+
+        #:modules
+        '((ice-9 ftw)
+          (ice-9 regex)
+          (ice-9 string-fun)
+          (srfi srfi-1)
+          (guix build gnu-build-system)
+          (guix build utils))
+
+        #:phases
+        #~(modify-phases %standard-phases
+	    (add-before 'build 'patch-HOME-path
+	      (lambda _
+	        (setenv "HOME" "/tmp") #t))
+	    (add-before 'build 'patch-scotch
+	      (lambda _
+	        (substitute* "etc/config.sh/scotch"
+	          (("^export SCOTCH_VERSION=scotch_.*$")
+	           (string-append "export SCOTCH_VERSION=scotch_"
+			          #$(package-version pt-scotch32) "\n"))
+	          (("^export SCOTCH_ARCH_PATH=.*$")
+	           (string-append "export SCOTCH_ARCH_PATH=" #$pt-scotch32 "\n")))
+	        #t))
+	    (add-before 'build 'patch-mpi
+	      (lambda _
+	        (let* ((mpi-version #$(package-version openmpi)))
+	          ;; specify openmpi type
+	          (substitute* "etc/bashrc"
+		    (("WM_MPLIB=SYSTEMOPENMPI")
+		     "WM_MPLIB=OPENMPI"))
+	          (substitute* "etc/config.sh/mpi"
+		    (("export FOAM_MPI=openmpi-.*$")
+		     (string-append "export FOAM_MPI=openmpi-"
+				    mpi-version "\n"))
+		    (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
+		     (string-append "export MPI_ARCH_PATH=" #$openmpi "\n"))))
+	        #t))
+	    (add-before 'build 'patch-paraview
+	      (lambda _
+	        (substitute* "etc/config.sh/paraview"
+	          (("^export ParaView_VERSION=.*$")
+	           (string-append "export ParaView_VERSION="
+			          #$(package-version paraview) "\n"))
+	          (("^export ParaView_DIR=.*$")
+	           (string-append "export ParaView_DIR=" #$paraview "\n"))
+                  (("export ParaView_GL=mesa") "export ParaView_GL=system"))
+	        #t))
+	    (add-before 'build 'add-rpaths
+	      (lambda _
+	        (letrec* ((libraries '("boost"
+				       "cgal"
+				       "gmp"
+				       "metis"
+				       "mpfr"
+				       "scotch"
+				       "pt-scotch32"
+ 				       "openmpi"
+				       "zlib"
+				       "paraview"))
+		          (rpaths
+		           (fold-right (lambda (lib rpaths)
+				         (string-append rpaths
+						        "-rpath="
+						        (assoc-ref %build-inputs lib)
+						        "/lib,")) "" libraries))
+		          (openfoam-lib
+		           (string-append #$output
+				          "/share/OpenFOAM-" #$version
+				          "/platforms/linux64GccDPInt32Opt/lib"))
+		          (ldflags
+		           (string-append "-Wl,"
+				          rpaths
+				          "-rpath="
+				          openfoam-lib
+				          ","
+				          "-rpath="
+				          openfoam-lib
+				          "/dummy,"
+				          "-rpath="
+				          openfoam-lib
+				          "/paraview-"
+				          #$(version-major+minor (package-version
+							          paraview)))))
+	          (substitute* "wmake/rules/linux64Gcc/c++"
+		    (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
+		     (string-append all " " ldflags)))) #t))
+	    (add-before 'build 'add-vtk-include-path
+	      (lambda _
+	        (let* ((vtk-version #$(version-major+minor
+				       (package-version vtk)))
+		       (vtk-inc (string-append #$vtk "/include/vtk-" vtk-version))
+		       (vtk-inc-flag (string-append "-I" vtk-inc)))
+	          (substitute* "wmake/rules/linux64Gcc/c++"
+		    (("\\$\\(LIB_HEADER_DIRS\\)" all)
+		     (string-append all " " vtk-inc-flag " "))))
+	        #t))
+	    (delete 'configure) ;no configure phase
+	    (replace 'build
+	      (lambda _
+	        ;; compile OpenFOAM libraries and applications
+	        (invoke "bash" "-c"
+		        (format #f
+			        "source ./etc/bashrc && ./Allwmake -j~a"
+			        (parallel-job-count)))))
+	    (add-after 'build 'cleanup
+	      ;; Avoid unnecessary, voluminous object and dep files.
+	      (lambda _
+	        (when (file-exists? "platforms/linux64GccDPInt32Opt/src")
+	          (delete-file-recursively
+	           "platforms/linux64GccDPInt32Opt/src"))
+	        (when (file-exists?
+		       "platforms/linux64GccDPInt32OptOPENMPI")
+	          (delete-file-recursively
+	           "platforms/linux64GccDPInt32OptOPENMPI"))
+	        (for-each delete-file
+		          (find-files "." "\\.o$"))
+                ;; Remove spurious files in src tree
+                (invoke "bash" "-c" "source ./etc/bashrc && wclean all")
+                #t))
+	    (replace 'check
+	      (lambda* (#:key tests? #:allow-other-keys)
+	        (when tests?
+	          (when (file-exists? "test")
+		    (with-directory-excursion "test"
+		      (invoke "bash" "-c"
+			      (format #f
+				      "source ../etc/bashrc && ./Allrun -j~a"
+				      (parallel-job-count)))
+                      ;; cleanup
+                      (invoke "bash" "-c"
+			      "source ../etc/bashrc && ./Allclean")))
+	          ;; too many tutorials are failing
+	          ;; (with-directory-excursion "tutorials"
+	          ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
+	          ) #t))
+	    (add-before 'install 'set-paths
+	      (lambda _
+	        (let ((install-path (string-append #$output
+					           "/share/OpenFOAM-" #$version)))
+	          (substitute* "etc/bashrc"
+		    (("^\\[ \"\\$BASH\".*$") "")
+		    (("^export FOAM_INST_DIR=\\$\\(cd.*$")
+		     (string-append "export FOAM_INST_DIR=" install-path "\n"))
+		    (("^export FOAM_INST_DIR=\\$HOME.*$") "")))
+	        #t))
+	    (replace 'install
+	      (lambda* (#:key outputs inputs #:allow-other-keys)
+	        (let ((install-path (string-append #$output
+					           "/share/OpenFOAM-" #$version)))
+	          (mkdir-p install-path) ;create install directory
+	          ;; move contents of build directory to install directory
+	          (copy-recursively "." install-path))))
+	    (add-after 'install 'add-symbolic-link
+	      (lambda _
+	        (let* ((bin (string-append #$output "/bin"))
+		       (lib (string-append #$output "/lib"))
+		       (openfoam (string-append #$output
+					        "/share/OpenFOAM-" #$version))
+		       (build-bin (string-append openfoam
+					         "/platforms/linux64GccDPInt32Opt/bin"))
+		       (build-lib (string-append openfoam
+					         "/platforms/linux64GccDPInt32Opt/lib"))
+		       (foam-bin (string-append openfoam "/bin")))
+	          ;; add symbolic links in standard 'bin' directory
+	          (mkdir-p bin)
+	          (for-each (lambda (file)
+			      (unless (member file
+					      '("." ".."))
+			        (symlink (string-append build-bin "/"
+						        file)
+				         (string-append bin "/" file))))
+			    (scandir build-bin))
+	          (for-each (lambda (file)
+			      (unless (member file
+					      '("." ".."))
+			        (symlink (string-append foam-bin "/"
+						        file)
+				         (string-append bin "/" file))))
+			    (scandir foam-bin))
+	          ;; add symbolic link for standard 'lib' directory
+	          (symlink build-lib lib)) #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 $WM_PROJECT_DIR/etc/bashrc
+      ;; $ mkdir -p $FOAM_RUN
+      ;; $ cd $FOAM_RUN
+      ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
+      ;; $ cd pitzDaily
+      ;; $ chmod -R u+w .
+      ;; $ blockMesh
+      (synopsis synopsis)
+      (description
+       "OpenFOAM provides a set of solvers and methods for tackling
+problems in the field of Computational Fluid Dynamics (CFD).  It is written in
+C++.  Governing equations such as the Navier-Stokes equations can be solved in
+integral form.  Physical processes such as phase change, droplet transport and
+chemical reaction can be modelled.  Numerical methods are included to deal with
+sharp gradients, such as those encountered in flows with shock waves and flows
+with gas/liquid interfaces.  Large problems may be split into smaller, connected
+problems for efficient solution on parallel systems.")
+      (license license:gpl3+)
+      (home-page home-page))))
+
 (define-public open-simulation-interface
   (package
     (name "open-simulation-interface")
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v2 2/3] gnu: openfoam-org: Update to 11.
       [not found] ` <aa633991702c2752a9692a695792e972172b2faf.1695980074.git.reza@housseini.me>
@ 2023-09-29  9:39   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-09-29  9:39 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Update to 11. Use
openfoam-package factory function to create package.
---
 gnu/packages/simulation.scm | 382 +++++-------------------------------
 1 file changed, 54 insertions(+), 328 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index ab4f7c124f..4dc8c9e30e 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -88,334 +88,6 @@ (define-module (gnu packages simulation)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1))
 
-(define-public openfoam-org
-  (package
-    (name "openfoam-org")
-    (version "10.20230119")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url (string-append "https://github.com/OpenFOAM/OpenFOAM-"
-                                        (version-major version)))
-                    (commit (second (string-split version #\.)))))
-              (sha256
-               (base32
-                "0icvwg7s6vnkgmdiczivia9pbrgx8nanw9a4j080fzfvdv9vxhzp"))
-              (file-name (git-file-name name version))
-              (modules '((guix build utils)))
-              (snippet `(begin
-                          ;; patch shell paths
-                          (substitute* (list "wmake/src/Makefile"
-                                             "wmake/makefiles/general")
-                            (("/bin/sh")
-                             "sh"))
-                          (substitute* "etc/bashrc"
-                            ;; only go back one folder level
-                            (("\\$\\(dirname \\$\\{BASH_SOURCE:-\\$0\\}\\)/../..")
-                             "$(dirname ${BASH_SOURCE:-$0})/..")
-                            ;; do not use openfoam folder convention
-                            (("^export WM_PROJECT_DIR=.*$")
-                             (string-append
-                              "export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR\n"))
-                            ;; do not source bash_completion (gives error)
-                            (("^.*bash_completion.*$" all)
-                             (string-append "#" all))
-                            ;; set same version as guix package
-                            (("^export WM_PROJECT_VERSION=.*$")
-                             (string-append "export WM_PROJECT_VERSION="
-                                            ,version "\n")))
-                          ;; add expand flag to RunFunctions
-                          (substitute* "bin/tools/RunFunctions"
-                            (("foamDictionary (.*)" all args)
-                             (string-append "foamDictionary -expand " args)))
-                          ;; disable failing test
-                          (substitute* "test/postProcessing/channel/Allrun"
-                            (("^.*getApplication.*$" all)
-                             (string-append "#" all "\n")))))))
-    (build-system gnu-build-system)
-    (inputs (list boost
-                  cgal
-                  git
-                  gmp
-                  libxt
-                  metis
-                  mpfr
-                  ncurses
-                  openmpi
-                  openssh
-                  paraview
-                  pt-scotch32
-                  readline
-                  zlib))
-    (native-inputs (list bison
-                         flex
-                         ;; paraview plugin dependencies
-                         cli11
-                         cmake-minimal
-                         cgns
-                         curl
-                         double-conversion
-                         eigen
-                         expat
-                         ffmpeg
-                         fmt
-                         freetype
-                         gdal
-                         gl2ps
-                         glew
-                         gmsh
-                         hdf5
-                         jsoncpp
-                         libjpeg-turbo
-                         libogg
-                         libpng
-                         libharu
-                         libtheora
-                         libtiff
-                         libx11
-                         libxml2
-                         lz4
-                         netcdf
-                         nlohmann-json
-                         proj
-                         protobuf
-                         pugixml
-                         python
-                         python-mpi4py
-                         qtbase-5
-                         qtsvg-5
-                         qttools-5
-                         qtwebengine-5
-                         qtxmlpatterns
-                         utfcpp
-                         vtk
-                         xz))
-    (propagated-inputs (list gnuplot))
-    (outputs '("debug" ;~60MB
-               "out"))
-    (arguments
-     (list
-      ;; Executable files and shared libraries are located in the 'platforms'
-      ;; subdirectory.
-      #:strip-directories
-      #~(list "share/OpenFOAM/platforms/linux64GccDPInt32Opt/bin"
-              "share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib")
-
-      #:modules
-      '((ice-9 ftw)
-        (ice-9 regex)
-        (ice-9 string-fun)
-        (srfi srfi-1)
-        (guix build gnu-build-system)
-        (guix build utils))
-
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-before 'build 'patch-HOME-path
-            (lambda _
-              (setenv "HOME" "/tmp")))
-          (add-before 'build 'rename-self
-            (lambda _
-              ;; The script 'bin/foamEtcFile' derives the version name based
-              ;; on the current directory name (!), so make sure to follow the
-              ;; expected naming convention.
-              (let ((here (canonicalize-path "."))
-                    (target #$(string-append
-                               "OpenFOAM-"
-                               (string-map (match-lambda
-                                             (#\. #\-)
-                                             (chr chr))
-                                           (package-version this-package)))))
-                (chdir "..")
-                (format #t "renaming '~a' to '~a'~%"
-                        here target)
-                (rename-file here target)
-                (chdir target))))
-          (add-before 'build 'patch-scotch
-            (lambda _
-              (substitute* "etc/config.sh/scotch"
-                (("^export SCOTCH_VERSION=scotch_.*$")
-                 (string-append "export SCOTCH_VERSION=scotch_"
-                                #$(package-version pt-scotch32) "\n"))
-                (("^export SCOTCH_ARCH_PATH=.*$")
-                 (string-append "export SCOTCH_ARCH_PATH="
-                                (assoc-ref %build-inputs "pt-scotch32")
-                                "\n"))) #t))
-          (add-before 'build 'patch-mpi
-            (lambda _
-              (let* ((mpi-path (assoc-ref %build-inputs "openmpi"))
-                     (mpi-version #$(package-version openmpi)))
-                ;; specify openmpi type
-                (substitute* "etc/bashrc"
-                  (("WM_MPLIB=SYSTEMOPENMPI")
-                   "WM_MPLIB=OPENMPI"))
-                (substitute* "etc/config.sh/mpi"
-                  (("export FOAM_MPI=openmpi-.*$")
-                   (string-append "export FOAM_MPI=openmpi-"
-                                  mpi-version "\n"))
-                  (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
-                   (string-append "export MPI_ARCH_PATH=" mpi-path
-                                  "\n")))) #t))
-          (add-before 'build 'patch-paraview
-            (lambda _
-              (substitute* "etc/config.sh/paraview"
-                (("^export ParaView_VERSION=.*$")
-                 (string-append "export ParaView_VERSION="
-                                #$(package-version paraview) "\n"))
-                (("^export ParaView_DIR=.*$")
-                 (string-append "export ParaView_DIR="
-                                (assoc-ref %build-inputs "paraview")
-                                "\n"))) #t))
-          (add-before 'build 'add-rpaths
-            (lambda _
-              (letrec* ((libraries '("boost" "cgal"
-                                     "gmp"
-                                     "metis"
-                                     "mpfr"
-                                     "pt-scotch32"
-                                     "openmpi"
-                                     "zlib"
-                                     "paraview"))
-                        (rpaths
-                         (fold-right (lambda (library rpaths)
-                                       (string-append rpaths
-                                                      "-rpath="
-                                                      (assoc-ref
-                                                       %build-inputs library)
-                                                      "/lib,")) "" libraries))
-                        (openfoam-lib
-                         (string-append #$output
-                                        "/share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib"))
-                        (ldflags
-                         (string-append "-Wl,"
-                                        rpaths
-                                        "-rpath="
-                                        openfoam-lib
-                                        ","
-                                        "-rpath="
-                                        openfoam-lib
-                                        "/dummy,"
-                                        "-rpath="
-                                        openfoam-lib
-                                        "/paraview-"
-                                        #$(version-major+minor (package-version
-                                                                paraview)))))
-                (substitute* "wmake/rules/linux64Gcc/c++"
-                  (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
-                   (string-append all " " ldflags)))) #t))
-          (add-before 'build 'add-vtk-include-path
-            (lambda _
-              (let* ((vtk-version #$(version-major+minor
-                                     (package-version vtk)))
-                     (vtk-root (assoc-ref %build-inputs "vtk"))
-                     (vtk-inc (string-append vtk-root "/include/vtk-" vtk-version))
-                     (vtk-inc-flag (string-append "-I" vtk-inc)))
-                (substitute* "wmake/rules/linux64Gcc/c++"
-                  (("\\$\\(LIB_HEADER_DIRS\\)" all)
-                   (string-append all " " vtk-inc-flag " "))))
-              #t))
-          (delete 'configure) ;no configure phase
-          (replace 'build
-            (lambda _
-              ;; compile OpenFOAM libraries and applications
-              (invoke "bash" "-c"
-                      (format #f
-                              "source ./etc/bashrc && ./Allwmake -j~a"
-                              (parallel-job-count)))))
-          (add-after 'build 'cleanup
-            ;; Avoid unnecessary, voluminous object and dep files.
-            (lambda _
-              (when (file-exists? "platforms/linux64GccDPInt32Opt/src")
-                (delete-file-recursively
-                 "platforms/linux64GccDPInt32Opt/src"))
-              (when (file-exists?
-                     "platforms/linux64GccDPInt32OptOPENMPI")
-                (delete-file-recursively
-                 "platforms/linux64GccDPInt32OptOPENMPI"))
-              (for-each delete-file
-                        (find-files "." "\\.o$")) #t))
-          (replace 'check
-            (lambda* (#:key tests? #:allow-other-keys)
-              (when tests?
-                (when (file-exists? "test")
-                  (with-directory-excursion "test"
-                    (invoke "bash" "-c"
-                            (format #f
-                                    "source ../etc/bashrc && ./Allrun -j~a"
-                                    (parallel-job-count)))))
-                ;; too many tutorials are failing
-                ;; (with-directory-excursion "tutorials"
-                ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
-                ) #t))
-          (replace 'install
-            (lambda _
-              (let ((install-dir (string-append #$output
-                                                "/share/OpenFOAM")))
-                (mkdir-p install-dir) ;create install directory
-                ;; move contents of build directory to install directory
-                (copy-recursively "." install-dir))))
-          (add-after 'install 'add-symbolic-link
-            (lambda _
-              (let* ((bin (string-append #$output "/bin"))
-                     (lib (string-append #$output "/lib"))
-                     (openfoam (string-append #$output
-                                              "/share/OpenFOAM"))
-                     (build-bin (string-append openfoam
-                                               "/platforms/linux64GccDPInt32Opt/bin"))
-                     (build-lib (string-append openfoam
-                                               "/platforms/linux64GccDPInt32Opt/lib"))
-                     (foam-bin (string-append openfoam "/bin")))
-                ;; add symbolic links in standard 'bin' directory
-                (mkdir-p bin)
-                (for-each (lambda (file)
-                            (unless (member file
-                                            '("." ".."))
-                              (symlink (string-append build-bin "/"
-                                                      file)
-                                       (string-append bin "/" file))))
-                          (scandir build-bin))
-                (for-each (lambda (file)
-                            (unless (member file
-                                            '("." ".."))
-                              (symlink (string-append foam-bin "/"
-                                                      file)
-                                       (string-append bin "/" file))))
-                          (scandir foam-bin))
-                ;; add symbolic link for standard 'lib' directory
-                (symlink build-lib lib)) #t)))))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "WM_PROJECT_DIR")
-            (separator #f)
-            (files '("share/OpenFOAM")))))
-    ;; 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 $(dirname $(which blockMesh))/../../../etc/bashrc
-    ;; $ mkdir -p $FOAM_RUN
-    ;; $ cd $FOAM_RUN
-    ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
-    ;; $ cd pitzDaily
-    ;; $ chmod -R u+w .
-    ;; $ blockMesh
-    (synopsis "Framework for numerical simulation of fluid flow")
-    (description
-     "OpenFOAM provides a set of solvers and methods for tackling
-problems in the field of Computational Fluid Dynamics (CFD).  It is written in
-C++.  Governing equations such as the Navier-Stokes equations can be solved in
-integral form.  Physical processes such as phase change, droplet transport and
-chemical reaction can be modelled.  Numerical methods are included to deal with
-sharp gradients, such as those encountered in flows with shock waves and flows
-with gas/liquid interfaces.  Large problems may be split into smaller, connected
-problems for efficient solution on parallel systems.")
-    (license license:gpl3+)
-    (home-page "https://openfoam.org")))
-
-(define-public openfoam
-  (deprecated-package "openfoam" openfoam-org))
-
 (define-public openfoam-com
   ;; This is a fork of 'openfoam-org', maintained separately.
   (package
@@ -745,6 +417,60 @@ (define* (openfoam-package source version name home-page synopsis)
       (license license:gpl3+)
       (home-page home-page))))
 
+(define-public openfoam-org
+  (let* ((version "11")
+         (name "openfoam-org")
+         (source (origin
+                   (method url-fetch)
+                   (uri (string-append "https://github.com/OpenFOAM/OpenFOAM-"
+                                       (version-major version)
+                                       "/archive/"
+                                       "version-"
+                                       (version-major version)
+                                       ".tar.gz"))
+                   (sha256 (base32
+                            "1h70a5ni2psx7bcx2xg6aqraj2kkbfn8mflh2akbp6k9mmpgih7b"))
+                   (modules '((guix build utils)))
+                   (snippet `(begin
+                               ;; patch shell paths
+                               (substitute* (list "wmake/src/Makefile"
+                                                  "wmake/makefiles/general")
+                                 (("/bin/sh")
+                                  "sh"))
+                               (substitute* "etc/bashrc"
+                                 ;; only go back one folder level
+                                 (("\\$\\(dirname \\$\\{BASH_SOURCE:-\\$0\\}\\)/../..")
+                                  "$(dirname ${BASH_SOURCE:-$0})/..")
+                                 ;; do not use openfoam folder convention
+                                 (("^export WM_PROJECT_DIR=.*$")
+                                  (string-append
+                                   "export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR
+"))
+                                 ;; do not source bash_completion (gives error)
+                                 (("^.*bash_completion.*$" all)
+                                  (string-append "#" all))
+                                 ;; set same version as guix package
+                                 (("^export WM_PROJECT_VERSION=.*$")
+                                  (string-append "export WM_PROJECT_VERSION="
+                                                 ,version "\n")))
+                               ;; add expand flag to RunFunctions
+                               (substitute* "bin/tools/RunFunctions"
+                                 (("foamDictionary (.*)" all args)
+                                  (string-append "foamDictionary -expand "
+                                                 args)))
+                               ;; disable failing test
+                               (substitute* "test/postProcessing/channel/Allrun"
+                                 (("^.*getApplication.*$" all)
+                                  (string-append "#" all "\n")))))))
+         (home-page "https://openfoam.org")
+         (synopsis "Framework for numerical simulation of fluid flow")
+         (template (openfoam-package source version name home-page synopsis)))
+    (package
+      (inherit template))))
+
+(define-public openfoam
+  (deprecated-package "openfoam" openfoam-org))
+
 (define-public open-simulation-interface
   (package
     (name "open-simulation-interface")
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v2 3/3] gnu: openfoam-com: Update to 2306.
       [not found] ` <9141e57d9db9be29442325736da07e61ff3c5420.1695980074.git.reza@housseini.me>
@ 2023-09-29  9:40   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-09-29  9:40 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation (openfoam-com): Update to 2306. Use openfoam-package
factory function to create package.
---
 gnu/packages/simulation.scm | 70 +++++++++++++++++++------------------
 1 file changed, 36 insertions(+), 34 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 4dc8c9e30e..c712693e6e 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -88,40 +88,6 @@ (define-module (gnu packages simulation)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1))
 
-(define-public openfoam-com
-  ;; This is a fork of 'openfoam-org', maintained separately.
-  (package
-    (inherit openfoam-org)
-    (name "openfoam-com")
-    (version "2212")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://develop.openfoam.com"
-                                  "/Development/openfoam/-/archive/OpenFOAM-v"
-                                  version
-                                  "/openfoam-OpenFOAM-v"
-                                  version
-                                  ".tar.gz"))
-              (sha256
-               (base32
-                "0i9039hfz9gvgymkdjhjvvn5500zha3cpdbpqrzfrfi8lbz10is2"))
-              (modules '((guix build utils)))
-              (snippet `(begin
-                          (substitute* "etc/bashrc"
-                            ;; set same version as guix package
-			    (("^export WM_PROJECT_VERSION=.*$")
-			     (string-append "export WM_PROJECT_VERSION="
-					    ,version "\n")))
-                          ;; patch shell paths
-                          (substitute* (list "src/OSspecific/POSIX/POSIX.C"
-                                             "wmake/src/Makefile"
-                                             "wmake/makefiles/general"
-                                             "wmake/makefiles/info")
-                            (("/bin/sh")
-                             "sh"))))))
-    (synopsis "Framework for numerical simulation of fluid flow (from openfoam.com)")
-    (home-page "https://www.openfoam.com")))
-
 (define* (openfoam-package source version name home-page synopsis)
   (let* ((install-path (string-append "share/OpenFOAM-" version))
          (paraview-version (version-major+minor (package-version paraview)))
@@ -471,6 +437,42 @@ (define-public openfoam-org
 (define-public openfoam
   (deprecated-package "openfoam" openfoam-org))
 
+(define-public openfoam-com
+  ;; This is a fork of 'openfoam-org', maintained separately.
+  (let* ((version "2306")
+         (name "openfoam-com")
+         (source (origin
+                   (method url-fetch)
+                   (uri (string-append "https://develop.openfoam.com"
+                                       "/Development/openfoam/-/archive/OpenFOAM-v"
+                                       version
+                                       "/openfoam-OpenFOAM-v"
+                                       version
+                                       ".tar.gz"))
+                   (sha256 (base32
+                            "0zlkp48vygl2a5cyl0mfpj8dsb5bffviq96rg3kws1l6ni40v7jr"))
+                   (modules '((guix build utils)))
+                   (snippet `(begin
+                               (substitute* "etc/bashrc"
+                                 ;; set same version as guix package
+                                 (("^export WM_PROJECT_VERSION=.*$")
+                                  (string-append "export WM_PROJECT_VERSION="
+                                                 ,version "\n")))
+                               ;; patch shell paths
+                               (substitute* (list
+                                             "src/OSspecific/POSIX/POSIX.C"
+                                             "wmake/src/Makefile"
+                                             "wmake/makefiles/general"
+                                             "wmake/makefiles/info")
+                                 (("/bin/sh")
+                                  "sh"))))))
+         (home-page "https://www.openfoam.com")
+         (synopsis
+          "Framework for numerical simulation of fluid flow (from openfoam.com)")
+         (template (openfoam-package source version name home-page synopsis)))
+    (package
+      (inherit template))))
+
 (define-public open-simulation-interface
   (package
     (name "open-simulation-interface")
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v3 0/3] Remove paraview plugin search path.
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
  2023-09-29  9:39   ` [bug#66262] [PATCH v2 0/3] Update openfoam reza via Guix-patches via
@ 2023-10-10  6:25   ` reza via Guix-patches via
  2023-11-29 14:28   ` [bug#66262] [PATCH v4 1/6] gnu: openfoam-org: Use gexps reza via Guix-patches via
                     ` (8 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-10-10  6:25 UTC (permalink / raw)
  To: 66262; +Cc: reza

This updated patch series removes the paraview plugin search path from
the openfoam-package factory function. This search path should be
added to the paraview package instead.

Reza Housseini (3):
  gnu: Add openfoam-package.
  gnu: openfoam-org: Update to 11.
  gnu: openfoam-com: Update to 2306.

 gnu/packages/simulation.scm | 699 ++++++++++++++++++------------------
 1 file changed, 356 insertions(+), 343 deletions(-)


base-commit: 1b0ec97bce2db93ec4159a13fb0a184f012df4fe
-- 
2.41.0





^ permalink raw reply	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v3 1/3] gnu: Add openfoam-package.
       [not found] ` <ccac0a551e301ab86d5c77ba928fac1cf69cf138.1696919009.git.reza@housseini.me>
@ 2023-10-10  6:25   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-10-10  6:25 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-package): Add factory function to
generate openfoam packages. Improve build tree clean up to fix reproducibility
bug. Fix install path to follow openfoam naming convention.
---
 gnu/packages/simulation.scm | 285 ++++++++++++++++++++++++++++++++++++
 1 file changed, 285 insertions(+)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index b2fb123815..4b95688e33 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -88,6 +88,291 @@ (define-module (gnu packages simulation)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1))
 
+(define* (openfoam-package source version name home-page synopsis)
+  (let* ((install-path (string-append "share/OpenFOAM-" version)))
+    (package
+      (name name)
+      (version version)
+      (source source)
+      (build-system gnu-build-system)
+      (native-search-paths
+       (list (search-path-specification
+	      (variable "WM_PROJECT_DIR")
+	      (files `(,install-path)))))
+      (inputs (list boost
+		    cgal
+		    git
+		    gmp
+		    libxt
+		    metis
+		    mpfr
+		    ncurses
+		    openmpi
+		    openssh
+		    paraview
+		    pt-scotch32
+		    readline
+		    scotch
+		    zlib))
+      (native-inputs (list bison
+		           flex
+		           ;; paraview plugin dependencies
+		           cli11
+		           cmake-minimal
+		           cgns
+		           curl
+		           double-conversion
+		           eigen
+		           expat
+		           ffmpeg
+		           fmt
+		           freetype
+		           gdal
+		           gl2ps
+		           glew
+		           gmsh
+		           hdf5
+		           jsoncpp
+		           libjpeg-turbo
+		           libogg
+		           libpng
+		           libharu
+		           libtheora
+		           libtiff
+		           libx11
+		           libxml2
+		           lz4
+		           netcdf
+		           nlohmann-json
+		           proj
+		           protobuf
+		           pugixml
+		           python
+		           python-mpi4py
+		           qtbase-5
+		           qtsvg-5
+		           qttools-5
+		           qtwebengine-5
+		           qtxmlpatterns
+		           utfcpp
+		           vtk
+		           xz))
+      (propagated-inputs (list gnuplot))
+      (outputs '("debug" ;~60MB
+	         "out"))
+      (arguments
+       (list
+        ;; Executable files and shared libraries are located in the 'platforms'
+        ;; subdirectory.
+        #:strip-directories
+        #~(list (string-append "OpenFOAM-" #$version "/platforms/linux64GccDPInt32Opt/bin")
+	        (string-append "OpenFOAM-" #$version "/platforms/linux64GccDPInt32Opt/lib"))
+
+        #:modules
+        '((ice-9 ftw)
+          (ice-9 regex)
+          (ice-9 string-fun)
+          (srfi srfi-1)
+          (guix build gnu-build-system)
+          (guix build utils))
+
+        #:phases
+        #~(modify-phases %standard-phases
+	    (add-before 'build 'patch-HOME-path
+	      (lambda _
+	        (setenv "HOME" "/tmp") #t))
+	    (add-before 'build 'patch-scotch
+	      (lambda _
+	        (substitute* "etc/config.sh/scotch"
+	          (("^export SCOTCH_VERSION=scotch_.*$")
+	           (string-append "export SCOTCH_VERSION=scotch_"
+			          #$(package-version pt-scotch32) "\n"))
+	          (("^export SCOTCH_ARCH_PATH=.*$")
+	           (string-append "export SCOTCH_ARCH_PATH=" #$pt-scotch32 "\n")))
+	        #t))
+	    (add-before 'build 'patch-mpi
+	      (lambda _
+	        (let* ((mpi-version #$(package-version openmpi)))
+	          ;; specify openmpi type
+	          (substitute* "etc/bashrc"
+		    (("WM_MPLIB=SYSTEMOPENMPI")
+		     "WM_MPLIB=OPENMPI"))
+	          (substitute* "etc/config.sh/mpi"
+		    (("export FOAM_MPI=openmpi-.*$")
+		     (string-append "export FOAM_MPI=openmpi-"
+				    mpi-version "\n"))
+		    (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
+		     (string-append "export MPI_ARCH_PATH=" #$openmpi "\n"))))
+	        #t))
+	    (add-before 'build 'patch-paraview
+	      (lambda _
+	        (substitute* "etc/config.sh/paraview"
+	          (("^export ParaView_VERSION=.*$")
+	           (string-append "export ParaView_VERSION="
+			          #$(package-version paraview) "\n"))
+	          (("^export ParaView_DIR=.*$")
+	           (string-append "export ParaView_DIR=" #$paraview "\n"))
+                  (("export ParaView_GL=mesa") "export ParaView_GL=system"))
+	        #t))
+	    (add-before 'build 'add-rpaths
+	      (lambda _
+	        (letrec* ((libraries '("boost"
+				       "cgal"
+				       "gmp"
+				       "metis"
+				       "mpfr"
+				       "scotch"
+				       "pt-scotch32"
+ 				       "openmpi"
+				       "zlib"
+				       "paraview"))
+		          (rpaths
+		           (fold-right (lambda (lib rpaths)
+				         (string-append rpaths
+						        "-rpath="
+						        (assoc-ref %build-inputs lib)
+						        "/lib,")) "" libraries))
+		          (openfoam-lib
+		           (string-append #$output
+				          "/share/OpenFOAM-" #$version
+				          "/platforms/linux64GccDPInt32Opt/lib"))
+		          (ldflags
+		           (string-append "-Wl,"
+				          rpaths
+				          "-rpath="
+				          openfoam-lib
+				          ","
+				          "-rpath="
+				          openfoam-lib
+				          "/dummy,"
+				          "-rpath="
+				          openfoam-lib
+				          "/paraview-"
+				          #$(version-major+minor (package-version
+							          paraview)))))
+	          (substitute* "wmake/rules/linux64Gcc/c++"
+		    (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
+		     (string-append all " " ldflags)))) #t))
+	    (add-before 'build 'add-vtk-include-path
+	      (lambda _
+	        (let* ((vtk-version #$(version-major+minor
+				       (package-version vtk)))
+		       (vtk-inc (string-append #$vtk "/include/vtk-" vtk-version))
+		       (vtk-inc-flag (string-append "-I" vtk-inc)))
+	          (substitute* "wmake/rules/linux64Gcc/c++"
+		    (("\\$\\(LIB_HEADER_DIRS\\)" all)
+		     (string-append all " " vtk-inc-flag " "))))
+	        #t))
+	    (delete 'configure) ;no configure phase
+	    (replace 'build
+	      (lambda _
+	        ;; compile OpenFOAM libraries and applications
+	        (invoke "bash" "-c"
+		        (format #f
+			        "source ./etc/bashrc && ./Allwmake -j~a"
+			        (parallel-job-count)))))
+	    (add-after 'build 'cleanup
+	      ;; Avoid unnecessary, voluminous object and dep files.
+	      (lambda _
+	        (when (file-exists? "platforms/linux64GccDPInt32Opt/src")
+	          (delete-file-recursively
+	           "platforms/linux64GccDPInt32Opt/src"))
+	        (when (file-exists?
+		       "platforms/linux64GccDPInt32OptOPENMPI")
+	          (delete-file-recursively
+	           "platforms/linux64GccDPInt32OptOPENMPI"))
+	        (for-each delete-file
+		          (find-files "." "\\.o$"))
+                ;; Remove spurious files in src tree
+                (invoke "bash" "-c" "source ./etc/bashrc && wclean all")
+                #t))
+	    (replace 'check
+	      (lambda* (#:key tests? #:allow-other-keys)
+	        (when tests?
+	          (when (file-exists? "test")
+		    (with-directory-excursion "test"
+		      (invoke "bash" "-c"
+			      (format #f
+				      "source ../etc/bashrc && ./Allrun -j~a"
+				      (parallel-job-count)))
+                      ;; cleanup
+                      (invoke "bash" "-c"
+			      "source ../etc/bashrc && ./Allclean")))
+	          ;; too many tutorials are failing
+	          ;; (with-directory-excursion "tutorials"
+	          ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
+	          ) #t))
+	    (add-before 'install 'set-paths
+	      (lambda _
+	        (let ((install-path (string-append #$output
+					           "/share/OpenFOAM-" #$version)))
+	          (substitute* "etc/bashrc"
+		    (("^\\[ \"\\$BASH\".*$") "")
+		    (("^export FOAM_INST_DIR=\\$\\(cd.*$")
+		     (string-append "export FOAM_INST_DIR=" install-path "\n"))
+		    (("^export FOAM_INST_DIR=\\$HOME.*$") "")))
+	        #t))
+	    (replace 'install
+	      (lambda* (#:key outputs inputs #:allow-other-keys)
+	        (let ((install-path (string-append #$output
+					           "/share/OpenFOAM-" #$version)))
+	          (mkdir-p install-path) ;create install directory
+	          ;; move contents of build directory to install directory
+	          (copy-recursively "." install-path))))
+	    (add-after 'install 'add-symbolic-link
+	      (lambda _
+	        (let* ((bin (string-append #$output "/bin"))
+		       (lib (string-append #$output "/lib"))
+		       (openfoam (string-append #$output
+					        "/share/OpenFOAM-" #$version))
+		       (build-bin (string-append openfoam
+					         "/platforms/linux64GccDPInt32Opt/bin"))
+		       (build-lib (string-append openfoam
+					         "/platforms/linux64GccDPInt32Opt/lib"))
+		       (foam-bin (string-append openfoam "/bin")))
+	          ;; add symbolic links in standard 'bin' directory
+	          (mkdir-p bin)
+	          (for-each (lambda (file)
+			      (unless (member file
+					      '("." ".."))
+			        (symlink (string-append build-bin "/"
+						        file)
+				         (string-append bin "/" file))))
+			    (scandir build-bin))
+	          (for-each (lambda (file)
+			      (unless (member file
+					      '("." ".."))
+			        (symlink (string-append foam-bin "/"
+						        file)
+				         (string-append bin "/" file))))
+			    (scandir foam-bin))
+	          ;; add symbolic link for standard 'lib' directory
+	          (symlink build-lib lib)) #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 $WM_PROJECT_DIR/etc/bashrc
+      ;; $ mkdir -p $FOAM_RUN
+      ;; $ cd $FOAM_RUN
+      ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
+      ;; $ cd pitzDaily
+      ;; $ chmod -R u+w .
+      ;; $ blockMesh
+      (synopsis synopsis)
+      (description
+       "OpenFOAM provides a set of solvers and methods for tackling
+problems in the field of Computational Fluid Dynamics (CFD).  It is written in
+C++.  Governing equations such as the Navier-Stokes equations can be solved in
+integral form.  Physical processes such as phase change, droplet transport and
+chemical reaction can be modelled.  Numerical methods are included to deal with
+sharp gradients, such as those encountered in flows with shock waves and flows
+with gas/liquid interfaces.  Large problems may be split into smaller, connected
+problems for efficient solution on parallel systems.")
+      (license license:gpl3+)
+      (home-page home-page))))
+
 (define-public openfoam-org
   (package
     (name "openfoam-org")
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v3 2/3] gnu: openfoam-org: Update to 11.
       [not found] ` <bce423db0172bc6d5e2c7cc21f0df96e1b1a34e6.1696919009.git.reza@housseini.me>
@ 2023-10-10  6:25   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-10-10  6:25 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Update to 11. Use
openfoam-package factory function to create package.
---
 gnu/packages/simulation.scm | 372 +++++-------------------------------
 1 file changed, 49 insertions(+), 323 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 4b95688e33..6ce15a2c2d 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -374,329 +374,55 @@ (define* (openfoam-package source version name home-page synopsis)
       (home-page home-page))))
 
 (define-public openfoam-org
-  (package
-    (name "openfoam-org")
-    (version "10.20230119")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url (string-append "https://github.com/OpenFOAM/OpenFOAM-"
-                                        (version-major version)))
-                    (commit (second (string-split version #\.)))))
-              (sha256
-               (base32
-                "0icvwg7s6vnkgmdiczivia9pbrgx8nanw9a4j080fzfvdv9vxhzp"))
-              (file-name (git-file-name name version))
-              (modules '((guix build utils)))
-              (snippet `(begin
-                          ;; patch shell paths
-                          (substitute* (list "wmake/src/Makefile"
-                                             "wmake/makefiles/general")
-                            (("/bin/sh")
-                             "sh"))
-                          (substitute* "etc/bashrc"
-                            ;; only go back one folder level
-                            (("\\$\\(dirname \\$\\{BASH_SOURCE:-\\$0\\}\\)/../..")
-                             "$(dirname ${BASH_SOURCE:-$0})/..")
-                            ;; do not use openfoam folder convention
-                            (("^export WM_PROJECT_DIR=.*$")
-                             (string-append
-                              "export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR\n"))
-                            ;; do not source bash_completion (gives error)
-                            (("^.*bash_completion.*$" all)
-                             (string-append "#" all))
-                            ;; set same version as guix package
-                            (("^export WM_PROJECT_VERSION=.*$")
-                             (string-append "export WM_PROJECT_VERSION="
-                                            ,version "\n")))
-                          ;; add expand flag to RunFunctions
-                          (substitute* "bin/tools/RunFunctions"
-                            (("foamDictionary (.*)" all args)
-                             (string-append "foamDictionary -expand " args)))
-                          ;; disable failing test
-                          (substitute* "test/postProcessing/channel/Allrun"
-                            (("^.*getApplication.*$" all)
-                             (string-append "#" all "\n")))))))
-    (build-system gnu-build-system)
-    (inputs (list boost
-                  cgal
-                  git
-                  gmp
-                  libxt
-                  metis
-                  mpfr
-                  ncurses
-                  openmpi
-                  openssh
-                  paraview
-                  pt-scotch32
-                  readline
-                  zlib))
-    (native-inputs (list bison
-                         flex
-                         ;; paraview plugin dependencies
-                         cli11
-                         cmake-minimal
-                         cgns
-                         curl
-                         double-conversion
-                         eigen
-                         expat
-                         ffmpeg
-                         fmt
-                         freetype
-                         gdal
-                         gl2ps
-                         glew
-                         gmsh
-                         hdf5
-                         jsoncpp
-                         libjpeg-turbo
-                         libogg
-                         libpng
-                         libharu
-                         libtheora
-                         libtiff
-                         libx11
-                         libxml2
-                         lz4
-                         netcdf
-                         nlohmann-json
-                         proj
-                         protobuf
-                         pugixml
-                         python
-                         python-mpi4py
-                         qtbase-5
-                         qtsvg-5
-                         qttools-5
-                         qtwebengine-5
-                         qtxmlpatterns
-                         utfcpp
-                         vtk
-                         xz))
-    (propagated-inputs (list gnuplot))
-    (outputs '("debug" ;~60MB
-               "out"))
-    (arguments
-     (list
-      ;; Executable files and shared libraries are located in the 'platforms'
-      ;; subdirectory.
-      #:strip-directories
-      #~(list "share/OpenFOAM/platforms/linux64GccDPInt32Opt/bin"
-              "share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib")
-
-      #:modules
-      '((ice-9 ftw)
-        (ice-9 regex)
-        (ice-9 string-fun)
-        (srfi srfi-1)
-        (guix build gnu-build-system)
-        (guix build utils))
-
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-before 'build 'patch-HOME-path
-            (lambda _
-              (setenv "HOME" "/tmp")))
-          (add-before 'build 'rename-self
-            (lambda _
-              ;; The script 'bin/foamEtcFile' derives the version name based
-              ;; on the current directory name (!), so make sure to follow the
-              ;; expected naming convention.
-              (let ((here (canonicalize-path "."))
-                    (target #$(string-append
-                               "OpenFOAM-"
-                               (string-map (match-lambda
-                                             (#\. #\-)
-                                             (chr chr))
-                                           (package-version this-package)))))
-                (chdir "..")
-                (format #t "renaming '~a' to '~a'~%"
-                        here target)
-                (rename-file here target)
-                (chdir target))))
-          (add-before 'build 'patch-scotch
-            (lambda _
-              (substitute* "etc/config.sh/scotch"
-                (("^export SCOTCH_VERSION=scotch_.*$")
-                 (string-append "export SCOTCH_VERSION=scotch_"
-                                #$(package-version pt-scotch32) "\n"))
-                (("^export SCOTCH_ARCH_PATH=.*$")
-                 (string-append "export SCOTCH_ARCH_PATH="
-                                (assoc-ref %build-inputs "pt-scotch32")
-                                "\n"))) #t))
-          (add-before 'build 'patch-mpi
-            (lambda _
-              (let* ((mpi-path (assoc-ref %build-inputs "openmpi"))
-                     (mpi-version #$(package-version openmpi)))
-                ;; specify openmpi type
-                (substitute* "etc/bashrc"
-                  (("WM_MPLIB=SYSTEMOPENMPI")
-                   "WM_MPLIB=OPENMPI"))
-                (substitute* "etc/config.sh/mpi"
-                  (("export FOAM_MPI=openmpi-.*$")
-                   (string-append "export FOAM_MPI=openmpi-"
-                                  mpi-version "\n"))
-                  (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
-                   (string-append "export MPI_ARCH_PATH=" mpi-path
-                                  "\n")))) #t))
-          (add-before 'build 'patch-paraview
-            (lambda _
-              (substitute* "etc/config.sh/paraview"
-                (("^export ParaView_VERSION=.*$")
-                 (string-append "export ParaView_VERSION="
-                                #$(package-version paraview) "\n"))
-                (("^export ParaView_DIR=.*$")
-                 (string-append "export ParaView_DIR="
-                                (assoc-ref %build-inputs "paraview")
-                                "\n"))) #t))
-          (add-before 'build 'add-rpaths
-            (lambda _
-              (letrec* ((libraries '("boost" "cgal"
-                                     "gmp"
-                                     "metis"
-                                     "mpfr"
-                                     "pt-scotch32"
-                                     "openmpi"
-                                     "zlib"
-                                     "paraview"))
-                        (rpaths
-                         (fold-right (lambda (library rpaths)
-                                       (string-append rpaths
-                                                      "-rpath="
-                                                      (assoc-ref
-                                                       %build-inputs library)
-                                                      "/lib,")) "" libraries))
-                        (openfoam-lib
-                         (string-append #$output
-                                        "/share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib"))
-                        (ldflags
-                         (string-append "-Wl,"
-                                        rpaths
-                                        "-rpath="
-                                        openfoam-lib
-                                        ","
-                                        "-rpath="
-                                        openfoam-lib
-                                        "/dummy,"
-                                        "-rpath="
-                                        openfoam-lib
-                                        "/paraview-"
-                                        #$(version-major+minor (package-version
-                                                                paraview)))))
-                (substitute* "wmake/rules/linux64Gcc/c++"
-                  (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
-                   (string-append all " " ldflags)))) #t))
-          (add-before 'build 'add-vtk-include-path
-            (lambda _
-              (let* ((vtk-version #$(version-major+minor
-                                     (package-version vtk)))
-                     (vtk-root (assoc-ref %build-inputs "vtk"))
-                     (vtk-inc (string-append vtk-root "/include/vtk-" vtk-version))
-                     (vtk-inc-flag (string-append "-I" vtk-inc)))
-                (substitute* "wmake/rules/linux64Gcc/c++"
-                  (("\\$\\(LIB_HEADER_DIRS\\)" all)
-                   (string-append all " " vtk-inc-flag " "))))
-              #t))
-          (delete 'configure) ;no configure phase
-          (replace 'build
-            (lambda _
-              ;; compile OpenFOAM libraries and applications
-              (invoke "bash" "-c"
-                      (format #f
-                              "source ./etc/bashrc && ./Allwmake -j~a"
-                              (parallel-job-count)))))
-          (add-after 'build 'cleanup
-            ;; Avoid unnecessary, voluminous object and dep files.
-            (lambda _
-              (when (file-exists? "platforms/linux64GccDPInt32Opt/src")
-                (delete-file-recursively
-                 "platforms/linux64GccDPInt32Opt/src"))
-              (when (file-exists?
-                     "platforms/linux64GccDPInt32OptOPENMPI")
-                (delete-file-recursively
-                 "platforms/linux64GccDPInt32OptOPENMPI"))
-              (for-each delete-file
-                        (find-files "." "\\.o$")) #t))
-          (replace 'check
-            (lambda* (#:key tests? #:allow-other-keys)
-              (when tests?
-                (when (file-exists? "test")
-                  (with-directory-excursion "test"
-                    (invoke "bash" "-c"
-                            (format #f
-                                    "source ../etc/bashrc && ./Allrun -j~a"
-                                    (parallel-job-count)))))
-                ;; too many tutorials are failing
-                ;; (with-directory-excursion "tutorials"
-                ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
-                ) #t))
-          (replace 'install
-            (lambda _
-              (let ((install-dir (string-append #$output
-                                                "/share/OpenFOAM")))
-                (mkdir-p install-dir) ;create install directory
-                ;; move contents of build directory to install directory
-                (copy-recursively "." install-dir))))
-          (add-after 'install 'add-symbolic-link
-            (lambda _
-              (let* ((bin (string-append #$output "/bin"))
-                     (lib (string-append #$output "/lib"))
-                     (openfoam (string-append #$output
-                                              "/share/OpenFOAM"))
-                     (build-bin (string-append openfoam
-                                               "/platforms/linux64GccDPInt32Opt/bin"))
-                     (build-lib (string-append openfoam
-                                               "/platforms/linux64GccDPInt32Opt/lib"))
-                     (foam-bin (string-append openfoam "/bin")))
-                ;; add symbolic links in standard 'bin' directory
-                (mkdir-p bin)
-                (for-each (lambda (file)
-                            (unless (member file
-                                            '("." ".."))
-                              (symlink (string-append build-bin "/"
-                                                      file)
-                                       (string-append bin "/" file))))
-                          (scandir build-bin))
-                (for-each (lambda (file)
-                            (unless (member file
-                                            '("." ".."))
-                              (symlink (string-append foam-bin "/"
-                                                      file)
-                                       (string-append bin "/" file))))
-                          (scandir foam-bin))
-                ;; add symbolic link for standard 'lib' directory
-                (symlink build-lib lib)) #t)))))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "WM_PROJECT_DIR")
-            (separator #f)
-            (files '("share/OpenFOAM")))))
-    ;; 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 $(dirname $(which blockMesh))/../../../etc/bashrc
-    ;; $ mkdir -p $FOAM_RUN
-    ;; $ cd $FOAM_RUN
-    ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
-    ;; $ cd pitzDaily
-    ;; $ chmod -R u+w .
-    ;; $ blockMesh
-    (synopsis "Framework for numerical simulation of fluid flow")
-    (description
-     "OpenFOAM provides a set of solvers and methods for tackling
-problems in the field of Computational Fluid Dynamics (CFD).  It is written in
-C++.  Governing equations such as the Navier-Stokes equations can be solved in
-integral form.  Physical processes such as phase change, droplet transport and
-chemical reaction can be modelled.  Numerical methods are included to deal with
-sharp gradients, such as those encountered in flows with shock waves and flows
-with gas/liquid interfaces.  Large problems may be split into smaller, connected
-problems for efficient solution on parallel systems.")
-    (license license:gpl3+)
-    (home-page "https://openfoam.org")))
+  (let* ((version "11")
+         (name "openfoam-org")
+         (source (origin
+                   (method url-fetch)
+                   (uri (string-append "https://github.com/OpenFOAM/OpenFOAM-"
+                                       (version-major version)
+                                       "/archive/"
+                                       "version-"
+                                       (version-major version)
+                                       ".tar.gz"))
+                   (sha256 (base32
+                            "1h70a5ni2psx7bcx2xg6aqraj2kkbfn8mflh2akbp6k9mmpgih7b"))
+                   (modules '((guix build utils)))
+                   (snippet `(begin
+                               ;; patch shell paths
+                               (substitute* (list "wmake/src/Makefile"
+                                                  "wmake/makefiles/general")
+                                 (("/bin/sh")
+                                  "sh"))
+                               (substitute* "etc/bashrc"
+                                 ;; only go back one folder level
+                                 (("\\$\\(dirname \\$\\{BASH_SOURCE:-\\$0\\}\\)/../..")
+                                  "$(dirname ${BASH_SOURCE:-$0})/..")
+                                 ;; do not use openfoam folder convention
+                                 (("^export WM_PROJECT_DIR=.*$")
+                                  (string-append
+                                   "export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR
+"))
+                                 ;; do not source bash_completion (gives error)
+                                 (("^.*bash_completion.*$" all)
+                                  (string-append "#" all))
+                                 ;; set same version as guix package
+                                 (("^export WM_PROJECT_VERSION=.*$")
+                                  (string-append "export WM_PROJECT_VERSION="
+                                                 ,version "\n")))
+                               ;; add expand flag to RunFunctions
+                               (substitute* "bin/tools/RunFunctions"
+                                 (("foamDictionary (.*)" all args)
+                                  (string-append "foamDictionary -expand "
+                                                 args)))
+                               ;; disable failing test
+                               (substitute* "test/postProcessing/channel/Allrun"
+                                 (("^.*getApplication.*$" all)
+                                  (string-append "#" all "\n")))))))
+         (home-page "https://openfoam.org")
+         (synopsis "Framework for numerical simulation of fluid flow")
+         (template (openfoam-package source version name home-page synopsis)))
+    (package
+      (inherit template))))
 
 (define-public openfoam
   (deprecated-package "openfoam" openfoam-org))
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v3 3/3] gnu: openfoam-com: Update to 2306.
       [not found] ` <f4cd9332ffd1c23dbf9fac5b1821676ae6c2aa2d.1696919009.git.reza@housseini.me>
@ 2023-10-10  6:25   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-10-10  6:25 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation (openfoam-com): Update to 2306. Use openfoam-package
factory function to create package.
---
 gnu/packages/simulation.scm | 58 +++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 6ce15a2c2d..f44e1dbf6f 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -429,37 +429,39 @@ (define-public openfoam
 
 (define-public openfoam-com
   ;; This is a fork of 'openfoam-org', maintained separately.
-  (package
-    (inherit openfoam-org)
-    (name "openfoam-com")
-    (version "2212")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://develop.openfoam.com"
-                                  "/Development/openfoam/-/archive/OpenFOAM-v"
-                                  version
-                                  "/openfoam-OpenFOAM-v"
-                                  version
-                                  ".tar.gz"))
-              (sha256
-               (base32
-                "0i9039hfz9gvgymkdjhjvvn5500zha3cpdbpqrzfrfi8lbz10is2"))
-              (modules '((guix build utils)))
-              (snippet `(begin
-                          (substitute* "etc/bashrc"
-                            ;; set same version as guix package
-			    (("^export WM_PROJECT_VERSION=.*$")
-			     (string-append "export WM_PROJECT_VERSION="
-					    ,version "\n")))
-                          ;; patch shell paths
-                          (substitute* (list "src/OSspecific/POSIX/POSIX.C"
+  (let* ((version "2306")
+         (name "openfoam-com")
+         (source (origin
+                   (method url-fetch)
+                   (uri (string-append "https://develop.openfoam.com"
+                                       "/Development/openfoam/-/archive/OpenFOAM-v"
+                                       version
+                                       "/openfoam-OpenFOAM-v"
+                                       version
+                                       ".tar.gz"))
+                   (sha256 (base32
+                            "0zlkp48vygl2a5cyl0mfpj8dsb5bffviq96rg3kws1l6ni40v7jr"))
+                   (modules '((guix build utils)))
+                   (snippet `(begin
+                               (substitute* "etc/bashrc"
+                                 ;; set same version as guix package
+                                 (("^export WM_PROJECT_VERSION=.*$")
+                                  (string-append "export WM_PROJECT_VERSION="
+                                                 ,version "\n")))
+                               ;; patch shell paths
+                               (substitute* (list
+                                             "src/OSspecific/POSIX/POSIX.C"
                                              "wmake/src/Makefile"
                                              "wmake/makefiles/general"
                                              "wmake/makefiles/info")
-                            (("/bin/sh")
-                             "sh"))))))
-    (synopsis "Framework for numerical simulation of fluid flow (from openfoam.com)")
-    (home-page "https://www.openfoam.com")))
+                                 (("/bin/sh")
+                                  "sh"))))))
+         (home-page "https://www.openfoam.com")
+         (synopsis
+          "Framework for numerical simulation of fluid flow (from openfoam.com)")
+         (template (openfoam-package source version name home-page synopsis)))
+    (package
+      (inherit template))))
 
 (define-public open-simulation-interface
   (package
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v4 1/6] gnu: openfoam-org: Use gexps.
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
  2023-09-29  9:39   ` [bug#66262] [PATCH v2 0/3] Update openfoam reza via Guix-patches via
  2023-10-10  6:25   ` [bug#66262] [PATCH v3 0/3] Remove paraview plugin search path reza via Guix-patches via
@ 2023-11-29 14:28   ` reza via Guix-patches via
  2023-11-29 20:39   ` [bug#66262] [PATCH v5 " reza via Guix-patches via
                     ` (7 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 14:28 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Use gexps, other cosmetic changes.

Change-Id: I856d9660559cb4656251cba6bc5dd31d004f1b74
---
 gnu/packages/simulation.scm | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index b2fb123815..cb6f07c383 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -238,13 +238,10 @@ (define-public openfoam-org
                  (string-append "export SCOTCH_VERSION=scotch_"
                                 #$(package-version pt-scotch32) "\n"))
                 (("^export SCOTCH_ARCH_PATH=.*$")
-                 (string-append "export SCOTCH_ARCH_PATH="
-                                (assoc-ref %build-inputs "pt-scotch32")
-                                "\n"))) #t))
+                 (string-append "export SCOTCH_ARCH_PATH=" #$pt-scotch32 "\n"))) #t))
           (add-before 'build 'patch-mpi
             (lambda _
-              (let* ((mpi-path (assoc-ref %build-inputs "openmpi"))
-                     (mpi-version #$(package-version openmpi)))
+              (let* ((mpi-version #$(package-version openmpi)))
                 ;; specify openmpi type
                 (substitute* "etc/bashrc"
                   (("WM_MPLIB=SYSTEMOPENMPI")
@@ -254,8 +251,7 @@ (define-public openfoam-org
                    (string-append "export FOAM_MPI=openmpi-"
                                   mpi-version "\n"))
                   (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
-                   (string-append "export MPI_ARCH_PATH=" mpi-path
-                                  "\n")))) #t))
+                   (string-append "export MPI_ARCH_PATH=" #$openmpi "\n")))) #t))
           (add-before 'build 'patch-paraview
             (lambda _
               (substitute* "etc/config.sh/paraview"
@@ -263,12 +259,11 @@ (define-public openfoam-org
                  (string-append "export ParaView_VERSION="
                                 #$(package-version paraview) "\n"))
                 (("^export ParaView_DIR=.*$")
-                 (string-append "export ParaView_DIR="
-                                (assoc-ref %build-inputs "paraview")
-                                "\n"))) #t))
+                 (string-append "export ParaView_DIR=" #$paraview "\n"))) #t))
           (add-before 'build 'add-rpaths
             (lambda _
-              (letrec* ((libraries '("boost" "cgal"
+              (letrec* ((libraries '("boost"
+                                     "cgal"
                                      "gmp"
                                      "metis"
                                      "mpfr"
@@ -277,11 +272,10 @@ (define-public openfoam-org
                                      "zlib"
                                      "paraview"))
                         (rpaths
-                         (fold-right (lambda (library rpaths)
+                         (fold-right (lambda (lib rpaths)
                                        (string-append rpaths
                                                       "-rpath="
-                                                      (assoc-ref
-                                                       %build-inputs library)
+                                                      (assoc-ref %build-inputs lib)
                                                       "/lib,")) "" libraries))
                         (openfoam-lib
                          (string-append #$output
@@ -307,13 +301,11 @@ (define-public openfoam-org
             (lambda _
               (let* ((vtk-version #$(version-major+minor
                                      (package-version vtk)))
-                     (vtk-root (assoc-ref %build-inputs "vtk"))
-                     (vtk-inc (string-append vtk-root "/include/vtk-" vtk-version))
+                     (vtk-inc (string-append #$vtk "/include/vtk-" vtk-version))
                      (vtk-inc-flag (string-append "-I" vtk-inc)))
                 (substitute* "wmake/rules/linux64Gcc/c++"
                   (("\\$\\(LIB_HEADER_DIRS\\)" all)
-                   (string-append all " " vtk-inc-flag " "))))
-              #t))
+                   (string-append all " " vtk-inc-flag " ")))) #t))
           (delete 'configure) ;no configure phase
           (replace 'build
             (lambda _
@@ -400,6 +392,7 @@ (define-public openfoam-org
     ;; $ cd pitzDaily
     ;; $ chmod -R u+w .
     ;; $ blockMesh
+    (home-page "https://openfoam.org")
     (synopsis "Framework for numerical simulation of fluid flow")
     (description
      "OpenFOAM provides a set of solvers and methods for tackling
@@ -410,8 +403,7 @@ (define-public openfoam-org
 sharp gradients, such as those encountered in flows with shock waves and flows
 with gas/liquid interfaces.  Large problems may be split into smaller, connected
 problems for efficient solution on parallel systems.")
-    (license license:gpl3+)
-    (home-page "https://openfoam.org")))
+    (license license:gpl3+)))
 
 (define-public openfoam
   (deprecated-package "openfoam" openfoam-org))

base-commit: e4397a32ac81d0b23b168df27424001a7d20aee7
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v4 2/6] gnu: openfoam-org: Refactor dependency.
       [not found] ` <c9ba1409a268744673caf17ec529b415ad1fa29f.1701268112.git.reza@housseini.me>
@ 2023-11-29 14:29   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 14:29 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Move dependency paraview to from
native-inputs to propagated-inputs.

Change-Id: I64c53b3554acc3d7390c88bbf2bcbcac98cdc141
---
 gnu/packages/simulation.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index cb6f07c383..73e53fe35f 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -143,7 +143,6 @@ (define-public openfoam-org
                   ncurses
                   openmpi
                   openssh
-                  paraview
                   pt-scotch32
                   readline
                   zlib))
@@ -190,7 +189,7 @@ (define-public openfoam-org
                          utfcpp
                          vtk
                          xz))
-    (propagated-inputs (list gnuplot))
+    (propagated-inputs (list paraview gnuplot))
     (outputs '("debug" ;~60MB
                "out"))
     (arguments
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v4 3/6] gnu: openfoam-org: Improve internal path handling.
       [not found] ` <0acf762696be31d70a2c40523c0054e52f9606ef.1701268112.git.reza@housseini.me>
@ 2023-11-29 14:29   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 14:29 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Improve handling of internal
path WM_PROJECT_DIR.

Change-Id: I43de76fb009f955294686a0b45bf3dc0217e7dc7
---
 gnu/packages/simulation.scm | 57 ++++++++++++++++++++++++++++---------
 1 file changed, 43 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 73e53fe35f..75eb070f64 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -197,8 +197,10 @@ (define-public openfoam-org
       ;; Executable files and shared libraries are located in the 'platforms'
       ;; subdirectory.
       #:strip-directories
-      #~(list "share/OpenFOAM/platforms/linux64GccDPInt32Opt/bin"
-              "share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib")
+      #~(list (string-append "OpenFOAM-" #$(package-version this-package)
+                             "/platforms/linux64GccDPInt32Opt/bin")
+	      (string-append "OpenFOAM-" #$(package-version this-package)
+                             "/platforms/linux64GccDPInt32Opt/lib"))
 
       #:modules
       '((ice-9 ftw)
@@ -278,7 +280,9 @@ (define-public openfoam-org
                                                       "/lib,")) "" libraries))
                         (openfoam-lib
                          (string-append #$output
-                                        "/share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib"))
+                                        "/share/OpenFOAM-"
+                                        #$(package-version this-package)
+                                        "/platforms/linux64GccDPInt32Opt/lib"))
                         (ldflags
                          (string-append "-Wl,"
                                         rpaths
@@ -338,19 +342,32 @@ (define-public openfoam-org
                 ;; (with-directory-excursion "tutorials"
                 ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
                 ) #t))
+          (add-before 'install 'set-paths
+            (lambda _
+              (let ((install-path (string-append #$output
+				                 "/share/OpenFOAM-"
+                                                 #$(package-version this-package))))
+                (substitute* "etc/bashrc"
+	          (("^\\[ \"\\$BASH\".*$") "")
+	          (("^export FOAM_INST_DIR=\\$\\(cd.*$")
+	           (string-append "export FOAM_INST_DIR=" install-path "\n"))
+	          (("^export FOAM_INST_DIR=\\$HOME.*$") ""))) #t))
           (replace 'install
             (lambda _
-              (let ((install-dir (string-append #$output
-                                                "/share/OpenFOAM")))
-                (mkdir-p install-dir) ;create install directory
+              (let ((install-path (string-append #$output
+                                                 "/share/OpenFOAM-"
+                                                 #$(package-version this-package))))
+                (mkdir-p install-path) ;create install directory
                 ;; move contents of build directory to install directory
-                (copy-recursively "." install-dir))))
+                (copy-recursively "." install-path))))
           (add-after 'install 'add-symbolic-link
             (lambda _
               (let* ((bin (string-append #$output "/bin"))
                      (lib (string-append #$output "/lib"))
+                     (etc (string-append #$output "/etc"))
                      (openfoam (string-append #$output
-                                              "/share/OpenFOAM"))
+                                              "/share/OpenFOAM-"
+                                              #$(package-version this-package)))
                      (build-bin (string-append openfoam
                                                "/platforms/linux64GccDPInt32Opt/bin"))
                      (build-lib (string-append openfoam
@@ -373,12 +390,24 @@ (define-public openfoam-org
                                        (string-append bin "/" file))))
                           (scandir foam-bin))
                 ;; add symbolic link for standard 'lib' directory
-                (symlink build-lib lib)) #t)))))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "WM_PROJECT_DIR")
-            (separator #f)
-            (files '("share/OpenFOAM")))))
+                (symlink build-lib lib)
+                ;; add symbolic link for bashrc file
+                (mkdir-p etc)
+                (symlink (string-append openfoam "/etc/bashrc")
+                         (string-append etc "/bashrc"))) #t))
+          (add-after 'add-symbolic-link 'wrap
+            (lambda* (#:key python inputs outputs #:allow-other-keys)
+              (let* ((bin (string-append #$output "/bin"))
+                     (openfoam (string-append #$output
+                                              "/share/OpenFOAM-"
+                                              #$(package-version this-package))))
+                (for-each
+                 (lambda (program)
+                   (unless (member program
+                                   '("." ".."))
+                     (wrap-program (string-append bin "/" program)
+                       `("WM_PROJECT_DIR" ":" prefix (,openfoam)))))
+                 (scandir bin))))))))
     ;; Note:
     ;; Tutorial files are installed read-only in /gnu/store.
     ;; To allow write permissions on files copied from the store a
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v4 4/6] gnu: openfoam-org: Improve build clean up.
       [not found] ` <97b7044beb51357a1b2f50bc59ab840fa5f97808.1701268112.git.reza@housseini.me>
@ 2023-11-29 14:29   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 14:29 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Improve build tree cleanup for
package reproducibility.

Change-Id: I59193f16a7d9598a9bc842f1c6091369c47906a8
---
 gnu/packages/simulation.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 75eb070f64..c6041643c8 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -328,7 +328,9 @@ (define-public openfoam-org
                 (delete-file-recursively
                  "platforms/linux64GccDPInt32OptOPENMPI"))
               (for-each delete-file
-                        (find-files "." "\\.o$")) #t))
+                        (find-files "." "\\.o$"))
+              ;; Remove spurious files in src tree
+              (invoke "bash" "-c" "source ./etc/bashrc && wclean all") #t))
           (replace 'check
             (lambda* (#:key tests? #:allow-other-keys)
               (when tests?
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v4 5/6] gnu: openfoam-org: Update to 11.
       [not found] ` <5380542281402a0572fbb4270658f354611448d9.1701268112.git.reza@housseini.me>
@ 2023-11-29 14:29   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 14:29 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Update to 11.

Change-Id: I6f9752e8bb35754ac3f67acbaa1e4ae8b216e410
---
 gnu/packages/simulation.scm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index c6041643c8..b33f24a5f4 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -91,17 +91,18 @@ (define-module (gnu packages simulation)
 (define-public openfoam-org
   (package
     (name "openfoam-org")
-    (version "10.20230119")
+    (version "11")
     (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url (string-append "https://github.com/OpenFOAM/OpenFOAM-"
-                                        (version-major version)))
-                    (commit (second (string-split version #\.)))))
+              (method url-fetch)
+              (uri (string-append "https://github.com/OpenFOAM/OpenFOAM-"
+                                  (version-major version)
+                                  "/archive/"
+                                  "version-"
+                                  (version-major version)
+                                  ".tar.gz"))
               (sha256
                (base32
-                "0icvwg7s6vnkgmdiczivia9pbrgx8nanw9a4j080fzfvdv9vxhzp"))
-              (file-name (git-file-name name version))
+                "1h70a5ni2psx7bcx2xg6aqraj2kkbfn8mflh2akbp6k9mmpgih7b"))
               (modules '((guix build utils)))
               (snippet `(begin
                           ;; patch shell paths
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v4 6/6] gnu: openfoam-com: Update to 2306.
       [not found] ` <3aca16d2ccc66d8f39f08ddcb9a4bbda30c9caa3.1701268112.git.reza@housseini.me>
@ 2023-11-29 14:29   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 14:29 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-com): Update to 2306.

Change-Id: I418fa263706574b716a852c77a33c7de5ee0068d
---
 gnu/packages/simulation.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index b33f24a5f4..f01044e76a 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -444,7 +444,7 @@ (define-public openfoam-com
   (package
     (inherit openfoam-org)
     (name "openfoam-com")
-    (version "2212")
+    (version "2306")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://develop.openfoam.com"
@@ -455,7 +455,7 @@ (define-public openfoam-com
                                   ".tar.gz"))
               (sha256
                (base32
-                "0i9039hfz9gvgymkdjhjvvn5500zha3cpdbpqrzfrfi8lbz10is2"))
+                "0zlkp48vygl2a5cyl0mfpj8dsb5bffviq96rg3kws1l6ni40v7jr"))
               (modules '((guix build utils)))
               (snippet `(begin
                           (substitute* "etc/bashrc"
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v5 1/6] gnu: openfoam-org: Use gexps.
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
                     ` (2 preceding siblings ...)
  2023-11-29 14:28   ` [bug#66262] [PATCH v4 1/6] gnu: openfoam-org: Use gexps reza via Guix-patches via
@ 2023-11-29 20:39   ` reza via Guix-patches via
  2023-11-30  8:30   ` [bug#66262] [PATCH v6 " reza via Guix-patches via
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 20:39 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Use gexps, other cosmetic changes.

Change-Id: I856d9660559cb4656251cba6bc5dd31d004f1b74
---
 gnu/packages/simulation.scm | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index b2fb123815..cb6f07c383 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -238,13 +238,10 @@ (define-public openfoam-org
                  (string-append "export SCOTCH_VERSION=scotch_"
                                 #$(package-version pt-scotch32) "\n"))
                 (("^export SCOTCH_ARCH_PATH=.*$")
-                 (string-append "export SCOTCH_ARCH_PATH="
-                                (assoc-ref %build-inputs "pt-scotch32")
-                                "\n"))) #t))
+                 (string-append "export SCOTCH_ARCH_PATH=" #$pt-scotch32 "\n"))) #t))
           (add-before 'build 'patch-mpi
             (lambda _
-              (let* ((mpi-path (assoc-ref %build-inputs "openmpi"))
-                     (mpi-version #$(package-version openmpi)))
+              (let* ((mpi-version #$(package-version openmpi)))
                 ;; specify openmpi type
                 (substitute* "etc/bashrc"
                   (("WM_MPLIB=SYSTEMOPENMPI")
@@ -254,8 +251,7 @@ (define-public openfoam-org
                    (string-append "export FOAM_MPI=openmpi-"
                                   mpi-version "\n"))
                   (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
-                   (string-append "export MPI_ARCH_PATH=" mpi-path
-                                  "\n")))) #t))
+                   (string-append "export MPI_ARCH_PATH=" #$openmpi "\n")))) #t))
           (add-before 'build 'patch-paraview
             (lambda _
               (substitute* "etc/config.sh/paraview"
@@ -263,12 +259,11 @@ (define-public openfoam-org
                  (string-append "export ParaView_VERSION="
                                 #$(package-version paraview) "\n"))
                 (("^export ParaView_DIR=.*$")
-                 (string-append "export ParaView_DIR="
-                                (assoc-ref %build-inputs "paraview")
-                                "\n"))) #t))
+                 (string-append "export ParaView_DIR=" #$paraview "\n"))) #t))
           (add-before 'build 'add-rpaths
             (lambda _
-              (letrec* ((libraries '("boost" "cgal"
+              (letrec* ((libraries '("boost"
+                                     "cgal"
                                      "gmp"
                                      "metis"
                                      "mpfr"
@@ -277,11 +272,10 @@ (define-public openfoam-org
                                      "zlib"
                                      "paraview"))
                         (rpaths
-                         (fold-right (lambda (library rpaths)
+                         (fold-right (lambda (lib rpaths)
                                        (string-append rpaths
                                                       "-rpath="
-                                                      (assoc-ref
-                                                       %build-inputs library)
+                                                      (assoc-ref %build-inputs lib)
                                                       "/lib,")) "" libraries))
                         (openfoam-lib
                          (string-append #$output
@@ -307,13 +301,11 @@ (define-public openfoam-org
             (lambda _
               (let* ((vtk-version #$(version-major+minor
                                      (package-version vtk)))
-                     (vtk-root (assoc-ref %build-inputs "vtk"))
-                     (vtk-inc (string-append vtk-root "/include/vtk-" vtk-version))
+                     (vtk-inc (string-append #$vtk "/include/vtk-" vtk-version))
                      (vtk-inc-flag (string-append "-I" vtk-inc)))
                 (substitute* "wmake/rules/linux64Gcc/c++"
                   (("\\$\\(LIB_HEADER_DIRS\\)" all)
-                   (string-append all " " vtk-inc-flag " "))))
-              #t))
+                   (string-append all " " vtk-inc-flag " ")))) #t))
           (delete 'configure) ;no configure phase
           (replace 'build
             (lambda _
@@ -400,6 +392,7 @@ (define-public openfoam-org
     ;; $ cd pitzDaily
     ;; $ chmod -R u+w .
     ;; $ blockMesh
+    (home-page "https://openfoam.org")
     (synopsis "Framework for numerical simulation of fluid flow")
     (description
      "OpenFOAM provides a set of solvers and methods for tackling
@@ -410,8 +403,7 @@ (define-public openfoam-org
 sharp gradients, such as those encountered in flows with shock waves and flows
 with gas/liquid interfaces.  Large problems may be split into smaller, connected
 problems for efficient solution on parallel systems.")
-    (license license:gpl3+)
-    (home-page "https://openfoam.org")))
+    (license license:gpl3+)))
 
 (define-public openfoam
   (deprecated-package "openfoam" openfoam-org))

base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v5 3/6] gnu: openfoam-org: Improve internal path handling.
       [not found] ` <b90c77d497a24b3b790237d1cd4c64f9ecf7ea9a.1701290362.git.reza@housseini.me>
@ 2023-11-29 20:39   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 20:39 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Improve handling of internal
path WM_PROJECT_DIR.

Change-Id: I43de76fb009f955294686a0b45bf3dc0217e7dc7
---
 gnu/packages/simulation.scm | 57 ++++++++++++++++++++++++++++---------
 1 file changed, 43 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 73e53fe35f..75eb070f64 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -197,8 +197,10 @@ (define-public openfoam-org
       ;; Executable files and shared libraries are located in the 'platforms'
       ;; subdirectory.
       #:strip-directories
-      #~(list "share/OpenFOAM/platforms/linux64GccDPInt32Opt/bin"
-              "share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib")
+      #~(list (string-append "OpenFOAM-" #$(package-version this-package)
+                             "/platforms/linux64GccDPInt32Opt/bin")
+	      (string-append "OpenFOAM-" #$(package-version this-package)
+                             "/platforms/linux64GccDPInt32Opt/lib"))
 
       #:modules
       '((ice-9 ftw)
@@ -278,7 +280,9 @@ (define-public openfoam-org
                                                       "/lib,")) "" libraries))
                         (openfoam-lib
                          (string-append #$output
-                                        "/share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib"))
+                                        "/share/OpenFOAM-"
+                                        #$(package-version this-package)
+                                        "/platforms/linux64GccDPInt32Opt/lib"))
                         (ldflags
                          (string-append "-Wl,"
                                         rpaths
@@ -338,19 +342,32 @@ (define-public openfoam-org
                 ;; (with-directory-excursion "tutorials"
                 ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
                 ) #t))
+          (add-before 'install 'set-paths
+            (lambda _
+              (let ((install-path (string-append #$output
+				                 "/share/OpenFOAM-"
+                                                 #$(package-version this-package))))
+                (substitute* "etc/bashrc"
+	          (("^\\[ \"\\$BASH\".*$") "")
+	          (("^export FOAM_INST_DIR=\\$\\(cd.*$")
+	           (string-append "export FOAM_INST_DIR=" install-path "\n"))
+	          (("^export FOAM_INST_DIR=\\$HOME.*$") ""))) #t))
           (replace 'install
             (lambda _
-              (let ((install-dir (string-append #$output
-                                                "/share/OpenFOAM")))
-                (mkdir-p install-dir) ;create install directory
+              (let ((install-path (string-append #$output
+                                                 "/share/OpenFOAM-"
+                                                 #$(package-version this-package))))
+                (mkdir-p install-path) ;create install directory
                 ;; move contents of build directory to install directory
-                (copy-recursively "." install-dir))))
+                (copy-recursively "." install-path))))
           (add-after 'install 'add-symbolic-link
             (lambda _
               (let* ((bin (string-append #$output "/bin"))
                      (lib (string-append #$output "/lib"))
+                     (etc (string-append #$output "/etc"))
                      (openfoam (string-append #$output
-                                              "/share/OpenFOAM"))
+                                              "/share/OpenFOAM-"
+                                              #$(package-version this-package)))
                      (build-bin (string-append openfoam
                                                "/platforms/linux64GccDPInt32Opt/bin"))
                      (build-lib (string-append openfoam
@@ -373,12 +390,24 @@ (define-public openfoam-org
                                        (string-append bin "/" file))))
                           (scandir foam-bin))
                 ;; add symbolic link for standard 'lib' directory
-                (symlink build-lib lib)) #t)))))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "WM_PROJECT_DIR")
-            (separator #f)
-            (files '("share/OpenFOAM")))))
+                (symlink build-lib lib)
+                ;; add symbolic link for bashrc file
+                (mkdir-p etc)
+                (symlink (string-append openfoam "/etc/bashrc")
+                         (string-append etc "/bashrc"))) #t))
+          (add-after 'add-symbolic-link 'wrap
+            (lambda* (#:key python inputs outputs #:allow-other-keys)
+              (let* ((bin (string-append #$output "/bin"))
+                     (openfoam (string-append #$output
+                                              "/share/OpenFOAM-"
+                                              #$(package-version this-package))))
+                (for-each
+                 (lambda (program)
+                   (unless (member program
+                                   '("." ".."))
+                     (wrap-program (string-append bin "/" program)
+                       `("WM_PROJECT_DIR" ":" prefix (,openfoam)))))
+                 (scandir bin))))))))
     ;; Note:
     ;; Tutorial files are installed read-only in /gnu/store.
     ;; To allow write permissions on files copied from the store a
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v5 5/6] gnu: openfoam-org: Update to 11.
       [not found] ` <f4fb02c20f3836c2e1a3c9abddd558c2addb0451.1701290362.git.reza@housseini.me>
@ 2023-11-29 20:39   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 20:39 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Update to 11.

Change-Id: I6f9752e8bb35754ac3f67acbaa1e4ae8b216e410
---
 gnu/packages/simulation.scm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index c6041643c8..b33f24a5f4 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -91,17 +91,18 @@ (define-module (gnu packages simulation)
 (define-public openfoam-org
   (package
     (name "openfoam-org")
-    (version "10.20230119")
+    (version "11")
     (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url (string-append "https://github.com/OpenFOAM/OpenFOAM-"
-                                        (version-major version)))
-                    (commit (second (string-split version #\.)))))
+              (method url-fetch)
+              (uri (string-append "https://github.com/OpenFOAM/OpenFOAM-"
+                                  (version-major version)
+                                  "/archive/"
+                                  "version-"
+                                  (version-major version)
+                                  ".tar.gz"))
               (sha256
                (base32
-                "0icvwg7s6vnkgmdiczivia9pbrgx8nanw9a4j080fzfvdv9vxhzp"))
-              (file-name (git-file-name name version))
+                "1h70a5ni2psx7bcx2xg6aqraj2kkbfn8mflh2akbp6k9mmpgih7b"))
               (modules '((guix build utils)))
               (snippet `(begin
                           ;; patch shell paths
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v5 4/6] gnu: openfoam-org: Improve build clean up.
       [not found] ` <54b1a2d73885ed2f5fef4f74fde212f9c811ce66.1701290362.git.reza@housseini.me>
@ 2023-11-29 20:39   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 20:39 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Improve build tree cleanup for
package reproducibility.

Change-Id: I59193f16a7d9598a9bc842f1c6091369c47906a8
---
 gnu/packages/simulation.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 75eb070f64..c6041643c8 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -328,7 +328,9 @@ (define-public openfoam-org
                 (delete-file-recursively
                  "platforms/linux64GccDPInt32OptOPENMPI"))
               (for-each delete-file
-                        (find-files "." "\\.o$")) #t))
+                        (find-files "." "\\.o$"))
+              ;; Remove spurious files in src tree
+              (invoke "bash" "-c" "source ./etc/bashrc && wclean all") #t))
           (replace 'check
             (lambda* (#:key tests? #:allow-other-keys)
               (when tests?
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v5 6/6] gnu: openfoam-com: Update to 2306.
       [not found] ` <1e5198861de5777cb1ad76b7919bc80870b54585.1701290362.git.reza@housseini.me>
@ 2023-11-29 20:39   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 20:39 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-com): Update to 2306.

Change-Id: I418fa263706574b716a852c77a33c7de5ee0068d
---
 gnu/packages/simulation.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index b33f24a5f4..f01044e76a 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -444,7 +444,7 @@ (define-public openfoam-com
   (package
     (inherit openfoam-org)
     (name "openfoam-com")
-    (version "2212")
+    (version "2306")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://develop.openfoam.com"
@@ -455,7 +455,7 @@ (define-public openfoam-com
                                   ".tar.gz"))
               (sha256
                (base32
-                "0i9039hfz9gvgymkdjhjvvn5500zha3cpdbpqrzfrfi8lbz10is2"))
+                "0zlkp48vygl2a5cyl0mfpj8dsb5bffviq96rg3kws1l6ni40v7jr"))
               (modules '((guix build utils)))
               (snippet `(begin
                           (substitute* "etc/bashrc"
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v5 2/6] gnu: openfoam-org: Refactor dependency.
       [not found] ` <e0b24fe5429f273c7e3fc07579efbb8c0cb8c560.1701290362.git.reza@housseini.me>
@ 2023-11-29 20:39   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-29 20:39 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Move dependency paraview to from
native-inputs to propagated-inputs.

Change-Id: I64c53b3554acc3d7390c88bbf2bcbcac98cdc141
---
 gnu/packages/simulation.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index cb6f07c383..73e53fe35f 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -143,7 +143,6 @@ (define-public openfoam-org
                   ncurses
                   openmpi
                   openssh
-                  paraview
                   pt-scotch32
                   readline
                   zlib))
@@ -190,7 +189,7 @@ (define-public openfoam-org
                          utfcpp
                          vtk
                          xz))
-    (propagated-inputs (list gnuplot))
+    (propagated-inputs (list paraview gnuplot))
     (outputs '("debug" ;~60MB
                "out"))
     (arguments
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v6 1/6] gnu: openfoam-org: Use gexps.
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
                     ` (3 preceding siblings ...)
  2023-11-29 20:39   ` [bug#66262] [PATCH v5 " reza via Guix-patches via
@ 2023-11-30  8:30   ` reza via Guix-patches via
  2023-11-30  8:38   ` [bug#66262] [PATCH v6 2/6] gnu: openfoam-org: Refactor dependency reza via Guix-patches via
                     ` (5 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-30  8:30 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Use gexps, other cosmetic changes.

Change-Id: I856d9660559cb4656251cba6bc5dd31d004f1b74
---
 gnu/packages/simulation.scm | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index b2fb123815..cb6f07c383 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -238,13 +238,10 @@ (define-public openfoam-org
                  (string-append "export SCOTCH_VERSION=scotch_"
                                 #$(package-version pt-scotch32) "\n"))
                 (("^export SCOTCH_ARCH_PATH=.*$")
-                 (string-append "export SCOTCH_ARCH_PATH="
-                                (assoc-ref %build-inputs "pt-scotch32")
-                                "\n"))) #t))
+                 (string-append "export SCOTCH_ARCH_PATH=" #$pt-scotch32 "\n"))) #t))
           (add-before 'build 'patch-mpi
             (lambda _
-              (let* ((mpi-path (assoc-ref %build-inputs "openmpi"))
-                     (mpi-version #$(package-version openmpi)))
+              (let* ((mpi-version #$(package-version openmpi)))
                 ;; specify openmpi type
                 (substitute* "etc/bashrc"
                   (("WM_MPLIB=SYSTEMOPENMPI")
@@ -254,8 +251,7 @@ (define-public openfoam-org
                    (string-append "export FOAM_MPI=openmpi-"
                                   mpi-version "\n"))
                   (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
-                   (string-append "export MPI_ARCH_PATH=" mpi-path
-                                  "\n")))) #t))
+                   (string-append "export MPI_ARCH_PATH=" #$openmpi "\n")))) #t))
           (add-before 'build 'patch-paraview
             (lambda _
               (substitute* "etc/config.sh/paraview"
@@ -263,12 +259,11 @@ (define-public openfoam-org
                  (string-append "export ParaView_VERSION="
                                 #$(package-version paraview) "\n"))
                 (("^export ParaView_DIR=.*$")
-                 (string-append "export ParaView_DIR="
-                                (assoc-ref %build-inputs "paraview")
-                                "\n"))) #t))
+                 (string-append "export ParaView_DIR=" #$paraview "\n"))) #t))
           (add-before 'build 'add-rpaths
             (lambda _
-              (letrec* ((libraries '("boost" "cgal"
+              (letrec* ((libraries '("boost"
+                                     "cgal"
                                      "gmp"
                                      "metis"
                                      "mpfr"
@@ -277,11 +272,10 @@ (define-public openfoam-org
                                      "zlib"
                                      "paraview"))
                         (rpaths
-                         (fold-right (lambda (library rpaths)
+                         (fold-right (lambda (lib rpaths)
                                        (string-append rpaths
                                                       "-rpath="
-                                                      (assoc-ref
-                                                       %build-inputs library)
+                                                      (assoc-ref %build-inputs lib)
                                                       "/lib,")) "" libraries))
                         (openfoam-lib
                          (string-append #$output
@@ -307,13 +301,11 @@ (define-public openfoam-org
             (lambda _
               (let* ((vtk-version #$(version-major+minor
                                      (package-version vtk)))
-                     (vtk-root (assoc-ref %build-inputs "vtk"))
-                     (vtk-inc (string-append vtk-root "/include/vtk-" vtk-version))
+                     (vtk-inc (string-append #$vtk "/include/vtk-" vtk-version))
                      (vtk-inc-flag (string-append "-I" vtk-inc)))
                 (substitute* "wmake/rules/linux64Gcc/c++"
                   (("\\$\\(LIB_HEADER_DIRS\\)" all)
-                   (string-append all " " vtk-inc-flag " "))))
-              #t))
+                   (string-append all " " vtk-inc-flag " ")))) #t))
           (delete 'configure) ;no configure phase
           (replace 'build
             (lambda _
@@ -400,6 +392,7 @@ (define-public openfoam-org
     ;; $ cd pitzDaily
     ;; $ chmod -R u+w .
     ;; $ blockMesh
+    (home-page "https://openfoam.org")
     (synopsis "Framework for numerical simulation of fluid flow")
     (description
      "OpenFOAM provides a set of solvers and methods for tackling
@@ -410,8 +403,7 @@ (define-public openfoam-org
 sharp gradients, such as those encountered in flows with shock waves and flows
 with gas/liquid interfaces.  Large problems may be split into smaller, connected
 problems for efficient solution on parallel systems.")
-    (license license:gpl3+)
-    (home-page "https://openfoam.org")))
+    (license license:gpl3+)))
 
 (define-public openfoam
   (deprecated-package "openfoam" openfoam-org))

base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v6 2/6] gnu: openfoam-org: Refactor dependency.
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
                     ` (4 preceding siblings ...)
  2023-11-30  8:30   ` [bug#66262] [PATCH v6 " reza via Guix-patches via
@ 2023-11-30  8:38   ` reza via Guix-patches via
  2023-11-30  8:41   ` [bug#66262] [PATCH v6 3/6] gnu: openfoam-org: Improve internal path handling reza via Guix-patches via
                     ` (4 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-30  8:38 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Move dependency paraview to from
native-inputs to propagated-inputs.

Change-Id: I64c53b3554acc3d7390c88bbf2bcbcac98cdc141
---
 gnu/packages/simulation.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index cb6f07c383..73e53fe35f 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -143,7 +143,6 @@ (define-public openfoam-org
                   ncurses
                   openmpi
                   openssh
-                  paraview
                   pt-scotch32
                   readline
                   zlib))
@@ -190,7 +189,7 @@ (define-public openfoam-org
                          utfcpp
                          vtk
                          xz))
-    (propagated-inputs (list gnuplot))
+    (propagated-inputs (list paraview gnuplot))
     (outputs '("debug" ;~60MB
                "out"))
     (arguments

base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
prerequisite-patch-id: e928ac9ae5a11e33ced4f46fed14ea984b551d0c
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v6 3/6] gnu: openfoam-org: Improve internal path handling.
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
                     ` (5 preceding siblings ...)
  2023-11-30  8:38   ` [bug#66262] [PATCH v6 2/6] gnu: openfoam-org: Refactor dependency reza via Guix-patches via
@ 2023-11-30  8:41   ` reza via Guix-patches via
  2023-11-30  8:57   ` [bug#66262] [PATCH v6 4/6] gnu: openfoam-org: Improve build clean up reza via Guix-patches via
                     ` (3 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-30  8:41 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Improve handling of internal
path WM_PROJECT_DIR.

Change-Id: I43de76fb009f955294686a0b45bf3dc0217e7dc7
---
 gnu/packages/simulation.scm | 57 ++++++++++++++++++++++++++++---------
 1 file changed, 43 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 73e53fe35f..75eb070f64 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -197,8 +197,10 @@ (define-public openfoam-org
       ;; Executable files and shared libraries are located in the 'platforms'
       ;; subdirectory.
       #:strip-directories
-      #~(list "share/OpenFOAM/platforms/linux64GccDPInt32Opt/bin"
-              "share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib")
+      #~(list (string-append "OpenFOAM-" #$(package-version this-package)
+                             "/platforms/linux64GccDPInt32Opt/bin")
+	      (string-append "OpenFOAM-" #$(package-version this-package)
+                             "/platforms/linux64GccDPInt32Opt/lib"))
 
       #:modules
       '((ice-9 ftw)
@@ -278,7 +280,9 @@ (define-public openfoam-org
                                                       "/lib,")) "" libraries))
                         (openfoam-lib
                          (string-append #$output
-                                        "/share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib"))
+                                        "/share/OpenFOAM-"
+                                        #$(package-version this-package)
+                                        "/platforms/linux64GccDPInt32Opt/lib"))
                         (ldflags
                          (string-append "-Wl,"
                                         rpaths
@@ -338,19 +342,32 @@ (define-public openfoam-org
                 ;; (with-directory-excursion "tutorials"
                 ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
                 ) #t))
+          (add-before 'install 'set-paths
+            (lambda _
+              (let ((install-path (string-append #$output
+				                 "/share/OpenFOAM-"
+                                                 #$(package-version this-package))))
+                (substitute* "etc/bashrc"
+	          (("^\\[ \"\\$BASH\".*$") "")
+	          (("^export FOAM_INST_DIR=\\$\\(cd.*$")
+	           (string-append "export FOAM_INST_DIR=" install-path "\n"))
+	          (("^export FOAM_INST_DIR=\\$HOME.*$") ""))) #t))
           (replace 'install
             (lambda _
-              (let ((install-dir (string-append #$output
-                                                "/share/OpenFOAM")))
-                (mkdir-p install-dir) ;create install directory
+              (let ((install-path (string-append #$output
+                                                 "/share/OpenFOAM-"
+                                                 #$(package-version this-package))))
+                (mkdir-p install-path) ;create install directory
                 ;; move contents of build directory to install directory
-                (copy-recursively "." install-dir))))
+                (copy-recursively "." install-path))))
           (add-after 'install 'add-symbolic-link
             (lambda _
               (let* ((bin (string-append #$output "/bin"))
                      (lib (string-append #$output "/lib"))
+                     (etc (string-append #$output "/etc"))
                      (openfoam (string-append #$output
-                                              "/share/OpenFOAM"))
+                                              "/share/OpenFOAM-"
+                                              #$(package-version this-package)))
                      (build-bin (string-append openfoam
                                                "/platforms/linux64GccDPInt32Opt/bin"))
                      (build-lib (string-append openfoam
@@ -373,12 +390,24 @@ (define-public openfoam-org
                                        (string-append bin "/" file))))
                           (scandir foam-bin))
                 ;; add symbolic link for standard 'lib' directory
-                (symlink build-lib lib)) #t)))))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "WM_PROJECT_DIR")
-            (separator #f)
-            (files '("share/OpenFOAM")))))
+                (symlink build-lib lib)
+                ;; add symbolic link for bashrc file
+                (mkdir-p etc)
+                (symlink (string-append openfoam "/etc/bashrc")
+                         (string-append etc "/bashrc"))) #t))
+          (add-after 'add-symbolic-link 'wrap
+            (lambda* (#:key python inputs outputs #:allow-other-keys)
+              (let* ((bin (string-append #$output "/bin"))
+                     (openfoam (string-append #$output
+                                              "/share/OpenFOAM-"
+                                              #$(package-version this-package))))
+                (for-each
+                 (lambda (program)
+                   (unless (member program
+                                   '("." ".."))
+                     (wrap-program (string-append bin "/" program)
+                       `("WM_PROJECT_DIR" ":" prefix (,openfoam)))))
+                 (scandir bin))))))))
     ;; Note:
     ;; Tutorial files are installed read-only in /gnu/store.
     ;; To allow write permissions on files copied from the store a

base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
prerequisite-patch-id: e928ac9ae5a11e33ced4f46fed14ea984b551d0c
prerequisite-patch-id: ff305aca25644db4a2b385cd2a9980df4ca457d5
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v6 4/6] gnu: openfoam-org: Improve build clean up.
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
                     ` (6 preceding siblings ...)
  2023-11-30  8:41   ` [bug#66262] [PATCH v6 3/6] gnu: openfoam-org: Improve internal path handling reza via Guix-patches via
@ 2023-11-30  8:57   ` reza via Guix-patches via
  2023-11-30  9:01   ` [bug#66262] [PATCH v6 5/6] gnu: openfoam-org: Update to 11 reza via Guix-patches via
                     ` (2 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-30  8:57 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Improve build tree cleanup for
package reproducibility.

Change-Id: I59193f16a7d9598a9bc842f1c6091369c47906a8
---
 gnu/packages/simulation.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 75eb070f64..c6041643c8 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -328,7 +328,9 @@ (define-public openfoam-org
                 (delete-file-recursively
                  "platforms/linux64GccDPInt32OptOPENMPI"))
               (for-each delete-file
-                        (find-files "." "\\.o$")) #t))
+                        (find-files "." "\\.o$"))
+              ;; Remove spurious files in src tree
+              (invoke "bash" "-c" "source ./etc/bashrc && wclean all") #t))
           (replace 'check
             (lambda* (#:key tests? #:allow-other-keys)
               (when tests?

base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
prerequisite-patch-id: e928ac9ae5a11e33ced4f46fed14ea984b551d0c
prerequisite-patch-id: ff305aca25644db4a2b385cd2a9980df4ca457d5
prerequisite-patch-id: b429416cc65454ac2af04a12b8bc93d7b87fbda8
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v6 5/6] gnu: openfoam-org: Update to 11.
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
                     ` (7 preceding siblings ...)
  2023-11-30  8:57   ` [bug#66262] [PATCH v6 4/6] gnu: openfoam-org: Improve build clean up reza via Guix-patches via
@ 2023-11-30  9:01   ` reza via Guix-patches via
  2023-11-30  9:03   ` [bug#66262] [PATCH v6 6/6] gnu: openfoam-com: Update to 2306 reza via Guix-patches via
  2023-12-01 20:21   ` [bug#66262] [PATCH v7 1/7] gnu: openfoam-org: Use gexps reza via Guix-patches via
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-30  9:01 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Update to 11.

Change-Id: I6f9752e8bb35754ac3f67acbaa1e4ae8b216e410
---
 gnu/packages/simulation.scm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index c6041643c8..b33f24a5f4 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -91,17 +91,18 @@ (define-module (gnu packages simulation)
 (define-public openfoam-org
   (package
     (name "openfoam-org")
-    (version "10.20230119")
+    (version "11")
     (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url (string-append "https://github.com/OpenFOAM/OpenFOAM-"
-                                        (version-major version)))
-                    (commit (second (string-split version #\.)))))
+              (method url-fetch)
+              (uri (string-append "https://github.com/OpenFOAM/OpenFOAM-"
+                                  (version-major version)
+                                  "/archive/"
+                                  "version-"
+                                  (version-major version)
+                                  ".tar.gz"))
               (sha256
                (base32
-                "0icvwg7s6vnkgmdiczivia9pbrgx8nanw9a4j080fzfvdv9vxhzp"))
-              (file-name (git-file-name name version))
+                "1h70a5ni2psx7bcx2xg6aqraj2kkbfn8mflh2akbp6k9mmpgih7b"))
               (modules '((guix build utils)))
               (snippet `(begin
                           ;; patch shell paths

base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
prerequisite-patch-id: e928ac9ae5a11e33ced4f46fed14ea984b551d0c
prerequisite-patch-id: ff305aca25644db4a2b385cd2a9980df4ca457d5
prerequisite-patch-id: b429416cc65454ac2af04a12b8bc93d7b87fbda8
prerequisite-patch-id: f1923fb8c806820e8e71471d00fc0ab56bb4ff5c
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v6 6/6] gnu: openfoam-com: Update to 2306.
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
                     ` (8 preceding siblings ...)
  2023-11-30  9:01   ` [bug#66262] [PATCH v6 5/6] gnu: openfoam-org: Update to 11 reza via Guix-patches via
@ 2023-11-30  9:03   ` reza via Guix-patches via
  2023-12-01 20:21   ` [bug#66262] [PATCH v7 1/7] gnu: openfoam-org: Use gexps reza via Guix-patches via
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-11-30  9:03 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-com): Update to 2306.

Change-Id: I418fa263706574b716a852c77a33c7de5ee0068d
---
 gnu/packages/simulation.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index b33f24a5f4..f01044e76a 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -444,7 +444,7 @@ (define-public openfoam-com
   (package
     (inherit openfoam-org)
     (name "openfoam-com")
-    (version "2212")
+    (version "2306")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://develop.openfoam.com"
@@ -455,7 +455,7 @@ (define-public openfoam-com
                                   ".tar.gz"))
               (sha256
                (base32
-                "0i9039hfz9gvgymkdjhjvvn5500zha3cpdbpqrzfrfi8lbz10is2"))
+                "0zlkp48vygl2a5cyl0mfpj8dsb5bffviq96rg3kws1l6ni40v7jr"))
               (modules '((guix build utils)))
               (snippet `(begin
                           (substitute* "etc/bashrc"

base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
prerequisite-patch-id: e928ac9ae5a11e33ced4f46fed14ea984b551d0c
prerequisite-patch-id: ff305aca25644db4a2b385cd2a9980df4ca457d5
prerequisite-patch-id: b429416cc65454ac2af04a12b8bc93d7b87fbda8
prerequisite-patch-id: f1923fb8c806820e8e71471d00fc0ab56bb4ff5c
prerequisite-patch-id: 95f7502d97cb847e3c6a53899d6513377f9475b9
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v7 1/7] gnu: openfoam-org: Use gexps.
  2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
                     ` (9 preceding siblings ...)
  2023-11-30  9:03   ` [bug#66262] [PATCH v6 6/6] gnu: openfoam-com: Update to 2306 reza via Guix-patches via
@ 2023-12-01 20:21   ` reza via Guix-patches via
  10 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-12-01 20:21 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Use gexps, other cosmetic changes.

Change-Id: I856d9660559cb4656251cba6bc5dd31d004f1b74
---
 gnu/packages/simulation.scm | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index b2fb123815..cb6f07c383 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -238,13 +238,10 @@ (define-public openfoam-org
                  (string-append "export SCOTCH_VERSION=scotch_"
                                 #$(package-version pt-scotch32) "\n"))
                 (("^export SCOTCH_ARCH_PATH=.*$")
-                 (string-append "export SCOTCH_ARCH_PATH="
-                                (assoc-ref %build-inputs "pt-scotch32")
-                                "\n"))) #t))
+                 (string-append "export SCOTCH_ARCH_PATH=" #$pt-scotch32 "\n"))) #t))
           (add-before 'build 'patch-mpi
             (lambda _
-              (let* ((mpi-path (assoc-ref %build-inputs "openmpi"))
-                     (mpi-version #$(package-version openmpi)))
+              (let* ((mpi-version #$(package-version openmpi)))
                 ;; specify openmpi type
                 (substitute* "etc/bashrc"
                   (("WM_MPLIB=SYSTEMOPENMPI")
@@ -254,8 +251,7 @@ (define-public openfoam-org
                    (string-append "export FOAM_MPI=openmpi-"
                                   mpi-version "\n"))
                   (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
-                   (string-append "export MPI_ARCH_PATH=" mpi-path
-                                  "\n")))) #t))
+                   (string-append "export MPI_ARCH_PATH=" #$openmpi "\n")))) #t))
           (add-before 'build 'patch-paraview
             (lambda _
               (substitute* "etc/config.sh/paraview"
@@ -263,12 +259,11 @@ (define-public openfoam-org
                  (string-append "export ParaView_VERSION="
                                 #$(package-version paraview) "\n"))
                 (("^export ParaView_DIR=.*$")
-                 (string-append "export ParaView_DIR="
-                                (assoc-ref %build-inputs "paraview")
-                                "\n"))) #t))
+                 (string-append "export ParaView_DIR=" #$paraview "\n"))) #t))
           (add-before 'build 'add-rpaths
             (lambda _
-              (letrec* ((libraries '("boost" "cgal"
+              (letrec* ((libraries '("boost"
+                                     "cgal"
                                      "gmp"
                                      "metis"
                                      "mpfr"
@@ -277,11 +272,10 @@ (define-public openfoam-org
                                      "zlib"
                                      "paraview"))
                         (rpaths
-                         (fold-right (lambda (library rpaths)
+                         (fold-right (lambda (lib rpaths)
                                        (string-append rpaths
                                                       "-rpath="
-                                                      (assoc-ref
-                                                       %build-inputs library)
+                                                      (assoc-ref %build-inputs lib)
                                                       "/lib,")) "" libraries))
                         (openfoam-lib
                          (string-append #$output
@@ -307,13 +301,11 @@ (define-public openfoam-org
             (lambda _
               (let* ((vtk-version #$(version-major+minor
                                      (package-version vtk)))
-                     (vtk-root (assoc-ref %build-inputs "vtk"))
-                     (vtk-inc (string-append vtk-root "/include/vtk-" vtk-version))
+                     (vtk-inc (string-append #$vtk "/include/vtk-" vtk-version))
                      (vtk-inc-flag (string-append "-I" vtk-inc)))
                 (substitute* "wmake/rules/linux64Gcc/c++"
                   (("\\$\\(LIB_HEADER_DIRS\\)" all)
-                   (string-append all " " vtk-inc-flag " "))))
-              #t))
+                   (string-append all " " vtk-inc-flag " ")))) #t))
           (delete 'configure) ;no configure phase
           (replace 'build
             (lambda _
@@ -400,6 +392,7 @@ (define-public openfoam-org
     ;; $ cd pitzDaily
     ;; $ chmod -R u+w .
     ;; $ blockMesh
+    (home-page "https://openfoam.org")
     (synopsis "Framework for numerical simulation of fluid flow")
     (description
      "OpenFOAM provides a set of solvers and methods for tackling
@@ -410,8 +403,7 @@ (define-public openfoam-org
 sharp gradients, such as those encountered in flows with shock waves and flows
 with gas/liquid interfaces.  Large problems may be split into smaller, connected
 problems for efficient solution on parallel systems.")
-    (license license:gpl3+)
-    (home-page "https://openfoam.org")))
+    (license license:gpl3+)))
 
 (define-public openfoam
   (deprecated-package "openfoam" openfoam-org))

base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v7 2/7] gnu: openfoam-org: Refactor dependency.
       [not found] ` <e0b24fe5429f273c7e3fc07579efbb8c0cb8c560.1701462064.git.reza@housseini.me>
@ 2023-12-01 20:21   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-12-01 20:21 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Move dependency paraview to from
native-inputs to propagated-inputs.

Change-Id: I64c53b3554acc3d7390c88bbf2bcbcac98cdc141
---
 gnu/packages/simulation.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index cb6f07c383..73e53fe35f 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -143,7 +143,6 @@ (define-public openfoam-org
                   ncurses
                   openmpi
                   openssh
-                  paraview
                   pt-scotch32
                   readline
                   zlib))
@@ -190,7 +189,7 @@ (define-public openfoam-org
                          utfcpp
                          vtk
                          xz))
-    (propagated-inputs (list gnuplot))
+    (propagated-inputs (list paraview gnuplot))
     (outputs '("debug" ;~60MB
                "out"))
     (arguments
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v7 3/7] gnu: openfoam-org: Improve internal path handling.
       [not found] ` <b90c77d497a24b3b790237d1cd4c64f9ecf7ea9a.1701462064.git.reza@housseini.me>
@ 2023-12-01 20:21   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-12-01 20:21 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Improve handling of internal
path WM_PROJECT_DIR.

Change-Id: I43de76fb009f955294686a0b45bf3dc0217e7dc7
---
 gnu/packages/simulation.scm | 57 ++++++++++++++++++++++++++++---------
 1 file changed, 43 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 73e53fe35f..75eb070f64 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -197,8 +197,10 @@ (define-public openfoam-org
       ;; Executable files and shared libraries are located in the 'platforms'
       ;; subdirectory.
       #:strip-directories
-      #~(list "share/OpenFOAM/platforms/linux64GccDPInt32Opt/bin"
-              "share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib")
+      #~(list (string-append "OpenFOAM-" #$(package-version this-package)
+                             "/platforms/linux64GccDPInt32Opt/bin")
+	      (string-append "OpenFOAM-" #$(package-version this-package)
+                             "/platforms/linux64GccDPInt32Opt/lib"))
 
       #:modules
       '((ice-9 ftw)
@@ -278,7 +280,9 @@ (define-public openfoam-org
                                                       "/lib,")) "" libraries))
                         (openfoam-lib
                          (string-append #$output
-                                        "/share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib"))
+                                        "/share/OpenFOAM-"
+                                        #$(package-version this-package)
+                                        "/platforms/linux64GccDPInt32Opt/lib"))
                         (ldflags
                          (string-append "-Wl,"
                                         rpaths
@@ -338,19 +342,32 @@ (define-public openfoam-org
                 ;; (with-directory-excursion "tutorials"
                 ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
                 ) #t))
+          (add-before 'install 'set-paths
+            (lambda _
+              (let ((install-path (string-append #$output
+				                 "/share/OpenFOAM-"
+                                                 #$(package-version this-package))))
+                (substitute* "etc/bashrc"
+	          (("^\\[ \"\\$BASH\".*$") "")
+	          (("^export FOAM_INST_DIR=\\$\\(cd.*$")
+	           (string-append "export FOAM_INST_DIR=" install-path "\n"))
+	          (("^export FOAM_INST_DIR=\\$HOME.*$") ""))) #t))
           (replace 'install
             (lambda _
-              (let ((install-dir (string-append #$output
-                                                "/share/OpenFOAM")))
-                (mkdir-p install-dir) ;create install directory
+              (let ((install-path (string-append #$output
+                                                 "/share/OpenFOAM-"
+                                                 #$(package-version this-package))))
+                (mkdir-p install-path) ;create install directory
                 ;; move contents of build directory to install directory
-                (copy-recursively "." install-dir))))
+                (copy-recursively "." install-path))))
           (add-after 'install 'add-symbolic-link
             (lambda _
               (let* ((bin (string-append #$output "/bin"))
                      (lib (string-append #$output "/lib"))
+                     (etc (string-append #$output "/etc"))
                      (openfoam (string-append #$output
-                                              "/share/OpenFOAM"))
+                                              "/share/OpenFOAM-"
+                                              #$(package-version this-package)))
                      (build-bin (string-append openfoam
                                                "/platforms/linux64GccDPInt32Opt/bin"))
                      (build-lib (string-append openfoam
@@ -373,12 +390,24 @@ (define-public openfoam-org
                                        (string-append bin "/" file))))
                           (scandir foam-bin))
                 ;; add symbolic link for standard 'lib' directory
-                (symlink build-lib lib)) #t)))))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "WM_PROJECT_DIR")
-            (separator #f)
-            (files '("share/OpenFOAM")))))
+                (symlink build-lib lib)
+                ;; add symbolic link for bashrc file
+                (mkdir-p etc)
+                (symlink (string-append openfoam "/etc/bashrc")
+                         (string-append etc "/bashrc"))) #t))
+          (add-after 'add-symbolic-link 'wrap
+            (lambda* (#:key python inputs outputs #:allow-other-keys)
+              (let* ((bin (string-append #$output "/bin"))
+                     (openfoam (string-append #$output
+                                              "/share/OpenFOAM-"
+                                              #$(package-version this-package))))
+                (for-each
+                 (lambda (program)
+                   (unless (member program
+                                   '("." ".."))
+                     (wrap-program (string-append bin "/" program)
+                       `("WM_PROJECT_DIR" ":" prefix (,openfoam)))))
+                 (scandir bin))))))))
     ;; Note:
     ;; Tutorial files are installed read-only in /gnu/store.
     ;; To allow write permissions on files copied from the store a
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v7 4/7] gnu: openfoam-org: Improve build clean up.
       [not found] ` <54b1a2d73885ed2f5fef4f74fde212f9c811ce66.1701462064.git.reza@housseini.me>
@ 2023-12-01 20:21   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-12-01 20:21 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Improve build tree cleanup for
package reproducibility.

Change-Id: I59193f16a7d9598a9bc842f1c6091369c47906a8
---
 gnu/packages/simulation.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 75eb070f64..c6041643c8 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -328,7 +328,9 @@ (define-public openfoam-org
                 (delete-file-recursively
                  "platforms/linux64GccDPInt32OptOPENMPI"))
               (for-each delete-file
-                        (find-files "." "\\.o$")) #t))
+                        (find-files "." "\\.o$"))
+              ;; Remove spurious files in src tree
+              (invoke "bash" "-c" "source ./etc/bashrc && wclean all") #t))
           (replace 'check
             (lambda* (#:key tests? #:allow-other-keys)
               (when tests?
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v7 5/7] gnu: openfoam-org: Update to 11.
       [not found] ` <f4fb02c20f3836c2e1a3c9abddd558c2addb0451.1701462064.git.reza@housseini.me>
@ 2023-12-01 20:21   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-12-01 20:21 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Update to 11.

Change-Id: I6f9752e8bb35754ac3f67acbaa1e4ae8b216e410
---
 gnu/packages/simulation.scm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index c6041643c8..b33f24a5f4 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -91,17 +91,18 @@ (define-module (gnu packages simulation)
 (define-public openfoam-org
   (package
     (name "openfoam-org")
-    (version "10.20230119")
+    (version "11")
     (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url (string-append "https://github.com/OpenFOAM/OpenFOAM-"
-                                        (version-major version)))
-                    (commit (second (string-split version #\.)))))
+              (method url-fetch)
+              (uri (string-append "https://github.com/OpenFOAM/OpenFOAM-"
+                                  (version-major version)
+                                  "/archive/"
+                                  "version-"
+                                  (version-major version)
+                                  ".tar.gz"))
               (sha256
                (base32
-                "0icvwg7s6vnkgmdiczivia9pbrgx8nanw9a4j080fzfvdv9vxhzp"))
-              (file-name (git-file-name name version))
+                "1h70a5ni2psx7bcx2xg6aqraj2kkbfn8mflh2akbp6k9mmpgih7b"))
               (modules '((guix build utils)))
               (snippet `(begin
                           ;; patch shell paths
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v7 6/7] gnu: openfoam-com: Update to 2306.
       [not found] ` <1e5198861de5777cb1ad76b7919bc80870b54585.1701462064.git.reza@housseini.me>
@ 2023-12-01 20:21   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-12-01 20:21 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-com): Update to 2306.

Change-Id: I418fa263706574b716a852c77a33c7de5ee0068d
---
 gnu/packages/simulation.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index b33f24a5f4..f01044e76a 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -444,7 +444,7 @@ (define-public openfoam-com
   (package
     (inherit openfoam-org)
     (name "openfoam-com")
-    (version "2212")
+    (version "2306")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://develop.openfoam.com"
@@ -455,7 +455,7 @@ (define-public openfoam-com
                                   ".tar.gz"))
               (sha256
                (base32
-                "0i9039hfz9gvgymkdjhjvvn5500zha3cpdbpqrzfrfi8lbz10is2"))
+                "0zlkp48vygl2a5cyl0mfpj8dsb5bffviq96rg3kws1l6ni40v7jr"))
               (modules '((guix build utils)))
               (snippet `(begin
                           (substitute* "etc/bashrc"
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [bug#66262] [PATCH v7 7/7] gnu: openfoam-org: Improve wrapping of binaries.
       [not found] ` <e215dd308ca23fcdac93a10f03ae11185fa9a9f0.1701462064.git.reza@housseini.me>
@ 2023-12-01 20:21   ` reza via Guix-patches via
  0 siblings, 0 replies; 37+ messages in thread
From: reza via Guix-patches via @ 2023-12-01 20:21 UTC (permalink / raw)
  To: 66262; +Cc: reza

* gnu/packages/simulation.scm (openfoam-org): Add all variables from
etc/bashrc to the wrapping of binaries.

Change-Id: Idf0d4d9a043dfff806b6fb1871c1931794c1935b
---
 gnu/packages/simulation.scm | 159 +++++++++++++++++++++++++++++++++++-
 1 file changed, 155 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index f01044e76a..6b61783c2c 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -401,15 +401,166 @@ (define-public openfoam-org
           (add-after 'add-symbolic-link 'wrap
             (lambda* (#:key python inputs outputs #:allow-other-keys)
               (let* ((bin (string-append #$output "/bin"))
-                     (openfoam (string-append #$output
-                                              "/share/OpenFOAM-"
-                                              #$(package-version this-package))))
+                     (openfoam-version #$(package-version this-package))
+                     (openfoam-root (string-append #$output
+                                                   "/share/OpenFOAM-"
+                                                   openfoam-version))
+                     (openmpi-version #$(package-version openmpi))
+                     (paraview-version #$(package-version paraview))
+                     (paraview-version-major+minor
+                      #$(version-major+minor (package-version paraview))))
                 (for-each
                  (lambda (program)
                    (unless (member program
                                    '("." ".."))
+                     ;; wrap the programs with all the variables created by sourcing
+                     ;; etc/bashrc
                      (wrap-program (string-append bin "/" program)
-                       `("WM_PROJECT_DIR" ":" prefix (,openfoam)))))
+                       `("WM_PROJECT_INST_DIR" = (,openfoam-root))
+                       `("WM_PROJECT_DIR" = (,openfoam-root))
+                       '("WM_PROJECT" = ("OpenFOAM"))
+                       `("WM_PROJECT_VERSION" = (,openfoam-version))
+                       '("WM_COMPILER_TYPE" = ("system"))
+                       '("WM_COMPILER" = ("Gcc"))
+                       '("WM_ARCH_OPTION" = ("64"))
+                       '("WM_PRECISION_OPTION" = ("DP"))
+                       '("WM_LABEL_SIZE" = ("32"))
+                       '("WM_COMPILE_OPTION" = ("Opt"))
+                       '("WM_MPLIB" = ("OPENMPI"))
+                       '("WM_OSTYPE" = ("POSIX"))
+                       '("WM_OPTIONS" = ("linux64GccDPInt32Opt"))
+                       `("WM_PROJECT_USER_DIR" = (,(string-append
+                                                    "$HOME/OpenFOAM/$USER-"
+                                                    openfoam-version)))
+                       `("WM_THIRD_PARTY_DIR" = (,(string-append
+                                                   openfoam-root
+                                                   "/ThirdParty-"
+                                                   openfoam-version)))
+                       '("WM_LABEL_OPTION" = ("Int32"))
+                       '("WM_LINK_LANGUAGE" = ("c++"))
+                       '("WM_COMPILER_LIB_ARCH" = ("64"))
+                       `("WM_DIR" = (,(string-append openfoam-root "/wmake")))
+                       '("WM_LDFLAGS" = ("-m64"))
+                       '("WM_CC" = ("gcc"))
+                       '("WM_CFLAGS" = ("-m64 -fPIC"))
+                       '("WM_CXX" = ("g++"))
+                       '("WM_CXXFLAGS" = ("-m64 -fPIC -std=c++0x"))
+                       
+                       `("FOAM_INST_DIR" = (,openfoam-root))
+                       `("FOAM_APP" = (,(string-append openfoam-root
+                                                       "/applications")))
+                       `("FOAM_SRC" = (,(string-append openfoam-root "/src")))
+                       `("FOAM_ETC" = (,(string-append openfoam-root "/etc")))
+                       `("FOAM_TUTORIALS" = (,(string-append openfoam-root
+                                                             "/tutorials")))
+                       `("FOAM_UTILITIES" = (,(string-append
+                                               openfoam-root
+                                               "/applications/utilities")))
+                       `("FOAM_SOLVERS" = (,(string-append
+                                             openfoam-root
+                                             "/applications/solvers")))
+                       `("FOAM_MPI" = (,(string-append "openmpi-"
+                                                       openmpi-version)))
+                       `("FOAM_RUN" = (,(string-append "$HOME/OpenFOAM/$USER-"
+                                                       openfoam-version "/run")))
+                       `("FOAM_EXT_LIBBIN" = (,(string-append
+                                                openfoam-root
+                                                "/ThirdParty-"
+                                                openfoam-version
+                                                "/platforms/linux64GccDPInt32/lib")))
+                       `("FOAM_APPBIN" = (,(string-append
+                                            openfoam-root
+                                            "/platforms/linux64GccDPInt32Opt/bin")))
+                       `("FOAM_JOB_DIR" = (,(string-append openfoam-root
+                                                           "/jobControl")))
+                       `("FOAM_LIBBIN" = (,(string-append
+                                            openfoam-root
+                                            "/platforms/linux64GccDPInt32Opt/lib")))
+                       `("FOAM_SITE_LIBBIN" = (,(string-append
+                                                 openfoam-root
+                                                 "/site/"
+                                                 openfoam-version
+                                                 "/platforms/linux64GccDPInt32Opt/lib")))
+                       `("FOAM_SITE_APPBIN" = (,(string-append
+                                                 openfoam-root
+                                                 "/site/"
+                                                 openfoam-version
+                                                 "/platforms/linux64GccDPInt32Opt/bin")))
+                       `("FOAM_USER_LIBBIN" = (,(string-append
+                                                 "$HOME/OpenFOAM/$USER-"
+                                                 openfoam-version
+                                                 "/platforms/linux64GccDPInt32Opt/lib")))
+                       `("FOAM_USER_APPBIN" = (,(string-append
+                                                 "$HOME/OpenFOAM/$USER-"
+                                                 openfoam-version
+                                                 "/platforms/linux64GccDPInt32Opt/bin")))
+                       `("FOAM_MODULES" = (,(string-append openfoam-root
+                                                           "/applications/modules")))
+                       '("FOAM_SIGFPE" = (""))
+                       '("FOAM_SETTINGS" = (""))
+
+                       `("ParaView_INCLUDE_DIR" = (,(string-append #$paraview
+                                                                   "/include/paraview-"
+                                                                   paraview-version-major+minor)))
+                       '("ParaView_GL" = ("mesa"))
+                       `("ParaView_VERSION" = (,paraview-version))
+                       `("ParaView_MAJOR" = (,paraview-version-major+minor))
+                       `("ParaView_DIR" = (,#$paraview))
+                       `("PV_PLUGIN_PATH" = (,(string-append
+                                               openfoam-root
+                                               "/platforms/linux64GccDPInt32Opt/lib/paraview-"
+                                               paraview-version-major+minor)))
+
+                       `("MPI_ARCH_PATH" = (,#$openmpi))
+                       `("OPAL_PREFIX" = (,#$openmpi))
+                       '("MPI_BUFFER_SIZE" = ("20000000"))
+                       
+                       `("LD_LIBRARY_PATH" prefix
+                         (,(string-append openfoam-root "/ThirdParty-"
+                                          openfoam-version
+                                          "/platforms/linux64Gcc/gperftools-svn/lib")
+                          ,(string-append #$paraview "/lib")
+                          ,(string-append openfoam-root
+                                          "/platforms/linux64GccDPInt32Opt/lib/openmpi-"
+                                          openmpi-version)
+                          ,(string-append openfoam-root "/ThirdParty-"
+                                          openfoam-version
+                                          "/platforms/linux64GccDPInt32/lib/openmpi-"
+                                          openmpi-version)
+                          ,(string-append #$openmpi "/lib")
+                          ,(string-append #$openmpi "/lib64")
+                          ,(string-append "$HOME/OpenFOAM/$USER-"
+                                          openfoam-version
+                                          "/platforms/linux64GccDPInt32Opt/lib")
+                          ,(string-append openfoam-root "/site/"
+                                          openfoam-version
+                                          "/platforms/linux64GccDPInt32Opt/lib")
+                          ,(string-append openfoam-root
+                                          "/platforms/linux64GccDPInt32Opt/lib")
+                          ,(string-append openfoam-root "/ThirdParty-"
+                                          openfoam-version
+                                          "/platforms/linux64GccDPInt32/lib")
+                          ,(string-append openfoam-root
+                                          "/platforms/linux64GccDPInt32Opt/lib/dummy")))
+                       `("PATH" prefix
+                         (,(string-append openfoam-root "/ThirdParty-"
+                                          openfoam-version
+                                          "/platforms/linux64Gcc/gperftools-svn/bin")
+                          ,(string-append #$paraview "/bin")
+                          ,(string-append openfoam-root "/ThirdParty-"
+                                          openfoam-version
+                                          "/platforms/linux64Gcc/cmake-*/bin")
+                          ,(string-append #$openmpi "/bin")
+                          ,(string-append openfoam-root "/bin")
+                          ,(string-append openfoam-root "/wmake")
+                          ,(string-append "$HOME/OpenFOAM/$USER-"
+                                          openfoam-version
+                                          "/platforms/linux64GccDPInt32Opt/bin")
+                          ,(string-append openfoam-root "/site/"
+                                          openfoam-version
+                                          "/platforms/linux64GccDPInt32Opt/bin")
+                          ,(string-append openfoam-root
+                                          "/platforms/linux64GccDPInt32Opt/bin"))))))
                  (scandir bin))))))))
     ;; Note:
     ;; Tutorial files are installed read-only in /gnu/store.
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2023-12-01 20:23 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1695977095.git.reza@housseini.me>
2023-09-29  9:00 ` [bug#66262] [PATCH 0/3] Update openfoam and fix bugs reza via Guix-patches via
2023-09-29  9:39   ` [bug#66262] [PATCH v2 0/3] Update openfoam reza via Guix-patches via
2023-10-10  6:25   ` [bug#66262] [PATCH v3 0/3] Remove paraview plugin search path reza via Guix-patches via
2023-11-29 14:28   ` [bug#66262] [PATCH v4 1/6] gnu: openfoam-org: Use gexps reza via Guix-patches via
2023-11-29 20:39   ` [bug#66262] [PATCH v5 " reza via Guix-patches via
2023-11-30  8:30   ` [bug#66262] [PATCH v6 " reza via Guix-patches via
2023-11-30  8:38   ` [bug#66262] [PATCH v6 2/6] gnu: openfoam-org: Refactor dependency reza via Guix-patches via
2023-11-30  8:41   ` [bug#66262] [PATCH v6 3/6] gnu: openfoam-org: Improve internal path handling reza via Guix-patches via
2023-11-30  8:57   ` [bug#66262] [PATCH v6 4/6] gnu: openfoam-org: Improve build clean up reza via Guix-patches via
2023-11-30  9:01   ` [bug#66262] [PATCH v6 5/6] gnu: openfoam-org: Update to 11 reza via Guix-patches via
2023-11-30  9:03   ` [bug#66262] [PATCH v6 6/6] gnu: openfoam-com: Update to 2306 reza via Guix-patches via
2023-12-01 20:21   ` [bug#66262] [PATCH v7 1/7] gnu: openfoam-org: Use gexps reza via Guix-patches via
     [not found] ` <08d37437f0611551d403bb7da15d78c94fe3791f.1695977095.git.reza@housseini.me>
2023-09-29  9:03   ` [bug#66262] [PATCH 1/3] gnu: Add openfoam-package reza via Guix-patches via
     [not found] ` <3c9e2eabdc2f10db9d2a51d82203fcefd5e5e218.1695977095.git.reza@housseini.me>
2023-09-29  9:03   ` [bug#66262] [PATCH 2/3] gnu: openfoam-org: Update to 11 reza via Guix-patches via
     [not found] ` <c648aabf51e10ae1063dec75068dc71d54d36ba9.1695977095.git.reza@housseini.me>
2023-09-29  9:03   ` [bug#66262] [PATCH 3/3] gnu: openfoam-com: Update to 2306 reza via Guix-patches via
     [not found] <cover.1695980074.git.reza@housseini.me>
     [not found] ` <8f684396d68f2748f0b5e9ea832e483438cf195d.1695980074.git.reza@housseini.me>
2023-09-29  9:39   ` [bug#66262] [PATCH v2 1/3] gnu: Add openfoam-package reza via Guix-patches via
     [not found] ` <aa633991702c2752a9692a695792e972172b2faf.1695980074.git.reza@housseini.me>
2023-09-29  9:39   ` [bug#66262] [PATCH v2 2/3] gnu: openfoam-org: Update to 11 reza via Guix-patches via
     [not found] ` <9141e57d9db9be29442325736da07e61ff3c5420.1695980074.git.reza@housseini.me>
2023-09-29  9:40   ` [bug#66262] [PATCH v2 3/3] gnu: openfoam-com: Update to 2306 reza via Guix-patches via
     [not found] <cover.1696919009.git.reza@housseini.me>
     [not found] ` <ccac0a551e301ab86d5c77ba928fac1cf69cf138.1696919009.git.reza@housseini.me>
2023-10-10  6:25   ` [bug#66262] [PATCH v3 1/3] gnu: Add openfoam-package reza via Guix-patches via
     [not found] ` <bce423db0172bc6d5e2c7cc21f0df96e1b1a34e6.1696919009.git.reza@housseini.me>
2023-10-10  6:25   ` [bug#66262] [PATCH v3 2/3] gnu: openfoam-org: Update to 11 reza via Guix-patches via
     [not found] ` <f4cd9332ffd1c23dbf9fac5b1821676ae6c2aa2d.1696919009.git.reza@housseini.me>
2023-10-10  6:25   ` [bug#66262] [PATCH v3 3/3] gnu: openfoam-com: Update to 2306 reza via Guix-patches via
     [not found] <fe263426cf5f402a7a251e120af65d4a15f955ab.1701268112.git.reza@housseini.me>
     [not found] ` <c9ba1409a268744673caf17ec529b415ad1fa29f.1701268112.git.reza@housseini.me>
2023-11-29 14:29   ` [bug#66262] [PATCH v4 2/6] gnu: openfoam-org: Refactor dependency reza via Guix-patches via
     [not found] ` <0acf762696be31d70a2c40523c0054e52f9606ef.1701268112.git.reza@housseini.me>
2023-11-29 14:29   ` [bug#66262] [PATCH v4 3/6] gnu: openfoam-org: Improve internal path handling reza via Guix-patches via
     [not found] ` <97b7044beb51357a1b2f50bc59ab840fa5f97808.1701268112.git.reza@housseini.me>
2023-11-29 14:29   ` [bug#66262] [PATCH v4 4/6] gnu: openfoam-org: Improve build clean up reza via Guix-patches via
     [not found] ` <5380542281402a0572fbb4270658f354611448d9.1701268112.git.reza@housseini.me>
2023-11-29 14:29   ` [bug#66262] [PATCH v4 5/6] gnu: openfoam-org: Update to 11 reza via Guix-patches via
     [not found] ` <3aca16d2ccc66d8f39f08ddcb9a4bbda30c9caa3.1701268112.git.reza@housseini.me>
2023-11-29 14:29   ` [bug#66262] [PATCH v4 6/6] gnu: openfoam-com: Update to 2306 reza via Guix-patches via
     [not found] <5a90ca452eac7f8947a241bf0900ca928acc311f.1701290362.git.reza@housseini.me>
     [not found] ` <b90c77d497a24b3b790237d1cd4c64f9ecf7ea9a.1701290362.git.reza@housseini.me>
2023-11-29 20:39   ` [bug#66262] [PATCH v5 3/6] gnu: openfoam-org: Improve internal path handling reza via Guix-patches via
     [not found] ` <f4fb02c20f3836c2e1a3c9abddd558c2addb0451.1701290362.git.reza@housseini.me>
2023-11-29 20:39   ` [bug#66262] [PATCH v5 5/6] gnu: openfoam-org: Update to 11 reza via Guix-patches via
     [not found] ` <54b1a2d73885ed2f5fef4f74fde212f9c811ce66.1701290362.git.reza@housseini.me>
2023-11-29 20:39   ` [bug#66262] [PATCH v5 4/6] gnu: openfoam-org: Improve build clean up reza via Guix-patches via
     [not found] ` <1e5198861de5777cb1ad76b7919bc80870b54585.1701290362.git.reza@housseini.me>
2023-11-29 20:39   ` [bug#66262] [PATCH v5 6/6] gnu: openfoam-com: Update to 2306 reza via Guix-patches via
     [not found] ` <e0b24fe5429f273c7e3fc07579efbb8c0cb8c560.1701290362.git.reza@housseini.me>
2023-11-29 20:39   ` [bug#66262] [PATCH v5 2/6] gnu: openfoam-org: Refactor dependency reza via Guix-patches via
     [not found] <5a90ca452eac7f8947a241bf0900ca928acc311f.1701462064.git.reza@housseini.me>
     [not found] ` <e0b24fe5429f273c7e3fc07579efbb8c0cb8c560.1701462064.git.reza@housseini.me>
2023-12-01 20:21   ` [bug#66262] [PATCH v7 2/7] " reza via Guix-patches via
     [not found] ` <b90c77d497a24b3b790237d1cd4c64f9ecf7ea9a.1701462064.git.reza@housseini.me>
2023-12-01 20:21   ` [bug#66262] [PATCH v7 3/7] gnu: openfoam-org: Improve internal path handling reza via Guix-patches via
     [not found] ` <54b1a2d73885ed2f5fef4f74fde212f9c811ce66.1701462064.git.reza@housseini.me>
2023-12-01 20:21   ` [bug#66262] [PATCH v7 4/7] gnu: openfoam-org: Improve build clean up reza via Guix-patches via
     [not found] ` <f4fb02c20f3836c2e1a3c9abddd558c2addb0451.1701462064.git.reza@housseini.me>
2023-12-01 20:21   ` [bug#66262] [PATCH v7 5/7] gnu: openfoam-org: Update to 11 reza via Guix-patches via
     [not found] ` <1e5198861de5777cb1ad76b7919bc80870b54585.1701462064.git.reza@housseini.me>
2023-12-01 20:21   ` [bug#66262] [PATCH v7 6/7] gnu: openfoam-com: Update to 2306 reza via Guix-patches via
     [not found] ` <e215dd308ca23fcdac93a10f03ae11185fa9a9f0.1701462064.git.reza@housseini.me>
2023-12-01 20:21   ` [bug#66262] [PATCH v7 7/7] gnu: openfoam-org: Improve wrapping of binaries reza via Guix-patches via

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).