Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .marscode/deviceInfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deviceId": "1d865d85971033dbc6e2146fc84e4bab560676c51efb52db347df5c3d503bafb"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是啥?删了

4 changes: 4 additions & 0 deletions xmake/includes/xpack/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ local apis = {
"xpack.add_buildrequires",
-- set nsis display icon
"xpack.set_nsis_displayicon",
-- set appimage icon name
"xpack.set_iconname",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The API name xpack.set_iconname is quite generic, but the comment indicates it's for AppImage. To avoid ambiguity and potential conflicts with other packaging formats, consider a more specific name like xpack.set_appimage_iconname. This would align with other format-specific APIs such as xpack.set_nsis_displayicon.

        "xpack.set_appimage_iconname",

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

按照上面的改下

Copy link
Member

@waruqi waruqi Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里还没改,暂时先分开单独设置

-- set appimage tool
"xpack.set_appimage_tool",
-- set package component title
"xpack_component.set_title",
-- set package component description
Expand Down
59 changes: 59 additions & 0 deletions xmake/modules/detect/tools/find_appimagetool.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
--!A cross-platform build utility based on Lua
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- Copyright (C) 2015-present, TBOOX Open Source Group.
--
-- @author RubMaker
-- @file find_appimagetool.lua
--

-- imports
import("lib.detect.find_program")

-- find appimagetool
--
-- @param opt the argument options
--
-- @return program path or nil
--
-- @code
--
-- local appimagetool = find_appimagetool()
--
-- @endcode
--
function main(opt)
opt = opt or {}

-- find appimagetool in system PATH
local program = find_program("appimagetool", opt)

-- if not found, check common installation paths
if not program then
local paths = {
"/usr/local/bin/appimagetool",
"/usr/bin/appimagetool",
"/opt/appimagetool/appimagetool"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里判断平台,这些都是 unix 路径,windows 下不会有

if not is_host("windows") then
    table.insert(paths, ..)
end

}

for _, p in ipairs(paths) do
if os.isfile(p) and os.isexec(p) then
program = p
break
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不对,find_program 支持 paths 参数传入,进行查找的,没必要额外自己实现。改下上面的 opt.paths 就行了

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参考

opt.paths = table.wrap(opt.paths)

end
end
end

return program
end
71 changes: 71 additions & 0 deletions xmake/modules/detect/tools/find_linuxdeploy.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
--!A cross-platform build utility based on Lua
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- Copyright (C) 2015-present, TBOOX Open Source Group.
--
-- @author RubMaker
-- @file find_linuxdeploy.lua
--

-- imports
import("lib.detect.find_program")

-- find linuxdeploy
--
-- @param opt the argument options
--
-- @return program path or nil
--
-- @code
--
-- local linuxdeploy = find_linuxdeploy()
--
-- @endcode
--
function main(opt)
opt = opt or {}

-- find linuxdeploy in system PATH
local program = find_program("linuxdeploy", opt)

-- if not found, check common installation paths
if not program then
local homedir = os.getenv("HOME")
local paths = {
"/usr/local/bin/linuxdeploy",
"/usr/bin/linuxdeploy",
"/opt/linuxdeploy/linuxdeploy",
path.join(os.tmpdir(), "linuxdeploy"),
path.join(homedir, "Downloads/linuxdeploy"),
path.join(homedir, "downloads/linuxdeploy"),
path.join(homedir, ".local/bin/linuxdeploy"),
path.join(homedir, "bin/linuxdeploy"),
"/snap/bin/linuxdeploy",
"/var/lib/flatpak/exports/bin/linuxdeploy",
path.join(homedir, ".local/share/flatpak/exports/bin/linuxdeploy"),
path.join(os.curdir(), "linuxdeploy"),
path.join(os.curdir(), "tools/linuxdeploy"),
path.join(os.curdir(), "bin/linuxdeploy")
}

for _, p in ipairs(paths) do
if os.isfile(p) and os.isexec(p) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里也是,挪到 find_program opt.paths里面

program = p
break
end
end
end

return program
end
73 changes: 73 additions & 0 deletions xmake/modules/detect/tools/find_linuxdeployqt.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
--!A cross-platform build utility based on Lua
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- Copyright (C) 2015-present, TBOOX Open Source Group.
--
-- @author RubMaker
-- @file find_linuxdeployqt.lua
--

-- imports
import("lib.detect.find_program")

-- find linuxdeployqt
--
-- @param opt the argument options
--
-- @return program path or nil
--
-- @code
--
-- local linuxdeployqt = find_linuxdeployqt()
--
-- @endcode
--
function main(opt)
opt = opt or {}

-- find linuxdeployqt in system PATH
local program = find_program("linuxdeployqt", opt)

-- if not found, check common installation paths
if not program then
-- get home directory safely
local homedir = os.getenv("HOME")

local paths = {
"/usr/local/bin/linuxdeployqt",
"/usr/bin/linuxdeployqt",
"/opt/linuxdeployqt/linuxdeployqt",
path.join(os.tmpdir(), "linuxdeployqt"),
path.join(homedir, "Downloads/linuxdeployqt"),
path.join(homedir, "downloads/linuxdeployqt"),
path.join(homedir, ".local/bin/linuxdeployqt"),
path.join(homedir, "bin/linuxdeployqt"),
"/snap/bin/linuxdeployqt",
"/var/lib/flatpak/exports/bin/linuxdeployqt",
path.join(homedir, ".local/share/flatpak/exports/bin/linuxdeployqt"),
path.join(os.curdir(), "linuxdeployqt"),
path.join(os.curdir(), "tools/linuxdeployqt"),
path.join(os.curdir(), "bin/linuxdeployqt")
}

for _, p in ipairs(paths) do
if os.isfile(p) and os.isexec(p) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里

program = p
break
end
end
end

return program
end
Loading