openfoam: 4.0 -> 8 (using older compiler didn't work with CGAL)

This commit is contained in:
Tyson Whitehead
2021-01-26 19:38:07 -05:00
parent 0fb47b7672
commit 8a98bdc5f7
3 changed files with 26 additions and 24 deletions

View File

@@ -23,7 +23,7 @@ self: super: pkgs: with pkgs; {
inherit (callPackage ./opengl/default.nix { inherit super; }) libGL mesa_glxgallium;
openfoam = callPackage ./openfoam { stdenv = overrideCC stdenv gcc7; };
openfoam = callPackage ./openfoam.nix { };
openslide = callPackage ./openslide { };

View File

@@ -1,23 +1,33 @@
{ stdenv, fetchurl, makeWrapper, flex, bison
{ stdenv, bashInteractive, fetchFromGitHub, makeWrapper, flex, bison
, zlib, boost, openmpi, readline, gperftools, cgal, metis, scotch, mpfr }:
stdenv.mkDerivation rec {
version = "4.0";
name = "openfoam-${version}";
version = "20201114";
pname = "OpenFOAM-8";
src = fetchurl {
url = "https://github.com/OpenFOAM/OpenFOAM-4.x/archive/version-${version}.tar.gz";
sha256 = "0jfzc561ra1wzg8wbp5ipp1r5r1qg84krhmcvi8injqkl4svxbkk";
src = fetchFromGitHub {
owner = "OpenFOAM";
repo = pname;
name = "${pname}-${version}.zip";
rev = version;
sha256 = "1hl7zr405ifkppbm519yax5yqcm8zy1f98sfgy6zdnph2jx8fs34";
};
patches = [ ./newer-cgal.patch ];
# a lot of assumptions about being under a directory named OpenFOAM-${version}
postUnpack = ''
echo "resettting sourceRoot to ''${sourceRoot/-4.x-version/}"
mv "$sourceRoot" "''${sourceRoot/-4.x-version/}"
sourceRoot="''${sourceRoot/-4.x-version/}"
echo "resettting sourceRoot to ''${sourceRoot/-${version}.zip/}"
mv "$sourceRoot" "''${sourceRoot/-${version}.zip/}"
sourceRoot="''${sourceRoot/-${version}.zip/}"
'';
# alternative to disabling exit on command failure with etc/bashrc could be
#
# sed -ie 's|^\( *unalias .\+ 2> */dev/null *\)$|\1 \|\| true|' etc/config.sh/aliases
# sed -ie 's|^\( *complete .\+\)$|\1 \|\| true|' etc/config.sh/bash_completion
patchPhase = ''
patchShebangs .
'';
# one of the following would bake in the rpath, but sourcing etc/bashrc file updates LD_LIBRARY_PATH
@@ -25,11 +35,13 @@ stdenv.mkDerivation rec {
# NIX_LDFLAGS="${NIX_LDFLAGS/"$out/lib$WM_ARCH_OPTION"/"$out/platform/$WM_OPTIONS/lib"}"
configurePhase = ''
sed -ie 's|FOAM_INST_DIR=$HOME/$WM_PROJECT.*|FOAM_INST_DIR='"$out"/lib/OpenFOAM-${version}'|' etc/bashrc
sed -ie 's|BOOST_ARCH_PATH=.*$|BOOST_ARCH_PATH=${boost}|' etc/config.sh/CGAL
sed -ie 's|CGAL_ARCH_PATH=.*$|CGAL_ARCH_PATH=${cgal}|' etc/config.sh/CGAL
sed -ie 's|METIS_ARCH_PATH=.*$|METIS_ARCH_PATH=${metis}|' etc/config.sh/metis
sed -ie 's|SCOTCH_ARCH_PATH=.*$|SCOTCH_ARCH_PATH=${scotch}|' etc/config.sh/scotch
sed -ie 's|gperftools_install=.*$|gperftools_install=${gperftools}|' etc/config.sh/gperftools
declare opts=$(shopt -p) output
set +o errexit
source "$PWD/etc/bashrc"
eval "$opts"
'';
buildPhase = ''

View File

@@ -1,10 +0,0 @@
--- OpenFOAM-4.0/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H_ 2019-05-08 12:06:37.310401266 -0400
+++ OpenFOAM-4.0/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H 2019-05-08 12:07:12.582103107 -0400
@@ -150,6 +150,7 @@
{
private:
+ typedef Foam::point point;
// Private data