diff --git a/pkgs/applications/science/physics/elmerfem/default.nix b/pkgs/applications/science/physics/elmerfem/default.nix new file mode 100644 index 000000000000..642982830f70 --- /dev/null +++ b/pkgs/applications/science/physics/elmerfem/default.nix @@ -0,0 +1,49 @@ +{ stdenv, fetchFromGitHub, cmake, git, gfortran, openmpi, blas, liblapack, qt4, qwt6_qt4, pkg-config }: + +stdenv.mkDerivation rec { + pname = "elmerfem"; + version = "8.4"; + + src = fetchFromGitHub { + owner = "elmercsc"; + repo = "elmerfem"; + rev = "release-${version}"; + sha256 = "0vk31lplxlng173q8jjcpbyj1gaf98jvkqjvi9077d1nslya7vpm"; + }; + + hardeningDisable = [ "format" ]; + + nativeBuildInputs = [ cmake pkg-config git ]; + buildInputs = [ gfortran openmpi blas liblapack qt4 qwt6_qt4 ]; + + preConfigure = '' + patchShebangs ./ + ''; + + storepath = placeholder "out"; + + cmakeFlags = [ + "-DELMER_INSTALL_LIB_DIR=${storepath}/lib" + "-DWITH_OpenMP:BOOLEAN=TRUE" + "-DWITH_MPI:BOOLEAN=TRUE" + "-DWITH_ELMERGUI:BOOLEAN=TRUE" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + "-DCMAKE_OpenGL_GL_PREFERENCE=GLVND" + ]; + + patches = [ + ./fix-cmake.patch + ]; + + enableParallelBuilding = true; + + meta = with stdenv.lib; { + homepage = http://www.elmerfem.org/; + description = "A finite element software for multiphysical problems."; + platforms = platforms.unix; + maintainers = [ maintainers.wulfsta ]; + license = licenses.lgpl21; + }; + +} diff --git a/pkgs/applications/science/physics/elmerfem/fix-cmake.patch b/pkgs/applications/science/physics/elmerfem/fix-cmake.patch new file mode 100644 index 000000000000..098f65207330 --- /dev/null +++ b/pkgs/applications/science/physics/elmerfem/fix-cmake.patch @@ -0,0 +1,13 @@ +diff --exclude '*~' -ruN A/torch/CMakeLists.txt B/torch/CMakeLists.txt +--- A/fem/tests/CMakeLists.txt 2020-04-23 02:35:03.243388917 -0400 ++++ B/fem/tests/CMakeLists.txt 2018-12-19 20:18:40.671857320 -0400 +@@ -14,7 +14,7 @@ + SET(MESH2D_BIN "${CMAKE_BINARY_DIR}/meshgen2d/src/Mesh2D") + + MACRO(SUBDIRLIST result curdir depth) + set(glob_pattern "*") +- FOREACH(D RANGE 1 depth) ++ FOREACH(D RANGE 1 ${depth}) + FILE(GLOB children RELATIVE ${curdir} ${glob_pattern}) + FOREACH(child ${children}) + IF(IS_DIRECTORY ${curdir}/${child}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 41f84902b3b5..045eee890527 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24603,7 +24603,9 @@ in dcmtk = callPackage ../applications/science/medicine/dcmtk { }; - ### PHYSICS + ### SCIENCE/PHYSICS + + elmerfem = callPackage ../applications/science/physics/elmerfem {}; sacrifice = callPackage ../applications/science/physics/sacrifice {};