diff --git a/xmake/plugins/pack/srpm/main.lua b/xmake/plugins/pack/srpm/main.lua index b30596a96f..60712a0f3b 100644 --- a/xmake/plugins/pack/srpm/main.lua +++ b/xmake/plugins/pack/srpm/main.lua @@ -117,6 +117,7 @@ function _get_specvars(package) if datestr then datestr = datestr:trim() end + specvars.PACKAGE_PREFIXDIR = package:prefixdir() or "" specvars.PACKAGE_DATE = datestr or "" specvars.PACKAGE_INSTALLCMDS = function () local installcmds = {} @@ -134,6 +135,13 @@ end -- pack srpm package function _pack_srpm(rpmbuild, package) + -- ensure prefixdir + local prefixdir = package:get("prefixdir") + if not prefixdir then + prefixdir = package:name() .. "-" .. package:version() + package:set("prefixdir", prefixdir) + end + -- install the initial specfile local specfile = package:specfile() if not os.isfile(specfile) then diff --git a/xmake/scripts/xpack/srpm/srpm.spec b/xmake/scripts/xpack/srpm/srpm.spec index fa16a64af2..cc82b87d28 100644 --- a/xmake/scripts/xpack/srpm/srpm.spec +++ b/xmake/scripts/xpack/srpm/srpm.spec @@ -18,6 +18,7 @@ BuildRequires: gcc-c++ ${PACKAGE_DESCRIPTION} %prep +%autosetup -n ${PACKAGE_PREFIXDIR} -p1 %build @@ -27,8 +28,6 @@ ${PACKAGE_INSTALLCMDS} %check %files -/resources/assets/file1.txt -/resources/assets/file2.txt %changelog * ${PACKAGE_DATE} ${PACKAGE_MAINTAINER} - ${PACKAGE_VERSION}-1