Skip to content

Commit 989cd64

Browse files
committed
llhttp: fix broken static build for v9.3.1
fix xmake-io#9802 1. nodejs/llhttp#789 replaced the `BUILD_SHARED_LIBS` and `BUILD_STATIC_LIBS` with `LLHTTP_BUILD_SHARED_LIBS` and `LLHTTP_BUILD_STATIC_LIBS`. 2. Fix double compilation bug
1 parent 478a487 commit 989cd64

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

packages/l/llhttp/xmake.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,19 @@ package("llhttp")
3434
opt.cflags = {"-flax-vector-conversions"}
3535
end
3636
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
37-
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
38-
table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
37+
if package:version():ge("9.3.1") then
38+
table.insert(configs, "-DLLHTTP_BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
39+
table.insert(configs, "-DLLHTTP_BUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
40+
else
41+
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
42+
table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
43+
end
3944
import("package.tools.cmake").install(package, configs, opt)
4045
else
4146
xmake_configs.export_symbol = true
47+
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
48+
import("package.tools.xmake").install(package, xmake_configs)
4249
end
43-
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
44-
import("package.tools.xmake").install(package, xmake_configs)
4550

4651
if package:config("shared") then
4752
io.replace(package:installdir("include/llhttp.h"), "__declspec(dllexport)", "__declspec(dllimport)", {plain = true})

0 commit comments

Comments
 (0)