summaryrefslogtreecommitdiffstats
path: root/makefu/5pkgs/cmpforopenssl/default.nix
blob: 3b9a20098d10414b212b77ed5cd428b9614f7143 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{ stdenv, fetchurl, buildPackages, perl, fetchgit
, hostPlatform
}:

with stdenv.lib;

let

  common = args@{ rev, sha256, patches ? [] }: stdenv.mkDerivation rec {
    name = "cmpforopenssl-${rev}";

    src = fetchgit {
      url = "https://git.code.sf.net/p/cmpforopenssl/git";
      inherit sha256 rev;
      fetchSubmodules = false;
      deepClone = false;
    };

    patches =
      (args.patches or [])
      ++ [ ./nix-ssl-cert-file.patch ];

    outputs = [ "bin" "dev" "out" "man" ];
    setOutputFlags = false;
    separateDebugInfo = stdenv.isLinux;

    nativeBuildInputs = [ perl ];

    configureScript = "./config";

    configureFlags = [
      "shared"
      "--libdir=lib"
      "--openssldir=etc/ssl"
    ] ;

    makeFlags = [ "MANDIR=$(man)/share/man" ];

    # Parallel building is broken in OpenSSL.
    enableParallelBuilding = false;

    postInstall = ''
      # If we're building dynamic libraries, then don't install static
      # libraries.
      if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
          rm "$out/lib/"*.a
      fi

      mkdir -p $bin
      mv $out/bin $bin/

      mkdir $dev
      mv $out/include $dev/

      # remove dependency on Perl at runtime
      rm -r $out/etc/ssl/misc

      rmdir $out/etc/ssl/{certs,private}
    '';

    postFixup = ''
      # Check to make sure the main output doesn't depend on perl
      if grep -r '${buildPackages.perl}' $out; then
        echo "Found an erroneous dependency on perl ^^^" >&2
        exit 1
      fi
    '';


    meta = {
      homepage = https://sourceforge.net/p/cmpforopenssl ;
      description = "A cryptographic library that implements the SSL and TLS protocols";
      platforms = stdenv.lib.platforms.all;
      maintainers = [ stdenv.lib.maintainers.makefu ];
      priority = 0; # resolves collision with ‘man-pages’
    };
  };

in common {
    rev = "462b3";
    sha256 = "1h2k1c4lg27gmsyd72zrlr303jw765x8sscxblq2jwb44jag85na";
  }