Unverified Commit ab270e03 authored by Marcin Serwin's avatar Marcin Serwin Committed by GitHub
Browse files

mcrl2: fixed darwin build (#499239)

parents 239a293f ca60c04e
Loading
Loading
Loading
Loading
+33 −3
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@
  libGL,
  qt6,
  boost,
  ninja,
  makeWrapper,
}:

stdenv.mkDerivation rec {
@@ -19,18 +21,46 @@ stdenv.mkDerivation rec {
    hash = "sha256-Ur7GGXbYvVmrEUq/CTRyuVNLDHKfFrYHJibo0JvYhyM=";
  };

  nativeBuildInputs = [ cmake ];
  postInstall = lib.optional stdenv.hostPlatform.isDarwin ''
    mkdir $out/Applications
    mv $out/mCRL2.app $out/Applications
    mkdir $out/bin
    makeWrapper "$out/Applications/mCRL2.app/Contents/MacOS/mCRL2" "$out/bin/mcrl2ide"
  '';

  postFixup = lib.optional stdenv.hostPlatform.isDarwin ''
    APP_DIR="$out/Applications/mCRL2.app/Contents"
    find "$APP_DIR/lib" -name "*.dylib" | while read lib; do
      install_name_tool -id "@rpath/$(basename "$lib")" "$lib" || true
      otool -L "$lib" | grep "$out" | awk '{print $1}' | while read old_path; do
        install_name_tool -change "$old_path" "@rpath/$(basename "$old_path")" "$lib" || true
      done
    done
    find "$APP_DIR/bin" -type f | while read bin; do
      install_name_tool -add_rpath "@loader_path/../lib" "$bin" || true
      otool -L "$bin" | grep "$out" | awk '{print $1}' | while read old_path; do
        libname=$(basename "$old_path")
        install_name_tool -change "$old_path" "@rpath/$libname" "$bin" || true
      done
    done
  '';

  nativeBuildInputs = [
    cmake
    ninja
  ];

  buildInputs = [
    libGLU
    libGL
    qt6.qtbase
    boost
  ];
  ]
  ++ lib.optional stdenv.hostPlatform.isDarwin [ makeWrapper ];

  dontWrapQtApps = true;

  meta = {
    broken = stdenv.hostPlatform.isDarwin;
    description = "Toolset for model-checking concurrent systems and protocols";
    longDescription = ''
      A formal specification language with an associated toolset,