summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-12-18 22:41:39 +0800
committerruki <[email protected]>2023-12-18 22:41:39 +0800
commitc1bba747f0859fb6f559169563973f28905c71f7 (patch)
tree580748622990c3548e65ab289c4591e1163b3619
parent9725c72f8834475640800ec1ac5315ac803cb0a0 (diff)
call rpmbuild
-rw-r--r--tests/plugins/pack/xmake.lua1
-rw-r--r--xmake/includes/xpack/xmake.lua2
-rw-r--r--xmake/plugins/pack/srpm/main.lua19
-rw-r--r--xmake/plugins/pack/xpack.lua1
-rw-r--r--xmake/scripts/xpack/srpm/srpm.spec4
5 files changed, 9 insertions, 18 deletions
diff --git a/tests/plugins/pack/xmake.lua b/tests/plugins/pack/xmake.lua
index 34b741406..b1a4c641b 100644
--- a/tests/plugins/pack/xmake.lua
+++ b/tests/plugins/pack/xmake.lua
@@ -24,6 +24,7 @@ xpack("test")
set_author("ruki")
set_description("A test installer.")
set_homepage("https://xmake.io")
+ set_license("Apache-2.0")
set_licensefile("LICENSE.md")
add_targets("test", "foo")
add_installfiles("src/(assets/*.png)", {prefixdir = "images"})
diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua
index bbc7c5050..ad26db9c4 100644
--- a/xmake/includes/xpack/xmake.lua
+++ b/xmake/includes/xpack/xmake.lua
@@ -79,6 +79,8 @@ local apis = {
"xpack.set_specfile",
-- set icon file path, e.g foo.ico
"xpack.set_iconfile",
+ -- set package license
+ "xpack.set_license",
-- set package license file, we will also get them from target
"xpack.set_licensefile",
-- add source files
diff --git a/xmake/plugins/pack/srpm/main.lua b/xmake/plugins/pack/srpm/main.lua
index 7fd300c33..8963db272 100644
--- a/xmake/plugins/pack/srpm/main.lua
+++ b/xmake/plugins/pack/srpm/main.lua
@@ -55,6 +55,7 @@ end
-- get specvars
function _get_specvars(package)
local specvars = table.clone(package:specvars())
+ specvars.PACKAGE_SOURCEDIR = package:sourcedir()
return specvars
end
@@ -100,22 +101,8 @@ function _pack_srpm(rpmbuild, package)
end
end
- -- generate the setup.sh script
- --[[
- local sourcedir = package:sourcedir()
- local setupfile = path.join(sourcedir, "__setup__.sh")
- os.cp(path.join(os.programdir(), "scripts", "xpack", "srpm", "setup.sh"), setupfile)
- local scriptfile = io.open(setupfile, "a+")
- if scriptfile then
- _write_installcmds(package, scriptfile, batchcmds.get_installcmds(package):cmds())
- for _, component in table.orderpairs(package:components()) do
- if component:get("default") ~= false then
- _write_installcmds(package, scriptfile, batchcmds.get_installcmds(component):cmds())
- end
- end
- scriptfile:close()
- end]]
-
+ -- do pack
+ os.vrunv(rpmbuild, {"-bs", specfile, "--define", "_srcrpmdir " .. package:outputfile()})
end
function main(package)
diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua
index 4f9f01ad2..5cf5f24f4 100644
--- a/xmake/plugins/pack/xpack.lua
+++ b/xmake/plugins/pack/xpack.lua
@@ -302,6 +302,7 @@ function xpack:specvars()
PACKAGE_COPYRIGHT = self:get("copyright") or "",
PACKAGE_COMPANY = self:get("company") or "",
PACKAGE_ICONFILE = self:get("iconfile") or "",
+ PACKAGE_LICENSE = self:license() or "",
PACKAGE_LICENSEFILE = self:get("licensefile") or ""
}
diff --git a/xmake/scripts/xpack/srpm/srpm.spec b/xmake/scripts/xpack/srpm/srpm.spec
index 9372e49bf..bde3d768a 100644
--- a/xmake/scripts/xpack/srpm/srpm.spec
+++ b/xmake/scripts/xpack/srpm/srpm.spec
@@ -7,9 +7,9 @@ Version: ${PACKAGE_VERSION}
Release: 1%{?dist}
Summary: ${PACKAGE_TITLE}
-License: Apache-2.0 AND LicenseRef-Fedora-Public-Domain AND BSD
+License: ${PACKAGE_LICENSE}
URL: ${PACKAGE_HOMEPAGE}
-Source0: https://github.com/xmake-io/xmake/releases/download/v%{version}/%{name}-v%{version}.tar.gz
+Source0: ${PACKAGE_SOURCEDIR}
BuildRequires: gcc
BuildRequires: gcc-c++