summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaciej Krüger <mkg20001@gmail.com>2023-02-08 21:24:06 +0100
committerMaciej Krüger <mkg20001@gmail.com>2023-02-08 21:25:22 +0100
commite0fbf34964af9eaa3e68204e14137ad9a49b640c (patch)
treeb2037efb9e82d9c387e06afa52b1a2f326139822
parent43ce59c656ee25643335da4729110ea817bafa5e (diff)
downloadnixpkgs-e0fbf34964af9eaa3e68204e14137ad9a49b640c.tar
nixpkgs-e0fbf34964af9eaa3e68204e14137ad9a49b640c.tar.gz
nixpkgs-e0fbf34964af9eaa3e68204e14137ad9a49b640c.tar.bz2
nixpkgs-e0fbf34964af9eaa3e68204e14137ad9a49b640c.tar.lz
nixpkgs-e0fbf34964af9eaa3e68204e14137ad9a49b640c.tar.xz
nixpkgs-e0fbf34964af9eaa3e68204e14137ad9a49b640c.tar.zst
nixpkgs-e0fbf34964af9eaa3e68204e14137ad9a49b640c.zip
libubox: add ssl flavours
-rw-r--r--pkgs/development/libraries/libubox/default.nix13
-rw-r--r--pkgs/development/libraries/ustream-ssl/default.nix12
-rw-r--r--pkgs/top-level/all-packages.nix8
3 files changed, 25 insertions, 8 deletions
diff --git a/pkgs/development/libraries/libubox/default.nix b/pkgs/development/libraries/libubox/default.nix
index cd8790c0e88..0a1e1e7f0a2 100644
--- a/pkgs/development/libraries/libubox/default.nix
+++ b/pkgs/development/libraries/libubox/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, lib, fetchgit, cmake, pkg-config, json_c, with_lua ? false, lua5_1 }:
+{ stdenv, lib, fetchgit, cmake, pkg-config, json_c, with_lua ? false, lua5_1, with_ustream_ssl ? false, ustream-ssl }:
 
 stdenv.mkDerivation {
   pname = "libubox";
-  version = "unstable-2023-01-03";
+  version = "unstable-2023-01-03${lib.optionalString with_ustream_ssl "-${ustream-ssl.ssl_implementation.pname}"}";
 
   src = fetchgit {
     url = "https://git.openwrt.org/project/libubox.git";
@@ -13,7 +13,14 @@ stdenv.mkDerivation {
   cmakeFlags = [ "-DBUILD_EXAMPLES=OFF" (if with_lua then "-DLUAPATH=${placeholder "out"}/lib/lua" else "-DBUILD_LUA=OFF") ];
 
   nativeBuildInputs = [ cmake pkg-config ];
-  buildInputs = [ json_c ] ++ lib.optional with_lua lua5_1;
+  buildInputs = [ json_c ] ++ lib.optional with_lua lua5_1 ++ lib.optional with_ustream_ssl ustream-ssl;
+
+  postInstall = lib.optionalString with_ustream_ssl ''
+    for fin in $(find ${ustream-ssl} -type f); do
+      fout="''${fin/"${ustream-ssl}"/"''${out}"}"
+      ln -s "$fin" "$fout"
+    done
+  '';
 
   meta = with lib; {
     description = "C utility functions for OpenWrt";
diff --git a/pkgs/development/libraries/ustream-ssl/default.nix b/pkgs/development/libraries/ustream-ssl/default.nix
index 27b40d0a7ce..007ebc9c457 100644
--- a/pkgs/development/libraries/ustream-ssl/default.nix
+++ b/pkgs/development/libraries/ustream-ssl/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, lib, fetchgit, cmake, pkg-config, libubox, ssl_implementation }:
+{ stdenv, lib, fetchgit, cmake, pkg-config, libubox-nossl, ssl_implementation }:
 
 stdenv.mkDerivation {
   pname = "ustream-ssl";
-  version = "unstable-2022-12-08";
+  version = "unstable-2022-12-08-${ssl_implementation.pname}";
 
   src = fetchgit {
     url = "https://git.openwrt.org/project/ustream-ssl.git";
@@ -12,8 +12,8 @@ stdenv.mkDerivation {
 
   preConfigure = ''
     sed -r \
-        -e "s|ubox_include_dir libubox/ustream.h|ubox_include_dir libubox/ustream.h HINTS ${libubox}/include|g" \
-        -e "s|ubox_library NAMES ubox|ubox_library NAMES ubox HINTS ${libubox}/lib|g" \
+        -e "s|ubox_include_dir libubox/ustream.h|ubox_include_dir libubox/ustream.h HINTS ${libubox-nossl}/include|g" \
+        -e "s|ubox_library NAMES ubox|ubox_library NAMES ubox HINTS ${libubox-nossl}/lib|g" \
         -e "s|^  FIND_LIBRARY\((.+)\)|  FIND_LIBRARY\(\1 HINTS ${if ssl_implementation ? lib then ssl_implementation.lib else ssl_implementation.out}\)|g" \
         -i CMakeLists.txt
   '';
@@ -23,6 +23,10 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ ssl_implementation ];
 
+  passthru = {
+    inherit ssl_implementation;
+  };
+
   meta = with lib; {
     description = "ustream SSL wrapper";
     homepage = "https://git.openwrt.org/?p=project/ustream-ssl.git;a=summary";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index aa5aabd12f4..141617f13a9 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -21751,7 +21751,13 @@ with pkgs;
 
   libu2f-server = callPackage ../development/libraries/libu2f-server { };
 
-  libubox = callPackage ../development/libraries/libubox { };
+  libubox-nossl = callPackage ../development/libraries/libubox { };
+
+  libubox = callPackage ../development/libraries/libubox { with_ustream_ssl = true; };
+
+  libubox-wolfssl = callPackage ../development/libraries/libubox { with_ustream_ssl = true; ustream-ssl = ustream-ssl-wolfssl; };
+
+  libubox-mbedtls = callPackage ../development/libraries/libubox { with_ustream_ssl = true; ustream-ssl = ustream-ssl-mbedtls; };
 
   libudev-zero = callPackage ../development/libraries/libudev-zero { };