You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
4.1 KiB

  1. { stdenv, lib, fetchFromGitHub, jdk, lp_solve, lp_solve_java, makeWrapper
  2. #, ltl2dstar, ltl2ba
  3. , makeDesktopItem, python27 }:
  4. let
  5. src = fetchFromGitHub {
  6. owner = "prismmodelchecker";
  7. repo = "prism";
  8. rev = "c2f637e177853b38fb8d9530e801e56d620e4466";
  9. sha256 = "13xra91y542w808363wnqk9l7psnasy8c0sbkgmvxa6813i1i2i0";
  10. };
  11. version = "4.4-git";
  12. cuddPrism = stdenv.mkDerivation rec {
  13. name = "cudd-prism-${version}";
  14. inherit version src;
  15. buildInputs = [ jdk ];
  16. configurePhase = "true";
  17. buildPhase = ''
  18. (
  19. cd ./cudd
  20. make clean JAVA_DIR="${jdk}"
  21. )
  22. (
  23. cd ./prism
  24. # will become cuddpackage
  25. make cuddpackageforce JAVA_DIR="${jdk}"
  26. )
  27. '';
  28. installPhase = ''
  29. mkdir -p $out/{lib,include}
  30. cd ./cudd
  31. for dir in cudd dddmp epd mtr st util; do
  32. cp ./$dir/lib$dir.a $out/lib
  33. cp ./$dir/$dir.h $out/include
  34. done
  35. cp ./cudd/cuddInt.h $out/include
  36. '';
  37. meta.description = "Build of a Prism-adapted version of the CUDD library";
  38. };
  39. in stdenv.mkDerivation {
  40. pname = "prism";
  41. inherit version src;
  42. buildInputs = [ jdk lp_solve_java cuddPrism lp_solve makeWrapper python27 ];
  43. patchPhase = ''
  44. (cd ./prism
  45. substituteInPlace ./Makefile \
  46. --replace "CFLAGS=\"\$(CFLAGS)\"" "CFLAGS=\"\$(CFLAGS) \$(NIX_CFLAGS_COMPILE)\"" \
  47. --replace "CPPFLAGS=\"\$(CPPFLAGS)\"" "CPPFLAGS=\"\$(CPPFLAGS) \$(NIX_CFLAGS)\"" \
  48. --replace "LDFLAGS=\"\$(LDFLAGS)\"" "LDFLAGS=\"\$(LDFLAGS)\"" \
  49. --replace "LDFLAGS = \$(CUDD_XCFLAGS)" "LDFLAGS = -lc -lstdc++" \
  50. --replace "@./install.sh silent" ":"
  51. LPSOLVE_JAR=$(echo ${lp_solve_java}/lib/*.jar) #*/
  52. for dir in automata dv hybrid jdd jltl2ba jltl2dstar mtbdd odd param parser pepa/compiler prism pta settings strat userinterface ; do
  53. substituteInPlace ./src/$dir/Makefile \
  54. --replace "PRISM_CLASSPATH = \"" "PRISM_CLASSPATH = $LPSOLVE_JAR:\""
  55. done
  56. substituteInPlace ./src/bin/prism.linux \
  57. --replace "PRISM_DIR=/home/luser/prism" "PRISM_DIR=$out
  58. PRISM_JAVA=\''${PRISM_JAVA-${jdk}/bin/java}" \
  59. --replace "PRISM_CLASSPATH=" "PRISM_CLASSPATH=$LPSOLVE_JAR:" \
  60. --replace "PRISM_LIB_PATH=" "PRISM_LIB_PATH=${lp_solve_java}/lib:"
  61. substituteInPlace ./src/bin/xprism.linux \
  62. --replace "PRISM_DIR=/home/luser/prism" "PRISM_DIR=$out
  63. PRISM_JAVA=\''${PRISM_JAVA-${jdk}/bin/java}" \
  64. --replace "PRISM_CLASSPATH=" "PRISM_CLASSPATH=$LPSOLVE_JAR:" \
  65. --replace "PRISM_LIB_PATH=" "PRISM_LIB_PATH=${lp_solve_java}/lib:"
  66. )
  67. '';
  68. configurePhase = "true";
  69. buildPhase = ''
  70. (
  71. cd ./prism
  72. make clean JAVA_DIR="${jdk}"
  73. make make_dirs CUDD_DIR="${cuddPrism}" JAVA_DIR="${jdk}" JNI_H_DIR="${jdk}/include/linux" JNI_MD_H_DIR="${jdk}/include/linux"
  74. )
  75. '';
  76. installPhase = ''
  77. mkdir -p $out/{bin,lib,include,classes,images,share/applications,share/icons/hicolor/{256x256,128x128,64x64,48x48,32x32,24x24,16x16}/apps}
  78. cd ./prism
  79. make bin_scripts CUDD_DIR="${cuddPrism}" JAVA_DIR="${jdk}" JNI_H_DIR="${jdk}/include/linux" JNI_MD_H_DIR="${jdk}/include/linux"
  80. cp -r lib include bin classes images $out
  81. '' +
  82. # ''
  83. # cp etc/scripts/hoa/* $out/bin #*/
  84. # for i in $out/bin/hoa-* ; do
  85. # wrapProgram $i --prefix PATH : ${lib.makeBinPath [ ltl2dstar ltl2ba ]}
  86. # done
  87. # '' +
  88. ''
  89. cp etc/scripts/prism-auto $out/bin
  90. for i in etc/icons/p*.png ; do
  91. SIZE=''${i#*/p}
  92. SIZE=''${SIZE%.png}
  93. cp $i $out/share/icons/hicolor/''${SIZE}x''${SIZE}/apps/xprism.png
  94. done
  95. ln -s ${makeDesktopItem {
  96. name = "xprism";
  97. desktopName = "XPrism Model Checker";
  98. genericName = "Graphical frontend to Prism Model Checker";
  99. exec = "xprism";
  100. icon = "xprism";
  101. categories = "Application;Science;Development;";
  102. }}/share/applications/xprism.desktop $out/share/applications/xprism.desktop
  103. '';
  104. dontStrip = true;
  105. meta = with lib; {
  106. homepage = "http://www.prismmodelchecker.org/";
  107. description = "Prism Probabilistic Model Checker";
  108. license = licenses.gpl2;
  109. maintainers = [ maintainers.spacefrogg ];
  110. platforms = with platforms; linux;
  111. };
  112. }