summaryrefslogtreecommitdiffstats
path: root/makefu/5pkgs/cmpforopenssl
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2017-08-16 12:33:54 +0200
committerlassulus <lassulus@lassul.us>2017-08-16 12:33:54 +0200
commit3b24a8306d0bb57924fcc64ec28c5b1aa3a4ac74 (patch)
treecbb9a36c1aa94eec48b6ce13c14e5c994df0f546 /makefu/5pkgs/cmpforopenssl
parentf8c0bcf1e9e4d4dd660e6fe82017e28dbbfd6024 (diff)
parenta795766f3a881d43f92dcafcf26eeb765e993ed7 (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/5pkgs/cmpforopenssl')
-rw-r--r--makefu/5pkgs/cmpforopenssl/default.nix82
-rw-r--r--makefu/5pkgs/cmpforopenssl/nix-ssl-cert-file.patch14
2 files changed, 96 insertions, 0 deletions
diff --git a/makefu/5pkgs/cmpforopenssl/default.nix b/makefu/5pkgs/cmpforopenssl/default.nix
new file mode 100644
index 000000000..3b9a20098
--- /dev/null
+++ b/makefu/5pkgs/cmpforopenssl/default.nix
@@ -0,0 +1,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";
+ }
diff --git a/makefu/5pkgs/cmpforopenssl/nix-ssl-cert-file.patch b/makefu/5pkgs/cmpforopenssl/nix-ssl-cert-file.patch
new file mode 100644
index 000000000..b615f1482
--- /dev/null
+++ b/makefu/5pkgs/cmpforopenssl/nix-ssl-cert-file.patch
@@ -0,0 +1,14 @@
+diff -ru -x '*~' openssl-1.0.2j-orig/crypto/x509/by_file.c openssl-1.0.2j/crypto/x509/by_file.c
+--- openssl-1.0.2j-orig/crypto/x509/by_file.c 2016-09-26 11:49:07.000000000 +0200
++++ openssl-1.0.2j/crypto/x509/by_file.c 2016-10-13 16:54:31.400288302 +0200
+@@ -97,7 +97,9 @@
+ switch (cmd) {
+ case X509_L_FILE_LOAD:
+ if (argl == X509_FILETYPE_DEFAULT) {
+- file = (char *)getenv(X509_get_default_cert_file_env());
++ file = (char *)getenv("NIX_SSL_CERT_FILE");
++ if (!file)
++ file = (char *)getenv(X509_get_default_cert_file_env());
+ if (file)
+ ok = (X509_load_cert_crl_file(ctx, file,
+ X509_FILETYPE_PEM) != 0);