Skip to content

Commit

Permalink
call rpmbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Dec 18, 2023
1 parent 9725c72 commit c1bba74
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
1 change: 1 addition & 0 deletions tests/plugins/pack/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down
2 changes: 2 additions & 0 deletions xmake/includes/xpack/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 3 additions & 16 deletions xmake/plugins/pack/srpm/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions xmake/plugins/pack/xpack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
}

Expand Down
4 changes: 2 additions & 2 deletions xmake/scripts/xpack/srpm/srpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand Down

0 comments on commit c1bba74

Please sign in to comment.