Skip to content

Commit 0c6771a

Browse files
committed
✨ feat(repo/packages/m/micropython/xmake.lua): add with_ffi config
1 parent d879d49 commit 0c6771a

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

repo/packages/m/micropython/xmake.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ do
3333
"d0eb05d02339977f9c5771dcc81d2a616962ec57cb4d272fe8da3b8b22cc830c")
3434

3535
add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"})
36+
add_configs("with_ffi", {description = "use libffi library.", default = false, type = "boolean"})
3637

3738
on_load(function(package)
38-
package:add("deps", "libffi", {debug = package:config("debug"), configs = {shared = package:config("shared")}})
39+
if package:config("with_ffi") then
40+
package:add("deps", "libffi",
41+
{debug = package:config("debug"), configs = {shared = package:config("shared")}})
42+
end
3943
end)
4044

4145
on_install("cross@linux", function(package)
@@ -48,8 +52,12 @@ do
4852
local cxflags = {}
4953
local packagedeps = {}
5054

51-
table.insert(cxflags, "-DMICROPY_FORCE_PLAT_ALLOC_EXEC=0")
52-
table.insert(packagedeps, "libffi")
55+
if package:config("with_ffi") then
56+
table.insert(cxflags, "-DMICROPY_FORCE_PLAT_ALLOC_EXEC=0")
57+
table.insert(packagedeps, "libffi")
58+
else
59+
io.gsub("ports/unix/mpconfigport.mk", "MICROPY_PY_FFI =.-\n", 'MICROPY_PY_FFI = 0')
60+
end
5361

5462
os.setenv("PATH", path.directory(cc) .. ":" .. os.getenv("PATH"))
5563

0 commit comments

Comments
 (0)