summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-23 23:01:36 +0800
committerruki <[email protected]>2023-11-23 23:01:36 +0800
commit375583b7de60067daf0b8b160524e4ad30b4b6b3 (patch)
treee82cb53f150bce5be260371ac0b9154f29c26364
parent1dbd290a8337e7bfb6bcc612c8e2be3aba6a33e9 (diff)
improve xmakesrc pack
-rw-r--r--.gitignore1
-rw-r--r--core/xpack.lua26
2 files changed, 14 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index bbc52df99..501d7e2f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,7 +41,6 @@ compile_commands.json
/core/**/*.obj
/core/**/*.lib
/core/**/*.exe
-/core/build
# for fortran
/tests/**/*.mod
diff --git a/core/xpack.lua b/core/xpack.lua
index d3d434aa1..bc2df257e 100644
--- a/core/xpack.lua
+++ b/core/xpack.lua
@@ -79,9 +79,21 @@ xpack_component("LongPath")
xpack("xmakesrc")
set_formats("zip", "targz")
set_basename("xmake-v$(version)")
- on_load(function (package)
+ before_package(function (package)
+ import("devel.git")
+
+ local rootdir = path.join(os.tmpfile(package:name()) .. ".dir", "repo")
+ os.tryrm(rootdir)
+ os.cp(path.directory(os.projectdir()), rootdir)
+
+ git.clean({repodir = rootdir, force = true, all = true})
+ git.reset({repodir = rootdir, hard = true})
+ if os.isfile(path.join(rootdir, ".gitmodules")) then
+ git.submodule.clean({repodir = rootdir, force = true, all = true})
+ git.submodule.reset({repodir = rootdir, hard = true})
+ end
+
local prefixdir = "xmake-" .. package:version()
- local rootdir = path.directory(os.projectdir())
local extraconf = {rootdir = rootdir, prefixdir = prefixdir}
package:add("installfiles", path.join(rootdir, "core/**|src/pdcurses/**|src/luajit/**|src/tbox/tbox/src/demo/**"), extraconf)
package:add("installfiles", path.join(rootdir, "xmake/**"), extraconf)
@@ -92,13 +104,3 @@ xpack("xmakesrc")
package:add("installfiles", path.join(rootdir, "scripts/debian/**"), extraconf)
package:add("installfiles", path.join(rootdir, "scripts/msys/**"), extraconf)
end)
- before_package(function (package)
- import("devel.git")
- local rootdir = path.directory(os.projectdir())
- git.clean({repodir = rootdir, force = true, all = true})
- git.reset({repodir = rootdir, hard = true})
- if os.isfile(path.join(rootdir, ".gitmodules")) then
- git.submodule.clean({repodir = rootdir, force = true, all = true})
- git.submodule.reset({repodir = rootdir, hard = true})
- end
- end)