Compare commits
69 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8d0f015896 | ||
|
1926c37598 | ||
|
a0e94bfc3d | ||
|
17a3cd024b | ||
|
2dd8d4cbdf | ||
|
3ec329b234 | ||
|
73aefaaac7 | ||
|
43dfe7d6f0 | ||
|
bc8fa85e90 | ||
|
dbb1278523 | ||
|
e0cfcc0fc7 | ||
|
cfdc80c51a | ||
|
74e11b4fa8 | ||
|
fdce9c67af | ||
|
def9a339d2 | ||
|
bd8637f7c3 | ||
|
139bc590fb | ||
|
b6b865f3d5 | ||
|
7581d21caa | ||
|
3d7758a2f0 | ||
|
391eca3508 | ||
|
27a8c7a7c2 | ||
|
61b19ee1b2 | ||
|
de1fe58a50 | ||
|
d8287391e7 | ||
|
0ce9e05ca9 | ||
|
c0fba28f76 | ||
|
f97705d6fd | ||
|
5c9060a85e | ||
|
6854161259 | ||
|
e6fe6513ee | ||
|
db291b8b29 | ||
|
9bbf519889 | ||
|
0d621460ce | ||
|
ee8888f636 | ||
|
c18bafdecc | ||
|
72a5199a5f | ||
|
d698d04313 | ||
|
8a5ee87c50 | ||
|
61f9eb90ba | ||
|
1e92e63ac8 | ||
|
4637e1bd55 | ||
|
06f1d527d7 | ||
|
5a7ab8f927 | ||
|
5baaf4a99c | ||
|
5f32aac09e | ||
|
e453b585b4 | ||
|
1d8a367d96 | ||
|
8a4f0edb9a | ||
|
331ffabd7e | ||
|
ecf9fd3bdb | ||
|
2c5594c9af | ||
|
5d8c70518a | ||
|
828c69effe | ||
|
91333a9c7c | ||
|
7562b38ec5 | ||
|
a468b36e29 | ||
|
fff16e5f5a | ||
|
891c721814 | ||
|
7324b32455 | ||
|
166707b501 | ||
|
0cb7566d95 | ||
|
a52af8dced | ||
|
e416a7b3da | ||
|
2a236590f5 | ||
|
7ca91f59f7 | ||
|
75a48b3556 | ||
|
924b9f3be4 | ||
|
cecab66c5d |
47
brp-llvm-compile-lto-elf
Executable file
47
brp-llvm-compile-lto-elf
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/bash -eu
|
||||||
|
|
||||||
|
CLANG_FLAGS=$@
|
||||||
|
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
TMPDIR=`mktemp -d`
|
||||||
|
|
||||||
|
check_convert_bitcode () {
|
||||||
|
local file_name=`realpath ${1}`
|
||||||
|
local file_type=`file ${file_name}`
|
||||||
|
|
||||||
|
if [[ "${file_type}" == *"LLVM IR bitcode"* ]]; then
|
||||||
|
# check for an indication that the bitcode was
|
||||||
|
# compiled with -flto
|
||||||
|
llvm-bcanalyzer -dump ${file_name} | grep -xP '.*\-flto((?!-fno-lto).)*' 2>&1 > /dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Compiling LLVM bitcode file ${file_name}."
|
||||||
|
# create path to file in temp dir
|
||||||
|
# move file to temp dir with llvm .bc extension for clang
|
||||||
|
mkdir -p ${TMPDIR}/`dirname ${file_name}`
|
||||||
|
mv $file_name ${TMPDIR}/${file_name}.bc
|
||||||
|
clang -c ${CLANG_FLAGS} -fno-lto -Wno-unused-command-line-argument ${TMPDIR}/${file_name}.bc -o ${file_name}
|
||||||
|
fi
|
||||||
|
elif [[ "${file_type}" == *"current ar archive"* ]]; then
|
||||||
|
echo "Unpacking ar archive ${file_name} to check for LLVM bitcode components."
|
||||||
|
# create archive stage for objects
|
||||||
|
local archive_stage=`mktemp -d`
|
||||||
|
local archive=${file_name}
|
||||||
|
pushd ${archive_stage}
|
||||||
|
ar x ${archive}
|
||||||
|
for archived_file in `find -not -type d`; do
|
||||||
|
check_convert_bitcode ${archived_file}
|
||||||
|
echo "Repacking ${archived_file} into ${archive}."
|
||||||
|
ar r ${archive} ${archived_file}
|
||||||
|
done
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Checking for LLVM bitcode artifacts"
|
||||||
|
for i in `find $RPM_BUILD_ROOT -type f -name "*.[ao]"`; do
|
||||||
|
check_convert_bitcode ${i}
|
||||||
|
done
|
||||||
|
|
@ -93,7 +93,14 @@ while IFS= read -r line; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
read shebang_line < "$f"
|
if ! read shebang_line < "$f"; then
|
||||||
|
echo >&2 "*** WARNING: Cannot read the first line from $f, removing executable bit"
|
||||||
|
ts=$(stat -c %y "$f")
|
||||||
|
chmod -x "$f"
|
||||||
|
touch -d "$ts" "$f"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
orig_shebang="${shebang_line#\#!}"
|
orig_shebang="${shebang_line#\#!}"
|
||||||
if [ "$orig_shebang" = "$shebang_line" ]; then
|
if [ "$orig_shebang" = "$shebang_line" ]; then
|
||||||
echo >&2 "*** WARNING: $f is executable but has no shebang, removing executable bit"
|
echo >&2 "*** WARNING: $f is executable but has no shebang, removing executable bit"
|
||||||
|
@ -1,144 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
errors_terminate=$2
|
|
||||||
extra=$3
|
|
||||||
|
|
||||||
# If using normal root, avoid changing anything.
|
|
||||||
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Figure out how deep we need to descend. We could pick an insanely high
|
|
||||||
# number and hope it's enough, but somewhere, somebody's sure to run into it.
|
|
||||||
depth=`(find "$RPM_BUILD_ROOT" -type f -name "*.py" -print0 ; echo /) | \
|
|
||||||
xargs -0 -n 1 dirname | sed 's,[^/],,g' | sort -u | tail -n 1 | wc -c`
|
|
||||||
if [ -z "$depth" -o "$depth" -le "1" ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This function now implements Python byte-compilation in two different ways:
|
|
||||||
# Python >= 3.4 uses a new module compileall2 - https://github.com/fedora-python/compileall2
|
|
||||||
# Python < 3.4 (inc. Python 2) uses compileall module from stdlib with some hacks
|
|
||||||
# When we drop support for Python 2, we'd be able to use all compileall2 features like:
|
|
||||||
# - -s and -p options to manipulate with a path baked into pyc files instead of $real_libdir
|
|
||||||
# - -o 0 -o 1 to produce multiple files in one run - each with a different optimization level - instead of $options
|
|
||||||
# - removed useless $depth - both compileall and compileall2 are limited by sys.getrecursionlimit()
|
|
||||||
# These changes will make this script much simpler
|
|
||||||
function python_bytecompile()
|
|
||||||
{
|
|
||||||
local options=$1
|
|
||||||
local python_binary=$2
|
|
||||||
local exclude=$3
|
|
||||||
local python_libdir=$4
|
|
||||||
local depth=$5 # Not used for Python >= 3.4
|
|
||||||
local real_libdir=$6 # Not used for Python >= 3.4
|
|
||||||
|
|
||||||
python_version=$($python_binary -c "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
|
|
||||||
|
|
||||||
#
|
|
||||||
# Python 3.4 and higher
|
|
||||||
#
|
|
||||||
if [ "$python_version" -ge 34 ]; then
|
|
||||||
|
|
||||||
[ ! -z $exclude ] && exclude="-x '$exclude'"
|
|
||||||
# /usr/lib/rpm/redhat/ contains compileall2 Python module
|
|
||||||
# -q disables verbose output
|
|
||||||
# -f forces the process to overwrite existing compiled files
|
|
||||||
# -x excludes paths defined by regex
|
|
||||||
# -e excludes symbolic links pointing outside the build root
|
|
||||||
# -x and -e together implements the same functionality as the Filter class below
|
|
||||||
# -s strips $RPM_BUILD_ROOT from the path
|
|
||||||
# -p prepends the leading slash to the path to make it absolute
|
|
||||||
PYTHONPATH=/usr/lib/rpm/redhat/ $python_binary -B $options -m compileall2 -q -f $exclude -s $RPM_BUILD_ROOT -p / -e $RPM_BUILD_ROOT $python_libdir
|
|
||||||
else
|
|
||||||
#
|
|
||||||
# Python 3.3 and lower (incl. Python 2)
|
|
||||||
#
|
|
||||||
|
|
||||||
cat << EOF | $python_binary $options
|
|
||||||
import compileall, sys, os, re
|
|
||||||
|
|
||||||
python_libdir = "$python_libdir"
|
|
||||||
depth = $depth
|
|
||||||
real_libdir = "$real_libdir"
|
|
||||||
build_root = "$RPM_BUILD_ROOT"
|
|
||||||
exclude = r"$exclude"
|
|
||||||
|
|
||||||
class Filter:
|
|
||||||
def search(self, path):
|
|
||||||
ret = not os.path.realpath(path).startswith(build_root)
|
|
||||||
if exclude:
|
|
||||||
ret = ret or re.search(exclude, path)
|
|
||||||
return ret
|
|
||||||
|
|
||||||
sys.exit(not compileall.compile_dir(python_libdir, depth, real_libdir, force=1, rx=Filter(), quiet=1))
|
|
||||||
EOF
|
|
||||||
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# .pyc/.pyo files embed a "magic" value, identifying the ABI version of Python
|
|
||||||
# bytecode that they are for.
|
|
||||||
#
|
|
||||||
# The files below RPM_BUILD_ROOT could be targeting multiple versions of
|
|
||||||
# python (e.g. a single build that emits several subpackages e.g. a
|
|
||||||
# python26-foo subpackage, a python31-foo subpackage etc)
|
|
||||||
#
|
|
||||||
# Support this by assuming that below each /usr/lib/python$VERSION/, all
|
|
||||||
# .pyc/.pyo files are to be compiled for /usr/bin/python$VERSION.
|
|
||||||
#
|
|
||||||
# For example, below /usr/lib/python2.6/, we're targeting /usr/bin/python2.6
|
|
||||||
# and below /usr/lib/python3.1/, we're targeting /usr/bin/python3.1
|
|
||||||
|
|
||||||
shopt -s nullglob
|
|
||||||
for python_libdir in `find "$RPM_BUILD_ROOT" -type d|grep -E "/usr/lib(64)?/python[0-9]\.[0-9]+$"`;
|
|
||||||
do
|
|
||||||
python_binary=/usr/bin/$(basename $python_libdir)
|
|
||||||
real_libdir=${python_libdir/$RPM_BUILD_ROOT/}
|
|
||||||
echo "Bytecompiling .py files below $python_libdir using $python_binary"
|
|
||||||
|
|
||||||
# Generate normal (.pyc) byte-compiled files.
|
|
||||||
python_bytecompile "" "$python_binary" "" "$python_libdir" "$depth" "$real_libdir"
|
|
||||||
if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
|
|
||||||
# One or more of the files had a syntax error
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Generate optimized (.pyo) byte-compiled files.
|
|
||||||
python_bytecompile "-O" "$python_binary" "" "$python_libdir" "$depth" "$real_libdir"
|
|
||||||
if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
|
|
||||||
# One or more of the files had a syntax error
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
# Handle other locations in the filesystem using the default python implementation
|
|
||||||
# if extra is set to 0, don't do this
|
|
||||||
if [ 0$extra -eq 0 ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If we don't have a default python interpreter, we cannot proceed
|
|
||||||
default_python=${1:-/usr/bin/python}
|
|
||||||
if [ ! -x "$default_python" ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Figure out if there are files to be bytecompiled with the default_python at all
|
|
||||||
# this prevents unnecessary default_python invocation
|
|
||||||
find "$RPM_BUILD_ROOT" -type f -name "*.py" | grep -Ev "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" || exit 0
|
|
||||||
|
|
||||||
# Generate normal (.pyc) byte-compiled files.
|
|
||||||
python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
|
|
||||||
if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
|
|
||||||
# One or more of the files had a syntax error
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Generate optimized (.pyo) byte-compiled files.
|
|
||||||
python_bytecompile "-O" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
|
|
||||||
if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
|
|
||||||
# One or more of the files had a syntax error
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
exit 0
|
|
135
common.lua
135
common.lua
@ -1,7 +1,46 @@
|
|||||||
-- Convenience Lua functions that can be used within rpm macros
|
-- Convenience Lua functions that can be used within rpm macros
|
||||||
|
|
||||||
-- Set a spec variable
|
-- Reads an rpm variable. Unlike a basic rpm.expand("{?foo}"), returns nil if
|
||||||
-- Echo the result if verbose
|
-- the variable is unset, which is convenient in lua tests and enables
|
||||||
|
-- differentiating unset variables from variables set to ""
|
||||||
|
local function read(rpmvar)
|
||||||
|
if not rpmvar or
|
||||||
|
(rpm.expand("%{" .. rpmvar .. "}") == "%{" .. rpmvar .. "}") then
|
||||||
|
return nil
|
||||||
|
else
|
||||||
|
return rpm.expand("%{?" .. rpmvar .. "}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Returns true if the macro that called this function had flag set
|
||||||
|
-- – for example, hasflag("z") would give the following results:
|
||||||
|
-- %foo -z bar → true
|
||||||
|
-- %foo -z → true
|
||||||
|
-- %foo → false
|
||||||
|
local function hasflag(flag)
|
||||||
|
return (rpm.expand("%{-" .. flag .. "}") ~= "")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Returns the argument passed to flag in the macro that called this function
|
||||||
|
-- – for example, readflag("z") would give the following results:
|
||||||
|
-- %foo -z bar → bar
|
||||||
|
-- %foo → nil
|
||||||
|
-- %foo -z "" → empty string
|
||||||
|
-- %foo -z '' → empty string
|
||||||
|
local function readflag(flag)
|
||||||
|
if not hasflag(flag) then
|
||||||
|
return nil
|
||||||
|
else
|
||||||
|
local a = rpm.expand("%{-" .. flag .. "*}")
|
||||||
|
-- Handle "" and '' as empty strings
|
||||||
|
if (a == '""') or (a == "''") then
|
||||||
|
a = ''
|
||||||
|
end
|
||||||
|
return a
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Sets a spec variable; echoes the result if verbose
|
||||||
local function explicitset(rpmvar, value, verbose)
|
local function explicitset(rpmvar, value, verbose)
|
||||||
local value = value
|
local value = value
|
||||||
if (value == nil) or (value == "") then
|
if (value == nil) or (value == "") then
|
||||||
@ -9,31 +48,29 @@ local function explicitset(rpmvar, value, verbose)
|
|||||||
end
|
end
|
||||||
rpm.define(rpmvar .. " " .. value)
|
rpm.define(rpmvar .. " " .. value)
|
||||||
if verbose then
|
if verbose then
|
||||||
rpm.expand("%{echo:Setting %%{" .. rpmvar .. "} = " .. value .. "}")
|
rpm.expand("%{warn:Setting %%{" .. rpmvar .. "} = " .. value .. "}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Unset a spec variable if it is defined
|
-- Unsets a spec variable if it is defined; echoes the result if verbose
|
||||||
-- Echo the result if verbose
|
|
||||||
local function explicitunset(rpmvar, verbose)
|
local function explicitunset(rpmvar, verbose)
|
||||||
if (rpm.expand("%{" .. rpmvar .. "}") ~= "%{" .. rpmvar .. "}") then
|
if (rpm.expand("%{" .. rpmvar .. "}") ~= "%{" .. rpmvar .. "}") then
|
||||||
rpm.define(rpmvar .. " %{nil}")
|
rpm.define(rpmvar .. " %{nil}")
|
||||||
if verbose then
|
if verbose then
|
||||||
rpm.expand("%{echo:Unsetting %%{" .. rpmvar .. "}}")
|
rpm.expand("%{warn:Unsetting %%{" .. rpmvar .. "}}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set a spec variable, if not already set
|
-- Sets a spec variable, if not already set; echoes the result if verbose
|
||||||
-- Echo the result if verbose
|
|
||||||
local function safeset(rpmvar, value, verbose)
|
local function safeset(rpmvar, value, verbose)
|
||||||
if (rpm.expand("%{" .. rpmvar .. "}") == "%{" .. rpmvar .. "}") then
|
if (rpm.expand("%{" .. rpmvar .. "}") == "%{" .. rpmvar .. "}") then
|
||||||
explicitset(rpmvar,value,verbose)
|
explicitset(rpmvar,value,verbose)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Alias a list of rpm variables to the same variables suffixed with 0 (and vice versa)
|
-- Aliases a list of rpm variables to the same variables suffixed with 0 (and
|
||||||
-- Echo the result if verbose
|
-- vice versa); echoes the result if verbose
|
||||||
local function zalias(rpmvars, verbose)
|
local function zalias(rpmvars, verbose)
|
||||||
for _, sfx in ipairs({{"","0"},{"0",""}}) do
|
for _, sfx in ipairs({{"","0"},{"0",""}}) do
|
||||||
for _, rpmvar in ipairs(rpmvars) do
|
for _, rpmvar in ipairs(rpmvars) do
|
||||||
@ -113,13 +150,7 @@ local function getbestsuffix(rpmvar, value)
|
|||||||
return best
|
return best
|
||||||
end
|
end
|
||||||
|
|
||||||
-- https://github.com/rpm-software-management/rpm/issues/581
|
-- %writevars core
|
||||||
-- 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)
|
local function writevars(macrofile, rpmvars)
|
||||||
for _, rpmvar in ipairs(rpmvars) do
|
for _, rpmvar in ipairs(rpmvars) do
|
||||||
print("sed -i 's\029" .. string.upper("@@" .. rpmvar .. "@@") ..
|
print("sed -i 's\029" .. string.upper("@@" .. rpmvar .. "@@") ..
|
||||||
@ -150,8 +181,9 @@ local function wordwrap(text)
|
|||||||
for word in string.gmatch(line, "%s*[^%s]*\n?") do
|
for word in string.gmatch(line, "%s*[^%s]*\n?") do
|
||||||
local wl, bad = utf8.len(word)
|
local wl, bad = utf8.len(word)
|
||||||
if not wl then
|
if not wl then
|
||||||
print("%{warn: Invalid UTF-8 sequence detected in:\n" ..
|
print("%{warn:Invalid UTF-8 sequence detected in:}" ..
|
||||||
word .. "\nIt may produce unexpected results.\n}")
|
"%{warn:" .. word .. "}" ..
|
||||||
|
"%{warn:It may produce unexpected results.}")
|
||||||
wl = bad
|
wl = bad
|
||||||
end
|
end
|
||||||
if (pos == 0) then
|
if (pos == 0) then
|
||||||
@ -182,7 +214,71 @@ local function wordwrap(text)
|
|||||||
return output
|
return output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Because rpmbuild will fail if a subpackage is declared before the source
|
||||||
|
-- package itself, provide a source package declaration shell as fallback.
|
||||||
|
local function srcpkg(verbose)
|
||||||
|
if verbose then
|
||||||
|
rpm.expand([[
|
||||||
|
%{echo:Creating a header for the SRPM from %%{source_name}, %%{source_summary} and}
|
||||||
|
%{echo:%%{source_description}. If that is not the intended result, please declare the}
|
||||||
|
%{echo:SRPM header and set %%{source_name} in your spec file before calling a macro}
|
||||||
|
%{echo:that creates other package headers.}
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
print(rpm.expand([[
|
||||||
|
Name: %{source_name}
|
||||||
|
Summary: %{source_summary}
|
||||||
|
%description
|
||||||
|
%wordwrap -v source_description
|
||||||
|
]]))
|
||||||
|
explicitset("currentname", "%{source_name}", verbose)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- %new_package core
|
||||||
|
local function new_package(source_name, pkg_name, name_suffix, first, verbose)
|
||||||
|
-- Safety net when the wrapper is used in conjunction with traditional syntax
|
||||||
|
if (not first) and (not source_name) then
|
||||||
|
rpm.expand([[
|
||||||
|
%{warn:Something already set a package name. However, %%{source_name} is not set.}
|
||||||
|
%{warn:Please set %%{source_name} to the SRPM name to ensure reliable processing.}
|
||||||
|
]])
|
||||||
|
if name_suffix then
|
||||||
|
print(rpm.expand("%package " .. name_suffix))
|
||||||
|
else
|
||||||
|
print(rpm.expand("%package -n " .. pkg_name))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- New processing
|
||||||
|
if not (pkg_name or name_suffix or source_name) then
|
||||||
|
rpm.expand([[
|
||||||
|
%{error:You need to set %%{source_name} or provide explicit package naming!}
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
if name_suffix then
|
||||||
|
print(rpm.expand("%package " .. name_suffix))
|
||||||
|
explicitset("currentname", "%{source_name}-" .. name_suffix, verbose)
|
||||||
|
else
|
||||||
|
if not source_name then
|
||||||
|
source_name = pkg_name
|
||||||
|
end
|
||||||
|
if (pkg_name == source_name) then
|
||||||
|
safeset("source_name", source_name, verbose)
|
||||||
|
print(rpm.expand("Name: %{source_name}"))
|
||||||
|
else
|
||||||
|
if source_name and first then
|
||||||
|
srcpkg(verbose)
|
||||||
|
end
|
||||||
|
print(rpm.expand("%package -n " .. pkg_name))
|
||||||
|
end
|
||||||
|
explicitset("currentname", pkg_name, verbose)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
read = read,
|
||||||
|
hasflag = hasflag,
|
||||||
|
readflag = readflag,
|
||||||
explicitset = explicitset,
|
explicitset = explicitset,
|
||||||
explicitunset = explicitunset,
|
explicitunset = explicitunset,
|
||||||
safeset = safeset,
|
safeset = safeset,
|
||||||
@ -194,4 +290,5 @@ return {
|
|||||||
getbestsuffix = getbestsuffix,
|
getbestsuffix = getbestsuffix,
|
||||||
writevars = writevars,
|
writevars = writevars,
|
||||||
wordwrap = wordwrap,
|
wordwrap = wordwrap,
|
||||||
|
new_package = new_package,
|
||||||
}
|
}
|
||||||
|
2
dist.sh
2
dist.sh
@ -25,7 +25,7 @@ function check_rhl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function check_rhel {
|
function check_rhel {
|
||||||
egrep -q "(Enterprise|Advanced)" $RELEASEFILE && echo $DISTNUM
|
egrep -q "(Enterprise|Advanced|CentOS)" $RELEASEFILE && echo $DISTNUM
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_fedora {
|
function check_fedora {
|
||||||
|
13
forge.lua
13
forge.lua
@ -31,6 +31,9 @@ local function checkforgeurl(url, id, silent)
|
|||||||
pagure_ns_fork = {
|
pagure_ns_fork = {
|
||||||
pattern = 'https://[^/]+/fork/[^/]+/[^/]+/[^/#?]+',
|
pattern = 'https://[^/]+/fork/[^/]+/[^/]+/[^/#?]+',
|
||||||
description = 'https://pagure.io/fork/owner/namespace/repo'},
|
description = 'https://pagure.io/fork/owner/namespace/repo'},
|
||||||
|
["gitea.com"] = {
|
||||||
|
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
|
||||||
|
description = 'https://gitea.com/owner/repo'},
|
||||||
github = {
|
github = {
|
||||||
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
|
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
|
||||||
description = 'https://(…[-.])github[-.]…/owner/repo'},
|
description = 'https://(…[-.])github[-.]…/owner/repo'},
|
||||||
@ -129,6 +132,11 @@ local function meta(suffix, verbose, informative, silent)
|
|||||||
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/[^/]+/[^/]+/([^/?#]+)")}',
|
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/[^/]+/[^/]+/([^/?#]+)")}',
|
||||||
archivename = "%{owner" .. suffix .. "}-%{namespace" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}",
|
archivename = "%{owner" .. suffix .. "}-%{namespace" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}",
|
||||||
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
|
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
|
||||||
|
["gitea.com"] = {
|
||||||
|
archiveext = "tar.gz",
|
||||||
|
archivename = "%{fileref" .. suffix .. "}",
|
||||||
|
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}.%{archiveext" .. suffix .. "}",
|
||||||
|
topdir = "%{repo}" },
|
||||||
github = {
|
github = {
|
||||||
archiveext = "tar.gz",
|
archiveext = "tar.gz",
|
||||||
archivename = "%{repo" .. suffix .. "}-%{fileref" .. suffix .. "}",
|
archivename = "%{repo" .. suffix .. "}-%{fileref" .. suffix .. "}",
|
||||||
@ -191,6 +199,11 @@ local function meta(suffix, verbose, informative, silent)
|
|||||||
fileref = string.gsub(rpm.expand(fileref), "/", "-")
|
fileref = string.gsub(rpm.expand(fileref), "/", "-")
|
||||||
end
|
end
|
||||||
fedora.safeset("fileref" .. suffix, fileref, verbose)
|
fedora.safeset("fileref" .. suffix, fileref, verbose)
|
||||||
|
elseif (forge == "gitea.com") then
|
||||||
|
-- Workaround the way gitea mangles /s in ref names
|
||||||
|
local fileref = ref
|
||||||
|
fileref = string.gsub(rpm.expand(fileref), "/", "-")
|
||||||
|
fedora.safeset("fileref" .. suffix, fileref, verbose)
|
||||||
elseif (forge == "code.googlesource.com") then
|
elseif (forge == "code.googlesource.com") then
|
||||||
if (ref == "%{?version" .. suffix .. "}") then
|
if (ref == "%{?version" .. suffix .. "}") then
|
||||||
ref = "v" .. ref
|
ref = "v" .. ref
|
||||||
|
12
gating.yaml
Normal file
12
gating.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
--- !Policy
|
||||||
|
product_versions:
|
||||||
|
- fedora-*
|
||||||
|
decision_context: bodhi_update_push_testing
|
||||||
|
rules:
|
||||||
|
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
||||||
|
--- !Policy
|
||||||
|
product_versions:
|
||||||
|
- fedora-*
|
||||||
|
decision_context: bodhi_update_push_stable
|
||||||
|
rules:
|
||||||
|
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
23
kmod.attr
23
kmod.attr
@ -1,2 +1,21 @@
|
|||||||
%__kmod_provides %{_rpmconfigdir}/kmod.prov
|
%__kmod_path ^/lib/modules/.*/(modules.builtin|.*ko)
|
||||||
%__kmod_path ^/lib/modules/.*$
|
%__kmod_provides() %{lua:
|
||||||
|
function basename(fn)
|
||||||
|
return string.gsub(fn, "(.*/)(.*)", "%2")
|
||||||
|
end
|
||||||
|
function printdep(mod)
|
||||||
|
print("kmod("..mod..")")
|
||||||
|
end
|
||||||
|
local fn = rpm.expand("%{1}")
|
||||||
|
local bn = basename(fn)
|
||||||
|
if bn == "modules.builtin" then
|
||||||
|
for l in io.lines(fn) do
|
||||||
|
printdep(basename(l))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local mod = string.match(bn, "%g+.ko")
|
||||||
|
if mod then
|
||||||
|
printdep(mod)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
28
kmod.prov
28
kmod.prov
@ -1,28 +0,0 @@
|
|||||||
#!/bin/sh +x
|
|
||||||
# Kernel build can have many thousands of modules.
|
|
||||||
# kmod.prov is run for every one of them.
|
|
||||||
# Try to make this script run as fast as we can.
|
|
||||||
# For example, use shell string ops instead of external programs
|
|
||||||
# where possible.
|
|
||||||
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
read -r fname || exit
|
|
||||||
|
|
||||||
# Only process files from .../lib/modules/... subtree
|
|
||||||
[ "${fname#*/lib/modules/*}" != "$fname" ] || exit 0
|
|
||||||
|
|
||||||
kmod=${fname##*/} # like basename, but faster
|
|
||||||
|
|
||||||
if [ "$kmod" = "modules.builtin" ]; then
|
|
||||||
for j in $(cat -- "$fname"); do
|
|
||||||
echo "kmod(${j##*/})"
|
|
||||||
done
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
kmod=${kmod%.gz}
|
|
||||||
kmod=${kmod%.xz}
|
|
||||||
if [ "${kmod%.ko}" != "$kmod" ]; then
|
|
||||||
echo "kmod($kmod)"
|
|
||||||
fi
|
|
183
macros
183
macros
@ -26,6 +26,52 @@
|
|||||||
%_debugsource_packages 1
|
%_debugsource_packages 1
|
||||||
%_debuginfo_subpackages 1
|
%_debuginfo_subpackages 1
|
||||||
|
|
||||||
|
# GCC toolchain
|
||||||
|
%__cc_gcc gcc
|
||||||
|
%__cxx_gcc g++
|
||||||
|
%__cpp_gcc gcc -E
|
||||||
|
|
||||||
|
# Clang toolchain
|
||||||
|
%__cc_clang clang
|
||||||
|
%__cxx_clang clang++
|
||||||
|
%__cpp_clang clang-cpp
|
||||||
|
|
||||||
|
# Default to the GCC toolchain
|
||||||
|
#
|
||||||
|
# It is enough to override `toolchain` macro and all relevant macro for C/C++
|
||||||
|
# compilers will be switched. Either in the spec or in the command-line.
|
||||||
|
#
|
||||||
|
# %global toolchain clang
|
||||||
|
#
|
||||||
|
# or:
|
||||||
|
#
|
||||||
|
# rpmbuild -D "toolchain clang" …
|
||||||
|
#
|
||||||
|
# Inside a spec file it is also possible to determine which toolchain is in use
|
||||||
|
# by testing the same macro. For example:
|
||||||
|
#
|
||||||
|
# %if "%{toolchain}" == "gcc"
|
||||||
|
# BuildRequires: gcc
|
||||||
|
# %endif
|
||||||
|
#
|
||||||
|
# or:
|
||||||
|
#
|
||||||
|
# %if "%{toolchain}" == "clang"
|
||||||
|
# BuildRequires: clang compiler-rt
|
||||||
|
# %endif
|
||||||
|
#
|
||||||
|
%toolchain gcc
|
||||||
|
|
||||||
|
%__cc %{expand:%%{__cc_%{toolchain}}}
|
||||||
|
%__cxx %{expand:%%{__cxx_%{toolchain}}}
|
||||||
|
%__cpp %{expand:%%{__cpp_%{toolchain}}}
|
||||||
|
|
||||||
|
# Compiler macros to use for invoking compilers in spec files for packages that
|
||||||
|
# want to use the default compiler and don't care which compiler that is.
|
||||||
|
%build_cc %{__cc}
|
||||||
|
%build_cxx %{__cxx}
|
||||||
|
%build_cpp %{__cpp}
|
||||||
|
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
# ---- compiler flags.
|
# ---- compiler flags.
|
||||||
|
|
||||||
@ -46,9 +92,12 @@
|
|||||||
# the flags, while intended for ld, are still passed through the gcc
|
# the flags, while intended for ld, are still passed through the gcc
|
||||||
# compiler driver. At the beginning of %%build, the environment
|
# compiler driver. At the beginning of %%build, the environment
|
||||||
# variable RPM_LD_FLAGS to this value.
|
# variable RPM_LD_FLAGS to this value.
|
||||||
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags}
|
# When clang is used as a linker driver, it does not auto-detect the LTO
|
||||||
|
# bytecode and neither does bfd, so we need to explicitly pass the -flto
|
||||||
|
# flag when linking.
|
||||||
|
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %{_annotation_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_lto_cflags}" : "" ]
|
||||||
|
|
||||||
# Expands to shell code to seot the compiler/linker environment
|
# Expands to shell code to set the compiler/linker environment
|
||||||
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
|
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
|
||||||
# not been set already. RPM_OPT_FLAGS and RPM_LD_FLAGS have already
|
# not been set already. RPM_OPT_FLAGS and RPM_LD_FLAGS have already
|
||||||
# been set implicitly at the start of the %%build section.
|
# been set implicitly at the start of the %%build section.
|
||||||
@ -59,14 +108,18 @@
|
|||||||
FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
|
FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
|
||||||
FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
|
FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
|
||||||
LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS ; \
|
LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS ; \
|
||||||
LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-%_libdir:}" ; export LT_SYS_LIBRARY_PATH
|
LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-%_libdir:}" ; export LT_SYS_LIBRARY_PATH ; \
|
||||||
|
CC="${CC:-%{__cc}}" ; export CC ; \
|
||||||
|
CXX="${CXX:-%{__cxx}}" ; export CXX
|
||||||
|
|
||||||
# Internal-only. Do not use. Expand a variable and strip the flags
|
# Internal-only. Do not use. Expand a variable and strip the flags
|
||||||
# not suitable to extension builders.
|
# not suitable to extension builders.
|
||||||
%__extension_strip_flags() %{lua:
|
%__extension_strip_flags() %{lua:
|
||||||
local name = rpm.expand("%{1}")
|
local name = rpm.expand("%{1}")
|
||||||
local value = " " .. rpm.expand("%{build_" .. name .. "}")
|
local value = " " .. rpm.expand("%{build_" .. name .. "}")
|
||||||
local result = string.gsub(value, "%s+-specs=[^%s]+", " ")
|
local specs_pattern = "%s+-specs=[^%s]+"
|
||||||
|
local lto_flags_pattern = rpm.expand("%{?_lto_cflags}"):gsub("[%-%.]", "%%%1")
|
||||||
|
local result = value:gsub(specs_pattern, " "):gsub(lto_flags_pattern, "")
|
||||||
print(result)
|
print(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,6 +137,13 @@ print(result)
|
|||||||
%__global_fcflags %{build_fflags}
|
%__global_fcflags %{build_fflags}
|
||||||
%__global_ldflags %{build_ldflags}
|
%__global_ldflags %{build_ldflags}
|
||||||
|
|
||||||
|
# Architecture-specific support. Internal. Do not use directly.
|
||||||
|
|
||||||
|
%__cflags_arch_x86_64 %[0%{?rhel} >= 9 ? "-march=x86-64-v2" : ""]
|
||||||
|
|
||||||
|
# Also used for s390.
|
||||||
|
%__cflags_arch_s390x %[0%{?rhel} >= 8 ? "-march=z13 -mtune=z14" : "-march=zEC12 -mtune=z13"]
|
||||||
|
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
# ---- configure and makeinstall.
|
# ---- configure and makeinstall.
|
||||||
#
|
#
|
||||||
@ -94,8 +154,49 @@ print(result)
|
|||||||
# Eventually we'll want to turn this on by default, but this gives packagers a
|
# Eventually we'll want to turn this on by default, but this gives packagers a
|
||||||
# way to turn it back off.
|
# way to turn it back off.
|
||||||
# %_configure_disable_silent_rules 1
|
# %_configure_disable_silent_rules 1
|
||||||
|
|
||||||
|
# This fixes various easy resolved configure tests that are compromised by LTO.
|
||||||
|
#
|
||||||
|
# We use this within the standard %configure macro, but also make it available
|
||||||
|
# for packages which don't use %configure
|
||||||
|
#
|
||||||
|
# The first three are common ways to test for the existence of a function, so
|
||||||
|
# we ensure the reference to the function is preserved
|
||||||
|
#
|
||||||
|
# The fourth are constants used to then try to generate NaNs and other key
|
||||||
|
# floating point numbers. We then use those special FP numbers to try and
|
||||||
|
# raise a SIGFPE. By declaring x & y volatile we prevent the optimizers
|
||||||
|
# from removing the computation
|
||||||
|
#
|
||||||
|
# The fifth (and worst) addresses problems with autoconf/libtool's approach
|
||||||
|
# to extracting symbols from .o files and generating C code. In an LTO world
|
||||||
|
# types matter much more closely and you can't have an object in one context
|
||||||
|
# that is a function definition and a simple scalar variable in another.
|
||||||
|
# Thankfully HP-UX has always had that restriction and is supported by
|
||||||
|
# autoconf/libtool. The insane sed script replaces the "generic" code with
|
||||||
|
# the HP-UX version.
|
||||||
|
#
|
||||||
|
# If we do not make changes, we put the original file back. This avoids
|
||||||
|
# unnecessary rebuilds of things that may have dependencies on the configure
|
||||||
|
# files.
|
||||||
|
#
|
||||||
|
%_fix_broken_configure_for_lto \
|
||||||
|
for file in $(find . -type f -name configure -print); do \
|
||||||
|
%{__sed} -r --in-place=.backup 's/^char \\(\\*f\\) \\(\\) = /__attribute__ ((used)) char (*f) () = /g' $file; \
|
||||||
|
diff -u $file.backup $file && mv $file.backup $file \
|
||||||
|
%{__sed} -r --in-place=.backup 's/^char \\(\\*f\\) \\(\\);/__attribute__ ((used)) char (*f) ();/g' $file; \
|
||||||
|
diff -u $file.backup $file && mv $file.backup $file \
|
||||||
|
%{__sed} -r --in-place=.backup 's/^char \\$2 \\(\\);/__attribute__ ((used)) char \\$2 ();/g' $file; \
|
||||||
|
diff -u $file.backup $file && mv $file.backup $file \
|
||||||
|
%{__sed} --in-place=.backup '1{$!N;$!N};$!N;s/int x = 1;\\nint y = 0;\\nint z;\\nint nan;/volatile int x = 1; volatile int y = 0; volatile int z, nan;/;P;D' $file; \
|
||||||
|
diff -u $file.backup $file && mv $file.backup $file \
|
||||||
|
%{__sed} --in-place=.backup 's#^lt_cv_sys_global_symbol_to_cdecl=.*#lt_cv_sys_global_symbol_to_cdecl="sed -n -e '"'"'s/^T .* \\\\(.*\\\\)$/extern int \\\\1();/p'"'"' -e '"'"'s/^$symcode* .* \\\\(.*\\\\)$/extern char \\\\1;/p'"'"'"#' $file; \
|
||||||
|
diff -u $file.backup $file && mv $file.backup $file \
|
||||||
|
done
|
||||||
|
|
||||||
%configure \
|
%configure \
|
||||||
%{set_build_flags}; \
|
%{set_build_flags}; \
|
||||||
|
[ "%{_lto_cflags}"x != x ] && %{_fix_broken_configure_for_lto}; \
|
||||||
[ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \
|
[ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \
|
||||||
[ -f /usr/lib/rpm/redhat/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/redhat/$(basename $i) $i ; \
|
[ -f /usr/lib/rpm/redhat/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/redhat/$(basename $i) $i ; \
|
||||||
done ; \
|
done ; \
|
||||||
@ -131,7 +232,7 @@ print(result)
|
|||||||
|
|
||||||
%__spec_install_pre %{___build_pre}\
|
%__spec_install_pre %{___build_pre}\
|
||||||
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
|
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
|
||||||
mkdir -p `dirname "$RPM_BUILD_ROOT"`\
|
mkdir -p "`dirname "$RPM_BUILD_ROOT"`"\
|
||||||
mkdir "$RPM_BUILD_ROOT"\
|
mkdir "$RPM_BUILD_ROOT"\
|
||||||
%{nil}
|
%{nil}
|
||||||
|
|
||||||
@ -149,15 +250,21 @@ print(result)
|
|||||||
%__brp_strip_lto /usr/lib/rpm/redhat/brp-strip-lto %{__strip}
|
%__brp_strip_lto /usr/lib/rpm/redhat/brp-strip-lto %{__strip}
|
||||||
%__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
|
%__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
|
||||||
%__brp_strip_static_archive /usr/lib/rpm/brp-strip-static-archive %{__strip}
|
%__brp_strip_static_archive /usr/lib/rpm/brp-strip-static-archive %{__strip}
|
||||||
%__brp_python_bytecompile /usr/lib/rpm/redhat/brp-python-bytecompile "%{__python}" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
|
%__brp_check_rpaths /usr/lib/rpm/check-rpaths
|
||||||
%__brp_python_hardlink /usr/lib/rpm/brp-python-hardlink
|
|
||||||
# __brp_mangle_shebangs_exclude - shebangs to exclude
|
# __brp_mangle_shebangs_exclude - shebangs to exclude
|
||||||
# __brp_mangle_shebangs_exclude_file - file from which to get shebangs to exclude
|
# __brp_mangle_shebangs_exclude_file - file from which to get shebangs to exclude
|
||||||
# __brp_mangle_shebangs_exclude_from - files to ignore
|
# __brp_mangle_shebangs_exclude_from - files to ignore
|
||||||
# __brp_mangle_shebangs_exclude_from_file - file from which to get files to ignore
|
# __brp_mangle_shebangs_exclude_from_file - file from which to get files to ignore
|
||||||
%__brp_mangle_shebangs /usr/lib/rpm/redhat/brp-mangle-shebangs %{?__brp_mangle_shebangs_exclude:--shebangs "%{?__brp_mangle_shebangs_exclude}"} %{?__brp_mangle_shebangs_exclude_file:--shebangs-from "%{__brp_mangle_shebangs_exclude_file}"} %{?__brp_mangle_shebangs_exclude_from:--files "%{?__brp_mangle_shebangs_exclude_from}"} %{?__brp_mangle_shebangs_exclude_from_file:--files-from "%{__brp_mangle_shebangs_exclude_from_file}"}
|
%__brp_mangle_shebangs /usr/lib/rpm/redhat/brp-mangle-shebangs %{?__brp_mangle_shebangs_exclude:--shebangs "%{?__brp_mangle_shebangs_exclude}"} %{?__brp_mangle_shebangs_exclude_file:--shebangs-from "%{__brp_mangle_shebangs_exclude_file}"} %{?__brp_mangle_shebangs_exclude_from:--files "%{?__brp_mangle_shebangs_exclude_from}"} %{?__brp_mangle_shebangs_exclude_from_file:--files-from "%{__brp_mangle_shebangs_exclude_from_file}"}
|
||||||
|
|
||||||
|
%__brp_llvm_compile_lto_elf /usr/lib/rpm/redhat/brp-llvm-compile-lto-elf %{build_cflags} %{build_ldflags}
|
||||||
|
|
||||||
|
# note: %%__os_install_post_python is defined in python-srpm-macros and contains several policies
|
||||||
|
# redhat-rpm-config maintainers, don't remove it from %%__os_install_post unless coordinating the change with Python maintainers
|
||||||
|
# packagers, don't undefine the entire macro, see the individual macros in /usr/lib/rpm/macros.d/macros.python-srpm
|
||||||
|
|
||||||
%__os_install_post \
|
%__os_install_post \
|
||||||
|
%[ "%{toolchain}" == "clang" ? "%{?__brp_llvm_compile_lto_elf}" : "%{nil}" ] \
|
||||||
%{?__brp_ldconfig} \
|
%{?__brp_ldconfig} \
|
||||||
%{?__brp_compress} \
|
%{?__brp_compress} \
|
||||||
%{!?__debug_package:\
|
%{!?__debug_package:\
|
||||||
@ -166,9 +273,9 @@ print(result)
|
|||||||
} \
|
} \
|
||||||
%{?__brp_strip_lto} \
|
%{?__brp_strip_lto} \
|
||||||
%{?__brp_strip_static_archive} \
|
%{?__brp_strip_static_archive} \
|
||||||
%{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \
|
%{?__brp_check_rpaths} \
|
||||||
%{?__brp_python_hardlink} \
|
|
||||||
%{?__brp_mangle_shebangs} \
|
%{?__brp_mangle_shebangs} \
|
||||||
|
%{__os_install_post_python} \
|
||||||
%{nil}
|
%{nil}
|
||||||
|
|
||||||
%__spec_install_post\
|
%__spec_install_post\
|
||||||
@ -185,16 +292,6 @@ print(result)
|
|||||||
# Should missing buildids terminate a build?
|
# Should missing buildids terminate a build?
|
||||||
%_missing_build_ids_terminate_build 1
|
%_missing_build_ids_terminate_build 1
|
||||||
|
|
||||||
#
|
|
||||||
## Automatically compile python files
|
|
||||||
%py_auto_byte_compile 1
|
|
||||||
|
|
||||||
#
|
|
||||||
## Should python bytecompilation errors terminate a build?
|
|
||||||
%_python_bytecompile_errors_terminate_build 1
|
|
||||||
## Should python bytecompilation compile outisde python specific directories?
|
|
||||||
%_python_bytecompile_extra 0
|
|
||||||
|
|
||||||
# Use SHA-256 for FILEDIGESTS instead of default MD5
|
# Use SHA-256 for FILEDIGESTS instead of default MD5
|
||||||
%_source_filedigest_algorithm 8
|
%_source_filedigest_algorithm 8
|
||||||
%_binary_filedigest_algorithm 8
|
%_binary_filedigest_algorithm 8
|
||||||
@ -202,24 +299,31 @@ print(result)
|
|||||||
# Use Zstandard compression for binary payloads
|
# Use Zstandard compression for binary payloads
|
||||||
%_binary_payload w19.zstdio
|
%_binary_payload w19.zstdio
|
||||||
|
|
||||||
%_hardening_cflags -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
|
%_hardening_gcc_cflags -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
|
||||||
|
%_hardening_clang_cflags --config /usr/lib/rpm/redhat/redhat-hardened-clang.cfg
|
||||||
|
%_hardening_cflags %{expand:%%{_hardening_%{toolchain}_cflags}} -fstack-protector-strong
|
||||||
# we don't escape symbols '~', '"', etc. so be careful when changing this
|
# we don't escape symbols '~', '"', etc. so be careful when changing this
|
||||||
%_hardening_ldflags -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
|
%_hardening_ldflags -Wl,-z,now %[ "%{toolchain}" == "gcc" ? "-specs=/usr/lib/rpm/redhat/redhat-hardened-ld" : "" ]
|
||||||
|
|
||||||
# Harden packages by default for Fedora 23:
|
# Harden packages by default for Fedora 23+:
|
||||||
# https://fedorahosted.org/fesco/ticket/1384 (accepted on 2014-02-11)
|
# https://fedorahosted.org/fesco/ticket/1384 (accepted on 2014-02-11)
|
||||||
# Use "%undefine _hardened_build" to disable.
|
# Use "%undefine _hardened_build" to disable.
|
||||||
%_hardened_build 1
|
%_hardened_build 1
|
||||||
%_hardened_cflags %{?_hardened_build:%{_hardening_cflags}}
|
%_hardened_cflags %{?_hardened_build:%{_hardening_cflags}}
|
||||||
%_hardened_ldflags %{?_hardened_build:%{_hardening_ldflags}}
|
%_hardened_ldflags %{?_hardened_build:%{_hardening_ldflags}}
|
||||||
|
|
||||||
%_annobin_cflags -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
|
# Add extra information to binary objects created by the compiler:
|
||||||
|
|
||||||
# Add extra information to binary objects created by gcc for Fedora 28:
|
|
||||||
# https://pagure.io/fesco/issue/1780 (accepted on 2017-10-30)
|
# https://pagure.io/fesco/issue/1780 (accepted on 2017-10-30)
|
||||||
|
# ...except on armv7hl, which has an issue whose root-cause isn't
|
||||||
|
# clear yet: https://bugzilla.redhat.com/show_bug.cgi?id=1951492
|
||||||
# Use "%undefine _annotated_build" to disable.
|
# Use "%undefine _annotated_build" to disable.
|
||||||
%_annotated_build 1
|
%_annotated_build 1
|
||||||
%_annotated_cflags %{?_annotated_build:%{_annobin_cflags}}
|
%_annobin_gcc_plugin -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
|
||||||
|
# The annobin plugin is not built for clang yet
|
||||||
|
%_annobin_clang_plugin %dnl-fplugin=/usr/lib64/clang/`clang -dumpversion`/lib/annobin.so
|
||||||
|
%_annotation_plugin %{?_annotated_build:%{expand:%%{_annobin_%{toolchain}_plugin}}}
|
||||||
|
%_annotation_cflags %[ "%{_target_cpu}" == "armv7hl" ? "" : "%{_annotation_plugin}" ]
|
||||||
|
%_annotation_ldflags %{?_lto_cflags:%{_annotation_cflags}}
|
||||||
|
|
||||||
# Fail linking if there are undefined symbols. Required for proper
|
# Fail linking if there are undefined symbols. Required for proper
|
||||||
# ELF symbol versioning support. Disabled by default.
|
# ELF symbol versioning support. Disabled by default.
|
||||||
@ -232,10 +336,30 @@ print(result)
|
|||||||
%_ld_as_needed 1
|
%_ld_as_needed 1
|
||||||
%_ld_as_needed_flags %{?_ld_as_needed:-Wl,--as-needed}
|
%_ld_as_needed_flags %{?_ld_as_needed:-Wl,--as-needed}
|
||||||
|
|
||||||
%__global_compiler_flags -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches %{_hardened_cflags} %{_annotated_cflags}%{?_legacy_common_support: -fcommon}
|
# LTO is the default in Fedora.
|
||||||
|
# "%define _lto_cflags %{nil}" to opt out
|
||||||
|
#
|
||||||
|
# We currently have -ffat-lto-objects turned on out of an abundance of
|
||||||
|
# caution. To remove it we need to do a check of the installed .o/.a files
|
||||||
|
# to verify they have real sections/symbols after LTO stripping. That
|
||||||
|
# way we can detect installing an unusable .o/.a file. This is on the TODO
|
||||||
|
# list for F34.
|
||||||
|
%_gcc_lto_cflags -flto=auto -ffat-lto-objects
|
||||||
|
%_clang_lto_cflags -flto
|
||||||
|
%_lto_cflags %{expand:%%{_%{toolchain}_lto_cflags}}
|
||||||
|
|
||||||
|
%_general_options -O2 %{?_lto_cflags} -fexceptions -g -grecord-gcc-switches -pipe
|
||||||
|
%_warning_options -Wall -Werror=format-security
|
||||||
|
%_preprocessor_defines -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
|
||||||
|
|
||||||
|
# Common variables are no longer generated by default by gcc and clang
|
||||||
|
# If they are needed then add "%define _legacy_common_support 1" to the spec file.
|
||||||
|
%_legacy_options %{?_legacy_common_support: -fcommon}
|
||||||
|
|
||||||
|
%__global_compiler_flags %{_general_options} %{_warning_options} %{_preprocessor_defines} %{_hardened_cflags} %{_annotation_cflags} %{_legacy_options}
|
||||||
|
|
||||||
# Automatically trim changelog entries after 2 years
|
# Automatically trim changelog entries after 2 years
|
||||||
%_changelog_trimtime %{lua:print(os.time() - 2 * 365 * 86400)}
|
%_changelog_trimage %{expr:2*365*24*60*60}
|
||||||
|
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
# ---- Generic auto req/prov filtering macros
|
# ---- Generic auto req/prov filtering macros
|
||||||
@ -269,6 +393,3 @@ print(result)
|
|||||||
%global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \
|
%global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \
|
||||||
%global __find_requires /bin/sh -c "%{?__filter_req_cmd} %{__deploop R} %{?__filter_from_req}" \
|
%global __find_requires /bin/sh -c "%{?__filter_req_cmd} %{__deploop R} %{?__filter_from_req}" \
|
||||||
}
|
}
|
||||||
|
|
||||||
# Temporary shelter for rpm 4.15 refugees
|
|
||||||
%requires_eq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
|
|
||||||
|
42
macros.build-constraints
Normal file
42
macros.build-constraints
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Macros to constrain resource use during the build process
|
||||||
|
|
||||||
|
# outputs build flag overrides to be used in conjunction with
|
||||||
|
# %%make_build, %%cmake_build etc.
|
||||||
|
#
|
||||||
|
# if no override is needed, this macro outputs nothing
|
||||||
|
#
|
||||||
|
# - m memory limit in MBs per core; default is 1024
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# e.g. %make_build %{limit_build -m 2048}
|
||||||
|
# => /usr/bin/make -O -j16 V=1 VERBOSE=1
|
||||||
|
# %make_build %{limit_build -m 40960}
|
||||||
|
# => /usr/bin/make -O -j16 V=1 VERBOSE=1 -j1
|
||||||
|
#
|
||||||
|
%limit_build(m:) %{lua:
|
||||||
|
local mem_per_process=rpm.expand("%{-m*}")
|
||||||
|
if mem_per_process == "" then
|
||||||
|
mem_per_process = 1024
|
||||||
|
else
|
||||||
|
mem_per_process = tonumber(mem_per_process)
|
||||||
|
end
|
||||||
|
local mem_total = 0
|
||||||
|
for line in io.lines('/proc/meminfo') do
|
||||||
|
if line:sub(1, 9) == "MemTotal:" then
|
||||||
|
local tokens = {}
|
||||||
|
for token in line:gmatch("%w+") do
|
||||||
|
tokens[#tokens + 1] = token
|
||||||
|
end
|
||||||
|
mem_total = tonumber(tokens[2])
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local max_jobs = mem_total // (mem_per_process * 1024)
|
||||||
|
if max_jobs < 1 then
|
||||||
|
max_jobs = 1
|
||||||
|
end
|
||||||
|
cur_max_jobs=tonumber(rpm.expand("%{_smp_build_ncpus}"))
|
||||||
|
if cur_max_jobs > max_jobs then
|
||||||
|
print("-j" .. max_jobs)
|
||||||
|
end
|
||||||
|
}
|
@ -1,16 +1,16 @@
|
|||||||
# Some miscellaneous Fedora-related macros
|
# Fedora macros, safe to use after the SRPM build stage
|
||||||
|
|
||||||
# List files matching inclusion globs, excluding files matching exclusion blogs
|
# Lists files matching inclusion globs, excluding files matching exclusion
|
||||||
# Optional parameters:
|
# globs
|
||||||
# – -i "<globs>" inclusion globs
|
# – globs are space-separated lists of shell globs. Such lists require
|
||||||
# – -x "<globs>" exclusion globs
|
# %{quote:} use when passed as rpm arguments or flags.
|
||||||
# Globs are space-separated lists of shell globs. Such lists require %{quote:}
|
# Control variables, flags and arguments:
|
||||||
# use for safe rpm argument passing.
|
# %{listfiles_include} inclusion globs
|
||||||
# Alternatively, set the following rpm variables before calling the macro:
|
# %{listfiles_exclude} exclusion globs
|
||||||
# – “listfiles_include” inclusion globs
|
# -i <globs> inclusion globs
|
||||||
# — “listfiles_exclude” exclusion globs
|
# -x <globs> exclusion globs
|
||||||
# Arguments passed to the macro without flags will be interpreted as inclusion
|
# … arguments passed to the macro without flags will be
|
||||||
# globs.
|
# interpreted as inclusion globs
|
||||||
%listfiles(i:x:) %{expand:
|
%listfiles(i:x:) %{expand:
|
||||||
%if %{lua: print(string.len(rpm.expand("%{?-i*}%{?listfiles_include}%*")))}
|
%if %{lua: print(string.len(rpm.expand("%{?-i*}%{?listfiles_include}%*")))}
|
||||||
listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u)
|
listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u)
|
||||||
@ -26,12 +26,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
# https://github.com/rpm-software-management/rpm/issues/581
|
# https://github.com/rpm-software-management/rpm/issues/581
|
||||||
# Write the contents of a list of rpm variables to a macro file.
|
# Writes the contents of a list of rpm variables to a macro file
|
||||||
# The target file must contain the corresponding anchors.
|
# Control variables, flags and arguments:
|
||||||
# For example %writevars -f myfile foo bar will replace:
|
# -f <filename> the macro file to process:
|
||||||
# @@FOO@@ with the rpm evaluation of %{foo} and
|
# – it must contain corresponding anchors
|
||||||
# @@BAR@@ with the rpm evaluation of %{bar}
|
# – for example %writevars -f myfile foo bar will replace:
|
||||||
# in myfile
|
# @@FOO@@ with the rpm evaluation of %{foo} and
|
||||||
|
# @@BAR@@ with the rpm evaluation of %{bar}
|
||||||
|
# in myfile
|
||||||
%writevars(f:) %{lua:
|
%writevars(f:) %{lua:
|
||||||
local fedora = require "fedora.common"
|
local fedora = require "fedora.common"
|
||||||
local macrofile = rpm.expand("%{-f*}")
|
local macrofile = rpm.expand("%{-f*}")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Some miscellaneous Fedora-related macros
|
# Fedora macros, safe to use at SRPM build stage
|
||||||
|
|
||||||
# A directory for rpm macros
|
# A directory for rpm macros
|
||||||
%rpmmacrodir /usr/lib/rpm/macros.d
|
%rpmmacrodir /usr/lib/rpm/macros.d
|
||||||
@ -10,13 +10,34 @@
|
|||||||
# A directory for SWID tag files describing the installation
|
# A directory for SWID tag files describing the installation
|
||||||
%_swidtagdir %{_prefix}/lib/swidtag/fedoraproject.org
|
%_swidtagdir %{_prefix}/lib/swidtag/fedoraproject.org
|
||||||
|
|
||||||
# A helper to apply the fedora.wordwrap filter to the content of an rpm
|
# Applies the fedora.wordwrap filter to the content of an rpm variable, and
|
||||||
# variable, and print the result. Optional parameter:
|
# prints the result.
|
||||||
# – -v <variable_name> (default value: _description)
|
# – putting multiple lines of UTF-8 text inside a variable is usually
|
||||||
# Putting multiple lines of UTF-8 text inside a variable is usually
|
# accomplished with %{expand:some_text}
|
||||||
# accomplished with a %%{expand: some_text}.
|
# Control variables, flags and arguments:
|
||||||
|
# -v <variable_name> (default value: _description)
|
||||||
%wordwrap(v:) %{lua:
|
%wordwrap(v:) %{lua:
|
||||||
local fedora = require "fedora.common"
|
local fedora = require "fedora.common"
|
||||||
local variable = "%{" .. rpm.expand("%{-v*}%{!-v:_description}") .. "}"
|
local variable = "%{?" .. rpm.expand("%{-v*}%{!-v:_description}") .. "}"
|
||||||
print(fedora.wordwrap(variable))
|
print(fedora.wordwrap(variable))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# A single Name: and %package substitute
|
||||||
|
# Control variables, flags and arguments:
|
||||||
|
# %{source_name} the SRPM name
|
||||||
|
# %{source_summary} the SRPM summary
|
||||||
|
# %{source_description} the SRPM description
|
||||||
|
# -n <name> declare a package named <name>
|
||||||
|
# (%package-like behavior)
|
||||||
|
# -v be verbose
|
||||||
|
# %1 declare a package named %{source_name}-%{%1}
|
||||||
|
# (%package-like behavior)
|
||||||
|
%new_package(n:v) %{lua:
|
||||||
|
local fedora = require "fedora.common"
|
||||||
|
local pkg_name = fedora.readflag("n")
|
||||||
|
local verbose = fedora.hasflag("v")
|
||||||
|
local name_suffix = fedora.read("1")
|
||||||
|
local source_name = fedora.read("source_name")
|
||||||
|
local first = not ( fedora.read("name") or fedora.read("currentname") )
|
||||||
|
fedora.new_package(source_name, pkg_name, name_suffix, first, verbose)
|
||||||
|
}
|
||||||
|
99
macros.forge
99
macros.forge
@ -1,50 +1,28 @@
|
|||||||
# Map forge information to rpm metadata. This macro will compute default spec
|
# Computes forge-related variables for use in the rest of the spec file
|
||||||
# variable values.
|
# Control variables, flags and arguments:
|
||||||
#
|
# %{forgeurl<number>} the project url on the target forge
|
||||||
# The following spec variables SHOULD be set before calling the macro:
|
# %{tag<number>} the packaged tag, OR
|
||||||
#
|
# %{commit<number>} the packaged commit, OR
|
||||||
# forgeurl the project url on the forge, strongly recommended;
|
# %{version<number>} the packaged version
|
||||||
# Version if applicable, set it with Version: <version>
|
# – %{version}/%{version0} are set via:
|
||||||
# tag if applicable
|
# Version:
|
||||||
# commit if applicable
|
# – because git is lacking a built-in version
|
||||||
# date if applicable (to override the mtime of the Source archive)
|
# reference, %{version<number>} will be translated
|
||||||
#
|
# into %{tag<number>} using unreliable heuristics;
|
||||||
# Use -z for multiple calls to the macro
|
# set %{tag<number>} directly if those fail
|
||||||
#
|
# %{date<number>} the packaged timestamp
|
||||||
# The macro will attempt to compute and set the following variables if they are
|
# … %forgemeta will compute a huge number of variables:
|
||||||
# not already set by the packager:
|
# — the packager can override it by setting some of
|
||||||
#
|
# those before the %forgemeta call
|
||||||
# forgesource an URL that can be used as SourceX: value
|
# – use the -i flag to list those variables
|
||||||
# forgesetupargs the correct arguments to pass to %setup for this source
|
# -z <number> only process the zth block of definitions
|
||||||
# used by %forgesetup and %forgeautosetup
|
# "" for the no-suffix block
|
||||||
# archivename the source archive filename, without extentions
|
# -i list the resulting variable values
|
||||||
# archiveext the source archive filename extensions, without leading dot
|
# -s silently ignore problems in %{forgeurl<number>}
|
||||||
# archiveurl the url that can be used to download the source archive,
|
# -v be verbose
|
||||||
# without renaming
|
# -a process all sources in one go, instead of using
|
||||||
# topdir the source archive top directory (can be empty)
|
# separate -z calls
|
||||||
# extractdir the source directory created inside %{_builddir} after using
|
%forgemeta(z:isva) %{lua:
|
||||||
# %%forgesetup, %forgeautosetup or %{forgesetupargs}
|
|
||||||
# repo the repository name
|
|
||||||
# owner the repository owner (if used by another computed variable)
|
|
||||||
# shortcommit the commit hash clamping used by the forge, if any
|
|
||||||
# scm the scm type, when packaging code snapshots: commits or tags
|
|
||||||
# distprefix the prefix that needs adding to dist to trace non-release packaging
|
|
||||||
#
|
|
||||||
# Most of the computed variables are both overridable and optional.
|
|
||||||
#
|
|
||||||
# Optional parameters:
|
|
||||||
# -a process all sources in one go, instead of using separate -z calls
|
|
||||||
# -z <number> suffix all the read and written variable names with <number>
|
|
||||||
# for example read forgeurl<number>, version<number>…
|
|
||||||
# and generate forgesetupargs<number>, archiveurl<number>…
|
|
||||||
# The macro assumes that null or nil suffix is used for the primary
|
|
||||||
# package source.
|
|
||||||
# -s Silently ignore problems in forgeurl, use it if it can be parsed,
|
|
||||||
# ignore it otherwise.
|
|
||||||
# -v Be verbose and print every spec variable the macro sets.
|
|
||||||
# -i Print some info about the state of spec variables the macro may use or
|
|
||||||
# set at the end of the processing.
|
|
||||||
%forgemeta(az:sviu:) %{lua:
|
|
||||||
local fedora = require "fedora.common"
|
local fedora = require "fedora.common"
|
||||||
local forge = require "fedora.srpm.forge"
|
local forge = require "fedora.srpm.forge"
|
||||||
local verbose = rpm.expand("%{-v}") ~= ""
|
local verbose = rpm.expand("%{-v}") ~= ""
|
||||||
@ -60,12 +38,17 @@ else
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# Convenience macro to relay computed arguments to %setup
|
# Unpacks sources computed by %forgemeta
|
||||||
# Optional parameters:
|
# Control variables, flags and arguments:
|
||||||
# -a process all sources in one go, instead of using separate -z calls
|
# %{forgesource<number>} the source archive that will be processed
|
||||||
# -z <number> read %{?forgesetupargs<number>}
|
# %{forgesetupargs<number>} %setup arguments
|
||||||
# -v be verbose
|
|
||||||
%forgesetup(az:v) %{lua:
|
# -z <number> only process the zth block of definitions
|
||||||
|
# "" for the no-suffix block
|
||||||
|
# -v be verbose
|
||||||
|
# -a process all sources in one go, instead of using
|
||||||
|
# separate -z calls
|
||||||
|
%forgesetup(z:va) %{lua:
|
||||||
local fedora = require "fedora.common"
|
local fedora = require "fedora.common"
|
||||||
if (rpm.expand("%{-z}") == "") and (rpm.expand("%{-a}") ~= "") then
|
if (rpm.expand("%{-z}") == "") and (rpm.expand("%{-a}") ~= "") then
|
||||||
for _,s in pairs(fedora.getsuffixes("forgesetupargs")) do
|
for _,s in pairs(fedora.getsuffixes("forgesetupargs")) do
|
||||||
@ -76,10 +59,12 @@ else
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# Convenience macro to relay computed arguments to %autosetup
|
# Calls %autosetup using %forgemeta results
|
||||||
# Parameters relayed to %autosetup: -v -N -S -p
|
# – this will probably be removed since it is unsafe in presence of multiple
|
||||||
# Optional parameters:
|
# sources
|
||||||
# -z <number> read %{?forgesetupargs<number>}
|
# Control variables, flags and arguments:
|
||||||
|
# -z <number> process the zth block of definitions
|
||||||
|
# -v -N -S -p relayed to %autosetup
|
||||||
%forgeautosetup(z:vNS:p:q) %{lua:
|
%forgeautosetup(z:vNS:p:q) %{lua:
|
||||||
print(rpm.expand("%autosetup %{-v} %{-N} %{?-S} %{?-p} %{?forgesetupargs" .. rpm.expand("%{-z*}") .. "}\\n"))
|
print(rpm.expand("%autosetup %{-v} %{-N} %{?-S} %{?-p} %{?forgesetupargs" .. rpm.expand("%{-z*}") .. "}\\n"))
|
||||||
}
|
}
|
||||||
|
2
macros.java-srpm
Normal file
2
macros.java-srpm
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Arches that OpenJDK and dependent packages run on
|
||||||
|
%java_arches aarch64 ppc64le s390x x86_64 %{arm} %{ix86}
|
3
macros.shell-completions
Normal file
3
macros.shell-completions
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
%bash_completions_dir %{_datadir}/bash-completion/completions
|
||||||
|
%zsh_completions_dir %{_datadir}/zsh/site-functions
|
||||||
|
%fish_completions_dir %{_datadir}/fish/vendor_completions.d
|
@ -4,4 +4,4 @@
|
|||||||
%_vpath_srcdir .
|
%_vpath_srcdir .
|
||||||
|
|
||||||
# directory (doesn't need to exist) where all generated build files will be placed
|
# directory (doesn't need to exist) where all generated build files will be placed
|
||||||
%_vpath_builddir %_target_platform
|
%_vpath_builddir %{_vendor}-%{_target_os}-build
|
||||||
|
1
redhat-hardened-clang.cfg
Normal file
1
redhat-hardened-clang.cfg
Normal file
@ -0,0 +1 @@
|
|||||||
|
-fPIE
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
Summary: Red Hat specific rpm configuration files
|
Summary: Red Hat specific rpm configuration files
|
||||||
Name: redhat-rpm-config
|
Name: redhat-rpm-config
|
||||||
Version: 153
|
Version: 202
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
# No version specified.
|
# No version specified.
|
||||||
License: GPL+
|
License: GPL+
|
||||||
@ -19,9 +19,10 @@ Source1: rpmrc
|
|||||||
# gcc specs files for hardened builds
|
# gcc specs files for hardened builds
|
||||||
Source50: redhat-hardened-cc1
|
Source50: redhat-hardened-cc1
|
||||||
Source51: redhat-hardened-ld
|
Source51: redhat-hardened-ld
|
||||||
|
Source52: redhat-hardened-clang.cfg
|
||||||
|
|
||||||
# gcc specs files for annobin builds
|
# gcc specs files for annobin builds
|
||||||
Source52: redhat-annobin-cc1
|
Source60: redhat-annobin-cc1
|
||||||
|
|
||||||
# The macros defined by these files are for things that need to be defined
|
# The macros defined by these files are for things that need to be defined
|
||||||
# at srpm creation time when it is not feasible to require the base packages
|
# at srpm creation time when it is not feasible to require the base packages
|
||||||
@ -33,14 +34,17 @@ Source102: macros.mono-srpm
|
|||||||
Source103: macros.nodejs-srpm
|
Source103: macros.nodejs-srpm
|
||||||
Source104: macros.ldc-srpm
|
Source104: macros.ldc-srpm
|
||||||
Source105: macros.valgrind-srpm
|
Source105: macros.valgrind-srpm
|
||||||
|
Source106: macros.java-srpm
|
||||||
|
|
||||||
# Other misc macros
|
# Other misc macros
|
||||||
Source150: macros.dwz
|
Source150: macros.build-constraints
|
||||||
Source151: macros.kmp
|
Source151: macros.dwz
|
||||||
Source152: macros.vpath
|
Source152: macros.fedora-misc
|
||||||
Source153: macros.forge
|
Source153: macros.forge
|
||||||
Source154: macros.ldconfig
|
Source154: macros.kmp
|
||||||
Source155: macros.fedora-misc
|
Source155: macros.ldconfig
|
||||||
|
Source156: macros.vpath
|
||||||
|
Source157: macros.shell-completions
|
||||||
|
|
||||||
# Build policy scripts
|
# Build policy scripts
|
||||||
# this comes from https://github.com/rpm-software-management/rpm/pull/344
|
# this comes from https://github.com/rpm-software-management/rpm/pull/344
|
||||||
@ -48,9 +52,8 @@ Source155: macros.fedora-misc
|
|||||||
# and an echo when the mangling happens
|
# and an echo when the mangling happens
|
||||||
Source201: brp-mangle-shebangs
|
Source201: brp-mangle-shebangs
|
||||||
|
|
||||||
# this comes from rpm itself
|
# for converting llvm LTO bitcode objects into ELF
|
||||||
# however, now we can do Fedora changes within
|
Source204: brp-llvm-compile-lto-elf
|
||||||
Source202: brp-python-bytecompile
|
|
||||||
|
|
||||||
# Dependency generator scripts (deprecated)
|
# Dependency generator scripts (deprecated)
|
||||||
Source300: find-provides
|
Source300: find-provides
|
||||||
@ -73,7 +76,6 @@ Source501: config.sub
|
|||||||
|
|
||||||
# Dependency generators & their rules
|
# Dependency generators & their rules
|
||||||
Source600: kmod.attr
|
Source600: kmod.attr
|
||||||
Source601: kmod.prov
|
|
||||||
Source602: libsymlink.attr
|
Source602: libsymlink.attr
|
||||||
|
|
||||||
# BRPs
|
# BRPs
|
||||||
@ -97,19 +99,23 @@ Requires: fpc-srpm-macros
|
|||||||
Requires: ghc-srpm-macros
|
Requires: ghc-srpm-macros
|
||||||
Requires: gnat-srpm-macros
|
Requires: gnat-srpm-macros
|
||||||
Requires: go-srpm-macros
|
Requires: go-srpm-macros
|
||||||
|
Requires: kernel-srpm-macros
|
||||||
|
Requires: lua-srpm-macros
|
||||||
Requires: nim-srpm-macros
|
Requires: nim-srpm-macros
|
||||||
Requires: ocaml-srpm-macros
|
Requires: ocaml-srpm-macros
|
||||||
Requires: openblas-srpm-macros
|
Requires: openblas-srpm-macros
|
||||||
Requires: perl-srpm-macros
|
Requires: perl-srpm-macros
|
||||||
# ↓ Provides compileall2 Python module
|
# ↓ Has Python BRPs originaly present in redhat-rpm-config
|
||||||
Requires: python-srpm-macros >= 3-46
|
Requires: python-srpm-macros >= 3.10-6
|
||||||
Requires: rust-srpm-macros
|
|
||||||
Requires: qt5-srpm-macros
|
Requires: qt5-srpm-macros
|
||||||
|
Requires: rust-srpm-macros
|
||||||
|
Requires: rpmautospec-rpm-macros
|
||||||
|
Requires: ansible-srpm-macros
|
||||||
|
|
||||||
Requires: rpm >= 4.11.0
|
Requires: rpm >= 4.11.0
|
||||||
Requires: dwz >= 0.4
|
Requires: dwz >= 0.4
|
||||||
Requires: zip
|
Requires: zip
|
||||||
Requires: (annobin if gcc)
|
Requires: (annobin-plugin-gcc if gcc)
|
||||||
|
|
||||||
# for brp-mangle-shebangs
|
# for brp-mangle-shebangs
|
||||||
Requires: %{_bindir}/find
|
Requires: %{_bindir}/find
|
||||||
@ -118,6 +124,9 @@ Requires: %{_bindir}/grep
|
|||||||
Requires: %{_bindir}/sed
|
Requires: %{_bindir}/sed
|
||||||
Requires: %{_bindir}/xargs
|
Requires: %{_bindir}/xargs
|
||||||
|
|
||||||
|
# for brp-llvm-compile-lto-elf
|
||||||
|
Requires: (llvm if clang)
|
||||||
|
|
||||||
# -fstack-clash-protection and -fcf-protection require GCC 8.
|
# -fstack-clash-protection and -fcf-protection require GCC 8.
|
||||||
Conflicts: gcc < 8.0.1-0.22
|
Conflicts: gcc < 8.0.1-0.22
|
||||||
|
|
||||||
@ -162,7 +171,6 @@ install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.*
|
|||||||
|
|
||||||
mkdir -p %{buildroot}%{_fileattrsdir}
|
mkdir -p %{buildroot}%{_fileattrsdir}
|
||||||
install -p -m 644 -t %{buildroot}%{_fileattrsdir} *.attr
|
install -p -m 644 -t %{buildroot}%{_fileattrsdir} *.attr
|
||||||
install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
|
|
||||||
|
|
||||||
mkdir -p %{buildroot}%{_rpmluadir}/fedora/{rpm,srpm}
|
mkdir -p %{buildroot}%{_rpmluadir}/fedora/{rpm,srpm}
|
||||||
install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora common.lua
|
install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora common.lua
|
||||||
@ -182,13 +190,14 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
|
|||||||
%{rrcdir}/find-requires
|
%{rrcdir}/find-requires
|
||||||
%{rrcdir}/brp-ldconfig
|
%{rrcdir}/brp-ldconfig
|
||||||
%{_fileattrsdir}/*.attr
|
%{_fileattrsdir}/*.attr
|
||||||
%{_rpmconfigdir}/kmod.prov
|
|
||||||
%{_rpmconfigdir}/macros.d/macros.*-srpm
|
%{_rpmconfigdir}/macros.d/macros.*-srpm
|
||||||
|
%{_rpmconfigdir}/macros.d/macros.build-constraints
|
||||||
%{_rpmconfigdir}/macros.d/macros.dwz
|
%{_rpmconfigdir}/macros.d/macros.dwz
|
||||||
|
%{_rpmconfigdir}/macros.d/macros.fedora-misc
|
||||||
%{_rpmconfigdir}/macros.d/macros.forge
|
%{_rpmconfigdir}/macros.d/macros.forge
|
||||||
%{_rpmconfigdir}/macros.d/macros.ldconfig
|
%{_rpmconfigdir}/macros.d/macros.ldconfig
|
||||||
|
%{_rpmconfigdir}/macros.d/macros.shell-completions
|
||||||
%{_rpmconfigdir}/macros.d/macros.vpath
|
%{_rpmconfigdir}/macros.d/macros.vpath
|
||||||
%{_rpmconfigdir}/macros.d/macros.fedora-misc
|
|
||||||
%dir %{_rpmluadir}/fedora
|
%dir %{_rpmluadir}/fedora
|
||||||
%dir %{_rpmluadir}/fedora/srpm
|
%dir %{_rpmluadir}/fedora/srpm
|
||||||
%dir %{_rpmluadir}/fedora/rpm
|
%dir %{_rpmluadir}/fedora/rpm
|
||||||
@ -209,6 +218,161 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
|
|||||||
%{_rpmconfigdir}/macros.d/macros.kmp
|
%{_rpmconfigdir}/macros.d/macros.kmp
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Aug 08 2022 Maxwell G <gotmax@e.email> - 202-1
|
||||||
|
- Add macros.shell-completions
|
||||||
|
|
||||||
|
* Thu May 19 2022 Jason L Tibbitts III <j@tib.bs> - 201-1
|
||||||
|
- Add java_arches macro.
|
||||||
|
|
||||||
|
* Tue May 17 2022 Maxwell G <gotmax@e.email> - 200-1
|
||||||
|
- Add `Requires: ansible-srpm-macros`
|
||||||
|
|
||||||
|
* Tue Sep 21 2021 Tom Stellard <tstellar@redhat.com> - 199-1
|
||||||
|
- Drop annobin-plugin-clang dependency
|
||||||
|
|
||||||
|
* Mon Aug 30 2021 Florian Weimer <fweimer@redhat.com> - 198-1
|
||||||
|
- ELN: Enable -march=x86-64-v2 for Clang as well
|
||||||
|
|
||||||
|
* Tue Aug 17 2021 Tom Stellard <tstellar@redhat.com> - 197-1
|
||||||
|
- Add build_ preifix to cc, cxx, and cpp macros
|
||||||
|
|
||||||
|
* Mon Aug 16 2021 Tom Stellard <tstellar@redhat.com> - 196-1
|
||||||
|
- Add cc, cxx, and cpp macros
|
||||||
|
|
||||||
|
* Sun Aug 15 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 195-1
|
||||||
|
- Fix macros.build-constraints' %%limit_build
|
||||||
|
- number of CPUs will never be set to less than 1
|
||||||
|
- this now outputs build flag overrides to be used with %%make_build etc.
|
||||||
|
- add documentation
|
||||||
|
|
||||||
|
* Mon Aug 2 2021 Florian Weimer <fweimer@redhat.com> - 194-1
|
||||||
|
- Active GCC plugin during LTO linking
|
||||||
|
|
||||||
|
* Sat Jul 24 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 193-1
|
||||||
|
- Add macros.build-constraints
|
||||||
|
- Keep the misc macros in alphabetical order
|
||||||
|
|
||||||
|
* Sat Jul 10 2021 Neal Gompa <ngompa13@gmail.com> - 192-1
|
||||||
|
- Make vpath builddir not include arch-specific info
|
||||||
|
|
||||||
|
* Thu Jul 01 2021 Miro Hrončok <mhroncok@redhat.com> - 191-1
|
||||||
|
- Require python-srpm-macros with Python related BuildRoot Policy scripts
|
||||||
|
|
||||||
|
* Wed Jun 30 2021 Miro Hrončok <mhroncok@redhat.com> - 190-1
|
||||||
|
- Move Python related BuildRoot Policy scripts from redhat-rpm-config to python-srpm-macros
|
||||||
|
|
||||||
|
* Mon Jun 28 2021 Ben Burton <bab@debian.org> - 189-1
|
||||||
|
- Adapt macros and BRP scripts for %%topdir with spaces
|
||||||
|
- Fixes rhbz#1947416
|
||||||
|
|
||||||
|
* Tue Jun 22 2021 Panu Matilainen <pmatilai@redhat.com> - 188-1
|
||||||
|
- Drop reference to now extinct brp-python-hardlink script
|
||||||
|
|
||||||
|
* Tue Jun 8 2021 Stephen Coady <scoady@redhat.com> - 187-1
|
||||||
|
- Add Requires: rpmautospec-rpm-macros
|
||||||
|
|
||||||
|
* Mon May 31 2021 Charalampos Stratakis <cstratak@redhat.com> - 186-1
|
||||||
|
- Enable RPATH check after %%install
|
||||||
|
- Part of https://fedoraproject.org/wiki/Changes/Broken_RPATH_will_fail_rpmbuild
|
||||||
|
- Resolves: rhbz#1964548
|
||||||
|
|
||||||
|
* Wed May 26 2021 Arjun Shankar <arjun@redhat.com> - 185-1
|
||||||
|
- Disable annobin on armv7hl
|
||||||
|
|
||||||
|
* Mon Apr 12 2021 David Benoit <dbenoit@redhat.com> - 184-1
|
||||||
|
- Change 'Requires: annobin' to 'Requires: annobin-plugin-gcc'.
|
||||||
|
|
||||||
|
* Tue Apr 6 2021 David Benoit <dbenoit@redhat.com> - 183-1
|
||||||
|
- BRP: LLVM Compile LTO Bitcode to ELF
|
||||||
|
- Add Requires: (llvm if clang)
|
||||||
|
|
||||||
|
* Mon Mar 22 2021 Lumír Balhar <lbalhar@redhat.com> - 182-1
|
||||||
|
- Fix handling of files without newlines in brp-mangle-shebang
|
||||||
|
|
||||||
|
* Wed Mar 10 2021 Kalev Lember <klember@redhat.com> - 181-1
|
||||||
|
- BRP Python Bytecompile: Avoid hardcoding /usr/bin prefix for python
|
||||||
|
|
||||||
|
* Tue Jan 19 2021 Florian Weimer <fweimer@redhat.com> - 180-1
|
||||||
|
- Use -march=x86-64-v2 only for the gcc toolchain
|
||||||
|
|
||||||
|
* Tue Jan 19 2021 Florian Weimer <fweimer@redhat.com> - 179-1
|
||||||
|
- x86_64: Enable -march=x86-64-v2 for ELN, following GCC.
|
||||||
|
|
||||||
|
* Sun Nov 29 2020 Miro Hrončok <mhroncok@redhat.com> - 178-1
|
||||||
|
- BRP Python Bytecompile: Also detect Python files in /app/lib/pythonX.Y
|
||||||
|
|
||||||
|
* Tue Oct 27 2020 Tom Stellard <tstellar@redhat.com> - 177-1
|
||||||
|
- Add back -fcf-protection flag for x86_64
|
||||||
|
|
||||||
|
* Tue Oct 20 2020 Florian Weimer <fweimer@redhat.com> - 176-1
|
||||||
|
- s390x: Tune for z14 (as in Red Hat Enterprise Linux 8)
|
||||||
|
|
||||||
|
* Mon Oct 5 2020 Florian Weimer <fweimer@redhat.com> - 175-1
|
||||||
|
- s390x: Switch Fedora ELN to z13 baseline
|
||||||
|
|
||||||
|
* Fri Sep 11 2020 Miro Hrončok <mhroncok@redhat.com> - 172-1
|
||||||
|
- Filter out LTO flags from %%extension flags macros
|
||||||
|
- Fixes: rhbz#1877652
|
||||||
|
|
||||||
|
* Wed Sep 2 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 171-1
|
||||||
|
- Add Requires: lua-srpm-macros
|
||||||
|
|
||||||
|
* Fri Aug 21 2020 Tom Stellard <tstellar@redhat.com> - 170-1
|
||||||
|
- Enable -fstack-clash-protection for clang on x86, s390x, and ppc64le
|
||||||
|
|
||||||
|
* Thu Aug 20 2020 Tom Stellard <tstellar@redhat.com> - 169-1
|
||||||
|
- Add -flto to ldflags for clang toolchain
|
||||||
|
|
||||||
|
* Thu Aug 20 2020 Neal Gompa <ngompa13@gmail.com> - 168-1
|
||||||
|
- Fix CC/CXX exports so arguments are included in exported variable
|
||||||
|
- Allow overrides of CC/CXX like CFLAGS and CXXFLAGS from shell variables
|
||||||
|
|
||||||
|
* Mon Aug 03 2020 Troy Dawson <tdawson@redhat.com> - 167-1
|
||||||
|
- Add Requires: kernel-srpm-macros
|
||||||
|
|
||||||
|
* Thu Jul 30 2020 Jeff Law <law@redhat.com> - 166-1
|
||||||
|
- Use -flto=auto for GCC to speed up builds
|
||||||
|
|
||||||
|
* Tue Jul 28 2020 Tom Stellard <tstellar@redhat.com> - 165-1
|
||||||
|
- Only use supported lto flags for clang toolchain
|
||||||
|
|
||||||
|
* Thu Jul 23 2020 Lumír Balhar <lbalhar@redhat.com> - 164-1
|
||||||
|
- Disable Python hash seed randomization in brp-python-bytecompile
|
||||||
|
|
||||||
|
* Tue Jul 21 2020 Jeff Law <law@redhat.com> - 163-1
|
||||||
|
- Enable LTO by default
|
||||||
|
|
||||||
|
* Thu Jul 16 2020 Lumír Balhar <lbalhar@redhat.com> - 162-1
|
||||||
|
- New script brp-fix-pyc-reproducibility
|
||||||
|
|
||||||
|
* Tue Jun 16 2020 Lumír Balhar <lbalhar@redhat.com> - 161-2
|
||||||
|
- Use stdlib compileall for Python >= 3.9
|
||||||
|
|
||||||
|
* Mon Jun 15 2020 Lumír Balhar <lbalhar@redhat.com> - 161-1
|
||||||
|
- No more automagic Python bytecompilation (phase 3)
|
||||||
|
https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_3
|
||||||
|
|
||||||
|
* Thu Jun 04 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 160-1
|
||||||
|
- Fix broken %%configure
|
||||||
|
|
||||||
|
* Wed Jun 03 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 159-1
|
||||||
|
- Fixes for new_package macro
|
||||||
|
|
||||||
|
* Wed Jun 03 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 158-1
|
||||||
|
- Add option to choose C/C++ toolchain
|
||||||
|
|
||||||
|
* Sat May 30 2020 Jeff Law <law@redhat.com> - 157-1
|
||||||
|
- When LTO is enabled, fix broken configure files.
|
||||||
|
|
||||||
|
* Sat May 30 2020 Nicolas Mailhot <nim@fedoraproject.org> - 156-1
|
||||||
|
- Add new_package macro and associated lua framework.
|
||||||
|
|
||||||
|
* Sat May 23 2020 Nicolas Mailhot <nim@fedoraproject.org> - 155-1
|
||||||
|
- forge: add gitea support
|
||||||
|
|
||||||
|
* Thu Apr 09 2020 Panu Matilainen <pmatilai@redhat.com> - 154-1
|
||||||
|
- Optimize kernel module provides by using a parametric generator
|
||||||
|
|
||||||
* Thu Feb 20 2020 Jason L Tibbitts III <tibbs@math.uh.edu> - 153-1
|
* Thu Feb 20 2020 Jason L Tibbitts III <tibbs@math.uh.edu> - 153-1
|
||||||
- Add dependency on fonts-srpm-macros, as those have now been approved by FPC.
|
- Add dependency on fonts-srpm-macros, as those have now been approved by FPC.
|
||||||
|
|
||||||
|
10
rpmrc
10
rpmrc
@ -6,7 +6,7 @@ optflags: i586 %{__global_compiler_flags} -m32 -march=i586 -mtune=generic -fasyn
|
|||||||
optflags: i686 %{__global_compiler_flags} -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
|
optflags: i686 %{__global_compiler_flags} -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
|
||||||
optflags: athlon %{__global_compiler_flags} -m32 -march=athlon -fasynchronous-unwind-tables -fstack-clash-protection
|
optflags: athlon %{__global_compiler_flags} -m32 -march=athlon -fasynchronous-unwind-tables -fstack-clash-protection
|
||||||
optflags: ia64 %{__global_compiler_flags}
|
optflags: ia64 %{__global_compiler_flags}
|
||||||
optflags: x86_64 %{__global_compiler_flags} -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
|
optflags: x86_64 %{__global_compiler_flags} -m64 %{__cflags_arch_x86_64} -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
|
||||||
|
|
||||||
optflags: alpha %{__global_compiler_flags} -mieee
|
optflags: alpha %{__global_compiler_flags} -mieee
|
||||||
optflags: alphaev5 %{__global_compiler_flags} -mieee -mcpu=ev5
|
optflags: alphaev5 %{__global_compiler_flags} -mieee -mcpu=ev5
|
||||||
@ -71,12 +71,12 @@ optflags: atariclone %{__global_compiler_flags}
|
|||||||
optflags: milan %{__global_compiler_flags}
|
optflags: milan %{__global_compiler_flags}
|
||||||
optflags: hades %{__global_compiler_flags}
|
optflags: hades %{__global_compiler_flags}
|
||||||
|
|
||||||
optflags: s390 %{__global_compiler_flags} -m31 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables
|
optflags: s390 %{__global_compiler_flags} -m31 %{__cflags_arch_s390x} -fasynchronous-unwind-tables
|
||||||
optflags: s390x %{__global_compiler_flags} -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection
|
optflags: s390x %{__global_compiler_flags} -m64 %{__cflags_arch_s390x} -fasynchronous-unwind-tables -fstack-clash-protection
|
||||||
|
|
||||||
optflags: aarch64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection
|
optflags: aarch64 %{__global_compiler_flags} -mbranch-protection=standard -fasynchronous-unwind-tables %[ "%{toolchain}" == "gcc" ? "-fstack-clash-protection" : "" ]
|
||||||
|
|
||||||
optflags: riscv64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection
|
optflags: riscv64 %{__global_compiler_flags} -fasynchronous-unwind-tables %[ "%{toolchain}" == "gcc" ? "-fstack-clash-protection" : "" ]
|
||||||
|
|
||||||
# set build arch to fedora buildarches on hardware capable of running it
|
# set build arch to fedora buildarches on hardware capable of running it
|
||||||
# saves having to do rpmbuild --target=
|
# saves having to do rpmbuild --target=
|
||||||
|
5
tests/gcc-fedora-flags/hello.c
Normal file
5
tests/gcc-fedora-flags/hello.c
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void hello() {
|
||||||
|
printf("Hello World\n");
|
||||||
|
}
|
5
tests/gcc-fedora-flags/hello.cpp
Normal file
5
tests/gcc-fedora-flags/hello.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
void hello() {
|
||||||
|
std::cout << "Hello World\n";
|
||||||
|
}
|
6
tests/gcc-fedora-flags/main.c
Normal file
6
tests/gcc-fedora-flags/main.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
void hello();
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
hello();
|
||||||
|
return 0;
|
||||||
|
}
|
6
tests/gcc-fedora-flags/main.cpp
Normal file
6
tests/gcc-fedora-flags/main.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
void hello();
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
hello();
|
||||||
|
return 0;
|
||||||
|
}
|
29
tests/gcc-fedora-flags/runtest.sh
Normal file
29
tests/gcc-fedora-flags/runtest.sh
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
default_cflags=`rpm -E %{build_cflags}`
|
||||||
|
default_cxxflags=`rpm -E %{build_cxxflags}`
|
||||||
|
default_ldflags=`rpm -E %{build_ldflags}`
|
||||||
|
|
||||||
|
cflags=`rpm -D '%toolchain gcc' -E %{build_cflags}`
|
||||||
|
cxxflags=`rpm -D '%toolchain gcc' -E %{build_cxxflags}`
|
||||||
|
ldflags=`rpm -D '%toolchain gcc' -E %{build_ldflags}`
|
||||||
|
|
||||||
|
test "$default_cflags" = "$cflags"
|
||||||
|
test "$default_cxxflags" = "$cxxflags"
|
||||||
|
test "$default_ldflags" = "$ldflags"
|
||||||
|
|
||||||
|
gcc $cflags -o hello.o -c hello.c
|
||||||
|
annocheck hello.o
|
||||||
|
gcc $cflags -o main.o -c main.c
|
||||||
|
gcc $ldflags -o hello main.o hello.o
|
||||||
|
annocheck hello
|
||||||
|
./hello | grep "Hello World"
|
||||||
|
|
||||||
|
g++ $cxxflags -o hello-cpp.o -c hello.cpp
|
||||||
|
annocheck hello-cpp.o
|
||||||
|
g++ $cxxflags -o main-cpp.o -c main.cpp
|
||||||
|
g++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o
|
||||||
|
annocheck hello-cpp
|
||||||
|
./hello-cpp | grep "Hello World"
|
19
tests/tests.yml
Normal file
19
tests/tests.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- role: standard-test-basic
|
||||||
|
tags:
|
||||||
|
- classic
|
||||||
|
required_packages:
|
||||||
|
- rpm
|
||||||
|
# clang/fedora-flags
|
||||||
|
- clang
|
||||||
|
#gcc-fedora-flags
|
||||||
|
- gcc
|
||||||
|
- gcc-c++
|
||||||
|
- annobin-annocheck
|
||||||
|
repositories:
|
||||||
|
- repo: https://src.fedoraproject.org/tests/clang.git
|
||||||
|
dest: clang
|
||||||
|
tests:
|
||||||
|
- clang/fedora-flags
|
||||||
|
- gcc-fedora-flags
|
Loading…
Reference in New Issue
Block a user