Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
This commit is contained in:
commit
709392a910
|
@ -6,5 +6,8 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
/sbin/ldconfig -N -r "$RPM_BUILD_ROOT"
|
||||
# Create an empty config file for ldconfig to shut up a warning
|
||||
config=$(mktemp -p "$RPM_BUILD_ROOT")
|
||||
/sbin/ldconfig -f $(basename "$config") -N -r "$RPM_BUILD_ROOT"
|
||||
rm -f "$config"
|
||||
# TODO: warn if it created new symlinks and guide people.
|
||||
|
|
|
@ -332,3 +332,44 @@ linker flags:
|
|||
security exploits, redirecting execution). Therefore, it is
|
||||
preferable to turn of lazy binding, although it increases startup
|
||||
time.
|
||||
|
||||
# Support for extension builders
|
||||
|
||||
Some packages include extension builders that allow users to build
|
||||
extension modules (which are usually written in C and C++) under the
|
||||
control of a special-purpose build system. This is a common
|
||||
functionality provided by scripting languages such as Python and Perl.
|
||||
Traditionally, such extension builders captured the Fedora build flags
|
||||
when these extension were built. However, these compiler flags are
|
||||
adjusted for a specific Fedora release and toolchain version and
|
||||
therefore do not work with a custom toolchain (e.g., different C/C++
|
||||
compilers), and users might want to build their own extension modules
|
||||
with such toolchains.
|
||||
|
||||
The macros `%{extension_cflags}`, `%{extension_cxxflags}`,
|
||||
`%{extension_fflags}`, `%{extension_ldflags}` contain a subset of
|
||||
flags that have been adjusted for compatibility with alternative
|
||||
toolchains, while still preserving some of the compile-time security
|
||||
hardening that the standard Fedora build flags provide.
|
||||
|
||||
The current set of differences are:
|
||||
|
||||
* No GCC plugins (such as annobin) are activated.
|
||||
* No GCC spec files (`-specs=` arguments) are used.
|
||||
|
||||
Additional flags may be removed in the future if they prove to be
|
||||
incompatible with alternative toolchains.
|
||||
|
||||
Extension builders should detect whether they are performing a regular
|
||||
RPM build (e.g., by looking for an `RPM_OPT_FLAGS` variable). In this
|
||||
case, they should use the *current* set of Fedora build flags (that
|
||||
is, the output from `rpm --eval '%{build_cflags}'` and related
|
||||
commands). Otherwise, when not performing an RPM build, they can
|
||||
either use hard-coded extension builder flags (thus avoiding a
|
||||
run-time dependency on `redhat-rpm-config`), or use the current
|
||||
extension builder flags (with a run-time dependency on
|
||||
`redhat-rpm-config`).
|
||||
|
||||
As a result, extension modules built for Fedora will use the official
|
||||
Fedora build flags, while users will still be able to build their own
|
||||
extension modules with custom toolchains.
|
||||
|
|
37
common.lua
37
common.lua
|
@ -2,7 +2,7 @@
|
|||
|
||||
-- Set a spec variable
|
||||
-- Echo the result if verbose
|
||||
local function explicitset(rpmvar,value,verbose)
|
||||
local function explicitset(rpmvar, value, verbose)
|
||||
local value = value
|
||||
if (value == nil) or (value == "") then
|
||||
value = "%{nil}"
|
||||
|
@ -15,7 +15,7 @@ end
|
|||
|
||||
-- Unset a spec variable if it is defined
|
||||
-- Echo the result if verbose
|
||||
local function explicitunset(rpmvar,verbose)
|
||||
local function explicitunset(rpmvar, verbose)
|
||||
if (rpm.expand("%{" .. rpmvar .. "}") ~= "%{" .. rpmvar .. "}") then
|
||||
rpm.define(rpmvar .. " %{nil}")
|
||||
if verbose then
|
||||
|
@ -26,7 +26,7 @@ end
|
|||
|
||||
-- Set a spec variable, if not already set
|
||||
-- Echo the result if verbose
|
||||
local function safeset(rpmvar,value,verbose)
|
||||
local function safeset(rpmvar, value, verbose)
|
||||
if (rpm.expand("%{" .. rpmvar .. "}") == "%{" .. rpmvar .. "}") then
|
||||
explicitset(rpmvar,value,verbose)
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ end
|
|||
|
||||
-- Alias a list of rpm variables to the same variables suffixed with 0 (and vice versa)
|
||||
-- Echo the result if verbose
|
||||
local function zalias(rpmvars,verbose)
|
||||
local function zalias(rpmvars, verbose)
|
||||
for _, sfx in ipairs({{"","0"},{"0",""}}) do
|
||||
for _, rpmvar in ipairs(rpmvars) do
|
||||
local toalias = "%{?" .. rpmvar .. sfx[1] .. "}"
|
||||
|
@ -45,6 +45,18 @@ local function zalias(rpmvars,verbose)
|
|||
end
|
||||
end
|
||||
|
||||
-- Takes a list of rpm variable roots and a suffix and alias current<root> to
|
||||
-- <root><suffix> if it resolves to something not empty
|
||||
local function setcurrent(rpmvars, suffix, verbose)
|
||||
for _, rpmvar in ipairs(rpmvars) do
|
||||
if (rpm.expand("%{?" .. rpmvar .. suffix .. "}") ~= "") then
|
||||
explicitset( "current" .. rpmvar, "%{" .. rpmvar .. suffix .. "}", verbose)
|
||||
else
|
||||
explicitunset("current" .. rpmvar, verbose)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Echo the list of rpm variables, with suffix, if set
|
||||
local function echovars(rpmvars, suffix)
|
||||
for _, rpmvar in ipairs(rpmvars) do
|
||||
|
@ -101,13 +113,30 @@ local function getbestsuffix(rpmvar, value)
|
|||
return best
|
||||
end
|
||||
|
||||
-- https://github.com/rpm-software-management/rpm/issues/581
|
||||
-- Writes the content of a list of rpm variables to a macro spec file.
|
||||
-- The target file must contain the corresponding anchors.
|
||||
-- For example writevars("myfile", {"foo","bar"}) will replace:
|
||||
-- @@FOO@@ with the rpm evaluation of %{foo} and
|
||||
-- @@BAR@@ with the rpm evaluation of %{bar}
|
||||
-- in myfile
|
||||
local function writevars(macrofile,rpmvars)
|
||||
for _, rpmvar in ipairs(rpmvars) do
|
||||
print("sed -i 's\029" .. string.upper("@@" .. rpmvar .. "@@") ..
|
||||
"\029" .. rpm.expand( "%{" .. rpmvar .. "}" ) ..
|
||||
"\029g' " .. macrofile .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
explicitset = explicitset,
|
||||
explicitunset = explicitunset,
|
||||
safeset = safeset,
|
||||
zalias = zalias,
|
||||
setcurrent = setcurrent,
|
||||
echovars = echovars,
|
||||
getsuffixed = getsuffixed,
|
||||
getsuffixes = getsuffixes,
|
||||
getbestsuffix = getbestsuffix,
|
||||
writevars = writevars,
|
||||
}
|
||||
|
|
10
forge.lua
10
forge.lua
|
@ -66,7 +66,7 @@ end
|
|||
-- The forgemeta macro main processing function
|
||||
-- See the documentation in the macros.forge file for argument description
|
||||
-- Also called directly by gometa
|
||||
local function forgemeta(suffix, verbose, informative, silent)
|
||||
local function meta(suffix, verbose, informative, silent)
|
||||
local fedora = require "fedora.common"
|
||||
local ismain = (suffix == "") or (suffix == "0")
|
||||
if ismain then
|
||||
|
@ -143,6 +143,8 @@ local function forgemeta(suffix, verbose, informative, silent)
|
|||
elseif (fileref ~= "%{?commit" .. suffix .. "}") and
|
||||
string.match(rpm.expand(fileref), "^v[%d]") then
|
||||
fileref = string.gsub(rpm.expand(fileref), "^v", "")
|
||||
elseif (string.match(rpm.expand(fileref), "/")) then
|
||||
fileref = string.gsub(rpm.expand(fileref), "/", "-")
|
||||
end
|
||||
fedora.safeset("fileref" .. suffix, fileref, verbose)
|
||||
elseif (forge == "code.googlesource.com") then
|
||||
|
@ -201,7 +203,7 @@ local function forgemeta(suffix, verbose, informative, silent)
|
|||
distprefix = string.gsub(distprefix, "[%p%s]+", ".")
|
||||
distprefix = string.gsub(distprefix, "^" .. string.lower(rpm.expand("%{?repo}")) .. "%.?", "")
|
||||
local v = string.gsub(rpm.expand("%{version}"), "[%p%s]+", ".")
|
||||
for _, p in ipairs({'','v','v.','version','version.'}) do
|
||||
for _, p in ipairs({'','v','v.','version','version.','tags.v', 'tags.v.'}) do
|
||||
distprefix = getversionsuffix(distprefix, p .. v)
|
||||
end
|
||||
distprefix = string.gsub(distprefix, "^%.", "")
|
||||
|
@ -224,7 +226,7 @@ local function forgemeta(suffix, verbose, informative, silent)
|
|||
end
|
||||
if (rpm.expand(distprefix) ~= "") then
|
||||
if not ismain then
|
||||
distprefix = string.gsub(distprefix, "^%.", ".S")
|
||||
distprefix = string.gsub(distprefix, "^%.", ".s")
|
||||
end
|
||||
fedora.safeset ("distprefix" .. suffix, distprefix, verbose)
|
||||
end
|
||||
|
@ -248,6 +250,6 @@ local function forgemeta(suffix, verbose, informative, silent)
|
|||
end
|
||||
|
||||
return {
|
||||
forgemeta = forgemeta,
|
||||
meta = meta,
|
||||
}
|
||||
|
||||
|
|
16
macros
16
macros
|
@ -57,6 +57,22 @@
|
|||
FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
|
||||
LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS
|
||||
|
||||
# Internal-only. Do not use. Expand a variable and strip the flags
|
||||
# not suitable to extension builders.
|
||||
%__extension_strip_flags() %{lua:
|
||||
local name = rpm.expand("%{1}")
|
||||
local value = " " .. rpm.expand("%{build_" .. name .. "}")
|
||||
local result = string.gsub(value, "%s+-specs=[^%s]+", " ")
|
||||
print(result)
|
||||
}
|
||||
|
||||
# Variants of CFLAGS, CXXFLAGS, FFLAGS, LDFLAGS for use within
|
||||
# extension builders.
|
||||
%extension_cflags %{__extension_strip_flags cflags}
|
||||
%extension_cxxflags %{__extension_strip_flags cxxflags}
|
||||
%extension_fflags %{__extension_strip_flags fflags}
|
||||
%extension_ldflags %{__extension_strip_flags ldflags}
|
||||
|
||||
# Deprecated names. For backwards compatibility only.
|
||||
%__global_cflags %{build_cflags}
|
||||
%__global_cxxflags %{build_cxxflags}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
# Some miscellaneous Fedora-related macros
|
||||
|
||||
# List files matching inclusion globs, excluding files matching exclusion blogs
|
||||
# Parameters:
|
||||
# -i "<globs>" include shell globs (also takes all other macro arguments)
|
||||
# -x "<globs>" exclude shell globs
|
||||
%listfiles(i:x:) %{expand:
|
||||
while IFS= read -r -d $'\\n' finc ; do
|
||||
printf "%s\\n" %{?-x*} \\
|
||||
| xargs -i realpath --relative-base=. '{}' \\
|
||||
| grep "${finc}" >/dev/null || echo "${finc}"
|
||||
done <<< $(printf "%s\\n" %{?-i*} %* | xargs -i realpath --relative-base=. '{}' | sort -u)
|
||||
}
|
||||
|
||||
# https://github.com/rpm-software-management/rpm/issues/581
|
||||
# Write the contents of a list of rpm variables to a macro file.
|
||||
# The target file must contain the corresponding anchors.
|
||||
# For example %writevars -f myfile foo bar will replace:
|
||||
# @@FOO@@ with the rpm evaluation of %{foo} and
|
||||
# @@BAR@@ with the rpm evaluation of %{bar}
|
||||
# in myfile
|
||||
%writevars(f:) %{lua:
|
||||
local fedora = require "fedora.common"
|
||||
local macrofile = rpm.expand("%{-f*}")
|
||||
local rpmvars = {}
|
||||
for i = 1, rpm.expand("%#") do
|
||||
table.insert(rpmvars, rpm.expand("%" .. i))
|
||||
end
|
||||
fedora.writevars(macrofile,rpmvars)
|
||||
}
|
16
macros.forge
16
macros.forge
|
@ -53,10 +53,10 @@ local silent = rpm.expand("%{-s}") ~= ""
|
|||
local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
||||
if processall then
|
||||
for _,s in pairs(fedora.getsuffixes("forgeurl")) do
|
||||
forge.forgemeta(s,verbose,informative,silent)
|
||||
forge.meta(s,verbose,informative,silent)
|
||||
end
|
||||
else
|
||||
forge.forgemeta(rpm.expand("%{-z*}"),verbose,informative,silent)
|
||||
forge.meta(rpm.expand("%{-z*}"),verbose,informative,silent)
|
||||
end
|
||||
}
|
||||
|
||||
|
@ -83,15 +83,3 @@ end
|
|||
%forgeautosetup(z:vNS:p:q) %{lua:
|
||||
print(rpm.expand("%autosetup %{-v} %{-N} %{?-S} %{?-p} %{?forgesetupargs" .. rpm.expand("%{-z*}") .. "}\\n"))
|
||||
}
|
||||
|
||||
# List files matching inclusion globs, excluding files matching exclusion blogs
|
||||
# Parameters:
|
||||
# -i "<globs>" include shell globs (also takes all other macro arguments)
|
||||
# -x "<globs>" exclude shell globs
|
||||
%listfiles(i:x:) %{expand:
|
||||
while IFS= read -r -d $'\\n' finc ; do
|
||||
printf "%s\\n" %{?-x*} \\
|
||||
| xargs -i realpath --relative-base=. '{}' \\
|
||||
| grep "${finc}" >/dev/null || echo "${finc}"
|
||||
done <<< $(printf "%s\\n" %{?-i*} %* | xargs -i realpath --relative-base=. '{}' | sort -u)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
Summary: Red Hat specific rpm configuration files
|
||||
Name: redhat-rpm-config
|
||||
Version: 125
|
||||
Version: 127
|
||||
Release: 1.0.riscv64%{?dist}
|
||||
# No version specified.
|
||||
License: GPL+
|
||||
|
@ -40,6 +40,7 @@ Source151: macros.kmp
|
|||
Source152: macros.vpath
|
||||
Source153: macros.forge
|
||||
Source154: macros.ldconfig
|
||||
Source155: macros.fedora-misc
|
||||
|
||||
# Build policy scripts
|
||||
# this comes from https://github.com/rpm-software-management/rpm/pull/344
|
||||
|
@ -177,6 +178,7 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
|
|||
%{_rpmconfigdir}/macros.d/macros.forge
|
||||
%{_rpmconfigdir}/macros.d/macros.ldconfig
|
||||
%{_rpmconfigdir}/macros.d/macros.vpath
|
||||
%{_rpmconfigdir}/macros.d/macros.fedora-misc
|
||||
%dir %{_rpmluadir}/fedora
|
||||
%dir %{_rpmluadir}/fedora/srpm
|
||||
%dir %{_rpmluadir}/fedora/rpm
|
||||
|
@ -197,12 +199,18 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
|
|||
%{_rpmconfigdir}/macros.d/macros.kmp
|
||||
|
||||
%changelog
|
||||
* Thu Nov 29 2018 David Abdurachmanov <david.abdurachmanov@gmail.com> - 125-1.0.riscv64
|
||||
* Mon Jan 14 2019 David Abdurachmanov <david.abdurachmanov@gmail.com> - 127-1.0.riscv64
|
||||
- Disable perl_default_subpackage_tests (test suite subpackage for perl packages)
|
||||
- Disable %check for riscv64
|
||||
- Add -fasynchronous-unwind-tables -fstack-clash-protection to riscv64 (other
|
||||
arches seem to have them now)
|
||||
|
||||
* Thu Dec 20 2018 Florian Weimer <fweimer@redhat.com> - 127-1
|
||||
- Build flags: Add support for extension builders (#1543394)
|
||||
|
||||
* Mon Dec 17 2018 Panu Matilainen <pmatilai@redhat.com> - 126-1
|
||||
- Silence the annoying warning from ldconfig brp-script (#1540971)
|
||||
|
||||
* Thu Nov 15 2018 Miro Hrončok <mhroncok@redhat.com> - 125-1
|
||||
- Make automagic Python bytecompilation optional
|
||||
https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_2
|
||||
|
|
Loading…
Reference in New Issue