1{ stdenv, lib, fetchgit, cmake, pkg-config, libubox-nossl, ssl_implementation }:
2
3stdenv.mkDerivation {
4 pname = "ustream-ssl";
5 version = "unstable-2022-12-08-${ssl_implementation.pname}";
6
7 src = fetchgit {
8 url = "https://git.openwrt.org/project/ustream-ssl.git";
9 rev = "9217ab46536353c7c792951b57163063f5ec7a3b";
10 sha256 = "1ldyyb3is213iljyccx98f56rb69rfpgdcb1kjxw9a176hvpipdd";
11 };
12
13 preConfigure = ''
14 sed -r \
15 -e "s|ubox_include_dir libubox/ustream.h|ubox_include_dir libubox/ustream.h HINTS ${libubox-nossl}/include|g" \
16 -e "s|ubox_library NAMES ubox|ubox_library NAMES ubox HINTS ${libubox-nossl}/lib|g" \
17 -e "s|^ FIND_LIBRARY\((.+)\)| FIND_LIBRARY\(\1 HINTS ${if ssl_implementation ? lib then ssl_implementation.lib else ssl_implementation.out}\)|g" \
18 -i CMakeLists.txt
19 '';
20
21 cmakeFlags = [ "-D${lib.toUpper ssl_implementation.pname}=ON" ];
22
23 nativeBuildInputs = [ cmake pkg-config ];
24 buildInputs = [ ssl_implementation ];
25
26 passthru = {
27 inherit ssl_implementation;
28 };
29
30 meta = with lib; {
31 description = "ustream SSL wrapper";
32 homepage = "https://git.openwrt.org/?p=project/ustream-ssl.git;a=summary";
33 license = licenses.isc;
34 maintainers = with maintainers; [ fpletz ];
35 platforms = platforms.all;
36 };
37}