all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
       [not found] <cover.1679863907.git.reza@housseini.me>
@ 2023-03-26 20:53 ` reza via Guix-patches via
  2023-03-27 16:51   ` reza via Guix-patches via
                     ` (6 more replies)
       [not found] ` <8e459feaf2d6a3d0f8720e72299e81259b9e6168.1679863907.git.reza@housseini.me>
                   ` (3 subsequent siblings)
  4 siblings, 7 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-03-26 20:53 UTC (permalink / raw)
  To: 62473; +Cc: reza

This is a patch series updating OpenFoam to version 10. This series gets rid
of the OpenFoam patch file and also adds the OpenFoam build from openfoam.com
(therefore the distinction with openfoam-org and openfoam-com).  Some effort
was put forward to build the two packages with the same instructions as the
sources are still very similar.  There is a strange issue that inside the
build of openfoam-com which inherits from openfoam-org, the version of
openfoam-org is used. Maybe this is a bug? Furthermore the dependencies and
build instructions have been updated to build the paraview plugin for OpenFoam
and the OpenFoam tests (only available for openfoam-org).

Reza Housseini (4):
  gnu: Add ftest.
  gnu: utfcpp: Update to 3.2.3.
  gnu: Add openfoam-org.
  gnu: Add openfoam-com.

 gnu/local.mk                                  |   2 +-
 gnu/packages/check.scm                        |  34 ++
 .../patches/openfoam-4.1-cleanup.patch        | 243 ----------
 gnu/packages/simulation.scm                   | 432 ++++++++++++------
 gnu/packages/textutils.scm                    |  35 +-
 5 files changed, 346 insertions(+), 400 deletions(-)
 delete mode 100644 gnu/packages/patches/openfoam-4.1-cleanup.patch


base-commit: de84b24613afa4020f3f0553dad8e39a78d1f92c
-- 
2.39.2






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

* [bug#62473] [PATCH 1/4] gnu: Add ftest.
       [not found] ` <8e459feaf2d6a3d0f8720e72299e81259b9e6168.1679863907.git.reza@housseini.me>
@ 2023-03-27  7:42   ` reza via Guix-patches via
  0 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-03-27  7:42 UTC (permalink / raw)
  To: 62473; +Cc: Reza Housseini

From: Reza Housseini <reza.housseini@gmail.com>

---
 gnu/packages/check.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 0c8777a074..9b58b2c09d 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -43,6 +43,7 @@
 ;;; Copyright © 2022 jgart <jgart@dismail.de>
 ;;; Copyright © 2023 Luis Felipe López Acevedo <luis.felipe.la@protonmail.com>
 ;;; Copyright © 2023 Timo Wilken <guix@twilken.net>
+;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,6 +66,7 @@ (define-module (gnu packages check)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
@@ -92,6 +94,7 @@ (define-module (gnu packages check)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
@@ -3531,6 +3534,7 @@ (define-public python-pytest-regressions
 that can be used to verify that future runs produce the same data.")
     (license license:expat)))
 
+
 (define-public guile-proba
   (package
     (name "guile-proba")
@@ -3606,3 +3610,33 @@ (define-public guile-proba
 to run test collections, and a library that includes a test runner and
 helpers for writing tests.")
     (license license:public-domain)))
+
+
+(define-public ftest
+  (package
+    (name "ftest")
+    (version "bf75576064fce2e07f52cd63a3e410f12358728b")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/nemtrif/ftest")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "01yjhjnlq2gci8hkc6favwj0axq7y1vvnradsgcffby6h09x00b4"))))
+    (build-system copy-build-system)
+    (native-inputs (list cmake-minimal))
+    (arguments
+     `(#:install-plan '(("ftest.h" "include/ftest/"))
+       #:phases (modify-phases %standard-phases
+                  (add-before 'install 'check
+                    (lambda _
+                      (with-directory-excursion "tests"
+                        (invoke "cmake" ".")
+                        (invoke "make")
+                        (invoke "ctest")))))))
+    (home-page "https://github.com/nemtrif/ftest")
+    (synopsis "Simple and limited unit-test framework for C++")
+    (description "A simple and limited unit-test framework for C++")
+    (license license:asl2.0)))
-- 
2.39.2






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

* [bug#62473] [PATCH 2/4] gnu: utfcpp: Update to 3.2.3.
       [not found] ` <622cad546298d2bd56fc4baf49dafeb8c9fa20b1.1679863907.git.reza@housseini.me>
@ 2023-03-27  7:46   ` reza via Guix-patches via
  0 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-03-27  7:46 UTC (permalink / raw)
  To: 62473; +Cc: Reza Housseini

From: Reza Housseini <reza.housseini@gmail.com>

---
 gnu/packages/textutils.scm | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index fb8bc7e868..a08fb76543 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -25,6 +25,7 @@
 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
 ;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com>
 ;;; Copyright © 2022 Gabriel Wicki <gabriel@erlikon.ch>
+;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -57,6 +58,7 @@ (define-module (gnu packages textutils)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages golang)
@@ -671,30 +673,31 @@ (define-public catdoc
 (define-public utfcpp
   (package
     (name "utfcpp")
-    (version "2.3.5")
+    (version "3.2.3")
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                     (url "https://github.com/nemtrif/utfcpp")
-                     (commit (string-append "v" version))))
+                    (url "https://github.com/nemtrif/utfcpp")
+                    (commit (string-append "v" version))))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1gr98d826z6wa58r1s5i7rz7q2x3r31v7zj0pjjlrc7gfxwklr4s"))))
+                "00hzh39iddbc6nxg13813qd6d55g2kccwjf5dr96wykfhway9wbr"))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          ;; delete bundled dependencies
+                          (delete-file-recursively "extern")
+                          (substitute* (list "tests/apitests.cpp"
+                                             "tests/noexceptionstests.cpp"
+                                             "tests/test_cpp11.cpp"
+                                             "tests/test_cpp17.cpp")
+                            (("\"\\.\\./extern/ftest/ftest.h\"")
+                             "<ftest/ftest.h>"))))))
     (build-system cmake-build-system)
+    (native-inputs (list ftest))
     (arguments
-     `(#:out-of-source? #f
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'install              ; no install target
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (include (string-append out "/include"))
-                    (doc (string-append out "/share/doc/" ,name)))
-               (copy-recursively "source" include)
-               (install-file "README.md" doc)
-               #t))))))
-    (home-page "https://github.com/nemtrif/utfcpp")
+     `(#:build-type "Release"))
+    (home-page "https://utfcpp.sourceforge.net")
     (synopsis "Portable C++ library for handling UTF-8")
     (description "UTF8-CPP is a C++ library for handling UTF-8 encoded text
 in a portable way.")
-- 
2.39.2






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

* [bug#62473] [PATCH 3/4] gnu: Add openfoam-org.
       [not found] ` <39bb016d78272ca6ef016fa0ea0fe364a2f051e4.1679863907.git.reza@housseini.me>
@ 2023-03-27  7:46   ` reza via Guix-patches via
  0 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-03-27  7:46 UTC (permalink / raw)
  To: 62473; +Cc: reza

---
 gnu/local.mk                                  |   2 +-
 .../patches/openfoam-4.1-cleanup.patch        | 243 -----------
 gnu/packages/simulation.scm                   | 393 +++++++++++-------
 3 files changed, 254 insertions(+), 384 deletions(-)
 delete mode 100644 gnu/packages/patches/openfoam-4.1-cleanup.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 64a1268fbe..287c9d52f7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1617,7 +1617,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/openboardview-use-system-imgui.patch	\
   %D%/packages/patches/openboardview-use-system-utf8.patch	\
   %D%/packages/patches/openbox-python3.patch			\
-  %D%/packages/patches/openfoam-4.1-cleanup.patch			\
+  %D%/packages/patches/openfoam-org-10-cleanup.patch			\
   %D%/packages/patches/openjdk-10-idlj-reproducibility.patch	\
   %D%/packages/patches/openjdk-15-xcursor-no-dynamic.patch	\
   %D%/packages/patches/openmpi-mtl-priorities.patch		\
diff --git a/gnu/packages/patches/openfoam-4.1-cleanup.patch b/gnu/packages/patches/openfoam-4.1-cleanup.patch
deleted file mode 100644
index 37effa5c9c..0000000000
--- a/gnu/packages/patches/openfoam-4.1-cleanup.patch
+++ /dev/null
@@ -1,243 +0,0 @@
-# This patch removes all need for the ThirdParty files of OpenFOAM.
-
-# Derived from EasyBuild patch by Ward Poelmans <wpoely86@gmail.com>.
-# Modified for GNU Guix by Paul Garlick <pgarlick@tourbillion-technology.com>.
-
-diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
---- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake
-+++ OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
-@@ -9,7 +9,7 @@
- #
- # use readline if available
- #
--if [ -f /usr/include/readline/readline.h ]
-+if true
- then
-     echo "Found <readline/readline.h>  --  enabling readline support."
-     export COMP_FLAGS="-DHAS_READLINE"
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/bashrc OpenFOAM-4.x-version-4.1/etc/bashrc
---- OpenFOAM-4.x-version-4.1.org/etc/bashrc
-+++ OpenFOAM-4.x-version-4.1/etc/bashrc
-@@ -43,8 +43,10 @@
- # Please set to the appropriate path if the default is not correct.
- #
- [ $BASH_SOURCE ] && \
--export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \
-+export FOAM_INST_DIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) || \
- export FOAM_INST_DIR=$HOME/$WM_PROJECT
-+# For GNU Guix: set initially for build then re-set at runtime
-+#
- # export FOAM_INST_DIR=~$WM_PROJECT
- # export FOAM_INST_DIR=/opt/$WM_PROJECT
- # export FOAM_INST_DIR=/usr/local/$WM_PROJECT
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL
-@@ -36,37 +36,7 @@
- #
- #------------------------------------------------------------------------------
-
--boost_version=boost-system
--cgal_version=cgal-system
--#cgal_version=CGAL-4.8
--
--if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ]
--then
--
--    common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
--
--    export BOOST_ARCH_PATH=$common_path/$boost_version
--    export CGAL_ARCH_PATH=$common_path/$cgal_version
--
--    if [ "$FOAM_VERBOSE" -a "$PS1" ]
--    then
--        echo "Using CGAL and boost" 1>&2
--        echo "    $cgal_version at $CGAL_ARCH_PATH" 1>&2
--        echo "    $boost_version at $BOOST_ARCH_PATH" 1>&2
--    fi
--
--    if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ]
--    then
--        _foamAddLib $CGAL_ARCH_PATH/lib
--    fi
--
--    if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ]
--    then
--        _foamAddLib $BOOST_ARCH_PATH/lib
--    fi
--
--    unset boost_version cgal_version common_path
--
--fi
-+export CGAL_ARCH_PATH=$CGAL_ROOT
-+export BOOST_ARCH_PATH=$BOOST_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools
-@@ -29,13 +29,5 @@
- #
- #------------------------------------------------------------------------------
-
--version=svn
--gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
--
--GPERFTOOLS_VERSION=gperftools-$version
--GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION
--
--export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH
--export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-version-4.1/etc/config.sh/metis
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/metis
-@@ -34,7 +34,7 @@
- #
- #------------------------------------------------------------------------------
-
--export METIS_VERSION=metis-5.1.0
--export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION
-+export METIS_VERSION=metis-$METISVERSION
-+export METIS_ARCH_PATH=$METIS_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch OpenFOAM-4.x-version-4.1/etc/config.sh/scotch
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/scotch
-@@ -37,7 +37,7 @@
- #
- #------------------------------------------------------------------------------
-
--export SCOTCH_VERSION=scotch_6.0.3
--export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION
-+export SCOTCH_VERSION=scotch_$SCOTCHVERSION
-+export SCOTCH_ARCH_PATH=$SCOTCH_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings OpenFOAM-4.x-version-4.1/etc/config.sh/settings
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/settings
-@@ -279,6 +279,9 @@
-     ;;
- system)
-     # Use system compiler
-+    # Use system GMP and MPFR packages
-+    export GMP_ARCH_PATH=$GMP_ROOT
-+    export MPFR_ARCH_PATH=$MPFR_ROOT
-     ;;
- *)
-     echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
-@@ -5,8 +5,7 @@
-     $(PFLAGS) $(PINC) \
-     -I$(SCOTCH_ROOT)/include \
-     -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
--    -I/usr/include/scotch \
-     -I../decompositionMethods/lnInclude
-
- LIB_LIBS = \
--    -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
-+    -L$(SCOTCH_ROOT)/lib -L$(MPI_ARCH_PATH)/lib -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options
-@@ -9,8 +9,7 @@
-     $(PFLAGS) $(PINC) \
-     -I$(SCOTCH_ROOT)/include \
-     -I$(SCOTCH_ARCH_PATH)/include \
--    -I/usr/include/scotch \
-     -I../decompositionMethods/lnInclude
-
- LIB_LIBS = \
--    -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt
-+    -L$(SCOTCH_ROOT)/lib -lscotch -lscotcherrexit -lrt
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general
---- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general
-+++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general
-@@ -33,7 +33,6 @@
- # The Makefile uses a POSIX shell
- #------------------------------------------------------------------------------
- 
--SHELL           = /bin/sh
- 
- 
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmake OpenFOAM-4.x-version-4.1/wmake/wmake
---- OpenFOAM-4.x-version-4.1.org/wmake/wmake
-+++ OpenFOAM-4.x-version-4.1/wmake/wmake
-@@ -163,7 +163,7 @@
- then
-     if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ]
-     then
--        lockDir=$HOME/.$WM_PROJECT/.wmake
-+        lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- 
-         if [ -d $lockDir ]
-         then
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler
---- OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler
-+++ OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler
-@@ -53,7 +53,7 @@
- # csh sets HOST, bash sets HOSTNAME
- : ${HOST:=$HOSTNAME}
- 
--lockDir=$HOME/.$WM_PROJECT/.wmake
-+lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- 
- # Fallback - 1 core on current host
- : ${WM_HOSTS:=$HOST:1}
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime
---- OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime
-+++ OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime
-@@ -53,7 +53,7 @@
- # csh sets HOST, bash sets HOSTNAME
- : ${HOST:=$HOSTNAME}
- 
--lockDir=$HOME/.$WM_PROJECT/.wmake
-+lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- # Fallback - 1 core on current host
- : ${WM_HOSTS:=$HOST:1}
- 
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C
-@@ -67,7 +67,7 @@
- 
-     // Processor weights initialised with no size, only used if specified in
-     // a file
--    Field<scalar> processorWeights;
-+    Field<floatScalar> processorWeights;
- 
-     // Cell weights (so on the vertices of the dual)
-     List<label> cellWeights;
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL
---- OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL
-+++ OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL
-@@ -6,9 +6,10 @@
-     -I/usr/include
- 
- CGAL_LIBS = \
--    -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
--    -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-+    -L$(MPFR_ARCH_PATH)/lib \
-+    -L$(GMP_ARCH_PATH)/lib \
-     -L$(BOOST_ARCH_PATH)/lib \
-     -L$(CGAL_ARCH_PATH)/lib \
-     -lCGAL \
-+    -lgmp \
-     -lmpfr
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++
---- OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++
-+++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++
-@@ -20,5 +20,5 @@
-
- LINK_LIBS   = $(c++DBUG)
-
--LINKLIBSO   = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
--LINKEXE     = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
-+LINKLIBSO   = $(CC) $(c++FLAGS) $(LDFLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
-+LINKEXE     = $(CC) $(c++FLAGS) $(LDFLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 059be5a2be..685b123903 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 Eric Bavier <bavier@posteo.net>
 ;;; Copyright © 2022 Liliana Marie Prikler <liliana.prikler@gmail.com>
+;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@ (define-module (gnu packages simulation)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
+  #:use-module (gnu packages engineering)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gettext)
@@ -41,22 +43,29 @@ (define-module (gnu packages simulation)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages iso-codes)
+  #:use-module (gnu packages image-processing)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages pdf)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-science)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages serialization)
+  #:use-module (gnu packages ssh)
+  #:use-module (gnu packages textutils)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
+  #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (guix download)
@@ -75,175 +84,279 @@ (define-module (gnu packages simulation)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1))
 
-(define-public openfoam
+(define-public openfoam-org
   (package
-    (name "openfoam")
-    (version "4.1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append
-             "http://dl.openfoam.org/source/"
-             (string-map (lambda (x) (if (eq? x #\.) #\- x)) version)))
-       (file-name (string-append name "-" version ".tar.gz"))
-       (sha256
-        (base32 "0cgxh4h2hf50qbvvdg5miwc2nympb0nrv3md96vb3gbs9vk8vq9d"))
-       (patches (search-patches "openfoam-4.1-cleanup.patch"))
-       (modules '((guix build utils)))
-       (snippet
-        '(begin
-           ;; Include <sys/sysmacros.h>, which is where glibc >= 2.28 provides
-           ;; 'major' and 'minor'.
-           (substitute* "src/OSspecific/POSIX/fileStat.C"
-             (("#include <unistd\\.h>")
-              "#include <unistd.h>\n#include <sys/sysmacros.h>\n"))
-           #t))))
+    (name "openfoam-org")
+    (version "10.20221128")
+    (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
+                "0yd924nhck4jh9gf1wrdnk8svj38yicg4803q79nnjqhn6lcq8c5"))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          ;; patch shell paths
+                          (substitute* (list "wmake/src/Makefile"
+                                             "wmake/makefiles/general")
+                            (("/bin/sh")
+                             which "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)))
+                          ;; add expand flag to RunFunctions
+                          (substitute* "bin/tools/RunFunctions"
+                            (("foamDictionary (.*)" all args)
+                             (string-append "foamDictionary -expand " args)))))))
     (build-system gnu-build-system)
-    (inputs
-     `(("boost" ,boost)
-       ("cgal" ,cgal)
-       ("flex" ,flex)
-       ("git" ,git)
-       ("gmp" ,gmp)
-       ("libxt" ,libxt)
-       ("metis" ,metis)
-       ("mpfr" ,mpfr)
-       ("ncurses" ,ncurses)
-       ("readline" ,readline)
-       ("scotch" ,pt-scotch32)
-       ("zlib" ,zlib)))
-    (native-inputs
-     (list bison))
-    (propagated-inputs
-     (list gzip gnuplot openmpi))
-    (outputs '("debug"                  ;~60MB
+    (inputs (list boost
+                  cgal
+                  git
+                  gmp
+                  libxt
+                  metis
+                  mpfr
+                  ncurses
+                  readline
+                  pt-scotch32
+                  zlib
+                  openmpi
+                  paraview-5.9
+                  openssh))
+    (native-inputs (list bison
+                         flex
+                         ;; paraview plugin dependencies
+                         cmake-minimal
+                         vtk
+                         libxml2
+                         libogg
+                         libtheora
+                         ffmpeg
+                         gl2ps
+                         libpng
+                         libharu
+                         jsoncpp
+                         netcdf
+                         hdf5
+                         gdal
+                         libx11
+                         qtbase-5
+                         eigen
+                         glew
+                         python
+                         expat
+                         xz
+                         utfcpp
+                         lz4
+                         double-conversion
+                         libjpeg-turbo
+                         libtiff
+                         freetype
+                         pugixml
+                         cgns
+                         qtsvg-5
+                         qttools-5
+                         protobuf
+                         qtxmlpatterns))
+    (propagated-inputs (list gnuplot))
+    (outputs '("debug" ;~60MB
                "out"))
     (arguments
-     `( ;; Executable files and shared libraries are located in the 'platforms'
+     `( ;Executable files and shared libraries are located in the 'platforms'
        ;; subdirectory.
-       #:strip-directories (list (string-append
-                                  "lib/OpenFOAM-" ,version
+       #:strip-directories (list (string-append "share/OpenFOAM-"
+                                  ,version
                                   "/platforms/linux64GccDPInt32Opt/bin")
-                                 (string-append
-                                  "lib/OpenFOAM-" ,version
+                                 (string-append "share/OpenFOAM-"
+                                  ,version
                                   "/platforms/linux64GccDPInt32Opt/lib"))
-       #:tests? #f                                ; no tests to run
 
        #: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-after 'unpack 'rename-build-directory
+                  (add-after 'unpack 'set-same-version-as-guix
                     (lambda _
-                      (chdir "..")
-                      ;; Use 'OpenFOAM-version' convention to match the file
-                      ;; name expectations in the build phase.
-                      (let ((unpack-dir (string-append
-                                         (getcwd) "/"
-                                         (list-ref (scandir (getcwd) (lambda (name)
-                                                                       (string-match "^OpenFOAM" name))) 0)))
-                            (build-dir (string-append
-                                        (getcwd) "/OpenFOAM-" ,version)))
-                        (rename-file unpack-dir build-dir) ; rename build directory
-                        (chdir (basename build-dir))) ; move to build directory
-                      #t))
-                  (delete 'configure)             ; no configure phase
-                  (replace 'build
+                      (substitute* "etc/bashrc"
+                        (("^export WM_PROJECT_VERSION=.*$")
+                         (string-append "export WM_PROJECT_VERSION="
+                                        ,version "\n"))) #t))
+                  (add-before 'build 'patch-HOME-path
                     (lambda _
-                      (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch")))
-                        ;; set variables to define store paths
-                        (for-each (lambda (library)
-                                    (setenv (string-append
-                                             (string-upcase library) "_ROOT")
-                                            (assoc-ref %build-inputs library))) libraries))
-                      ;; set variables to define package versions
-                      (setenv "SCOTCHVERSION" ,(package-version scotch))
-                      (setenv "METISVERSION" ,(package-version metis))
-                      ;; set variable to pass extra 'rpath' arguments to linker
-                      (setenv "LDFLAGS"
-                              (string-append
-                               "-Wl,"
-                               "-rpath=" %output "/lib/OpenFOAM-" ,version
-                               "/platforms/linux64GccDPInt32Opt/lib,"
-                               "-rpath=" %output "/lib/OpenFOAM-" ,version
-                               "/platforms/linux64GccDPInt32Opt/lib/dummy"))
-                      ;; compile OpenFOAM libraries and applications
-                      (zero? (system (format #f
-                                             "source ./etc/bashrc && ./Allwmake -j~a"
-                                             (parallel-job-count))))))
-                  (add-after 'build 'update-configuration-files
+                      (setenv "HOME" "/tmp") #t))
+                  (add-before 'build 'patch-scotch
                     (lambda _
-                      ;; record store paths and package versions in
-                      ;; configuration files
-                      (substitute* "etc/config.sh/CGAL"
-                        (("$BOOST_ROOT") (getenv "BOOST_ROOT")))
-                      (substitute* "etc/config.sh/CGAL"
-                        (("$CGAL_ROOT") (getenv "CGAL_ROOT")))
-                      (substitute* "etc/config.sh/metis"
-                        (("$METIS_ROOT") (getenv "METIS_ROOT")))
-                      (substitute* "etc/config.sh/metis"
-                        (("$METISVERSION") (getenv "METISVERSION")))
-                      (substitute* "etc/config.sh/scotch"
-                        (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT")))
                       (substitute* "etc/config.sh/scotch"
-                        (("$SCOTCHVERSION") (getenv "SCOTCHVERSION")))
-                      (substitute* "etc/config.sh/settings"
-                        (("$GMP_ROOT") (getenv "GMP_ROOT")))
-                      (substitute* "etc/config.sh/settings"
-                        (("$MPFR_ROOT") (getenv "MPFR_ROOT")))
-                      ;; reset lockDir variable to refer to write-enabled
-                      ;; directory
-                      (substitute* "wmake/wmake"
-                        (("        lockDir=.*$")
-                         "        lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      (substitute* "wmake/wmakeScheduler"
-                        (("lockDir=.*$")
-                         "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      (substitute* "wmake/wmakeSchedulerUptime"
-                        (("lockDir=.*$")
-                         "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      #t))
+                        (("^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-5.9) "\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-"
+                                               ,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-5.9)))))
+                        (substitute* "wmake/rules/linux64Gcc/c++"
+                          (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
+                           (string-append all " " ldflags)))) #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 unncessary, voluminous object and dep files.
+                    ;; Avoid unnecessary, voluminous object and dep files.
                     (lambda _
-                      (delete-file-recursively
-                       "platforms/linux64GccDPInt32Opt/src")
-                      (delete-file-recursively
-                       "platforms/linux64GccDPInt32OptSYSTEMOPENMPI")
-                      (for-each delete-file (find-files "." "\\.o$"))
-                      #t))
+                      (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 _
                       ;; use 'OpenFOAM-version' convention
-                      (let ((install-dir (string-append
-                                          %output "/lib/OpenFOAM-" ,version)))
-                        (mkdir-p install-dir)     ; create install directory
+                      (let ((install-dir (string-append %output
+                                                        "/share/OpenFOAM-"
+                                                        ,version)))
+                        (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 _
-                      ;; add symbolic link for standard 'bin' directory
-                      (symlink
-                       (string-append "./lib/OpenFOAM-" ,version
-                                      "/platforms/linux64GccDPInt32Opt/bin")
-                       (string-append %output "/bin"))
-                      #t)))))
+                      (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 $GUIX_PROFILE/lib/OpenFOAM-4.1/etc/bashrc
-    ;;  $ mkdir -p $FOAM_RUN
-    ;;  $ cd $FOAM_RUN
-    ;;  $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
-    ;;  $ cd pitzDaily
-    ;;  $ chmod -R u+w .
-    ;;  $ blockMesh
+    ;; 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
+    (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
-- 
2.39.2


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

* [bug#62473] [PATCH 4/4] gnu: Add openfoam-com.
       [not found] ` <1c95a4bb417b77c8cad9edbdca11b769afcfe4e9.1679863907.git.reza@housseini.me>
@ 2023-03-27  7:46   ` reza via Guix-patches via
  0 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-03-27  7:46 UTC (permalink / raw)
  To: 62473; +Cc: reza

---
 gnu/packages/simulation.scm | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 685b123903..282cf6e10c 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -367,6 +367,45 @@ (define-public openfoam-org
     (license license:gpl3+)
     (home-page "https://openfoam.org")))
 
+(define-public openfoam-com
+  (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
+                          ;; patch shell paths
+                          (substitute* (list "src/OSspecific/POSIX/POSIX.C"
+                                             "wmake/src/Makefile"
+                                             "wmake/makefiles/general"
+                                             "wmake/makefiles/info")
+                            (("/bin/sh")
+                             which "sh"))))))
+    (description
+     "OpenFOAM is a free, open source CFD software released and developed by
+OpenCFD Ltd since 2004.  It has a large user base across most areas of
+engineering and science, from both commercial and academic organizations.
+OpenFOAM has an extensive range of features to solve anything from complex
+fluid flows involving chemical reactions, turbulence and heat transfer, to
+acoustics, solid mechanics and electromagnetics.  See documentation OpenFOAM
+is professionally released every six months to include customer sponsored
+developments and contributions from the community - individual and group
+contributors, integrations (eg, from FOAM-extend and OpenFOAM Foundation Ltd)
+as well as governance guided activities.")
+    (home-page "https://www.openfoam.com")))
+
 (define-public open-simulation-interface
   (package
     (name "open-simulation-interface")
-- 
2.39.2






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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
  2023-03-26 20:53 ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
@ 2023-03-27 16:51   ` reza via Guix-patches via
  2023-04-05 18:21   ` [bug#62473] [PATCH v2 0/4] Remove spurious file, add env var reza via Guix-patches via
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-03-27 16:51 UTC (permalink / raw)
  To: 62473

[-- Attachment #1: Type: text/plain, Size: 68 bytes --]

This would also resolve [1].

[1] https://issues.guix.gnu.org/51071

[-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #3: OpenPGP_signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

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

* [bug#62473] [PATCH v2 0/4] Remove spurious file, add env var
  2023-03-26 20:53 ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
  2023-03-27 16:51   ` reza via Guix-patches via
@ 2023-04-05 18:21   ` reza via Guix-patches via
  2023-05-04  8:04   ` [bug#62473] [PATCH v3 1/4] gnu: Add ftest reza via Guix-patches via
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-04-05 18:21 UTC (permalink / raw)
  To: 62473; +Cc: reza

Remove spurious patch file in gnu/local.mk and add WM_PROJECT_DIR
environment variable.

Reza Housseini (4):
  gnu: Add ftest.
  gnu: utfcpp: Update to 3.2.3.
  gnu: Add openfoam-org.
  gnu: Add openfoam-com.

 gnu/local.mk                                  |   1 -
 gnu/packages/check.scm                        |  34 ++
 .../patches/openfoam-4.1-cleanup.patch        | 243 ----------
 gnu/packages/simulation.scm                   | 444 ++++++++++++------
 gnu/packages/textutils.scm                    |  35 +-
 5 files changed, 355 insertions(+), 402 deletions(-)
 delete mode 100644 gnu/packages/patches/openfoam-4.1-cleanup.patch


base-commit: de84b24613afa4020f3f0553dad8e39a78d1f92c
-- 
2.39.2





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

* [bug#62473] [PATCH v2 1/4] gnu: Add ftest.
       [not found] ` <8e459feaf2d6a3d0f8720e72299e81259b9e6168.1680707361.git.reza@housseini.me>
@ 2023-04-05 18:21   ` reza via Guix-patches via
  2023-04-06 14:29     ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 Ludovic Courtès
  0 siblings, 1 reply; 31+ messages in thread
From: reza via Guix-patches via @ 2023-04-05 18:21 UTC (permalink / raw)
  To: 62473; +Cc: Reza Housseini

From: Reza Housseini <reza.housseini@gmail.com>

---
 gnu/packages/check.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 0c8777a074..9b58b2c09d 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -43,6 +43,7 @@
 ;;; Copyright © 2022 jgart <jgart@dismail.de>
 ;;; Copyright © 2023 Luis Felipe López Acevedo <luis.felipe.la@protonmail.com>
 ;;; Copyright © 2023 Timo Wilken <guix@twilken.net>
+;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,6 +66,7 @@ (define-module (gnu packages check)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
@@ -92,6 +94,7 @@ (define-module (gnu packages check)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
@@ -3531,6 +3534,7 @@ (define-public python-pytest-regressions
 that can be used to verify that future runs produce the same data.")
     (license license:expat)))
 
+
 (define-public guile-proba
   (package
     (name "guile-proba")
@@ -3606,3 +3610,33 @@ (define-public guile-proba
 to run test collections, and a library that includes a test runner and
 helpers for writing tests.")
     (license license:public-domain)))
+
+
+(define-public ftest
+  (package
+    (name "ftest")
+    (version "bf75576064fce2e07f52cd63a3e410f12358728b")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/nemtrif/ftest")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "01yjhjnlq2gci8hkc6favwj0axq7y1vvnradsgcffby6h09x00b4"))))
+    (build-system copy-build-system)
+    (native-inputs (list cmake-minimal))
+    (arguments
+     `(#:install-plan '(("ftest.h" "include/ftest/"))
+       #:phases (modify-phases %standard-phases
+                  (add-before 'install 'check
+                    (lambda _
+                      (with-directory-excursion "tests"
+                        (invoke "cmake" ".")
+                        (invoke "make")
+                        (invoke "ctest")))))))
+    (home-page "https://github.com/nemtrif/ftest")
+    (synopsis "Simple and limited unit-test framework for C++")
+    (description "A simple and limited unit-test framework for C++")
+    (license license:asl2.0)))
-- 
2.39.2






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

* [bug#62473] [PATCH v2 2/4] gnu: utfcpp: Update to 3.2.3.
       [not found] ` <622cad546298d2bd56fc4baf49dafeb8c9fa20b1.1680707361.git.reza@housseini.me>
@ 2023-04-05 18:21   ` reza via Guix-patches via
  2023-04-06 14:30     ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 Ludovic Courtès
  0 siblings, 1 reply; 31+ messages in thread
From: reza via Guix-patches via @ 2023-04-05 18:21 UTC (permalink / raw)
  To: 62473; +Cc: Reza Housseini

From: Reza Housseini <reza.housseini@gmail.com>

---
 gnu/packages/textutils.scm | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index fb8bc7e868..a08fb76543 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -25,6 +25,7 @@
 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
 ;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com>
 ;;; Copyright © 2022 Gabriel Wicki <gabriel@erlikon.ch>
+;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -57,6 +58,7 @@ (define-module (gnu packages textutils)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages golang)
@@ -671,30 +673,31 @@ (define-public catdoc
 (define-public utfcpp
   (package
     (name "utfcpp")
-    (version "2.3.5")
+    (version "3.2.3")
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                     (url "https://github.com/nemtrif/utfcpp")
-                     (commit (string-append "v" version))))
+                    (url "https://github.com/nemtrif/utfcpp")
+                    (commit (string-append "v" version))))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1gr98d826z6wa58r1s5i7rz7q2x3r31v7zj0pjjlrc7gfxwklr4s"))))
+                "00hzh39iddbc6nxg13813qd6d55g2kccwjf5dr96wykfhway9wbr"))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          ;; delete bundled dependencies
+                          (delete-file-recursively "extern")
+                          (substitute* (list "tests/apitests.cpp"
+                                             "tests/noexceptionstests.cpp"
+                                             "tests/test_cpp11.cpp"
+                                             "tests/test_cpp17.cpp")
+                            (("\"\\.\\./extern/ftest/ftest.h\"")
+                             "<ftest/ftest.h>"))))))
     (build-system cmake-build-system)
+    (native-inputs (list ftest))
     (arguments
-     `(#:out-of-source? #f
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'install              ; no install target
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (include (string-append out "/include"))
-                    (doc (string-append out "/share/doc/" ,name)))
-               (copy-recursively "source" include)
-               (install-file "README.md" doc)
-               #t))))))
-    (home-page "https://github.com/nemtrif/utfcpp")
+     `(#:build-type "Release"))
+    (home-page "https://utfcpp.sourceforge.net")
     (synopsis "Portable C++ library for handling UTF-8")
     (description "UTF8-CPP is a C++ library for handling UTF-8 encoded text
 in a portable way.")
-- 
2.39.2






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

* [bug#62473] [PATCH v2 3/4] gnu: Add openfoam-org.
       [not found] ` <d4b6b174d56867b447ac5cff1aa02c3fea055fa0.1680707361.git.reza@housseini.me>
@ 2023-04-05 18:21   ` reza via Guix-patches via
  2023-04-06 14:33     ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 Ludovic Courtès
  0 siblings, 1 reply; 31+ messages in thread
From: reza via Guix-patches via @ 2023-04-05 18:21 UTC (permalink / raw)
  To: 62473; +Cc: reza

---
 gnu/local.mk                                  |   1 -
 .../patches/openfoam-4.1-cleanup.patch        | 243 -----------
 gnu/packages/simulation.scm                   | 405 ++++++++++++------
 3 files changed, 263 insertions(+), 386 deletions(-)
 delete mode 100644 gnu/packages/patches/openfoam-4.1-cleanup.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 64a1268fbe..14a7fe4025 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1617,7 +1617,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/openboardview-use-system-imgui.patch	\
   %D%/packages/patches/openboardview-use-system-utf8.patch	\
   %D%/packages/patches/openbox-python3.patch			\
-  %D%/packages/patches/openfoam-4.1-cleanup.patch			\
   %D%/packages/patches/openjdk-10-idlj-reproducibility.patch	\
   %D%/packages/patches/openjdk-15-xcursor-no-dynamic.patch	\
   %D%/packages/patches/openmpi-mtl-priorities.patch		\
diff --git a/gnu/packages/patches/openfoam-4.1-cleanup.patch b/gnu/packages/patches/openfoam-4.1-cleanup.patch
deleted file mode 100644
index 37effa5c9c..0000000000
--- a/gnu/packages/patches/openfoam-4.1-cleanup.patch
+++ /dev/null
@@ -1,243 +0,0 @@
-# This patch removes all need for the ThirdParty files of OpenFOAM.
-
-# Derived from EasyBuild patch by Ward Poelmans <wpoely86@gmail.com>.
-# Modified for GNU Guix by Paul Garlick <pgarlick@tourbillion-technology.com>.
-
-diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
---- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake
-+++ OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
-@@ -9,7 +9,7 @@
- #
- # use readline if available
- #
--if [ -f /usr/include/readline/readline.h ]
-+if true
- then
-     echo "Found <readline/readline.h>  --  enabling readline support."
-     export COMP_FLAGS="-DHAS_READLINE"
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/bashrc OpenFOAM-4.x-version-4.1/etc/bashrc
---- OpenFOAM-4.x-version-4.1.org/etc/bashrc
-+++ OpenFOAM-4.x-version-4.1/etc/bashrc
-@@ -43,8 +43,10 @@
- # Please set to the appropriate path if the default is not correct.
- #
- [ $BASH_SOURCE ] && \
--export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \
-+export FOAM_INST_DIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) || \
- export FOAM_INST_DIR=$HOME/$WM_PROJECT
-+# For GNU Guix: set initially for build then re-set at runtime
-+#
- # export FOAM_INST_DIR=~$WM_PROJECT
- # export FOAM_INST_DIR=/opt/$WM_PROJECT
- # export FOAM_INST_DIR=/usr/local/$WM_PROJECT
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL
-@@ -36,37 +36,7 @@
- #
- #------------------------------------------------------------------------------
-
--boost_version=boost-system
--cgal_version=cgal-system
--#cgal_version=CGAL-4.8
--
--if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ]
--then
--
--    common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
--
--    export BOOST_ARCH_PATH=$common_path/$boost_version
--    export CGAL_ARCH_PATH=$common_path/$cgal_version
--
--    if [ "$FOAM_VERBOSE" -a "$PS1" ]
--    then
--        echo "Using CGAL and boost" 1>&2
--        echo "    $cgal_version at $CGAL_ARCH_PATH" 1>&2
--        echo "    $boost_version at $BOOST_ARCH_PATH" 1>&2
--    fi
--
--    if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ]
--    then
--        _foamAddLib $CGAL_ARCH_PATH/lib
--    fi
--
--    if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ]
--    then
--        _foamAddLib $BOOST_ARCH_PATH/lib
--    fi
--
--    unset boost_version cgal_version common_path
--
--fi
-+export CGAL_ARCH_PATH=$CGAL_ROOT
-+export BOOST_ARCH_PATH=$BOOST_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools
-@@ -29,13 +29,5 @@
- #
- #------------------------------------------------------------------------------
-
--version=svn
--gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
--
--GPERFTOOLS_VERSION=gperftools-$version
--GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION
--
--export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH
--export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-version-4.1/etc/config.sh/metis
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/metis
-@@ -34,7 +34,7 @@
- #
- #------------------------------------------------------------------------------
-
--export METIS_VERSION=metis-5.1.0
--export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION
-+export METIS_VERSION=metis-$METISVERSION
-+export METIS_ARCH_PATH=$METIS_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch OpenFOAM-4.x-version-4.1/etc/config.sh/scotch
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/scotch
-@@ -37,7 +37,7 @@
- #
- #------------------------------------------------------------------------------
-
--export SCOTCH_VERSION=scotch_6.0.3
--export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION
-+export SCOTCH_VERSION=scotch_$SCOTCHVERSION
-+export SCOTCH_ARCH_PATH=$SCOTCH_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings OpenFOAM-4.x-version-4.1/etc/config.sh/settings
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/settings
-@@ -279,6 +279,9 @@
-     ;;
- system)
-     # Use system compiler
-+    # Use system GMP and MPFR packages
-+    export GMP_ARCH_PATH=$GMP_ROOT
-+    export MPFR_ARCH_PATH=$MPFR_ROOT
-     ;;
- *)
-     echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
-@@ -5,8 +5,7 @@
-     $(PFLAGS) $(PINC) \
-     -I$(SCOTCH_ROOT)/include \
-     -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
--    -I/usr/include/scotch \
-     -I../decompositionMethods/lnInclude
-
- LIB_LIBS = \
--    -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
-+    -L$(SCOTCH_ROOT)/lib -L$(MPI_ARCH_PATH)/lib -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options
-@@ -9,8 +9,7 @@
-     $(PFLAGS) $(PINC) \
-     -I$(SCOTCH_ROOT)/include \
-     -I$(SCOTCH_ARCH_PATH)/include \
--    -I/usr/include/scotch \
-     -I../decompositionMethods/lnInclude
-
- LIB_LIBS = \
--    -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt
-+    -L$(SCOTCH_ROOT)/lib -lscotch -lscotcherrexit -lrt
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general
---- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general
-+++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general
-@@ -33,7 +33,6 @@
- # The Makefile uses a POSIX shell
- #------------------------------------------------------------------------------
- 
--SHELL           = /bin/sh
- 
- 
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmake OpenFOAM-4.x-version-4.1/wmake/wmake
---- OpenFOAM-4.x-version-4.1.org/wmake/wmake
-+++ OpenFOAM-4.x-version-4.1/wmake/wmake
-@@ -163,7 +163,7 @@
- then
-     if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ]
-     then
--        lockDir=$HOME/.$WM_PROJECT/.wmake
-+        lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- 
-         if [ -d $lockDir ]
-         then
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler
---- OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler
-+++ OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler
-@@ -53,7 +53,7 @@
- # csh sets HOST, bash sets HOSTNAME
- : ${HOST:=$HOSTNAME}
- 
--lockDir=$HOME/.$WM_PROJECT/.wmake
-+lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- 
- # Fallback - 1 core on current host
- : ${WM_HOSTS:=$HOST:1}
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime
---- OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime
-+++ OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime
-@@ -53,7 +53,7 @@
- # csh sets HOST, bash sets HOSTNAME
- : ${HOST:=$HOSTNAME}
- 
--lockDir=$HOME/.$WM_PROJECT/.wmake
-+lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- # Fallback - 1 core on current host
- : ${WM_HOSTS:=$HOST:1}
- 
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C
-@@ -67,7 +67,7 @@
- 
-     // Processor weights initialised with no size, only used if specified in
-     // a file
--    Field<scalar> processorWeights;
-+    Field<floatScalar> processorWeights;
- 
-     // Cell weights (so on the vertices of the dual)
-     List<label> cellWeights;
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL
---- OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL
-+++ OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL
-@@ -6,9 +6,10 @@
-     -I/usr/include
- 
- CGAL_LIBS = \
--    -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
--    -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-+    -L$(MPFR_ARCH_PATH)/lib \
-+    -L$(GMP_ARCH_PATH)/lib \
-     -L$(BOOST_ARCH_PATH)/lib \
-     -L$(CGAL_ARCH_PATH)/lib \
-     -lCGAL \
-+    -lgmp \
-     -lmpfr
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++
---- OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++
-+++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++
-@@ -20,5 +20,5 @@
-
- LINK_LIBS   = $(c++DBUG)
-
--LINKLIBSO   = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
--LINKEXE     = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
-+LINKLIBSO   = $(CC) $(c++FLAGS) $(LDFLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
-+LINKEXE     = $(CC) $(c++FLAGS) $(LDFLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 059be5a2be..a4df23785a 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 Eric Bavier <bavier@posteo.net>
 ;;; Copyright © 2022 Liliana Marie Prikler <liliana.prikler@gmail.com>
+;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@ (define-module (gnu packages simulation)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
+  #:use-module (gnu packages engineering)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gettext)
@@ -41,22 +43,29 @@ (define-module (gnu packages simulation)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages iso-codes)
+  #:use-module (gnu packages image-processing)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages pdf)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-science)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages serialization)
+  #:use-module (gnu packages ssh)
+  #:use-module (gnu packages textutils)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
+  #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (guix download)
@@ -75,175 +84,287 @@ (define-module (gnu packages simulation)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1))
 
-(define-public openfoam
+(define-public openfoam-org
   (package
-    (name "openfoam")
-    (version "4.1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append
-             "http://dl.openfoam.org/source/"
-             (string-map (lambda (x) (if (eq? x #\.) #\- x)) version)))
-       (file-name (string-append name "-" version ".tar.gz"))
-       (sha256
-        (base32 "0cgxh4h2hf50qbvvdg5miwc2nympb0nrv3md96vb3gbs9vk8vq9d"))
-       (patches (search-patches "openfoam-4.1-cleanup.patch"))
-       (modules '((guix build utils)))
-       (snippet
-        '(begin
-           ;; Include <sys/sysmacros.h>, which is where glibc >= 2.28 provides
-           ;; 'major' and 'minor'.
-           (substitute* "src/OSspecific/POSIX/fileStat.C"
-             (("#include <unistd\\.h>")
-              "#include <unistd.h>\n#include <sys/sysmacros.h>\n"))
-           #t))))
+    (name "openfoam-org")
+    (version "10.20221128")
+    (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
+                "0yd924nhck4jh9gf1wrdnk8svj38yicg4803q79nnjqhn6lcq8c5"))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          ;; patch shell paths
+                          (substitute* (list "wmake/src/Makefile"
+                                             "wmake/makefiles/general")
+                            (("/bin/sh")
+                             which "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)))
+                          ;; add expand flag to RunFunctions
+                          (substitute* "bin/tools/RunFunctions"
+                            (("foamDictionary (.*)" all args)
+                             (string-append "foamDictionary -expand " args)))))))
     (build-system gnu-build-system)
-    (inputs
-     `(("boost" ,boost)
-       ("cgal" ,cgal)
-       ("flex" ,flex)
-       ("git" ,git)
-       ("gmp" ,gmp)
-       ("libxt" ,libxt)
-       ("metis" ,metis)
-       ("mpfr" ,mpfr)
-       ("ncurses" ,ncurses)
-       ("readline" ,readline)
-       ("scotch" ,pt-scotch32)
-       ("zlib" ,zlib)))
-    (native-inputs
-     (list bison))
-    (propagated-inputs
-     (list gzip gnuplot openmpi))
-    (outputs '("debug"                  ;~60MB
+    (inputs (list boost
+                  cgal
+                  git
+                  gmp
+                  libxt
+                  metis
+                  mpfr
+                  ncurses
+                  readline
+                  pt-scotch32
+                  zlib
+                  openmpi
+                  paraview-5.9
+                  openssh))
+    (native-inputs (list bison
+                         flex
+                         ;; paraview plugin dependencies
+                         cmake-minimal
+                         vtk
+                         libxml2
+                         libogg
+                         libtheora
+                         ffmpeg
+                         gl2ps
+                         libpng
+                         libharu
+                         jsoncpp
+                         netcdf
+                         hdf5
+                         gdal
+                         libx11
+                         qtbase-5
+                         eigen
+                         glew
+                         python
+                         expat
+                         xz
+                         utfcpp
+                         lz4
+                         double-conversion
+                         libjpeg-turbo
+                         libtiff
+                         freetype
+                         pugixml
+                         cgns
+                         qtsvg-5
+                         qttools-5
+                         protobuf
+                         qtxmlpatterns))
+    (propagated-inputs (list gnuplot))
+    (outputs '("debug" ;~60MB
                "out"))
     (arguments
-     `( ;; Executable files and shared libraries are located in the 'platforms'
+     `( ;Executable files and shared libraries are located in the 'platforms'
        ;; subdirectory.
-       #:strip-directories (list (string-append
-                                  "lib/OpenFOAM-" ,version
-                                  "/platforms/linux64GccDPInt32Opt/bin")
-                                 (string-append
-                                  "lib/OpenFOAM-" ,version
-                                  "/platforms/linux64GccDPInt32Opt/lib"))
-       #:tests? #f                                ; no tests to run
+       #:strip-directories (list (string-append "share/OpenFOAM-"
+                                                ,version
+                                                "/platforms/linux64GccDPInt32Opt/bin")
+                                 (string-append "share/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-after 'unpack 'rename-build-directory
+                  (add-after 'unpack 'set-same-version-as-guix
                     (lambda _
-                      (chdir "..")
-                      ;; Use 'OpenFOAM-version' convention to match the file
-                      ;; name expectations in the build phase.
-                      (let ((unpack-dir (string-append
-                                         (getcwd) "/"
-                                         (list-ref (scandir (getcwd) (lambda (name)
-                                                                       (string-match "^OpenFOAM" name))) 0)))
-                            (build-dir (string-append
-                                        (getcwd) "/OpenFOAM-" ,version)))
-                        (rename-file unpack-dir build-dir) ; rename build directory
-                        (chdir (basename build-dir))) ; move to build directory
-                      #t))
-                  (delete 'configure)             ; no configure phase
-                  (replace 'build
+                      (substitute* "etc/bashrc"
+                        (("^export WM_PROJECT_VERSION=.*$")
+                         (string-append "export WM_PROJECT_VERSION="
+                                        ,version "\n"))) #t))
+                  (add-before 'build 'patch-HOME-path
                     (lambda _
-                      (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch")))
-                        ;; set variables to define store paths
-                        (for-each (lambda (library)
-                                    (setenv (string-append
-                                             (string-upcase library) "_ROOT")
-                                            (assoc-ref %build-inputs library))) libraries))
-                      ;; set variables to define package versions
-                      (setenv "SCOTCHVERSION" ,(package-version scotch))
-                      (setenv "METISVERSION" ,(package-version metis))
-                      ;; set variable to pass extra 'rpath' arguments to linker
-                      (setenv "LDFLAGS"
-                              (string-append
-                               "-Wl,"
-                               "-rpath=" %output "/lib/OpenFOAM-" ,version
-                               "/platforms/linux64GccDPInt32Opt/lib,"
-                               "-rpath=" %output "/lib/OpenFOAM-" ,version
-                               "/platforms/linux64GccDPInt32Opt/lib/dummy"))
-                      ;; compile OpenFOAM libraries and applications
-                      (zero? (system (format #f
-                                             "source ./etc/bashrc && ./Allwmake -j~a"
-                                             (parallel-job-count))))))
-                  (add-after 'build 'update-configuration-files
+                      (setenv "HOME" "/tmp") #t))
+                  (add-before 'build 'patch-scotch
                     (lambda _
-                      ;; record store paths and package versions in
-                      ;; configuration files
-                      (substitute* "etc/config.sh/CGAL"
-                        (("$BOOST_ROOT") (getenv "BOOST_ROOT")))
-                      (substitute* "etc/config.sh/CGAL"
-                        (("$CGAL_ROOT") (getenv "CGAL_ROOT")))
-                      (substitute* "etc/config.sh/metis"
-                        (("$METIS_ROOT") (getenv "METIS_ROOT")))
-                      (substitute* "etc/config.sh/metis"
-                        (("$METISVERSION") (getenv "METISVERSION")))
-                      (substitute* "etc/config.sh/scotch"
-                        (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT")))
                       (substitute* "etc/config.sh/scotch"
-                        (("$SCOTCHVERSION") (getenv "SCOTCHVERSION")))
-                      (substitute* "etc/config.sh/settings"
-                        (("$GMP_ROOT") (getenv "GMP_ROOT")))
-                      (substitute* "etc/config.sh/settings"
-                        (("$MPFR_ROOT") (getenv "MPFR_ROOT")))
-                      ;; reset lockDir variable to refer to write-enabled
-                      ;; directory
-                      (substitute* "wmake/wmake"
-                        (("        lockDir=.*$")
-                         "        lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      (substitute* "wmake/wmakeScheduler"
-                        (("lockDir=.*$")
-                         "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      (substitute* "wmake/wmakeSchedulerUptime"
-                        (("lockDir=.*$")
-                         "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      #t))
+                        (("^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-5.9) "\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-"
+                                                ,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-5.9)))))
+                        (substitute* "wmake/rules/linux64Gcc/c++"
+                          (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
+                           (string-append all " " ldflags)))) #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 unncessary, voluminous object and dep files.
+                    ;; Avoid unnecessary, voluminous object and dep files.
                     (lambda _
-                      (delete-file-recursively
-                       "platforms/linux64GccDPInt32Opt/src")
-                      (delete-file-recursively
-                       "platforms/linux64GccDPInt32OptSYSTEMOPENMPI")
-                      (for-each delete-file (find-files "." "\\.o$"))
-                      #t))
+                      (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 _
                       ;; use 'OpenFOAM-version' convention
-                      (let ((install-dir (string-append
-                                          %output "/lib/OpenFOAM-" ,version)))
-                        (mkdir-p install-dir)     ; create install directory
+                      (let ((install-dir (string-append %output
+                                                        "/share/OpenFOAM-"
+                                                        ,version)))
+                        (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 _
-                      ;; add symbolic link for standard 'bin' directory
-                      (symlink
-                       (string-append "./lib/OpenFOAM-" ,version
-                                      "/platforms/linux64GccDPInt32Opt/bin")
-                       (string-append %output "/bin"))
-                      #t)))))
+                      (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)))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "WM_PROJECT_DIR")
+            (separator #f)
+            (files '("")))))
     ;; Note:
-    ;;  Tutorial files are installed read-only in /gnu/store.
-    ;;  To allow write permissions on files copied from the store a
-    ;;  'chmod' step is needed before running the applications.  For
-    ;;  example, from a user's login:
-    ;;  $ source $GUIX_PROFILE/lib/OpenFOAM-4.1/etc/bashrc
-    ;;  $ mkdir -p $FOAM_RUN
-    ;;  $ cd $FOAM_RUN
-    ;;  $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
-    ;;  $ cd pitzDaily
-    ;;  $ chmod -R u+w .
-    ;;  $ blockMesh
+    ;; 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
+    (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
-- 
2.39.2


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

* [bug#62473] [PATCH v2 4/4] gnu: Add openfoam-com.
       [not found] ` <83f2db8384fdd419a9a75a4f00338a1fbbab52b4.1680707361.git.reza@housseini.me>
@ 2023-04-05 18:21   ` reza via Guix-patches via
  2023-04-06 14:36     ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 Ludovic Courtès
  0 siblings, 1 reply; 31+ messages in thread
From: reza via Guix-patches via @ 2023-04-05 18:21 UTC (permalink / raw)
  To: 62473; +Cc: reza

---
 gnu/packages/simulation.scm | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index a4df23785a..15fff6e57c 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -375,6 +375,45 @@ (define-public openfoam-org
     (license license:gpl3+)
     (home-page "https://openfoam.org")))
 
+(define-public openfoam-com
+  (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
+                          ;; patch shell paths
+                          (substitute* (list "src/OSspecific/POSIX/POSIX.C"
+                                             "wmake/src/Makefile"
+                                             "wmake/makefiles/general"
+                                             "wmake/makefiles/info")
+                            (("/bin/sh")
+                             which "sh"))))))
+    (description
+     "OpenFOAM is a free, open source CFD software released and developed by
+OpenCFD Ltd since 2004.  It has a large user base across most areas of
+engineering and science, from both commercial and academic organizations.
+OpenFOAM has an extensive range of features to solve anything from complex
+fluid flows involving chemical reactions, turbulence and heat transfer, to
+acoustics, solid mechanics and electromagnetics.  See documentation OpenFOAM
+is professionally released every six months to include customer sponsored
+developments and contributions from the community - individual and group
+contributors, integrations (eg, from FOAM-extend and OpenFOAM Foundation Ltd)
+as well as governance guided activities.")
+    (home-page "https://www.openfoam.com")))
+
 (define-public open-simulation-interface
   (package
     (name "open-simulation-interface")
-- 
2.39.2






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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
  2023-04-05 18:21   ` [bug#62473] [PATCH v2 1/4] gnu: Add ftest reza via Guix-patches via
@ 2023-04-06 14:29     ` Ludovic Courtès
       [not found]       ` <72de2b1c-2a2d-c640-6246-caaf71e62263@housseini.me>
  0 siblings, 1 reply; 31+ messages in thread
From: Ludovic Courtès @ 2023-04-06 14:29 UTC (permalink / raw)
  To: reza; +Cc: 62473, Reza Housseini

Hi Reza,

Great work, it’s good to have an OpenFoam update!

Some comments follow.

reza <reza@housseini.me> skribis:

> From: Reza Housseini <reza.housseini@gmail.com>
> 
> ---
>  gnu/packages/check.scm | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)

Your mail user agent apparently added DOS-style line endings, which I
think is the reason why <https://qa.guix.gnu.org/issue/62473> doesn’t
have any info.

Could you try to use ‘git send-email’ in the future, to avoid that kind
of issue?

> +(define-public ftest
> +  (package
> +    (name "ftest")
> +    (version "bf75576064fce2e07f52cd63a3e410f12358728b")

That’s not a reasonable version string; see
<https://guix.gnu.org/manual/devel/en/html_node/Version-Numbers.html>
on how to derive version strings for Git checkouts.

Furthermore, when packaging a snapshot (as opposed to a tagged release),
please add a short comment explaining why we’re not providing a release.

> +    (build-system copy-build-system)
> +    (native-inputs (list cmake-minimal))

Perhaps use ‘cmake-build-system’?

> +    (synopsis "Simple and limited unit-test framework for C++")
> +    (description "A simple and limited unit-test framework for C++")

Please write a full sentence:

  https://guix.gnu.org/manual/devel/en/html_node/Synopses-and-Descriptions.html

Ludo’.




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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
  2023-04-05 18:21   ` [bug#62473] [PATCH v2 2/4] gnu: utfcpp: Update to 3.2.3 reza via Guix-patches via
@ 2023-04-06 14:30     ` Ludovic Courtès
  0 siblings, 0 replies; 31+ messages in thread
From: Ludovic Courtès @ 2023-04-06 14:30 UTC (permalink / raw)
  To: reza; +Cc: 62473, Reza Housseini

reza <reza@housseini.me> skribis:

> From: Reza Housseini <reza.housseini@gmail.com>
> 
> ---
>  gnu/packages/textutils.scm | 35 +++++++++++++++++++----------------
>  1 file changed, 19 insertions(+), 16 deletions(-)

This one LGTM, as long as dependents shown by ‘guix refresh -l utfcpp’
still work after this.

Ludo’.




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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
  2023-04-05 18:21   ` [bug#62473] [PATCH v2 3/4] gnu: Add openfoam-org reza via Guix-patches via
@ 2023-04-06 14:33     ` Ludovic Courtès
       [not found]       ` <1061a4d6-ea54-6437-9e28-a64c3c091b0a@housseini.me>
  0 siblings, 1 reply; 31+ messages in thread
From: Ludovic Courtès @ 2023-04-06 14:33 UTC (permalink / raw)
  To: reza; +Cc: 62473

reza <reza@housseini.me> skribis:

> ---
>  gnu/local.mk                                  |   1 -
>  .../patches/openfoam-4.1-cleanup.patch        | 243 -----------
>  gnu/packages/simulation.scm                   | 405 ++++++++++++------
>  3 files changed, 263 insertions(+), 386 deletions(-)
>  delete mode 100644 gnu/packages/patches/openfoam-4.1-cleanup.patch

BTW, please consider adding ChangeLog-style commit log, as per the
project’s conventions:

  https://guix.gnu.org/manual/devel/en/html_node/Submitting-Patches.html

(We can help you if needed.)

> -(define-public openfoam
> +(define-public openfoam-org

Maybe add:

  (define-public openfoam
    (deprecated-package "openfoam" openfoam-org))

Otherwise LGTM.




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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
  2023-04-05 18:21   ` [bug#62473] [PATCH v2 4/4] gnu: Add openfoam-com reza via Guix-patches via
@ 2023-04-06 14:36     ` Ludovic Courtès
       [not found]       ` <ed4f586d-4bbf-61e3-4f88-97d81882bf7b@housseini.me>
  0 siblings, 1 reply; 31+ messages in thread
From: Ludovic Courtès @ 2023-04-06 14:36 UTC (permalink / raw)
  To: reza; +Cc: 62473

reza <reza@housseini.me> skribis:

> +(define-public openfoam-com
> +  (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
> +                          ;; patch shell paths
> +                          (substitute* (list "src/OSspecific/POSIX/POSIX.C"
> +                                             "wmake/src/Makefile"
> +                                             "wmake/makefiles/general"
> +                                             "wmake/makefiles/info")
> +                            (("/bin/sh")
> +                             which "sh"))))))
> +    (description
> +     "OpenFOAM is a free, open source CFD software released and developed by
> +OpenCFD Ltd since 2004.  It has a large user base across most areas of
> +engineering and science, from both commercial and academic organizations.

This is not OK:

  https://guix.gnu.org/manual/devel/en/html_node/Synopses-and-Descriptions.html

You can keep the description of ‘openfoam-org’, which is inherited.
However, please provide at least a different ‘synopsis’ to show how it
differs from ‘openfoam-org’.

Is the license the same for both?

Does “com” stand for “commercial”, and if so, what are the implications?

Thanks in advance,
Ludo’.




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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
       [not found]       ` <72de2b1c-2a2d-c640-6246-caaf71e62263@housseini.me>
@ 2023-04-06 14:42         ` reza via Guix-patches via
  2023-04-18 20:06           ` Ludovic Courtès
  0 siblings, 1 reply; 31+ messages in thread
From: reza via Guix-patches via @ 2023-04-06 14:42 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 62473

[-- Attachment #1: Type: text/plain, Size: 1586 bytes --]

> Great work, it’s good to have an OpenFoam update!

Yes this was a great hassle to finally compile, but I hope I made it 
future proof so there is not too much work for updates.
>> ---
>>   gnu/packages/check.scm | 34 ++++++++++++++++++++++++++++++++++
>>   1 file changed, 34 insertions(+)
> 
> Your mail user agent apparently added DOS-style line endings, which I
> think is the reason why <https://qa.guix.gnu.org/issue/62473> doesn’t
> have any info.
> 
> Could you try to use ‘git send-email’ in the future, to avoid that kind
> of issue?

This is strange, I use git send-email from a linux machine for the patches?

>> +(define-public ftest
>> +  (package
>> +    (name "ftest")
>> +    (version "bf75576064fce2e07f52cd63a3e410f12358728b")
> 
> That’s not a reasonable version string; see
> <https://guix.gnu.org/manual/devel/en/html_node/Version-Numbers.html>
> on how to derive version strings for Git checkouts.
> 
> Furthermore, when packaging a snapshot (as opposed to a tagged release),
> please add a short comment explaining why we’re not providing a release.

I'm not sure how to proceed here, there aren't any releases and it looks 
more like a small side project. I included it for completness but maybe 
we should drop it and skip the tests for utfcpp?

>> +    (build-system copy-build-system)
>> +    (native-inputs (list cmake-minimal))
> 
> Perhaps use ‘cmake-build-system’?

There is only a CMakeLists.txt file for the tests but not for the 
source, shall I provide one?

Thanks for looking into this!


[-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #3: OpenPGP_signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
       [not found]       ` <1061a4d6-ea54-6437-9e28-a64c3c091b0a@housseini.me>
@ 2023-04-06 14:46         ` reza via Guix-patches via
  0 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-04-06 14:46 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 62473

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

> BTW, please consider adding ChangeLog-style commit log, as per the
> project’s conventions:
> 
>    https://guix.gnu.org/manual/devel/en/html_node/Submitting-Patches.html
> 
> (We can help you if needed.)

Will try to adhere to it in a new revision, feedback is definitely welcome.

>> -(define-public openfoam
>> +(define-public openfoam-org
> 
> Maybe add:
> 
>    (define-public openfoam
>      (deprecated-package "openfoam" openfoam-org))

Ok will add it to the updated patch revision


[-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #3: OpenPGP_signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
       [not found]       ` <ed4f586d-4bbf-61e3-4f88-97d81882bf7b@housseini.me>
@ 2023-04-06 14:52         ` reza via Guix-patches via
  2023-04-18 20:09           ` Ludovic Courtès
  0 siblings, 1 reply; 31+ messages in thread
From: reza via Guix-patches via @ 2023-04-06 14:52 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 62473

[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]

> This is not OK:
> 
>    https://guix.gnu.org/manual/devel/en/html_node/Synopses-and-Descriptions.html
> 
> You can keep the description of ‘openfoam-org’, which is inherited.
> However, please provide at least a different ‘synopsis’ to show how it
> differs from ‘openfoam-org’.

Ok will change thy synopsis.

> Is the license the same for both?

They have the same license (GPL3.0)

> Does “com” stand for “commercial”, and if so, what are the implications?

"com" stands for the website "openfoam.com". The project forked at some 
point and now there are two almost identical code bases. openfoam-com 

which is maintained by a company has more rapid development in favor of 
stability while openfoam-org stays more conservative with code additions 
but being more stable therefore.

I don't know how to handle the almost identical builds of this two code 
bases, shall I make a function? There is also an issue with the version 
of openfoam-org getting used in the build of openfoam-com, maybe this is 
a bug?

[-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #3: OpenPGP_signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
  2023-04-06 14:42         ` reza via Guix-patches via
@ 2023-04-18 20:06           ` Ludovic Courtès
  0 siblings, 0 replies; 31+ messages in thread
From: Ludovic Courtès @ 2023-04-18 20:06 UTC (permalink / raw)
  To: reza; +Cc: 62473, Reza Housseini

Hi,

reza <reza@housseini.me> skribis:

>>> +(define-public ftest
>>> +  (package
>>> +    (name "ftest")
>>> +    (version "bf75576064fce2e07f52cd63a3e410f12358728b")
>> 
>> That’s not a reasonable version string; see
>> <https://guix.gnu.org/manual/devel/en/html_node/Version-Numbers.html>
>> on how to derive version strings for Git checkouts.
>> 
>> Furthermore, when packaging a snapshot (as opposed to a tagged release),
>> please add a short comment explaining why we’re not providing a release.
>
> I'm not sure how to proceed here, there aren't any releases and it looks 
> more like a small side project. I included it for completness but maybe 
> we should drop it and skip the tests for utfcpp?

You can keep it; just add a comment with the explanation you wrote
above, and make sure the version string is built as show in the manual
page above.

>>> +    (build-system copy-build-system)
>>> +    (native-inputs (list cmake-minimal))
>> 
>> Perhaps use ‘cmake-build-system’?
>
> There is only a CMakeLists.txt file for the tests but not for the 
> source, shall I provide one?

Oh, weird.  Then just add a comment stating that and keep it this way.

Thanks,
Ludo’.




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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
  2023-04-06 14:52         ` reza via Guix-patches via
@ 2023-04-18 20:09           ` Ludovic Courtès
  0 siblings, 0 replies; 31+ messages in thread
From: Ludovic Courtès @ 2023-04-18 20:09 UTC (permalink / raw)
  To: reza; +Cc: 62473

Hi,

reza <reza@housseini.me> skribis:

>> Does “com” stand for “commercial”, and if so, what are the implications?
>
> "com" stands for the website "openfoam.com". The project forked at some 
> point and now there are two almost identical code bases. openfoam-com 
>
> which is maintained by a company has more rapid development in favor of 
> stability while openfoam-org stays more conservative with code additions 
> but being more stable therefore.

Interesting situation.  :-)

> I don't know how to handle the almost identical builds of this two code 
> bases, shall I make a function?

No, I think it’s fine to inherit like you did.

> There is also an issue with the version of openfoam-org getting used
> in the build of openfoam-com, maybe this is a bug?

Given your description above, it’s surprising that one depends on the
other.  If there is such a dependency, then it might be worth reporting
upstream as a bug or asking for clarifications.

Thanks for your replies!

Ludo’.




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

* [bug#62473] [PATCH v3 1/4] gnu: Add ftest.
  2023-03-26 20:53 ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
  2023-03-27 16:51   ` reza via Guix-patches via
  2023-04-05 18:21   ` [bug#62473] [PATCH v2 0/4] Remove spurious file, add env var reza via Guix-patches via
@ 2023-05-04  8:04   ` reza via Guix-patches via
  2023-06-15 21:56     ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 Ludovic Courtès
  2023-06-24 21:38   ` [bug#62473] [PATCH v4 1/2] gnu: Add openfoam-org. Deprecate openfoam reza via Guix-patches via
                     ` (3 subsequent siblings)
  6 siblings, 1 reply; 31+ messages in thread
From: reza via Guix-patches via @ 2023-05-04  8:04 UTC (permalink / raw)
  To: 62473; +Cc: reza

* gnu/packages/check.scm (ftest): New variable.
---
 gnu/packages/check.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 17c2b7284e..8772095944 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -43,6 +43,7 @@
 ;;; Copyright © 2022 jgart <jgart@dismail.de>
 ;;; Copyright © 2023 Luis Felipe López Acevedo <luis.felipe.la@protonmail.com>
 ;;; Copyright © 2023 Timo Wilken <guix@twilken.net>
+;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,6 +66,7 @@ (define-module (gnu packages check)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
@@ -92,6 +94,7 @@ (define-module (gnu packages check)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
@@ -3530,3 +3533,36 @@ (define-public guile-proba
 to run test collections, and a library that includes a test runner and
 helpers for writing tests.")
     (license license:public-domain)))
+
+(define-public ftest
+  (package
+    (name "ftest")
+    ;; There aren't any releases and it looks
+    ;; more like a small side project. It is included for
+    ;; completness to run tests for package utfcpp
+    (version "bf75576064fce2e07f52cd63a3e410f12358728b")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/nemtrif/ftest")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "01yjhjnlq2gci8hkc6favwj0axq7y1vvnradsgcffby6h09x00b4"))))
+    ;; No CMakeLists.txt file provided, only one to run tests
+    (build-system copy-build-system)
+    (native-inputs (list cmake-minimal))
+    (arguments
+     `(#:install-plan '(("ftest.h" "include/ftest/"))
+       #:phases (modify-phases %standard-phases
+                  (add-before 'install 'check
+                    (lambda _
+                      (with-directory-excursion "tests"
+                        (invoke "cmake" ".")
+                        (invoke "make")
+                        (invoke "ctest")))))))
+    (home-page "https://github.com/nemtrif/ftest")
+    (synopsis "Simple and limited unit-test framework for C++")
+    (description "A simple and limited unit-test framework for C++")
+    (license license:asl2.0)))

base-commit: 7a0a186a32524d4156bf96786d708fab323cebff
-- 
2.39.2






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

* [bug#62473] [PATCH v3 2/4] gnu: utfcpp: Update to 3.2.3.
       [not found] ` <2b6a4965ceb4f835b949e4d9a03f51b0facf54f9.1683187409.git.reza@housseini.me>
@ 2023-05-04  8:04   ` reza via Guix-patches via
  0 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-05-04  8:04 UTC (permalink / raw)
  To: 62473; +Cc: reza

* gnu/packages/textutils.scm (utfcpp): Update to 3.2.3.
---
 gnu/packages/textutils.scm | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index d7cb217e17..40a5c01242 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -25,6 +25,7 @@
 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
 ;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com>
 ;;; Copyright © 2022 Gabriel Wicki <gabriel@erlikon.ch>
+;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -57,6 +58,7 @@ (define-module (gnu packages textutils)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages golang)
@@ -685,30 +687,31 @@ (define-public catdoc
 (define-public utfcpp
   (package
     (name "utfcpp")
-    (version "2.3.5")
+    (version "3.2.3")
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                     (url "https://github.com/nemtrif/utfcpp")
-                     (commit (string-append "v" version))))
+                    (url "https://github.com/nemtrif/utfcpp")
+                    (commit (string-append "v" version))))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1gr98d826z6wa58r1s5i7rz7q2x3r31v7zj0pjjlrc7gfxwklr4s"))))
+                "00hzh39iddbc6nxg13813qd6d55g2kccwjf5dr96wykfhway9wbr"))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          ;; delete bundled dependencies
+                          (delete-file-recursively "extern")
+                          (substitute* (list "tests/apitests.cpp"
+                                             "tests/noexceptionstests.cpp"
+                                             "tests/test_cpp11.cpp"
+                                             "tests/test_cpp17.cpp")
+                            (("\"\\.\\./extern/ftest/ftest.h\"")
+                             "<ftest/ftest.h>"))))))
     (build-system cmake-build-system)
+    (native-inputs (list ftest))
     (arguments
-     `(#:out-of-source? #f
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'install              ; no install target
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (include (string-append out "/include"))
-                    (doc (string-append out "/share/doc/" ,name)))
-               (copy-recursively "source" include)
-               (install-file "README.md" doc)
-               #t))))))
-    (home-page "https://github.com/nemtrif/utfcpp")
+     `(#:build-type "Release"))
+    (home-page "https://utfcpp.sourceforge.net")
     (synopsis "Portable C++ library for handling UTF-8")
     (description "UTF8-CPP is a C++ library for handling UTF-8 encoded text
 in a portable way.")
-- 
2.39.2






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

* [bug#62473] [PATCH v3 3/4] gnu: Add openfoam-org. Deprecate openfoam.
       [not found] ` <f7f9d4efda30291d6dff6fb3537cf8e1d2a91a37.1683187409.git.reza@housseini.me>
@ 2023-05-04  8:04   ` reza via Guix-patches via
  0 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-05-04  8:04 UTC (permalink / raw)
  To: 62473; +Cc: reza

* gnu/local.mk: Remove mention of openfoam patch file.
* gnu/packages/patches/openfoam-4.1-cleanup.patch: Delete file.
* gnu/packages/simulation.scm (openfoam-org): New variable.
* gnu/packages/simulation.scm (openfoam): Deprecate variable.
---
 gnu/local.mk                                  |   1 -
 .../patches/openfoam-4.1-cleanup.patch        | 243 -----------
 gnu/packages/simulation.scm                   | 405 ++++++++++++------
 3 files changed, 265 insertions(+), 384 deletions(-)
 delete mode 100644 gnu/packages/patches/openfoam-4.1-cleanup.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 4305bee89c..c262f6cb85 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1635,7 +1635,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/openboardview-use-system-mpc.patch	\
   %D%/packages/patches/openbox-python3.patch			\
   %D%/packages/patches/opencolorio-fix-build-with-gcc11.patch	\
-  %D%/packages/patches/openfoam-4.1-cleanup.patch			\
   %D%/packages/patches/openjdk-9-pointer-comparison.patch       \
   %D%/packages/patches/openjdk-9-setsignalhandler.patch         \
   %D%/packages/patches/openjdk-10-idlj-reproducibility.patch	\
diff --git a/gnu/packages/patches/openfoam-4.1-cleanup.patch b/gnu/packages/patches/openfoam-4.1-cleanup.patch
deleted file mode 100644
index 37effa5c9c..0000000000
--- a/gnu/packages/patches/openfoam-4.1-cleanup.patch
+++ /dev/null
@@ -1,243 +0,0 @@
-# This patch removes all need for the ThirdParty files of OpenFOAM.
-
-# Derived from EasyBuild patch by Ward Poelmans <wpoely86@gmail.com>.
-# Modified for GNU Guix by Paul Garlick <pgarlick@tourbillion-technology.com>.
-
-diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
---- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake
-+++ OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
-@@ -9,7 +9,7 @@
- #
- # use readline if available
- #
--if [ -f /usr/include/readline/readline.h ]
-+if true
- then
-     echo "Found <readline/readline.h>  --  enabling readline support."
-     export COMP_FLAGS="-DHAS_READLINE"
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/bashrc OpenFOAM-4.x-version-4.1/etc/bashrc
---- OpenFOAM-4.x-version-4.1.org/etc/bashrc
-+++ OpenFOAM-4.x-version-4.1/etc/bashrc
-@@ -43,8 +43,10 @@
- # Please set to the appropriate path if the default is not correct.
- #
- [ $BASH_SOURCE ] && \
--export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \
-+export FOAM_INST_DIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) || \
- export FOAM_INST_DIR=$HOME/$WM_PROJECT
-+# For GNU Guix: set initially for build then re-set at runtime
-+#
- # export FOAM_INST_DIR=~$WM_PROJECT
- # export FOAM_INST_DIR=/opt/$WM_PROJECT
- # export FOAM_INST_DIR=/usr/local/$WM_PROJECT
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL
-@@ -36,37 +36,7 @@
- #
- #------------------------------------------------------------------------------
-
--boost_version=boost-system
--cgal_version=cgal-system
--#cgal_version=CGAL-4.8
--
--if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ]
--then
--
--    common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
--
--    export BOOST_ARCH_PATH=$common_path/$boost_version
--    export CGAL_ARCH_PATH=$common_path/$cgal_version
--
--    if [ "$FOAM_VERBOSE" -a "$PS1" ]
--    then
--        echo "Using CGAL and boost" 1>&2
--        echo "    $cgal_version at $CGAL_ARCH_PATH" 1>&2
--        echo "    $boost_version at $BOOST_ARCH_PATH" 1>&2
--    fi
--
--    if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ]
--    then
--        _foamAddLib $CGAL_ARCH_PATH/lib
--    fi
--
--    if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ]
--    then
--        _foamAddLib $BOOST_ARCH_PATH/lib
--    fi
--
--    unset boost_version cgal_version common_path
--
--fi
-+export CGAL_ARCH_PATH=$CGAL_ROOT
-+export BOOST_ARCH_PATH=$BOOST_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools
-@@ -29,13 +29,5 @@
- #
- #------------------------------------------------------------------------------
-
--version=svn
--gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
--
--GPERFTOOLS_VERSION=gperftools-$version
--GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION
--
--export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH
--export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-version-4.1/etc/config.sh/metis
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/metis
-@@ -34,7 +34,7 @@
- #
- #------------------------------------------------------------------------------
-
--export METIS_VERSION=metis-5.1.0
--export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION
-+export METIS_VERSION=metis-$METISVERSION
-+export METIS_ARCH_PATH=$METIS_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch OpenFOAM-4.x-version-4.1/etc/config.sh/scotch
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/scotch
-@@ -37,7 +37,7 @@
- #
- #------------------------------------------------------------------------------
-
--export SCOTCH_VERSION=scotch_6.0.3
--export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION
-+export SCOTCH_VERSION=scotch_$SCOTCHVERSION
-+export SCOTCH_ARCH_PATH=$SCOTCH_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings OpenFOAM-4.x-version-4.1/etc/config.sh/settings
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/settings
-@@ -279,6 +279,9 @@
-     ;;
- system)
-     # Use system compiler
-+    # Use system GMP and MPFR packages
-+    export GMP_ARCH_PATH=$GMP_ROOT
-+    export MPFR_ARCH_PATH=$MPFR_ROOT
-     ;;
- *)
-     echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
-@@ -5,8 +5,7 @@
-     $(PFLAGS) $(PINC) \
-     -I$(SCOTCH_ROOT)/include \
-     -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
--    -I/usr/include/scotch \
-     -I../decompositionMethods/lnInclude
-
- LIB_LIBS = \
--    -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
-+    -L$(SCOTCH_ROOT)/lib -L$(MPI_ARCH_PATH)/lib -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options
-@@ -9,8 +9,7 @@
-     $(PFLAGS) $(PINC) \
-     -I$(SCOTCH_ROOT)/include \
-     -I$(SCOTCH_ARCH_PATH)/include \
--    -I/usr/include/scotch \
-     -I../decompositionMethods/lnInclude
-
- LIB_LIBS = \
--    -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt
-+    -L$(SCOTCH_ROOT)/lib -lscotch -lscotcherrexit -lrt
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general
---- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general
-+++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general
-@@ -33,7 +33,6 @@
- # The Makefile uses a POSIX shell
- #------------------------------------------------------------------------------
- 
--SHELL           = /bin/sh
- 
- 
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmake OpenFOAM-4.x-version-4.1/wmake/wmake
---- OpenFOAM-4.x-version-4.1.org/wmake/wmake
-+++ OpenFOAM-4.x-version-4.1/wmake/wmake
-@@ -163,7 +163,7 @@
- then
-     if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ]
-     then
--        lockDir=$HOME/.$WM_PROJECT/.wmake
-+        lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- 
-         if [ -d $lockDir ]
-         then
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler
---- OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler
-+++ OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler
-@@ -53,7 +53,7 @@
- # csh sets HOST, bash sets HOSTNAME
- : ${HOST:=$HOSTNAME}
- 
--lockDir=$HOME/.$WM_PROJECT/.wmake
-+lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- 
- # Fallback - 1 core on current host
- : ${WM_HOSTS:=$HOST:1}
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime
---- OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime
-+++ OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime
-@@ -53,7 +53,7 @@
- # csh sets HOST, bash sets HOSTNAME
- : ${HOST:=$HOSTNAME}
- 
--lockDir=$HOME/.$WM_PROJECT/.wmake
-+lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- # Fallback - 1 core on current host
- : ${WM_HOSTS:=$HOST:1}
- 
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C
-@@ -67,7 +67,7 @@
- 
-     // Processor weights initialised with no size, only used if specified in
-     // a file
--    Field<scalar> processorWeights;
-+    Field<floatScalar> processorWeights;
- 
-     // Cell weights (so on the vertices of the dual)
-     List<label> cellWeights;
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL
---- OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL
-+++ OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL
-@@ -6,9 +6,10 @@
-     -I/usr/include
- 
- CGAL_LIBS = \
--    -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
--    -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-+    -L$(MPFR_ARCH_PATH)/lib \
-+    -L$(GMP_ARCH_PATH)/lib \
-     -L$(BOOST_ARCH_PATH)/lib \
-     -L$(CGAL_ARCH_PATH)/lib \
-     -lCGAL \
-+    -lgmp \
-     -lmpfr
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++
---- OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++
-+++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++
-@@ -20,5 +20,5 @@
-
- LINK_LIBS   = $(c++DBUG)
-
--LINKLIBSO   = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
--LINKEXE     = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
-+LINKLIBSO   = $(CC) $(c++FLAGS) $(LDFLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
-+LINKEXE     = $(CC) $(c++FLAGS) $(LDFLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 059be5a2be..079f4c4da0 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 Eric Bavier <bavier@posteo.net>
 ;;; Copyright © 2022 Liliana Marie Prikler <liliana.prikler@gmail.com>
+;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@ (define-module (gnu packages simulation)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
+  #:use-module (gnu packages engineering)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gettext)
@@ -41,22 +43,29 @@ (define-module (gnu packages simulation)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages iso-codes)
+  #:use-module (gnu packages image-processing)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages pdf)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-science)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages serialization)
+  #:use-module (gnu packages ssh)
+  #:use-module (gnu packages textutils)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
+  #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (guix download)
@@ -75,175 +84,291 @@ (define-module (gnu packages simulation)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1))
 
+;; replaced by packages openfoam-org and openfoam-com
 (define-public openfoam
+  (deprecated-package "openfoam" openfoam-org))
+
+(define-public openfoam-org
   (package
-    (name "openfoam")
-    (version "4.1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append
-             "http://dl.openfoam.org/source/"
-             (string-map (lambda (x) (if (eq? x #\.) #\- x)) version)))
-       (file-name (string-append name "-" version ".tar.gz"))
-       (sha256
-        (base32 "0cgxh4h2hf50qbvvdg5miwc2nympb0nrv3md96vb3gbs9vk8vq9d"))
-       (patches (search-patches "openfoam-4.1-cleanup.patch"))
-       (modules '((guix build utils)))
-       (snippet
-        '(begin
-           ;; Include <sys/sysmacros.h>, which is where glibc >= 2.28 provides
-           ;; 'major' and 'minor'.
-           (substitute* "src/OSspecific/POSIX/fileStat.C"
-             (("#include <unistd\\.h>")
-              "#include <unistd.h>\n#include <sys/sysmacros.h>\n"))
-           #t))))
+    (name "openfoam-org")
+    (version "10.20221128")
+    (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
+                "0yd924nhck4jh9gf1wrdnk8svj38yicg4803q79nnjqhn6lcq8c5"))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          ;; patch shell paths
+                          (substitute* (list "wmake/src/Makefile"
+                                             "wmake/makefiles/general")
+                            (("/bin/sh")
+                             which "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)))
+                          ;; add expand flag to RunFunctions
+                          (substitute* "bin/tools/RunFunctions"
+                            (("foamDictionary (.*)" all args)
+                             (string-append "foamDictionary -expand " args)))))))
     (build-system gnu-build-system)
-    (inputs
-     `(("boost" ,boost)
-       ("cgal" ,cgal)
-       ("flex" ,flex)
-       ("git" ,git)
-       ("gmp" ,gmp)
-       ("libxt" ,libxt)
-       ("metis" ,metis)
-       ("mpfr" ,mpfr)
-       ("ncurses" ,ncurses)
-       ("readline" ,readline)
-       ("scotch" ,pt-scotch32)
-       ("zlib" ,zlib)))
-    (native-inputs
-     (list bison))
-    (propagated-inputs
-     (list gzip gnuplot openmpi))
-    (outputs '("debug"                  ;~60MB
+    (inputs (list boost
+                  cgal
+                  git
+                  gmp
+                  libxt
+                  metis
+                  mpfr
+                  ncurses
+                  readline
+                  pt-scotch32
+                  zlib
+                  openmpi
+                  paraview-5.9
+                  openssh))
+    (native-inputs (list bison
+                         flex
+                         ;; paraview plugin dependencies
+                         cmake-minimal
+                         vtk
+                         libxml2
+                         libogg
+                         libtheora
+                         ffmpeg
+                         gl2ps
+                         libpng
+                         libharu
+                         jsoncpp
+                         netcdf
+                         hdf5
+                         gdal
+                         libx11
+                         qtbase-5
+                         eigen
+                         glew
+                         python
+                         expat
+                         xz
+                         utfcpp
+                         lz4
+                         double-conversion
+                         libjpeg-turbo
+                         libtiff
+                         freetype
+                         pugixml
+                         cgns
+                         qtsvg-5
+                         qttools-5
+                         protobuf
+                         qtxmlpatterns))
+    (propagated-inputs (list gnuplot))
+    (outputs '("debug" ;~60MB
                "out"))
     (arguments
      `( ;; Executable files and shared libraries are located in the 'platforms'
        ;; subdirectory.
-       #:strip-directories (list (string-append
-                                  "lib/OpenFOAM-" ,version
-                                  "/platforms/linux64GccDPInt32Opt/bin")
-                                 (string-append
-                                  "lib/OpenFOAM-" ,version
-                                  "/platforms/linux64GccDPInt32Opt/lib"))
-       #:tests? #f                                ; no tests to run
+       #:strip-directories (list (string-append "share/OpenFOAM-"
+                                                ,version
+                                                "/platforms/linux64GccDPInt32Opt/bin")
+                                 (string-append "share/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-after 'unpack 'rename-build-directory
+                  (add-after 'unpack 'set-same-version-as-guix
                     (lambda _
-                      (chdir "..")
-                      ;; Use 'OpenFOAM-version' convention to match the file
-                      ;; name expectations in the build phase.
-                      (let ((unpack-dir (string-append
-                                         (getcwd) "/"
-                                         (list-ref (scandir (getcwd) (lambda (name)
-                                                                       (string-match "^OpenFOAM" name))) 0)))
-                            (build-dir (string-append
-                                        (getcwd) "/OpenFOAM-" ,version)))
-                        (rename-file unpack-dir build-dir) ; rename build directory
-                        (chdir (basename build-dir))) ; move to build directory
-                      #t))
-                  (delete 'configure)             ; no configure phase
-                  (replace 'build
+                      (substitute* "etc/bashrc"
+                        (("^export WM_PROJECT_VERSION=.*$")
+                         (string-append "export WM_PROJECT_VERSION="
+                                        ,version "\n"))) #t))
+                  (add-before 'build 'patch-HOME-path
                     (lambda _
-                      (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch")))
-                        ;; set variables to define store paths
-                        (for-each (lambda (library)
-                                    (setenv (string-append
-                                             (string-upcase library) "_ROOT")
-                                            (assoc-ref %build-inputs library))) libraries))
-                      ;; set variables to define package versions
-                      (setenv "SCOTCHVERSION" ,(package-version scotch))
-                      (setenv "METISVERSION" ,(package-version metis))
-                      ;; set variable to pass extra 'rpath' arguments to linker
-                      (setenv "LDFLAGS"
-                              (string-append
-                               "-Wl,"
-                               "-rpath=" %output "/lib/OpenFOAM-" ,version
-                               "/platforms/linux64GccDPInt32Opt/lib,"
-                               "-rpath=" %output "/lib/OpenFOAM-" ,version
-                               "/platforms/linux64GccDPInt32Opt/lib/dummy"))
-                      ;; compile OpenFOAM libraries and applications
-                      (zero? (system (format #f
-                                             "source ./etc/bashrc && ./Allwmake -j~a"
-                                             (parallel-job-count))))))
-                  (add-after 'build 'update-configuration-files
+                      (setenv "HOME" "/tmp") #t))
+                  (add-before 'build 'patch-scotch
                     (lambda _
-                      ;; record store paths and package versions in
-                      ;; configuration files
-                      (substitute* "etc/config.sh/CGAL"
-                        (("$BOOST_ROOT") (getenv "BOOST_ROOT")))
-                      (substitute* "etc/config.sh/CGAL"
-                        (("$CGAL_ROOT") (getenv "CGAL_ROOT")))
-                      (substitute* "etc/config.sh/metis"
-                        (("$METIS_ROOT") (getenv "METIS_ROOT")))
-                      (substitute* "etc/config.sh/metis"
-                        (("$METISVERSION") (getenv "METISVERSION")))
-                      (substitute* "etc/config.sh/scotch"
-                        (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT")))
                       (substitute* "etc/config.sh/scotch"
-                        (("$SCOTCHVERSION") (getenv "SCOTCHVERSION")))
-                      (substitute* "etc/config.sh/settings"
-                        (("$GMP_ROOT") (getenv "GMP_ROOT")))
-                      (substitute* "etc/config.sh/settings"
-                        (("$MPFR_ROOT") (getenv "MPFR_ROOT")))
-                      ;; reset lockDir variable to refer to write-enabled
-                      ;; directory
-                      (substitute* "wmake/wmake"
-                        (("        lockDir=.*$")
-                         "        lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      (substitute* "wmake/wmakeScheduler"
-                        (("lockDir=.*$")
-                         "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      (substitute* "wmake/wmakeSchedulerUptime"
-                        (("lockDir=.*$")
-                         "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      #t))
+                        (("^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-5.9) "\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-"
+                                                ,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-5.9)))))
+                        (substitute* "wmake/rules/linux64Gcc/c++"
+                          (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
+                           (string-append all " " ldflags)))) #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 unncessary, voluminous object and dep files.
+                    ;; Avoid unnecessary, voluminous object and dep files.
                     (lambda _
-                      (delete-file-recursively
-                       "platforms/linux64GccDPInt32Opt/src")
-                      (delete-file-recursively
-                       "platforms/linux64GccDPInt32OptSYSTEMOPENMPI")
-                      (for-each delete-file (find-files "." "\\.o$"))
-                      #t))
+                      (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 _
                       ;; use 'OpenFOAM-version' convention
-                      (let ((install-dir (string-append
-                                          %output "/lib/OpenFOAM-" ,version)))
-                        (mkdir-p install-dir)     ; create install directory
+                      (let ((install-dir (string-append %output
+                                                        "/share/OpenFOAM-"
+                                                        ,version)))
+                        (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 _
-                      ;; add symbolic link for standard 'bin' directory
-                      (symlink
-                       (string-append "./lib/OpenFOAM-" ,version
-                                      "/platforms/linux64GccDPInt32Opt/bin")
-                       (string-append %output "/bin"))
-                      #t)))))
+                      (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)))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "WM_PROJECT_DIR")
+            (separator #f)
+            (files '("")))))
     ;; Note:
-    ;;  Tutorial files are installed read-only in /gnu/store.
-    ;;  To allow write permissions on files copied from the store a
-    ;;  'chmod' step is needed before running the applications.  For
-    ;;  example, from a user's login:
-    ;;  $ source $GUIX_PROFILE/lib/OpenFOAM-4.1/etc/bashrc
-    ;;  $ mkdir -p $FOAM_RUN
-    ;;  $ cd $FOAM_RUN
-    ;;  $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
-    ;;  $ cd pitzDaily
-    ;;  $ chmod -R u+w .
-    ;;  $ blockMesh
+    ;; 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
+    (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
-- 
2.39.2


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

* [bug#62473] [PATCH v3 4/4] gnu: Add openfoam-com:
       [not found] ` <11f18160d0a4c5be3daf533ca7930dd2245c3a72.1683187409.git.reza@housseini.me>
@ 2023-05-04  8:04   ` reza via Guix-patches via
  0 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-05-04  8:04 UTC (permalink / raw)
  To: 62473; +Cc: reza

* gnu/packages/simulation.scm (openfoam-com): New variable.
---
 gnu/packages/simulation.scm | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 079f4c4da0..bc8edf627a 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -379,6 +379,45 @@ (define-public openfoam-org
     (license license:gpl3+)
     (home-page "https://openfoam.org")))
 
+(define-public openfoam-com
+  (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
+                          ;; patch shell paths
+                          (substitute* (list "src/OSspecific/POSIX/POSIX.C"
+                                             "wmake/src/Makefile"
+                                             "wmake/makefiles/general"
+                                             "wmake/makefiles/info")
+                            (("/bin/sh")
+                             which "sh"))))))
+    (description
+     "OpenFOAM is a free, open source CFD software released and developed by
+OpenCFD Ltd since 2004.  It has a large user base across most areas of
+engineering and science, from both commercial and academic organizations.
+OpenFOAM has an extensive range of features to solve anything from complex
+fluid flows involving chemical reactions, turbulence and heat transfer, to
+acoustics, solid mechanics and electromagnetics.  See documentation OpenFOAM
+is professionally released every six months to include customer sponsored
+developments and contributions from the community - individual and group
+contributors, integrations (eg, from FOAM-extend and OpenFOAM Foundation Ltd)
+as well as governance guided activities.")
+    (home-page "https://www.openfoam.com")))
+
 (define-public open-simulation-interface
   (package
     (name "open-simulation-interface")
-- 
2.39.2






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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
  2023-05-04  8:04   ` [bug#62473] [PATCH v3 1/4] gnu: Add ftest reza via Guix-patches via
@ 2023-06-15 21:56     ` Ludovic Courtès
  0 siblings, 0 replies; 31+ messages in thread
From: Ludovic Courtès @ 2023-06-15 21:56 UTC (permalink / raw)
  To: reza; +Cc: 62473

Hi reza,

Sorry for taking so long to get back to you.

As I wrote in April, could you please resend with ‘git send-email’ or
somehow ensure your mail user agent doesn’t use DOS-style line endings?

  https://issues.guix.gnu.org/62473#11

Thanks in advance!

Ludo’.




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

* [bug#62473] [PATCH v4 1/2] gnu: Add openfoam-org. Deprecate openfoam.
  2023-03-26 20:53 ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
                     ` (2 preceding siblings ...)
  2023-05-04  8:04   ` [bug#62473] [PATCH v3 1/4] gnu: Add ftest reza via Guix-patches via
@ 2023-06-24 21:38   ` reza via Guix-patches via
  2023-08-10 15:40   ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-06-24 21:38 UTC (permalink / raw)
  To: 62473; +Cc: reza

* gnu/local.mk: Remove mention of openfoam patch file.
* gnu/packages/patches/openfoam-4.1-cleanup.patch: Delete file.
* gnu/packages/simulation.scm (openfoam-org): New variable.
* gnu/packages/simulation.scm (openfoam): Deprecate variable.
---
 gnu/local.mk                                  |   1 -
 .../patches/openfoam-4.1-cleanup.patch        | 243 ---------
 gnu/packages/simulation.scm                   | 464 ++++++++++++------
 3 files changed, 303 insertions(+), 405 deletions(-)
 delete mode 100644 gnu/packages/patches/openfoam-4.1-cleanup.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 1b59cc522b..9901058762 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1653,7 +1653,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/openboardview-use-system-mpc.patch	\
   %D%/packages/patches/openbox-python3.patch			\
   %D%/packages/patches/opencolorio-fix-build-with-gcc11.patch	\
-  %D%/packages/patches/openfoam-4.1-cleanup.patch			\
   %D%/packages/patches/openjdk-9-pointer-comparison.patch       \
   %D%/packages/patches/openjdk-9-setsignalhandler.patch         \
   %D%/packages/patches/openjdk-10-idlj-reproducibility.patch	\
diff --git a/gnu/packages/patches/openfoam-4.1-cleanup.patch b/gnu/packages/patches/openfoam-4.1-cleanup.patch
deleted file mode 100644
index 37effa5c9c..0000000000
--- a/gnu/packages/patches/openfoam-4.1-cleanup.patch
+++ /dev/null
@@ -1,243 +0,0 @@
-# This patch removes all need for the ThirdParty files of OpenFOAM.
-
-# Derived from EasyBuild patch by Ward Poelmans <wpoely86@gmail.com>.
-# Modified for GNU Guix by Paul Garlick <pgarlick@tourbillion-technology.com>.
-
-diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
---- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake
-+++ OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
-@@ -9,7 +9,7 @@
- #
- # use readline if available
- #
--if [ -f /usr/include/readline/readline.h ]
-+if true
- then
-     echo "Found <readline/readline.h>  --  enabling readline support."
-     export COMP_FLAGS="-DHAS_READLINE"
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/bashrc OpenFOAM-4.x-version-4.1/etc/bashrc
---- OpenFOAM-4.x-version-4.1.org/etc/bashrc
-+++ OpenFOAM-4.x-version-4.1/etc/bashrc
-@@ -43,8 +43,10 @@
- # Please set to the appropriate path if the default is not correct.
- #
- [ $BASH_SOURCE ] && \
--export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \
-+export FOAM_INST_DIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) || \
- export FOAM_INST_DIR=$HOME/$WM_PROJECT
-+# For GNU Guix: set initially for build then re-set at runtime
-+#
- # export FOAM_INST_DIR=~$WM_PROJECT
- # export FOAM_INST_DIR=/opt/$WM_PROJECT
- # export FOAM_INST_DIR=/usr/local/$WM_PROJECT
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL
-@@ -36,37 +36,7 @@
- #
- #------------------------------------------------------------------------------
-
--boost_version=boost-system
--cgal_version=cgal-system
--#cgal_version=CGAL-4.8
--
--if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ]
--then
--
--    common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
--
--    export BOOST_ARCH_PATH=$common_path/$boost_version
--    export CGAL_ARCH_PATH=$common_path/$cgal_version
--
--    if [ "$FOAM_VERBOSE" -a "$PS1" ]
--    then
--        echo "Using CGAL and boost" 1>&2
--        echo "    $cgal_version at $CGAL_ARCH_PATH" 1>&2
--        echo "    $boost_version at $BOOST_ARCH_PATH" 1>&2
--    fi
--
--    if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ]
--    then
--        _foamAddLib $CGAL_ARCH_PATH/lib
--    fi
--
--    if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ]
--    then
--        _foamAddLib $BOOST_ARCH_PATH/lib
--    fi
--
--    unset boost_version cgal_version common_path
--
--fi
-+export CGAL_ARCH_PATH=$CGAL_ROOT
-+export BOOST_ARCH_PATH=$BOOST_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools
-@@ -29,13 +29,5 @@
- #
- #------------------------------------------------------------------------------
-
--version=svn
--gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
--
--GPERFTOOLS_VERSION=gperftools-$version
--GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION
--
--export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH
--export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-version-4.1/etc/config.sh/metis
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/metis
-@@ -34,7 +34,7 @@
- #
- #------------------------------------------------------------------------------
-
--export METIS_VERSION=metis-5.1.0
--export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION
-+export METIS_VERSION=metis-$METISVERSION
-+export METIS_ARCH_PATH=$METIS_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch OpenFOAM-4.x-version-4.1/etc/config.sh/scotch
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/scotch
-@@ -37,7 +37,7 @@
- #
- #------------------------------------------------------------------------------
-
--export SCOTCH_VERSION=scotch_6.0.3
--export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION
-+export SCOTCH_VERSION=scotch_$SCOTCHVERSION
-+export SCOTCH_ARCH_PATH=$SCOTCH_ROOT
-
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings OpenFOAM-4.x-version-4.1/etc/config.sh/settings
---- OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings
-+++ OpenFOAM-4.x-version-4.1/etc/config.sh/settings
-@@ -279,6 +279,9 @@
-     ;;
- system)
-     # Use system compiler
-+    # Use system GMP and MPFR packages
-+    export GMP_ARCH_PATH=$GMP_ROOT
-+    export MPFR_ARCH_PATH=$MPFR_ROOT
-     ;;
- *)
-     echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
-@@ -5,8 +5,7 @@
-     $(PFLAGS) $(PINC) \
-     -I$(SCOTCH_ROOT)/include \
-     -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
--    -I/usr/include/scotch \
-     -I../decompositionMethods/lnInclude
-
- LIB_LIBS = \
--    -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
-+    -L$(SCOTCH_ROOT)/lib -L$(MPI_ARCH_PATH)/lib -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options
-@@ -9,8 +9,7 @@
-     $(PFLAGS) $(PINC) \
-     -I$(SCOTCH_ROOT)/include \
-     -I$(SCOTCH_ARCH_PATH)/include \
--    -I/usr/include/scotch \
-     -I../decompositionMethods/lnInclude
-
- LIB_LIBS = \
--    -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt
-+    -L$(SCOTCH_ROOT)/lib -lscotch -lscotcherrexit -lrt
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general
---- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general
-+++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general
-@@ -33,7 +33,6 @@
- # The Makefile uses a POSIX shell
- #------------------------------------------------------------------------------
- 
--SHELL           = /bin/sh
- 
- 
- #------------------------------------------------------------------------------
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmake OpenFOAM-4.x-version-4.1/wmake/wmake
---- OpenFOAM-4.x-version-4.1.org/wmake/wmake
-+++ OpenFOAM-4.x-version-4.1/wmake/wmake
-@@ -163,7 +163,7 @@
- then
-     if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ]
-     then
--        lockDir=$HOME/.$WM_PROJECT/.wmake
-+        lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- 
-         if [ -d $lockDir ]
-         then
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler
---- OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler
-+++ OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler
-@@ -53,7 +53,7 @@
- # csh sets HOST, bash sets HOSTNAME
- : ${HOST:=$HOSTNAME}
- 
--lockDir=$HOME/.$WM_PROJECT/.wmake
-+lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- 
- # Fallback - 1 core on current host
- : ${WM_HOSTS:=$HOST:1}
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime
---- OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime
-+++ OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime
-@@ -53,7 +53,7 @@
- # csh sets HOST, bash sets HOSTNAME
- : ${HOST:=$HOSTNAME}
- 
--lockDir=$HOME/.$WM_PROJECT/.wmake
-+lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
- # Fallback - 1 core on current host
- : ${WM_HOSTS:=$HOST:1}
- 
-diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C
---- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C
-+++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C
-@@ -67,7 +67,7 @@
- 
-     // Processor weights initialised with no size, only used if specified in
-     // a file
--    Field<scalar> processorWeights;
-+    Field<floatScalar> processorWeights;
- 
-     // Cell weights (so on the vertices of the dual)
-     List<label> cellWeights;
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL
---- OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL
-+++ OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL
-@@ -6,9 +6,10 @@
-     -I/usr/include
- 
- CGAL_LIBS = \
--    -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
--    -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-+    -L$(MPFR_ARCH_PATH)/lib \
-+    -L$(GMP_ARCH_PATH)/lib \
-     -L$(BOOST_ARCH_PATH)/lib \
-     -L$(CGAL_ARCH_PATH)/lib \
-     -lCGAL \
-+    -lgmp \
-     -lmpfr
-diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++
---- OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++
-+++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++
-@@ -20,5 +20,5 @@
-
- LINK_LIBS   = $(c++DBUG)
-
--LINKLIBSO   = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
--LINKEXE     = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
-+LINKLIBSO   = $(CC) $(c++FLAGS) $(LDFLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
-+LINKEXE     = $(CC) $(c++FLAGS) $(LDFLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 059be5a2be..303b7d8d5a 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 Eric Bavier <bavier@posteo.net>
 ;;; Copyright © 2022 Liliana Marie Prikler <liliana.prikler@gmail.com>
+;;; Copyright © 2023 Reza Housseini <reza@housseini.me>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,8 @@ (define-module (gnu packages simulation)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
+  #:use-module (gnu packages curl)
+  #:use-module (gnu packages engineering)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gettext)
@@ -41,22 +44,30 @@ (define-module (gnu packages simulation)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages iso-codes)
+  #:use-module (gnu packages image-processing)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages pdf)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-science)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages serialization)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages ssh)
+  #:use-module (gnu packages textutils)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
+  #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (guix download)
@@ -75,175 +86,303 @@ (define-module (gnu packages simulation)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1))
 
-(define-public openfoam
+(define-public openfoam-org
   (package
-    (name "openfoam")
-    (version "4.1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append
-             "http://dl.openfoam.org/source/"
-             (string-map (lambda (x) (if (eq? x #\.) #\- x)) version)))
-       (file-name (string-append name "-" version ".tar.gz"))
-       (sha256
-        (base32 "0cgxh4h2hf50qbvvdg5miwc2nympb0nrv3md96vb3gbs9vk8vq9d"))
-       (patches (search-patches "openfoam-4.1-cleanup.patch"))
-       (modules '((guix build utils)))
-       (snippet
-        '(begin
-           ;; Include <sys/sysmacros.h>, which is where glibc >= 2.28 provides
-           ;; 'major' and 'minor'.
-           (substitute* "src/OSspecific/POSIX/fileStat.C"
-             (("#include <unistd\\.h>")
-              "#include <unistd.h>\n#include <sys/sysmacros.h>\n"))
-           #t))))
+    (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")
+                             which "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
-     `(("boost" ,boost)
-       ("cgal" ,cgal)
-       ("flex" ,flex)
-       ("git" ,git)
-       ("gmp" ,gmp)
-       ("libxt" ,libxt)
-       ("metis" ,metis)
-       ("mpfr" ,mpfr)
-       ("ncurses" ,ncurses)
-       ("readline" ,readline)
-       ("scotch" ,pt-scotch32)
-       ("zlib" ,zlib)))
-    (native-inputs
-     (list bison))
-    (propagated-inputs
-     (list gzip gnuplot openmpi))
-    (outputs '("debug"                  ;~60MB
+    (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
-     `( ;; Executable files and shared libraries are located in the 'platforms'
-       ;; subdirectory.
-       #:strip-directories (list (string-append
-                                  "lib/OpenFOAM-" ,version
-                                  "/platforms/linux64GccDPInt32Opt/bin")
-                                 (string-append
-                                  "lib/OpenFOAM-" ,version
-                                  "/platforms/linux64GccDPInt32Opt/lib"))
-       #:tests? #f                                ; no tests to run
+     (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)
-                  (guix build gnu-build-system)
-                  (guix build utils))
+      #: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-after 'unpack 'rename-build-directory
-                    (lambda _
-                      (chdir "..")
-                      ;; Use 'OpenFOAM-version' convention to match the file
-                      ;; name expectations in the build phase.
-                      (let ((unpack-dir (string-append
-                                         (getcwd) "/"
-                                         (list-ref (scandir (getcwd) (lambda (name)
-                                                                       (string-match "^OpenFOAM" name))) 0)))
-                            (build-dir (string-append
-                                        (getcwd) "/OpenFOAM-" ,version)))
-                        (rename-file unpack-dir build-dir) ; rename build directory
-                        (chdir (basename build-dir))) ; move to build directory
-                      #t))
-                  (delete 'configure)             ; no configure phase
-                  (replace 'build
-                    (lambda _
-                      (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch")))
-                        ;; set variables to define store paths
-                        (for-each (lambda (library)
-                                    (setenv (string-append
-                                             (string-upcase library) "_ROOT")
-                                            (assoc-ref %build-inputs library))) libraries))
-                      ;; set variables to define package versions
-                      (setenv "SCOTCHVERSION" ,(package-version scotch))
-                      (setenv "METISVERSION" ,(package-version metis))
-                      ;; set variable to pass extra 'rpath' arguments to linker
-                      (setenv "LDFLAGS"
-                              (string-append
-                               "-Wl,"
-                               "-rpath=" %output "/lib/OpenFOAM-" ,version
-                               "/platforms/linux64GccDPInt32Opt/lib,"
-                               "-rpath=" %output "/lib/OpenFOAM-" ,version
-                               "/platforms/linux64GccDPInt32Opt/lib/dummy"))
-                      ;; compile OpenFOAM libraries and applications
-                      (zero? (system (format #f
-                                             "source ./etc/bashrc && ./Allwmake -j~a"
-                                             (parallel-job-count))))))
-                  (add-after 'build 'update-configuration-files
-                    (lambda _
-                      ;; record store paths and package versions in
-                      ;; configuration files
-                      (substitute* "etc/config.sh/CGAL"
-                        (("$BOOST_ROOT") (getenv "BOOST_ROOT")))
-                      (substitute* "etc/config.sh/CGAL"
-                        (("$CGAL_ROOT") (getenv "CGAL_ROOT")))
-                      (substitute* "etc/config.sh/metis"
-                        (("$METIS_ROOT") (getenv "METIS_ROOT")))
-                      (substitute* "etc/config.sh/metis"
-                        (("$METISVERSION") (getenv "METISVERSION")))
-                      (substitute* "etc/config.sh/scotch"
-                        (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT")))
-                      (substitute* "etc/config.sh/scotch"
-                        (("$SCOTCHVERSION") (getenv "SCOTCHVERSION")))
-                      (substitute* "etc/config.sh/settings"
-                        (("$GMP_ROOT") (getenv "GMP_ROOT")))
-                      (substitute* "etc/config.sh/settings"
-                        (("$MPFR_ROOT") (getenv "MPFR_ROOT")))
-                      ;; reset lockDir variable to refer to write-enabled
-                      ;; directory
-                      (substitute* "wmake/wmake"
-                        (("        lockDir=.*$")
-                         "        lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      (substitute* "wmake/wmakeScheduler"
-                        (("lockDir=.*$")
-                         "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      (substitute* "wmake/wmakeSchedulerUptime"
-                        (("lockDir=.*$")
-                         "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
-                      #t))
-                  (add-after 'build 'cleanup
-                    ;; Avoid unncessary, voluminous object and dep files.
-                    (lambda _
-                      (delete-file-recursively
-                       "platforms/linux64GccDPInt32Opt/src")
-                      (delete-file-recursively
-                       "platforms/linux64GccDPInt32OptSYSTEMOPENMPI")
-                      (for-each delete-file (find-files "." "\\.o$"))
-                      #t))
-                  (replace 'install
-                    (lambda _
-                      ;; use 'OpenFOAM-version' convention
-                      (let ((install-dir (string-append
-                                          %output "/lib/OpenFOAM-" ,version)))
-                        (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 _
-                      ;; add symbolic link for standard 'bin' directory
-                      (symlink
-                       (string-append "./lib/OpenFOAM-" ,version
-                                      "/platforms/linux64GccDPInt32Opt/bin")
-                       (string-append %output "/bin"))
-                      #t)))))
+      #: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 $GUIX_PROFILE/lib/OpenFOAM-4.1/etc/bashrc
-    ;;  $ mkdir -p $FOAM_RUN
-    ;;  $ cd $FOAM_RUN
-    ;;  $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
-    ;;  $ cd pitzDaily
-    ;;  $ chmod -R u+w .
-    ;;  $ blockMesh
+    ;; 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
+    (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
@@ -254,6 +393,9 @@ (define-public openfoam
     (license license:gpl3+)
     (home-page "https://openfoam.org")))
 
+(define-public openfoam
+  (deprecated-package "openfoam" openfoam-org))
+
 (define-public open-simulation-interface
   (package
     (name "open-simulation-interface")

base-commit: f25529b08e356f89ca7cecc44295085531a8faba
-- 
2.40.1


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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
  2023-03-26 20:53 ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
                     ` (3 preceding siblings ...)
  2023-06-24 21:38   ` [bug#62473] [PATCH v4 1/2] gnu: Add openfoam-org. Deprecate openfoam reza via Guix-patches via
@ 2023-08-10 15:40   ` reza via Guix-patches via
  2024-02-15  9:38   ` Hartmut Goebel
  2024-07-09 10:50   ` bug#62473: " Hartmut Goebel
  6 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2023-08-10 15:40 UTC (permalink / raw)
  To: 62473@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

Hi Ludo,

Thank you very much! Sorry for not following up on your review feedback, 
this was not intentional.
I asked on the mailing list about the circular dependency issue but got 
no reply and with my basic knowledge of guile I was basically lost.
Also the issue with line endings has me still scratching my head. I 
prepared the patch on a guix system with git send-mail I searched the 
internet for the issue but could not figure out why I had dos line endings?
The rest of the problems are really on my side and I apologize for it.

I'm in the process of preparing a follow up patch for openfoam, first to 
bump the version to 11 and second there is an issue with the naming 
convention of the share/OpenFOAM folder. I hope I can sort out the line 
ending issue, maybe you have an idea?

Best,
Reza

[-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #3: OpenPGP_signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
  2023-03-26 20:53 ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
                     ` (4 preceding siblings ...)
  2023-08-10 15:40   ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
@ 2024-02-15  9:38   ` Hartmut Goebel
       [not found]     ` <ac391026-3182-6d3a-f727-3785dbbe880f@housseini.me>
       [not found]     ` <5d41ffce-773d-0a69-6290-735d6f3989c3@housseini.me>
  2024-07-09 10:50   ` bug#62473: " Hartmut Goebel
  6 siblings, 2 replies; 31+ messages in thread
From: Hartmut Goebel @ 2024-02-15  9:38 UTC (permalink / raw)
  To: 62473

This seems to be merged, see https://issues.guix.gnu.org/62473#29

  Can it be closed?

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
       [not found]     ` <ac391026-3182-6d3a-f727-3785dbbe880f@housseini.me>
@ 2024-02-16 21:12       ` reza via Guix-patches via
  0 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2024-02-16 21:12 UTC (permalink / raw)
  To: 62473

>   Can it be closed?

Yes this can be closed. There is already an update to version 11 here: 
https://issues.guix.gnu.org/66262






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

* [bug#62473] [PATCH 0/4] OpenFoam update to version 10
       [not found]     ` <5d41ffce-773d-0a69-6290-735d6f3989c3@housseini.me>
@ 2024-02-17 10:01       ` reza via Guix-patches via
  0 siblings, 0 replies; 31+ messages in thread
From: reza via Guix-patches via @ 2024-02-17 10:01 UTC (permalink / raw)
  To: 62473

>   Can it be closed?

Yes this can be closed. There is already an update to version 11 here: 
https://issues.guix.gnu.org/66262






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

* bug#62473: [PATCH 0/4] OpenFoam update to version 10
  2023-03-26 20:53 ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
                     ` (5 preceding siblings ...)
  2024-02-15  9:38   ` Hartmut Goebel
@ 2024-07-09 10:50   ` Hartmut Goebel
  6 siblings, 0 replies; 31+ messages in thread
From: Hartmut Goebel @ 2024-07-09 10:50 UTC (permalink / raw)
  To: 62473-close






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

end of thread, other threads:[~2024-07-09 11:01 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1679863907.git.reza@housseini.me>
2023-03-26 20:53 ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
2023-03-27 16:51   ` reza via Guix-patches via
2023-04-05 18:21   ` [bug#62473] [PATCH v2 0/4] Remove spurious file, add env var reza via Guix-patches via
2023-05-04  8:04   ` [bug#62473] [PATCH v3 1/4] gnu: Add ftest reza via Guix-patches via
2023-06-15 21:56     ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 Ludovic Courtès
2023-06-24 21:38   ` [bug#62473] [PATCH v4 1/2] gnu: Add openfoam-org. Deprecate openfoam reza via Guix-patches via
2023-08-10 15:40   ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 reza via Guix-patches via
2024-02-15  9:38   ` Hartmut Goebel
     [not found]     ` <ac391026-3182-6d3a-f727-3785dbbe880f@housseini.me>
2024-02-16 21:12       ` reza via Guix-patches via
     [not found]     ` <5d41ffce-773d-0a69-6290-735d6f3989c3@housseini.me>
2024-02-17 10:01       ` reza via Guix-patches via
2024-07-09 10:50   ` bug#62473: " Hartmut Goebel
     [not found] ` <8e459feaf2d6a3d0f8720e72299e81259b9e6168.1679863907.git.reza@housseini.me>
2023-03-27  7:42   ` [bug#62473] [PATCH 1/4] gnu: Add ftest reza via Guix-patches via
     [not found] ` <622cad546298d2bd56fc4baf49dafeb8c9fa20b1.1679863907.git.reza@housseini.me>
2023-03-27  7:46   ` [bug#62473] [PATCH 2/4] gnu: utfcpp: Update to 3.2.3 reza via Guix-patches via
     [not found] ` <39bb016d78272ca6ef016fa0ea0fe364a2f051e4.1679863907.git.reza@housseini.me>
2023-03-27  7:46   ` [bug#62473] [PATCH 3/4] gnu: Add openfoam-org reza via Guix-patches via
     [not found] ` <1c95a4bb417b77c8cad9edbdca11b769afcfe4e9.1679863907.git.reza@housseini.me>
2023-03-27  7:46   ` [bug#62473] [PATCH 4/4] gnu: Add openfoam-com reza via Guix-patches via
     [not found] <cover.1680707361.git.reza@housseini.me>
     [not found] ` <8e459feaf2d6a3d0f8720e72299e81259b9e6168.1680707361.git.reza@housseini.me>
2023-04-05 18:21   ` [bug#62473] [PATCH v2 1/4] gnu: Add ftest reza via Guix-patches via
2023-04-06 14:29     ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 Ludovic Courtès
     [not found]       ` <72de2b1c-2a2d-c640-6246-caaf71e62263@housseini.me>
2023-04-06 14:42         ` reza via Guix-patches via
2023-04-18 20:06           ` Ludovic Courtès
     [not found] ` <622cad546298d2bd56fc4baf49dafeb8c9fa20b1.1680707361.git.reza@housseini.me>
2023-04-05 18:21   ` [bug#62473] [PATCH v2 2/4] gnu: utfcpp: Update to 3.2.3 reza via Guix-patches via
2023-04-06 14:30     ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 Ludovic Courtès
     [not found] ` <d4b6b174d56867b447ac5cff1aa02c3fea055fa0.1680707361.git.reza@housseini.me>
2023-04-05 18:21   ` [bug#62473] [PATCH v2 3/4] gnu: Add openfoam-org reza via Guix-patches via
2023-04-06 14:33     ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 Ludovic Courtès
     [not found]       ` <1061a4d6-ea54-6437-9e28-a64c3c091b0a@housseini.me>
2023-04-06 14:46         ` reza via Guix-patches via
     [not found] ` <83f2db8384fdd419a9a75a4f00338a1fbbab52b4.1680707361.git.reza@housseini.me>
2023-04-05 18:21   ` [bug#62473] [PATCH v2 4/4] gnu: Add openfoam-com reza via Guix-patches via
2023-04-06 14:36     ` [bug#62473] [PATCH 0/4] OpenFoam update to version 10 Ludovic Courtès
     [not found]       ` <ed4f586d-4bbf-61e3-4f88-97d81882bf7b@housseini.me>
2023-04-06 14:52         ` reza via Guix-patches via
2023-04-18 20:09           ` Ludovic Courtès
     [not found] <b45be3d6737e0f394961a5ad345501d790518a9a.1683187409.git.reza@housseini.me>
     [not found] ` <2b6a4965ceb4f835b949e4d9a03f51b0facf54f9.1683187409.git.reza@housseini.me>
2023-05-04  8:04   ` [bug#62473] [PATCH v3 2/4] gnu: utfcpp: Update to 3.2.3 reza via Guix-patches via
     [not found] ` <f7f9d4efda30291d6dff6fb3537cf8e1d2a91a37.1683187409.git.reza@housseini.me>
2023-05-04  8:04   ` [bug#62473] [PATCH v3 3/4] gnu: Add openfoam-org. Deprecate openfoam reza via Guix-patches via
     [not found] ` <11f18160d0a4c5be3daf533ca7930dd2245c3a72.1683187409.git.reza@housseini.me>
2023-05-04  8:04   ` [bug#62473] [PATCH v3 4/4] gnu: Add openfoam-com: reza via Guix-patches via

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.