scyther: Separated into two derivations

+91 -62
+32
pkgs/applications/science/programming/scyther/cli.nix
··· 1 + { stdenv, glibc, flex, bison, cmake 2 + , version, src, meta }: 3 + stdenv.mkDerivation { 4 + name = "scyther-cli-${version}"; 5 + 6 + inherit src meta; 7 + 8 + buildInputs = [ 9 + cmake 10 + glibc.static 11 + flex 12 + bison 13 + ]; 14 + 15 + patchPhase = '' 16 + # Since we're not in a git dir, the normal command this project uses to create this file wouldn't work 17 + printf "%s\n" "#define TAGVERSION \"${version}\"" > src/version.h 18 + ''; 19 + 20 + configurePhase = '' 21 + (cd src && cmakeConfigurePhase) 22 + ''; 23 + 24 + dontUseCmakeBuildDir = true; 25 + cmakeFlags = [ "-DCMAKE_C_FLAGS=-std=gnu89" ]; 26 + 27 + installPhase = '' 28 + mkdir -p "$out/bin" 29 + mv src/scyther-linux "$out/bin/scyther-cli" 30 + ln -s "$out/bin/scyther-cli" "$out/bin/scyther-linux" 31 + ''; 32 + }
+58 -61
pkgs/applications/science/programming/scyther/default.nix
··· 1 - { stdenv, lib, fetchFromGitHub, glibc, flex, bison, python27Packages, graphviz, cmake 1 + { stdenv, lib, buildEnv, callPackage_i686, fetchFromGitHub, python27Packages, graphviz 2 2 , includeGUI ? true 3 3 , includeProtocols ? true 4 4 }: 5 5 let 6 6 version = "1.1.3"; 7 - in 8 - stdenv.mkDerivation { 9 - name = "scyther-${version}"; 7 + 10 8 src = fetchFromGitHub { 11 9 rev = "v${version}"; 12 10 sha256 = "0rb4ha5bnjxnwj4f3hciq7kyj96fhw14hqbwl5kr9cdw8q62mx0h"; ··· 14 12 repo = "scyther"; 15 13 }; 16 14 17 - buildInputs = [ 18 - cmake 19 - glibc.static 20 - flex 21 - bison 22 - ] ++ lib.optional includeGUI [ 23 - python27Packages.wrapPython 24 - ]; 15 + meta = with lib; { 16 + description = "Scyther is a tool for the automatic verification of security protocols."; 17 + homepage = https://www.cs.ox.ac.uk/people/cas.cremers/scyther/; 18 + license = licenses.gpl2; 19 + maintainers = with maintainers; [ infinisil ]; 20 + platforms = platforms.linux; 21 + }; 25 22 26 - patchPhase = '' 27 - # Since we're not in a git dir, the normal command this project uses to create this file wouldn't work 28 - printf "%s\n" "#define TAGVERSION \"${version}\"" > src/version.h 29 - '' + lib.optionalString includeGUI '' 30 - file=gui/Scyther/Scyther.py 31 - 32 - # By default the scyther binary is looked for in the directory of the python script ($out/gui), but we want to have it look where our cli package is 33 - substituteInPlace $file --replace "return getMyDir()" "return \"$out/bin\"" 23 + cli = callPackage_i686 ./cli.nix { 24 + inherit version src meta; 25 + }; 34 26 35 - # Removes the Shebang from the file, as this would be wrapped wrongly 36 - sed -i -e "1d" $file 37 - ''; 27 + gui = stdenv.mkDerivation { 28 + name = "scyther-gui-${version}"; 29 + inherit src meta; 30 + buildInputs = [ 31 + python27Packages.wrapPython 32 + ]; 38 33 39 - configurePhase = '' 40 - (cd src && cmakeConfigurePhase) 41 - ''; 34 + patchPhase = '' 35 + file=gui/Scyther/Scyther.py 42 36 43 - propagatedBuildInputs = lib.optional includeGUI [ 44 - python27Packages.wxPython 45 - graphviz 46 - ]; 47 - 48 - dontUseCmakeBuildDir = true; 49 - cmakeFlags = [ "-DCMAKE_C_FLAGS=-std=gnu89" ]; 37 + # By default the scyther binary is looked for in the directory of the python script ($out/gui), but we want to have it look where our cli package is 38 + substituteInPlace $file --replace "return getMyDir()" "return \"${cli}/bin\"" 39 + 40 + # Removes the Shebang from the file, as this would be wrapped wrongly 41 + sed -i -e "1d" $file 42 + ''; 50 43 51 - installPhase = '' 52 - mkdir -p "$out/bin" 53 - cp src/scyther-linux "$out/bin/scyther-cli" 54 - '' + lib.optionalString includeGUI '' 55 - mkdir -p "$out/gui" 56 - cp -r gui/* "$out/gui" 57 - ln -s ../gui/scyther-gui.py "$out/bin/scyther-gui" 58 - ln -s ../bin/scyther-cli "$out/bin/scyther-linux" 59 - '' + lib.optionalString includeProtocols (if includeGUI then '' 60 - ln -s ./gui/Protocols "$out/protocols" 61 - '' else '' 62 - mkdir -p "$out/protocols" 63 - cp -r gui/Protocols/* "$out/protocols" 64 - ''); 44 + dontBuild = true; 65 45 66 - postFixup = lib.optionalString includeGUI '' 67 - wrapPythonProgramsIn "$out/gui" "$out $pythonPath" 68 - ''; 46 + propagatedBuildInputs = [ 47 + python27Packages.wxPython 48 + graphviz 49 + ]; 50 + 51 + installPhase = '' 52 + mkdir -p "$out"/gui "$out"/bin 53 + cp -r gui/* "$out"/gui 54 + ln -s "$out"/gui/scyther-gui.py "$out/bin/scyther-gui" 55 + ''; 69 56 70 - doInstallCheck = includeGUI; 71 - installCheckPhase = '' 72 - "$out/gui/scyther.py" "$src/gui/Protocols/Demo/ns3.spdl" 73 - ''; 57 + postFixup = '' 58 + wrapPythonProgramsIn "$out/gui" "$out $pythonPath" 59 + ''; 74 60 75 - meta = with lib; { 76 - description = "Scyther is a tool for the automatic verification of security protocols."; 77 - homepage = https://www.cs.ox.ac.uk/people/cas.cremers/scyther/; 78 - license = licenses.gpl2; 79 - maintainers = with maintainers; [ infinisil ]; 80 - platforms = platforms.linux; 61 + doInstallCheck = true; 62 + installCheckPhase = '' 63 + "$out/gui/scyther.py" "$src/gui/Protocols/Demo/ns3.spdl" 64 + ''; 81 65 }; 82 - } 66 + in 67 + buildEnv { 68 + name = "scyther-${version}"; 69 + inherit meta; 70 + paths = [ cli ] ++ lib.optional includeGUI gui; 71 + pathsToLink = [ "/bin" ]; 72 + 73 + postBuild = '' 74 + rm "$out/bin/scyther-linux" 75 + '' + lib.optionalString includeProtocols '' 76 + mkdir -p "$out/protocols" 77 + cp -rv ${src}/protocols/* "$out/protocols" 78 + ''; 79 + }
+1 -1
pkgs/top-level/all-packages.nix
··· 17852 17852 17853 17853 plm = callPackage ../applications/science/programming/plm { }; 17854 17854 17855 - scyther = callPackage_i686 ../applications/science/programming/scyther { }; 17855 + scyther = callPackage ../applications/science/programming/scyther { }; 17856 17856 17857 17857 ### SCIENCE/LOGIC 17858 17858