about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-08-26 20:11:52 +0200
committerbptato <nincsnevem662@gmail.com>2023-08-26 20:11:52 +0200
commitce87773b7ec3fbf86223eb3e046670391a7ad89d (patch)
tree4e68cc81cd243e28bb765fbdaa885e1064ca0a87
parente0950d5f6eed46509246b4820ac478a5920354da (diff)
downloadchawan-ce87773b7ec3fbf86223eb3e046670391a7ad89d.tar.gz
Allow overriding libcurl name
for better compatibility with curl-impersonate
-rw-r--r--Makefile2
-rw-r--r--src/bindings/curl.nim12
2 files changed, 10 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index ef9df0fc..6e1edf96 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 NIMC = nim c
 OBJDIR = .obj
-FLAGS = -o:cha
+FLAGS = -o:cha -d:curlLibName:$(CURLLIBNAME)
 FILES = src/main.nim
 prefix = /usr/local
 QJSOBJ = $(OBJDIR)/quickjs
diff --git a/src/bindings/curl.nim b/src/bindings/curl.nim
index ed2057eb..bab180f5 100644
--- a/src/bindings/curl.nim
+++ b/src/bindings/curl.nim
@@ -1,7 +1,13 @@
 const curllib = (func(): string =
-  when defined(windows): return "libcurl.dll"
-  elif defined(macos): return "libcurl(|.4|.4.8.0).dylib"
-  else: return "libcurl.so(|.4|.4.8.0)" # assume posix
+  const curlLibName {.strdefine.} = ""
+  when curlLibName != "":
+    return curlLibName
+  elif defined(windows):
+    return "libcurl.dll"
+  elif defined(macos):
+    return "libcurl(|.4|.4.8.0).dylib"
+  else: # assume posix
+    return "libcurl.so(|.4|.4.8.0)"
 )()
 
 const