Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xpack: wix toolset support #5153

Merged
merged 28 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions core/xpack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ xpack("xmake")
set_copyright("Copyright (C) 2015-present, TBOOX Open Source Group")
set_author("[email protected]")
set_licensefile("../LICENSE.md")
set_formats("nsis", "zip")
set_formats("nsis", "wix", "zip")
add_targets("demo")
set_bindir(".")
set_iconfile("src/demo/xmake.ico")
Expand Down Expand Up @@ -33,7 +33,7 @@ xpack("xmake")
import("utils.archive")
import("core.base.global")
local format = package:format()
if package:is_plat("windows") and (format == "nsis" or format == "zip") then
if package:is_plat("windows") and (format == "nsis" or format == "wix" or format == "zip") then
local winenv = path.join(os.programdir(), "winenv")
if os.isdir(winenv) then
package:add("installfiles", path.join(winenv, "**"), {rootdir = path.directory(winenv)})
Expand Down Expand Up @@ -69,6 +69,11 @@ xpack_component("LongPath")
; Enable long path
WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1
${EndIf}]])
batchcmds:rawcmd("wix", [[
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Control\FileSystem">
<RegistryValue Type="integer" Name="LongPathsEnabled" Value="1" KeyPath="yes"/>
</RegistryKey>
]])
end)

xpack("xmakesrc")
Expand Down
7 changes: 6 additions & 1 deletion tests/plugins/pack/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target("foo")
add_packages("zlib")

xpack("test")
set_formats("nsis", "srpm", "rpm", "zip", "targz", "srczip", "srctargz", "runself")
set_formats("nsis", "srpm", "rpm", "zip", "targz", "srczip", "srctargz", "runself", "wix")
set_title("hello")
set_author("ruki")
set_description("A test installer.")
Expand Down Expand Up @@ -61,6 +61,11 @@ xpack_component("LongPath")
set_title("Enable Long Path")
set_description("Increases the maximum path length limit, up to 32,767 characters (before 256).")
on_installcmd(function (component, batchcmds)
batchcmds:rawcmd("wix", [[
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Control\FileSystem">
<RegistryValue Type="integer" Name="LongPathsEnabled" Value="1" KeyPath="yes"/>
</RegistryKey>
]])
batchcmds:rawcmd("nsis", [[
${If} $NoAdmin == "false"
; Enable long path
Expand Down
1 change: 1 addition & 0 deletions xmake/core/package/package.lua
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ function _instance:manifest_save()
manifest.mode = self:mode()
manifest.configs = self:configs()
manifest.envs = self:_rawenvs()
manifest.pathenvs = self:_pathenvs():to_array()

-- save enabled library deps
if self:librarydeps() then
Expand Down
12 changes: 8 additions & 4 deletions xmake/modules/private/action/require/impl/packagenv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@
--

-- imports
import("core.base.hashset")
import("core.package.package", {alias = "core_package"})

-- enter the package environments
function _enter_package(package_name, envs, installdir)
function _enter_package(package_name, envs, pathenvs, installdir)
if pathenvs then
pathenvs = hashset.from(pathenvs)
end
for name, values in pairs(envs) do
if name == "PATH" or name == "LD_LIBRARY_PATH" or name == "DYLD_LIBRARY_PATH" then
if pathenvs and pathenvs:has(name) then
for _, value in ipairs(values) do
if path.is_absolute(value) then
os.addenv(name, value)
else
os.addenv(name, path.join(installdir, value))
os.addenv(name, path.normalize(path.join(installdir, value)))
end
end
else
Expand All @@ -45,7 +49,7 @@ function enter(...)
for _, manifest_file in ipairs(os.files(path.join(core_package.installdir(), name:sub(1, 1), name, "*", "*", "manifest.txt"))) do
local manifest = io.load(manifest_file)
if manifest and manifest.plat == os.host() and manifest.arch == os.arch() then
_enter_package(name, manifest.envs, path.directory(manifest_file))
_enter_package(name, manifest.envs, manifest.pathenvs, path.directory(manifest_file))
end
end
end
Expand Down
Loading
Loading