-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibcurl-gnutls-stub.nix
29 lines (27 loc) · 1.11 KB
/
libcurl-gnutls-stub.nix
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
{ stdenv, writeText }:
# libPvGenICam.so from ebus_sdk links to libcurl-gnutls.so.4 and
# expect it to be compiled with versioned symbols. Nix does not use
# versioned symbols in this library so we cannot use nix-provided
# library. We also don't want to change curl derivation to use
# versioned symbols because nix fetch* functions depend on curl and
# the change causes rebuild of almost everything. Since we do not
# need curl-related functionality, we replace this library with a
# stub of empty functions.
stdenv.mkDerivation {
name = "libcurl-gnutls-stub";
src = writeText "libcurl-gnutls.c" ''
#define STUB(x) \
void x() {} \
__asm__(".symver " #x "," #x "@CURL_GNUTLS_3")
STUB(curl_easy_init);
STUB(curl_easy_strerror);
STUB(curl_easy_perform);
STUB(curl_easy_setopt);
STUB(curl_easy_cleanup);
'';
vers = writeText "libcurl-gnutls.vers" "CURL_GNUTLS_3 {};";
buildCommand = ''
mkdir -p $out/lib
gcc -fPIC -shared -Wl,--version-script=$vers -Wl,--soname='libcurl-gnutls.so.4' -o $out/lib/libcurl-gnutls.so.4 $src
'';
}