about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/wolfssl/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/wolfssl/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/wolfssl/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/wolfssl/default.nix b/nixpkgs/pkgs/development/libraries/wolfssl/default.nix
new file mode 100644
index 000000000000..48178e774093
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/wolfssl/default.nix
@@ -0,0 +1,47 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  pname = "wolfssl";
+  version = "4.6.0";
+
+  src = fetchFromGitHub {
+    owner = "wolfSSL";
+    repo = "wolfssl";
+    rev = "v${version}-stable";
+    sha256 = "0hk3bnzznxj047gwxdxw2v3w6jqq47996m7g72iwj6c2ai9g6h4m";
+  };
+
+  # almost same as Debian but for now using --enable-all instead of --enable-distro to ensure options.h gets installed
+  configureFlags = [ "--enable-all --enable-pkcs11 --enable-tls13 --enable-base64encode" ];
+
+  outputs = [ "out" "dev" "doc" "lib" ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  postPatch = ''
+     # fix recursive cycle:
+     # build flags (including location of header files) are exposed in the
+     # public API of wolfssl, causing lib to depend on dev
+     substituteInPlace configure.ac \
+       --replace '#define LIBWOLFSSL_CONFIGURE_ARGS \"$ac_configure_args\"' ' '
+     substituteInPlace configure.ac \
+       --replace '#define LIBWOLFSSL_GLOBAL_CFLAGS \"$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS\"' ' '
+  '';
+
+
+  postInstall = ''
+     # fix recursive cycle:
+     # wolfssl-config points to dev, dev propagates bin
+     moveToOutput bin/wolfssl-config "$dev"
+     # moveToOutput also removes "$out" so recreate it
+     mkdir -p "$out"
+  '';
+
+  meta = with lib; {
+    description = "A small, fast, portable implementation of TLS/SSL for embedded devices";
+    homepage    = "https://www.wolfssl.com/";
+    platforms   = platforms.all;
+    license = lib.licenses.gpl2;
+    maintainers = with maintainers; [ mcmtroffaes ];
+  };
+}