diff options
| author | ruki <[email protected]> | 2023-11-10 22:46:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-10 22:46:52 +0800 |
| commit | a98c3c6027dbfcf93f50044777bb5c0542f16cc5 (patch) | |
| tree | 95be8eefa3f70a83c7303b412eebda5739933ec7 | |
| parent | fcbd4baf1055b02ce4cd71ed96c7d32402f077e9 (diff) | |
get makensis
| -rw-r--r-- | xmake/plugins/pack/main.lua | 2 | ||||
| -rw-r--r-- | xmake/plugins/pack/nsis/main.lua | 41 |
2 files changed, 41 insertions, 2 deletions
diff --git a/xmake/plugins/pack/main.lua b/xmake/plugins/pack/main.lua index b0a147208..513888061 100644 --- a/xmake/plugins/pack/main.lua +++ b/xmake/plugins/pack/main.lua @@ -28,7 +28,7 @@ import("xpack") function _pack_package(package) assert(package:formats(), "xpack(%s): formats not found, please use `set_formats()` to set it.", package:name()) for _, format in package:formats():keys() do - import(format)(package) + import(format)(package, {format = format}) end end diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua index 695e5b19f..390ac329d 100644 --- a/xmake/plugins/pack/nsis/main.lua +++ b/xmake/plugins/pack/nsis/main.lua @@ -20,9 +20,48 @@ -- imports import("core.base.option") +import("lib.detect.find_tool") +import("private.action.require.impl.packagenv") +import("private.action.require.impl.install_packages") -function main(package) +-- get the makensis +function _get_makensis() + + -- enter the environments of nsis + local oldenvs = packagenv.enter("nsis") + + -- find makensis + local packages = {} + local makensis = find_tool("makensis", {check = "/CMDHELP"}) + if not makensis then + table.join2(packages, install_packages("nsis")) + end + + -- enter the environments of installed packages + for _, instance in ipairs(packages) do + instance:envs_enter() + end + + -- we need to force detect and flush detect cache after loading all environments + if not makensis then + makensis = find_tool("makensis", {check = "/CMDHELP", force = true}) + end + assert(makensis, "makensis not found!") + + return makensis, oldenvs +end + +function main(package, opt) + + -- get makensis + local makensis, oldenvs = _get_makensis() + print("makensis", makensis) + + -- do pack print("xpack(%s)", package:name()) print(" description: %s", package:description()) print(" installcmd: ", package:script("installcmd")) + + -- done + os.setenvs(oldenvs) end |
