diff options
| author | ruki <[email protected]> | 2023-11-21 22:41:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-21 22:41:26 +0800 |
| commit | b07ccfbad1bf0ab942bf9247f09655c75f5cf199 (patch) | |
| tree | 6e4a2afdc2afec5ad101f5246daf7836133fe0ef /core/xpack.lua | |
| parent | d9bd4228a079cadf73092c1317a3a34717c6f3e6 (diff) | |
pack xmakesrc tar.gz and zip
Diffstat (limited to 'core/xpack.lua')
| -rw-r--r-- | core/xpack.lua | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/core/xpack.lua b/core/xpack.lua index a84c839d5..fb9c50264 100644 --- a/core/xpack.lua +++ b/core/xpack.lua @@ -69,3 +69,51 @@ xpack("xmake") WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1 ${EndIf}]], {description = "Increases the maximum path length limit, up to 32,767 characters (before 256)."}) +xpack("xmakesrc") + set_formats("src_zip", "src_targz") + set_basename("xmake-v$(version)") + on_load(function (package) + local format = package:format() + if format == "src_zip" then + package:set("extension", ".zip") + elseif format == "src_targz" then + package:set("extension", ".tar.gz") + end + end) + on_package(function (package) + import("devel.git") + import("utils.archive") + print("packing %s", package:outputfile()) + local tmpdir = os.tmpfile() .. ".dir" + local repodir = path.join(tmpdir, "repo") + local srcdir = path.join(package:rootdir(), "xmakesrc") + local topdir = path.join(srcdir, "xmake-" .. package:version()) + os.tryrm(repodir) + os.cp(path.directory(path.absolute(os.projectdir())), repodir) + git.clean({repodir = repodir, force = true, all = true}) + git.reset({repodir = repodir, hard = true}) + if os.isfile(path.join(repodir, ".gitmodules")) then + git.submodule.clean({repodir = repodir, force = true, all = true}) + git.submodule.reset({repodir = repodir, hard = true}) + end + os.mkdir(path.join(topdir, "scripts")) + os.vcp(path.join(repodir, "core"), topdir) + os.vcp(path.join(repodir, "xmake"), topdir) + os.vcp(path.join(repodir, "*.md"), topdir) + os.vcp(path.join(repodir, "configure"), topdir) + os.vcp(path.join(repodir, "scripts", "*.sh"), path.join(topdir, "scripts")) + os.vcp(path.join(repodir, "scripts", "man"), path.join(topdir, "scripts")) + os.vcp(path.join(repodir, "scripts", "debian"), path.join(topdir, "scripts")) + os.vcp(path.join(repodir, "scripts", "msys"), path.join(topdir, "scripts")) + os.rm(path.join(topdir, "core", "src", "tbox", "tbox", "src", "demo")) + os.rm(path.join(topdir, "core", "src", "luajit")) + os.rm(path.join(topdir, "core", "src", "pdcurses")) + + -- archive files + local oldir = os.cd(srcdir) + local archivefiles = os.files("**") + os.cd(oldir) + archive.archive(path.absolute(package:outputfile()), archivefiles, {curdir = srcdir, compress = "best"}) + os.tryrm(tmpdir) + end) + |
