summary refs log tree commit diff
path: root/pkgs/applications/science/misc/openmodelica/default.nix
blob: 50d4dcc1a9ff6a58b884d02f8ab9cf0c886b30c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{stdenv, fetchgit, fetchsvn, autoconf, automake, libtool, gfortran, clang, cmake, gnumake,
hwloc, jre, lapack, blas, hdf5, expat, ncurses, readline, qt4, webkitgtk, which,
lp_solve, omniorb, sqlite, libatomic_ops, pkgconfig, file, gettext, flex, bison,
doxygen, boost, openscenegraph, gnome2, xorg, git, bash, gtk2, makeWrapper }:

let

  fakegit = import ./fakegit.nix {inherit stdenv fetchgit fetchsvn bash;} ;

in

stdenv.mkDerivation {
  name = "openmodelica";

  src = fetchgit (import ./src-main.nix);

  buildInputs = [autoconf cmake automake libtool gfortran clang gnumake
    hwloc jre lapack blas hdf5 expat ncurses readline qt4 webkitgtk which
    lp_solve omniorb sqlite libatomic_ops pkgconfig file gettext flex bison
    doxygen boost openscenegraph gnome2.gtkglext xorg.libXmu
    git gtk2 makeWrapper];

  hardeningDisable = [ "format" ];

  enableParallelBuilding = true;

  patchPhase = ''
    cp -fv ${fakegit}/bin/checkout-git.sh libraries/checkout-git.sh
    cp -fv ${fakegit}/bin/checkout-svn.sh libraries/checkout-svn.sh
  '';

  configurePhase = ''
    export NIX_LDFLAGS="$NIX_LDFLAGS -L${gfortran.cc.lib}/lib"

    autoconf
    ./configure CC=${clang}/bin/clang CXX=${clang}/bin/clang++ --prefix=$out
  '';

  postFixup = ''
    for e in $(cd $out/bin && ls); do
      wrapProgram $out/bin/$e \
        --prefix PATH : "${gnumake}/bin" \
        --prefix LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ lapack blas ]}"
    done
  '';

  meta = with stdenv.lib; {
    description = "OpenModelica is an open-source Modelica-based modeling and simulation environment";
    homepage    = "https://openmodelica.org";
    license     = licenses.gpl3;
    maintainers = with maintainers; [ smironov ];
    platforms   = platforms.linux;
    broken      = true;
  };
}