Compare commits

...

196 Commits
f24 ... master

Author SHA1 Message Date
Jason Tibbitts 1b85ce0ce8 Keep the macro deps in alphabetical order. 2020-02-21 11:54:53 -06:00
Jason Tibbitts 3a4ec69bee Add dependency on fonts-srpm-macros.
The font guidelines overhaul was approved by FPC, so bring the macros
into the buildroot.  https://pagure.io/packaging-committee/issue/935
2020-02-20 16:56:42 -06:00
Jeff Law 9dd5528cf9 - Use eu-elfclassify to only run strip on ELF relocatables
and archive libraries.
2020-02-20 13:40:19 -07:00
Igor Raits edd94328ae
Fixup parallel algorithm for brp-strip-lto
Same as in RPM upstream.

Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-02-14 14:26:36 +01:00
Igor Raits b92766d4d9
Fix year in changelog
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-02-14 14:20:25 +01:00
Igor Raits 776d974885
brp-strip-lto: Run strip in parallel
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-02-14 14:12:15 +01:00
Jeff Law 20749d9857
Strip LTO sections/symbols from installed .o/.a files 2020-02-14 13:39:34 +01:00
Tomas Orsava 9ce99265fd brp-python-bytecompile: Prepare for 2 digit minor versions (e.g. 3.10) 2020-02-14 12:35:17 +00:00
Lumir Balhar 312bfbac26 Use `-B` flag for Python when using compileall2 to not write pyc files
The Python compileall2 module in /usr/lib/rpm/redhat/
can be executed by various different Python interpreters.
We don't want to write several different `*.pyc` files
to this location - in most cases, that's not possible,
but somebody might run this as root.
2020-01-27 15:32:07 +00:00
Jeff Law 3e759e70ac Allow conditionally adding -fcommon to CFLAGS by defining %_legacy_common_support
Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
2020-01-23 14:25:11 +01:00
Florian Weimer fff3459086 Reenable annobin after GCC 10 integration (#1792892)
This reverts commit c18924507d
("Temporarily disable annobin for GCC 10 (#1792892)").
2020-01-20 13:52:38 +01:00
Florian Weimer c18924507d Temporarily disable annobin for GCC 10 (#1792892) 2020-01-20 11:42:04 +01:00
Denys Vlasenko 40a9e696d6 Bump version
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2019-12-05 13:56:00 +01:00
Denys Vlasenko 817f533126 kmod.prov: fix and speed it up
For kernel builds, /usr/lib/rpm/kmod.prov is fork+execed by rpmbuild
in "Processing files:" step about 8000 times, single-threaded,
with cumulative run time of ~2 minutes.

Speed up this script, by avoiding additional fork+execing.

Tested to work, observed speedup: almost exactly 2 times faster.

While verifying correctness, noticed that old script was buggy -
it was generating a bogus "Provides:" item - kmod(modules.builtin.modinfo),
because the logic in script was filtering for */*.ko files and
for */modules.builtin* files, and wasn't prepared for
the existence of */modules.builtin.modinfo file.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2019-12-05 13:53:31 +01:00
Igor Gnatenko 2721f1c528
Bump version
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-12-03 15:48:35 +01:00
Pavel Raiskup e345575f97 %set_build_flags: define LT_SYS_LIBRARY_PATH
This config is to let libtool recognize that our 64bit variant of
%_libdir is actually on the standard/default library path, so libtool
doesn't think it has to be hard-wired as RPATH.  This is proper solution
for libtool RPATH issues described in:

  https://docs.fedoraproject.org/en-US/packaging-guidelines/#_removing_rpath

The libtool script/macros (new enough, v2.4.6+) honor this variable when
it isn't possible to detect the system-wide default library path.  It is
e.g. able to parse /etc/ld.so.* configuration, but there's no info about
/usr/lib64 on Fedora.

So to not force everybody to do:

   %configure LT_SYS_LIBRARY_PATH=...

... rather set this system-wide.  This is low-risk change since
older libtool scripts don't use this variable, and really no other
tools should.
2019-12-03 15:04:51 +01:00
Nicolas Mailhot f5f6818d6e wordwrap: fix some corner cases
– handle CR in addition to LF
– be smarter in presence of lists
– fix off-by-one mistake when a LF in the processed text falls exactly on the 81st column
2019-12-03 12:02:01 +00:00
Denys Vlasenko ddce306578
Bump version
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2019-12-03 13:01:10 +01:00
Denys Vlasenko 140ee1de89
brp-mangle-shebangs: do not stat / touch files needlessly
Run "stat" to get mtime, and "touch -d $saved_mtime"
only if we indeed modify file's shebang.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2019-12-03 13:00:36 +01:00
Denys Vlasenko 618362d6fb
brp-mangle-shebangs: fix unsafe/incorrect command expansion
trim() {
  printf '%s' "$*"
}
...
  read shebang_line < "$f" || :
  orig_shebang=$(trim $(echo "$shebang_line" | grep -Po "#!\K.*" || echo))

The "trimming", i.e. replacement of multiple spaces and removal of leading
and trailing spaces, is achieved because "trim $(cmd)" construct has an
unquoted $(), which is subject to word splitting.

This works, yes. BUT.

It is also subject to glob expansion - any ?s and *s will be attempted
to be expanded as well - definitely NOT what we want!

This change replaces this trick with code which avoids the expansion issue,
and which does not spawn any subprocesses for string manipulations -
this is ~3 times faster (fork+execs are expensive).

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2019-12-03 13:00:36 +01:00
Denys Vlasenko 63d7e4dc11
brp-mangle-shebangs: speed up finding of "text executables" (scripts)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2019-12-03 13:00:35 +01:00
Lumir Balhar 6335a7ff4a Fix brp-python-bytecompile with the new features from compileall2
Resolves: rhbz#1595265

The problem this change is intended to solve is with how `real_libdir`
is calculated. Let's assume we want to recursively byte-compile all
`*.py` files in
`/builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8`.
Then, `real_libdir` is this path without `$RPM_BUILD_ROOT` with
the filename at the end which displays in the error message like this:

```
Bytecompiling .py files below /builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8 using /usr/bin/python3.8
*** Error compiling '/builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8/site-packages/greplin/bar.py'...
  File "/usr/lib/python3.8/bar.py", line 1
    import sin from math
               ^
SyntaxError: invalid syntax
```

`/usr/lib/python3.8/bar.py` is obviously wrong.

One of the new features of the `compileall2` module (which will
be available in stdlib in Python 3.9) is that the path byte-compiled to
`*.pyc` files is calculated for each file. This means that by using
`-s` and `-p` we can strip `$RPM_BUILD_ROOT` and prepend `/` for each
file individually which will fix the problem.

```
Bytecompiling .py files below /builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8 using /usr/bin/python3.8
*** Error compiling '/builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8/site-packages/greplin/bar.py'...
  File "/usr/lib/python3.8/site-packages/greplin/bar.py", line 1
    import sin from math
               ^
SyntaxError: invalid syntax
```

This change has an effect only for Python >= 3.4.
2019-12-02 16:39:32 +01:00
Miro Hrončok 4d93255fb3 Fix the simple API of %gpgverify 2019-11-01 08:04:12 +01:00
Jason Tibbitts 2c88f0ec58 Bump release and add changelog entry. 2019-08-22 10:46:36 -05:00
Miro Hrončok 3490049617 Simplify the API of %gpgverify
Instead of:

  %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'

It is now possible to do:

  %gpgverify -k2 -s1 -d0

I haven't yet assumed any defaults not to break backwards compatibility.
2019-07-25 11:20:37 +02:00
Richard W.M. Jones 0b30be56e5 Bump version and rebuild. 2019-07-25 10:13:28 +01:00
David Abdurachmanov 0676a754f0 rpmrc: update optflags for riscv64
Match other architectures by adding missing flags:

    -fasynchronous-unwind-tables -fstack-clash-protection

This is already in Fedora/RISCV for 1+ year.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-07-25 10:12:03 +01:00
Igor Gnatenko 4a1d1dd78f
Fixup python-srpm-macros version
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-07-20 18:47:27 +02:00
Lumir Balhar 5437dfca81 Use compileall2 Python module for byte-compilation in brp-python-bytecompile 2019-07-20 08:08:26 +02:00
Miro Hrončok 53617406d9 Move brp-python-bytecompile from rpm, so we can easily adapt it 2019-07-20 08:07:57 +02:00
Nicolas Mailhot faef29eb93 bump release 2019-07-08 23:32:20 +02:00
Nicolas Mailhot b8797dcd02 listfiles: make it robust against all kinds of “interesting” input
– restore protection against empty input
 – handle non-empty inputs, with whitespace, quotes, linebreaks, etc
2019-07-08 23:30:42 +02:00
Nicolas Mailhot 1f7310110e wordwrap: make list indenting smarter, to produce something with enough structure that it can be converted into AppStream metadata 2019-07-08 23:24:08 +02:00
Robert-André Mauchin 1e9cb0e970 Revert "listfiles: fix expansion of listfiles_exclude/listfiles_include"
This reverts commit 9deb0680eb.

Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
2019-07-08 17:13:20 +02:00
Nicolas Mailhot 9deb0680eb listfiles: fix expansion of listfiles_exclude/listfiles_include 2019-07-08 01:14:41 +02:00
Florian Festi 6b139317d5 Add changelog entry for previous change 2019-07-01 17:12:12 +02:00
Daniel Mach 38d0d92d5c Switch binary payload compression to Zstandard level 19
Fedora Change: https://fedoraproject.org/w/index.php?title=Changes/Switch_RPMs_to_zstd_compression
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1720729
Fesco ticket: https://pagure.io/fesco/issue/2144
Rel-eng ticket: https://pagure.io/releng/issue/8395
2019-07-01 16:41:12 +02:00
Vít Ondruch 86aae600e6 Enable RPM to set SOURCE_DATE_EPOCH environment variable.
If %source_date_epoch_from_changelog is true, RPM can set the SOURCE_DATE_EPOCH
environment variable to the timestamp of the topmost changelog entry. The
SOURCE_DATE_EPOCH can be in turn used by various projects to override otherwise
dynamically generated timestamps.

E.g. this might help to have stable timestamps in generated
documentation etc.
2019-06-27 08:41:44 +02:00
Igor Gnatenko 6708d7876e
Bump release
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-06-25 08:14:09 +02:00
Robert-André Mauchin 29b504fa55 Expand listfiles_include and listfiles_exclude in condition
listfiles_include and listfiles_exclude can contain multiline data that should be expanded, otherwise it breaks the if condition on newlines.
2019-06-24 22:47:59 +00:00
Jitka Plesnikova c68c6bd353 Remove perl macro refugees 2019-06-12 12:54:26 +02:00
Panu Matilainen bab65715b2 Provide temporary shelter for rpm 4.15 perl macro refugees
Rpm 4.15 removes various language-specific macros. Python side is
already covered by the versioned python macros but this is not the
case with Perl, macros. Add them here temporarily to avoid breaking
the world, but these really belong to perl-macros or such.
2019-06-10 14:12:21 +03:00
Igor Gnatenko 5878df46c0
Bump release
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-06-04 08:25:50 +02:00
Nicolas Mailhot 02f4a20583 misc: protect listfiles against empty input, to avoid harmless but annoying messages in build logs 2019-06-04 08:24:14 +02:00
Nicolas Mailhot 8394d3cf12
misc: add a wordwrap helper 2019-06-04 08:23:55 +02:00
Björn Persson 3da0ad5da8 Added gpgverify. 2019-05-30 19:54:13 +02:00
Nicolas Mailhot c6773c14ed misc: listfiles: improve argument passing, simplify it and make it more robust 2019-04-24 17:16:46 +02:00
Nicolas Mailhot 61ec2ef5ba forge: add pagure driver 2019-04-24 16:48:00 +02:00
Nicolas Mailhot 68a8a3b402 misc: writevars: fix code formatting 2019-04-24 16:47:34 +02:00
Miro Hrončok f29acc639b buildflags.md: Fix the packaging guidelines link 2019-01-18 22:38:59 +01:00
Panu Matilainen 20a0e63249 Drop redundant _smp_mflag re-definition, use the one from rpm instead
Once upon a time these did differ (for various bad reasons) but the
version in rpm has been identical to ours for many years, lets shed
some old baggage.
2019-01-15 12:02:22 +02:00
Florian Weimer e80fa1344a Build flags: Add support for extension builders (#1543394) 2018-12-20 11:34:27 +01:00
Panu Matilainen 98ffd5040d Silence the annoying warning from ldconfig brp-script (#1540971) 2018-12-17 16:16:25 +02:00
Nicolas Mailhot 5335ee546b common: add a writevars helper 2018-12-04 17:25:02 +01:00
Nicolas Mailhot 353f8b9faf common: add a setcurrent helper 2018-12-04 17:25:01 +01:00
Nicolas Mailhot 7b6ec4668c forge: fix handling of / in refs as showcased by github.com/dnstap/golang-dnstap 2018-12-04 17:24:34 +01:00
Nicolas Mailhot d6f71146ac forge: keep distprefixes lowercase, even for not primary ones 2018-12-04 17:24:34 +01:00
Miro Hrončok a212174975 Make automagic Python bytecompilation optional
https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_2
2018-11-15 12:13:14 +01:00
Jason Tibbitts b725d1e38a Bump version/update changelog. 2018-11-08 08:34:28 -06:00
Nicolas Mailhot 455084c511 forge: add more distprefix cleaning (bz1646724) 2018-11-06 17:47:28 +01:00
Igor Gnatenko 65fc49d917
bump version
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-10-22 11:09:13 +02:00
Nicolas Mailhot 8ba2a65b5c forge: add back a no-op -q in %forgeautosetup, even though being quiet was always its default behaviour
https://lists.fedoraproject.org/archives/users/81059352675829171399634426908237561548/
2018-10-22 10:10:19 +02:00
Igor Gnatenko 39fa88418c
bump version
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-10-20 12:32:45 +02:00
Nicolas Mailhot c70110c677
forge: refactor to allow multiple calls
– permit extraction of multiple archives in a single specfile
   – %forgemeta, %forgesetup, %forgeautosetup: add a “-z <number>” switch to
     select a specific set of rpm variables
     (for example forgeurl<number> and version<number>)
   – %forgemeta, %forgesetup: add a “-a” switch to process all sets in one go
     (makes no sense in forgeautosetup, as you need so select specific patches)
   – %forgemeta: deprecate the “-u” switch, use “-z” it’s better
     (“-u” was awkward and mainly used by the %gometa macro. %gometa will now
      call the lua code directly)
 – %forgesetup: use “-v” for verbose processing, be quiet by default, drop “-q”
   (align with %forgemeta, %forgeautosetup and %autosetup)
 – %forgesetup, %forgeautosetup: only pass flags that make sense to
   %setup/%autosetup; reorder to match what works in el7
 – factor out complex or common lua code in separate lua modules, to allow:
   – code reuse in other macros without cut and pasting
   – direct lua routine invocation from other macros without going through a
     rpm macro
   – rpm syntax errors that point to a line in an actual lua file
 – %forgemeta: refactor the logic to drop as much forge-specific code as
   possible, use a single logic flow with tables of constants
 – %forgemeta: export more computed info in rpm variables, such as the
   %{_builddir} subdirectory an archive was extracted to (lifesaver when
   processing multiple archives)
 – %forgemeta: prepend secondary distprefixes with .S, to make clear they do
    not apply to the main archive
 – %forgemeta: add versionx to secondary distprefixes, if relevant
 – %forgemeta: make tar.bz2 the default archive format

Caveats:
 – forge services implement full-release downloads via tags. However the actual
   syntax of such tags is not standardised. If the macro does not guess the
   correct tag an upstream uses for a specific release, you will need to
   set the tag value explicitly.
 – GitHub lets upstreams move their projects to new URLs, keeping the old URL
   active. It all works transparently *except* the top directory inside
   generated archives always matches the new project name (even when accessed
   by compatibility URLs, and even for releases that antedate the renaming).
   Therefore, if macro processing of a GitHub archive suddenly fails, start by
   checking if upstream didn’t rename itself.

Multicall usage example (with “-a”)
 – to process a specific bloc in one of the macros use “-z <suffix>”
 – suffix 0 and no suffix are synonyms
 – therefore, calling the macros without “-a” or “-z” just works for the
   general use case when you have a single archive to process
 – caveat: forge services implement full-release

%<--
%global forgeurl0        https://gitlab.com/osslugaru/lugaru
Version:                 1.2

%global forgeurl1        https://gitlab.com/osslugaru/lugaru
%global tag1             1.1

%global forgeurl2        https://gitlab.com/osslugaru/lugaru
%global commit2          68488b0a11df90dca703c67e5592b93c6a269957

%global forgeurl3        https://gitlab.com/osslugaru/lugaru
%global branch3          v1.1

%global forgeurl4       https://github.com/google/trillian
%global version4        1.0.8

%global forgeurl5       https://github.com/kubernetes/apiextensions-apiserver
%global version5        1.9.6
%global tag5            kubernetes-%{version5}

%global forgeurl6        https://github.com/jdbranham/grafana-diagram
%global version6         1.3
%global commit6          440689793ab6da82019c5ee43b49438dfef976d5

%global forgeurl7        https://github.com/rethinkdb/rethinkdb-go
%global version7         1.4.2
%global branch7          v1

%global forgeurl8        https://code.googlesource.com/gocloud
%global version8         0.20.0

%global forgeurl9        https://code.googlesource.com/gocloud
%global tag9             v0.27.0

%global forgeurl10      https://code.googlesource.com/google-api-go-client
%global commit10        24928b980e6919be4c72647aacd53ebcbb8c4bab
%global version10       0

%global forgeurl11      https://code.googlesource.com/google-api-go-client
%global branch11        dartman

%global forgeurl12      https://bitbucket.org/nielsenb/pdfocr
%global version12       0.3.0
%global commit12        4f5750d202d33267094621630836f1215a5efa66

%global forgeurl13      https://bitbucket.org/nielsenb/pdfocr
%global version13       0.1.4
%global tag13           v0.1.4
%global commit13        c0359843a3420769940e12019ebd68891a053bd8

%global forgeurl14      https://bitbucket.org/creachadair/shell
%global commit14        3dcd505a7ca5845388111724cc2e094581e92cc6

%global forgeurl15      https://bitbucket.org/kirbyvisp/vdjpuzzle2/
%global branch15        js-edits
%global commit15        36a3850eb4a04c05e0f7e29e7d0c196f373eb672

%forgemeta -ia

Name:           testing
Release:        1%{?dist}
Summary:        A test package

URL:            %{forgeurl}
License:        Public domain

Source0:        %{forgesource0}
Source1:        %{forgesource1}
Source2:        %{forgesource2}
Source3:        %{forgesource3}
Source4:        %{forgesource4}
Source5:        %{forgesource5}
Source6:        %{forgesource6}
Source7:        %{forgesource7}
Source8:        %{forgesource8}
Source9:        %{forgesource9}
Source10:       %{forgesource10}
Source11:       %{forgesource11}
Source12:       %{forgesource12}
Source13:       %{forgesource13}
Source14:       %{forgesource14}
Source15:       %{forgesource15}

%description
A test package

%prep
%forgesetup -a

%build
exit 1

%install

%files
%doc
%<--

Merges: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/35
2018-10-20 12:26:43 +02:00
Jan Pazdziora e3e0ba6ab7 Add %_swidtagdir for directory for SWID tag files describing the installation.
Signed-off-by: Jan Pazdziora <jpazdziora@redhat.com>
2018-10-11 14:26:10 +02:00
Igor Gnatenko f4ecbd3f4c Merge #34 `switch to distprefix in forge macros, implement branch support, refactor the logic to be simpler to understand and maintain` 2018-10-06 17:15:47 +00:00
Igor Gnatenko e46fe6f663 Merge #33 `remove explicit linebreaks, recent rpm versions insert them by default` 2018-10-06 17:15:25 +00:00
Igor Gnatenko 7e278eadca Merge #32 `simplify gitlab processing thanks to https://gitlab.com/gitlab-org/gitlab-ce/issues/38830` 2018-10-06 17:14:55 +00:00
Miro Hrončok b852a706ad Make ambiguous python shebangs error
See https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
2018-09-10 18:26:02 +02:00
Nicolas Mailhot 2c2e13ee0e switch to distprefix, implement branch support, refactor the logic to be simpler to understand and maintain 2018-08-31 20:03:31 +02:00
Nicolas Mailhot ec13f91007 remove explicit linebreaks, recent rpm versions insert them by default 2018-08-31 12:24:10 +02:00
Nicolas Mailhot 31fa384924 simplify gitlab processing thanks to https://gitlab.com/gitlab-org/gitlab-ce/issues/38830 2018-08-31 11:21:57 +02:00
Kalev Lember 9278251531 Add aarch64 to ldc arches 2018-08-20 22:33:04 +02:00
Igor Gnatenko 357550f7ba
Enable --as-needed by default
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-08-15 07:00:14 +02:00
Jason ティビツ 4d49f071dd Merge #24 `allow overriding the computed date in forge's %{?dist} macro` 2018-07-31 22:11:59 +00:00
Miro Hrončok 973e5c7052 Mangle /bin shebangs to /usr/bin ones (#1581757) 2018-07-19 12:34:53 +02:00
David Hugh Malcolm 521c1a9dd5 buildflags.md: fix typo 2018-07-11 13:43:53 +00:00
Igor Gnatenko ce50624ff0
fix type from previous commit
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-07-10 16:45:19 +02:00
Igor Gnatenko 85e473f982
Add option to add -Wl,--as-needed into LDFLAGS
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-07-10 16:41:33 +02:00
Igor Gnatenko 68e4ff270c
rename _strict_symbol_defs_build to _ld_strict_symbol_defs
It says more where to look and what it is supposed to do.

Acked-by: Florian Festi <ffesti@redhat.com>
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-07-10 16:41:33 +02:00
Kalev Lember 9a15f27f34 Disable non-functional ppc64 support for ldc packages
Sadly, ldc ppc64 support has detoriated so much that it no longer works
with any current llvm version. I'll keep an eye on things and re-enable
it once it's fixed, but right now it's just broken and upstream is
suggesting to disable the support for now.

https://github.com/ldc-developers/ldc/issues/2356
2018-07-09 12:24:57 +02:00
Panu Matilainen a62764b8e8 - Fix kernel ABI related strings (Peter Oros, #26)
- Automatically trim changelog to two years (Zbigniew Jędrzejewski-Szmek, #22)
- Cosmetics cleanups (Zbigniew Jędrzejewski-Szmek, #22)
2018-06-26 13:44:59 +03:00
Panu Matilainen 4d324adc62 Merge #26 `Fix kernel ABI related scripts` 2018-06-26 10:40:37 +00:00
Panu Matilainen aa24434396 Merge #22 `Automatically trim changelog entries after 2 years` 2018-06-26 10:40:16 +00:00
Florian Weimer a5c98437e2 Build flags: Require SSE2 on i686 (#1592212) 2018-06-18 11:48:31 +02:00
Fabio Valentini 30ef72bedf
macros.forge: drop additional dot to match current Guidelines 2018-06-14 18:25:25 +02:00
Petr Oros 4e17da5386 Fix kernel ABI related scripts
find-provides.ksyms and find-requires.ksyms contain macros for
  generate external kernel module symbol dependency table.
  These scripts are broken in fedora for long time.
  Patch fix both and make it useable again.

  -Petr

Signed-off-by: Petr Oros <poros@redhat.com>
2018-06-04 08:44:43 +02:00
Miro Hrončok c7d6417a3b Add a possibility to opt-out form automagic Python bytecompilation
That is, outside of Python specific directories.

More at https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation
2018-05-28 14:26:20 +02:00
Fabio Valentini 22833277e6
supplying %date for %forge macros optional (backwards compatible) 2018-05-26 11:59:04 +02:00
Fabio Valentini 74b8dd05bb do not use modification time of tarball for computing %dist
Using the modification time of the snapshot tarball for computing dist is a bad idea, since it's different on different machines.

For example, the computed date during the `buildSRPMfromSCM` koji task is likely different from the local date when the package was prepared, and so package builds (especially EVRs and changelog entries) are not reproducible.

With this change, the snapshot date is not calculated magically, but the packager has to set "%global date YYYYMMDD" manually. I also adapted the documentation for the macro to reflect that change.

This is related to the following FPC issue: https://pagure.io/packaging-committee/issue/719
2018-05-10 17:11:47 +00:00
Peter Jones f7e8f73ead brp-mangle-shebangs: make it possible to use generated exclusion lists
This patch adds two additional rpm macros, __brp_mangle_shebangs_exclude_file
and __brp_mangle_shebangs_exclude_from_file, to specify files from which
to read the extended regexps used for excluding shebangs and target
files.

Additionally, this adds documentation in the macros file and
--help/--usage/-?/-h to brp-mangle-shebangs, so that it's possible to
actually discover what the intended behavior is without reading the
script itself.

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-05-02 14:38:46 -04:00
Florian Weimer f25f1b7627 Reflect -fasynchronous-unwind-tables GCC default on POWER (#1550914) 2018-05-02 11:55:12 +02:00
Florian Weimer 6b620c91fb Use plain -fcf-protection compiler flag, without -mcet (#1570823) 2018-05-02 11:39:39 +02:00
Peter Jones 60cf200c3c Add Requires: efi-srpm-macros for %{efi}
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-05-01 16:00:40 -04:00
Jason Tibbitts fdbb98bd99 Add %_metainfodir macro.
An intervening commit added a fix to %forgeautosetup, but the specfile
was not updated.  I indicated the fix in the %changelog.
2018-04-20 12:05:38 -05:00
Nicolas Mailhot e1493f294d fix patch application with autosetup (we have autosetup users now!) 2018-03-25 19:24:58 +02:00
Zbigniew Jędrzejewski-Szmek 8c5d5de24a Trim changelog entries older than two years
Inspired by http://gitweb.mageia.org/software/rpm/rpm-setup/tree/macros.in#n22
but changed to two years (3+ releases of Fedora).
2018-03-11 15:15:30 +01:00
Zbigniew Jędrzejewski-Szmek f843bf828a Drop Group tag and period from Summary 2018-03-11 14:52:54 +01:00
Jason Tibbitts b771d1efaf Update forge macros. 2018-03-05 10:22:04 -06:00
Nicolas Mailhot bea8f67f2c add another safety for people that write urls without protocols → quite a lot of indenting changes 2018-03-04 23:40:59 +01:00
Nicolas Mailhot 1073ba2a5a Handle more github quirks 2018-03-04 23:39:29 +01:00
Florian Weimer 8deb29e50a Make -fasynchronous-unwind-tables explicit on aarch64 (#1536431)
This reflects the default built into GCC.
2018-02-28 14:49:24 +01:00
Florian Weimer d5133f9acc Use -funwind-tables on POWER
Ideally, the GCC defaults should change as well, but let's put this into
redhat-rpm-config, too, similarly to -fasynchronous-unwind-tables.
2018-02-28 10:45:12 +01:00
Igor Gnatenko 71d7440127
ldconfig: make %ldconfig_post/%ldconfig_postun parameterized
If %ldconfig is not defined, then "%ldconfig_post/%ldconfig_postun foo"
will expand to " foo" which is breaking packages.

Also now it is possible to move %end into post/postun.

Reported-by: Terje Røsten <terjeros@phys.ntnu.no>
References: https://bugzilla.redhat.com/show_bug.cgi?id=1548331
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-25 07:11:46 +01:00
Florian Weimer 0448c23b73 Document the use of -Wl,z,lazy 2018-02-24 21:46:59 +01:00
Florian Weimer a4ec7ec768 Update release and changelog 2018-02-24 21:38:00 +01:00
Florian Weimer 509d4afbe4 Remove -z now from GCC specs file, now on command line (#1548397) 2018-02-24 21:37:06 +01:00
Florian Weimer 910c8585f3 Update release and changelog 2018-02-24 17:40:55 +01:00
Florian Weimer cd7779aeac First step of moving -z now to the gcc command line (#1548397) 2018-02-24 17:38:12 +01:00
Miro Hrončok 8f59b756ca Don't mangle shebangs with whitespace only changes (#1546993) 2018-02-22 11:12:28 +01:00
Igor Gnatenko 987e94f6ea
Move %end to %ldconfig_scriptlets
If people choose to use %ldconfig_post/%ldconfig_postun, let them to
deal with %end.

Reported-by: Harald Reindl <h.reindl@thelounge.net>
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1547838
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-22 07:58:50 +01:00
Igor Gnatenko 17746cb929
macros.ldconfig: %end section immediately
Some people tend to use comments in spec files which adds them into the
scriptlet and we don't want this.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-17 13:51:42 +01:00
Igor Gnatenko 40990bb864
brp-mangle-shebangs: add support for whitespaces in file names
Now it starts requiring bash instead of POSIX-compatible shell, but this
is not a problem since other scripts in here do same.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-15 10:03:34 +01:00
Miro Hrončok fb05a239d2
Allow to opt-out from shebang mangling for specific paths/shebangs
Introduces __brp_mangle_shebangs_exclude_from and __brp_mangle_shebangs_exclude

 * the first allows to explude specific paths from the mangling
 * the second allows to exlude specific shebangs

Both are used with `grep -E`. Similar escaping rules as in [1] apply.

[1] https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering
2018-02-15 08:47:54 +01:00
Igor Gnatenko 6bc9480501
buildflags.md: add missing quote
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-09 17:42:37 +01:00
Nicolas Mailhot f0c0098d58 Add bitbucket.org support to %forgemeta 2018-02-09 10:17:46 +01:00
Nicolas Mailhot c314c8a285 enhance slightly %forgemeta to help investigating when it is called in silent mode from another macro 2018-02-09 10:17:46 +01:00
Nicolas Mailhot c6cdde1b01 fix slight brokenness in %forgesetup error paths 2018-02-09 10:17:46 +01:00
Igor Gnatenko 51f1c66748
brp-mangle-shebangs: Simplify/Fix check for shebang starting with "/"
Reported-by: Jun Aruga <jaruga@redhat.com>
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1541057
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-08 10:38:45 +01:00
Igor Gnatenko 8444cee8f3
bump release
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-07 18:24:10 +01:00
Igor Gnatenko 35f7182912
brp-mangle-shebangs: fix mangling absolute paths in /.../env
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-07 18:23:28 +01:00
Igor Gnatenko d2cc76421f
chmod +x brp-ldconfig
Just for consistency.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-07 18:06:01 +01:00
Florian Weimer ddb845537c Fix typo 2018-02-05 14:40:59 +01:00
Florian Weimer fa08f0e5a1 Add RPM macros for compiler/linker flags 2018-02-04 18:00:40 +01:00
Igor Gnatenko 222670e2e7
Use newly available /usr/bin/grep
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-03 18:29:37 +01:00
Peter Robinson 07dea7d44f Use generic tuning for ARMv7 2018-01-31 09:34:18 +00:00
Jason Tibbitts 9ac5353554 Fix bad dependency on grep. 2018-01-30 20:23:24 -06:00
Miro Hrončok 00b0603754 Explicitly require stuff for brp-mangle-shebangs
Except what is in coreutils (already required)
2018-01-30 22:08:52 +01:00
Miro Hrončok 257a3a95c7 Add brp-mangle-shebangs 2018-01-30 13:31:25 +01:00
Igor Gnatenko 1591a6fbf8
Add macros.ldconfig
With https://fedoraproject.org/wiki/Changes/Removing_ldconfig_scriptlets
we try to remove ldconfig scriptlets, but it would make every package
look horrible with all those conditionals. So let's just wrap ldconfig
scriptlets into macro so it doesn't look that horrible and error-prone.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-30 08:23:10 +01:00
Igor Gnatenko 7a29d55964
typo: fix day of week
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-29 17:30:29 +01:00
Igor Gnatenko 12ace9bdb9 Create DSO symlinks automatically
If there are unpackaged symlinks, build will fail with unpackaged files.
People can %undefine __brp_ldconfig if they need to and they should make
sure that they call ldconfig themselves.

Right now, script doesn't guide packagers what to do, but it's not
prerequisite.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-29 16:41:52 +01:00
Florian Weimer 8d6c6d0761 Build flags: Disable -z defs again (#1535422) 2018-01-29 15:18:11 +01:00
Florian Weimer 1b296f01fc Build flags: Enable CET on i686, x86_64 (#1538725) 2018-01-29 15:18:11 +01:00
Florian Weimer 6e5a75d61e Build flags: Switch to generic tuning on i686 (#1538693)
This matches what the gcc package already does by default.
2018-01-25 16:22:54 +01:00
Florian Weimer a013956e4f Build flags: Mention -fplugin-arg-annobin-disable 2018-01-23 16:25:52 +01:00
Florian Weimer c873752b33 Build flags: Improve description of -z defs remedies 2018-01-23 11:42:25 +01:00
Florian Weimer 078af19261 Link with -z defs by default (#1535422) 2018-01-22 16:01:54 +01:00
Florian Weimer 75a53b7ea3 Make armhfp flags consistent with GCC defaults 2018-01-22 15:41:54 +01:00
Florian Weimer 72b1044620 Build flags: Consistently use x86_64 (Fedora architecture name) 2018-01-22 15:18:23 +01:00
Florian Weimer e43ce312b7 Make use of -fasynchronous-unwind-tables more explicit (#1536431) 2018-01-22 15:17:14 +01:00
Florian Weimer 5b96b31cac Fix typo in build flags documentation 2018-01-22 14:53:38 +01:00
Florian Weimer faa1ad44f7 Remove --param=ssp-buffer-size=4 from build flags
-fstack-protector-strong does not use frame size heuristics for
deciding which functions to instrument, so changing the parameter has
no effect.
2018-01-22 14:30:12 +01:00
Florian Weimer 0d162176e9 Document build flags 2018-01-22 14:28:15 +01:00
Panu Matilainen 3bf139f646 Document how to disable hardened and annotated build (#1211296) 2018-01-19 12:21:06 +02:00
Panu Matilainen a747e7fb51 Fix the inevitable embarrassing typo in 77, doh 2018-01-17 12:57:53 +02:00
Panu Matilainen c4646d791d Macroize build root policies for consistent disable/override ability
Add a separate macro for each brp we have, using standard naming
convention and conditionalize the usage in %__os_install_post.
Voilà, we have a standard way to disable (and also override) any brp
scripts from specs that need it and a common scheme for new brps
to follow.

Note that this is not supposed to change the existing behavior and
default build root policy invocations at all, any change in those
would be a thinko/typo/copy-paste error in this commit.
2018-01-17 12:29:44 +02:00
Florian Weimer 42f29f31df Add -fstack-clash-protection for supported architectures (#1515865)
Avoid it on architectures which have only generic GCC support (such as
armv7hl).
2018-01-17 10:14:56 +01:00
Florian Weimer 6c35c254c2 Add _GLIBCXX_ASSERTIONS to CFLAGS/CXXFLAGS (#1515858) 2018-01-17 10:14:18 +01:00
Igor Gnatenko 7ab7ab048c Remove Requires: cmake-rpm-macros
It doesn't belong to redhat-rpm-config which is about *srpm* buildtime..

This reverts commit ea5600c887.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-15 23:28:09 +01:00
Jason Tibbitts 7c4cd33085 Add macros.forge.
Add macros to simplify the packaging of forge-hosted projects.
* https://bugzilla.redhat.com/show_bug.cgi?id=1523779
* https://fedoraproject.org/wiki/Forge-hosted_projects_packaging_automation
2018-01-11 17:49:08 -06:00
Sergey Avseyev ebb7ec32a4 Add Requires: nim-srpm-macros for %nim_arches 2018-01-03 12:43:14 +02:00
Igor Gnatenko bbf2e891aa Require annobin only if gcc is installed
Since b5ea4b290b we started to require gcc
(because annobin requires gcc). Since annobin does work only with gcc,
we don't have to install it if user doesn't have it.

Reported-by: Dominick Grift <dac.override@gmail.com>
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-02 12:56:19 +01:00
Björn Esser ea5600c887
Add Requires: cmake-rpm-macros for CMake auto-{provides,requires} (#1498894) 2017-12-21 16:12:02 +01:00
Panu Matilainen b9d5eecd65 Update URL to current location at src.fedoraproject.org 2017-12-08 14:32:21 +02:00
Nick Clifton b5ea4b290b Enable binary annotations in compiler flags 2017-11-22 12:41:44 +01:00
Troy Dawson fb76fd5200 Remove Requires: fedora-rpm-macros
- fedora-rpm-macros only contains a file with just a comment
 - If the package ever gets content we can add it back
2017-10-26 07:00:37 -07:00
Igor Gnatenko 1e879960b4 fix typo in changelog
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-10-03 15:43:01 +02:00
Igor Gnatenko 6d23bc8dc0 bump version
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-07-31 14:45:19 +02:00
Igor Gnatenko 00e8557ba2 Move _debuginfo_subpackages and _debugsource_packages from rpm (RHBZ #1476735)
References: https://bugzilla.redhat.com/show_bug.cgi?id=1476735
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-07-31 14:45:08 +02:00
Igor Gnatenko f6596a4ca5 Define _include_gdx_index (RHBZ #1476722)
References: https://bugzilla.redhat.com/show_bug.cgi?id=1476722
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-07-31 14:43:55 +02:00
Robin Lee bc1c35fe61 Make %kernel_module_package actually honor %kmodtool_generate_buildreqs 2017-07-18 14:42:07 +02:00
Igor Gnatenko 2cb318efe9 Add Requires: rust-srpm-macros for %rust_arches
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-07-13 16:52:55 +02:00
Orion Poplawski 38d4bf84e7 Add Requires: openblas-srpm-macros for %openblas_arches 2017-03-15 15:03:00 -06:00
Dan Horák 4914809dca - set zEC12 as minimum architecture level for s390(x) (#1404991) 2017-02-02 12:26:14 +01:00
Jason Tibbitts 905b8bae64 Add macros.vpath from FPC ticket 655
https://fedorahosted.org/fpc/ticket/655
2016-12-15 13:05:41 -06:00
Adam Williamson 6dc72405b3 Revert #1393492 changes, they break far too many builds
Per fweimer: "Sorry, we need to revert the -Werror=implicit-*
bits.  There is no chance we can get this working in any
reasonable time frame, there is simply too much breakage."
2016-12-06 14:45:53 -08:00
Panu Matilainen 4edc01803a Actually bump version too. Sigh, again... 2016-11-30 13:52:35 +02:00
Panu Matilainen beb08c6bba Error on implicit function declaration and -return type for C (#1393492)
Add -Werror=implicit-function-declaration -Werror=implicit-int to
global cflags as per https://fedoraproject.org/wiki/Changes/Fedora26CFlags
2016-11-30 13:51:10 +02:00
Panu Matilainen 3081c4e7d5 Introduce macros for language specific compiler options
Introduce new language specific __global_fooflags for C, C++ and Fortran
This looks mildly strange and suspicious since because the global flags
get pulled in indirectly via %optflags (that doesn't change here but becomes
more obvious).

Depends on previous commit (8fe5b07871)
which was done separately to make the actual change (or lack of thereof)
stand out here.

This is not supposed to change any actual values for current usages,
so if it does it's a bug.

However there's a minor bonus involved for Fortran users who can now get
the correct FFLAGS/FCFLAGS for non-autoconf projects too by using
__global_fflags/fcflags
2016-11-30 13:41:57 +02:00
Panu Matilainen 8fe5b07871 Rename __global_cflags to __global_compiler_flags
Preparing for language specific compiler flag macros, this is
simply:

    perl -pi -e "s:__global_cflags:__global_compiler_flags:g" macros rpmrc

Since this looks like a much bigger change than it actually is, doing
it in a separate step without an associated build.
2016-11-30 13:37:12 +02:00
Panu Matilainen 5815b8dba9 Argh, remember to bump version too 2016-11-29 10:20:53 +02:00
Panu Matilainen c6dadedc03 Drop atom optimization on i686 (#1393492)
Implements the first half of:
https://fedoraproject.org/wiki/Changes/Fedora26CFlags
2016-11-29 10:19:51 +02:00
Dan Horák af1538f1bd - set z10 as minimum architecture level for s390(x) 2016-11-15 11:17:07 +01:00
Panu Matilainen d95e9bc7b6 Fix directory name mismatch in kernel_source macro (#648996)
Patch from  Jacob Keller.
2016-11-11 09:34:23 +02:00
Panu Matilainen cf7406787b Add default compiler flags for various MIPS architectures (#1366735) 2016-11-08 16:42:14 +02:00
Panu Matilainen b1a45b244e -pie is incompatible with static linkage (#1343892, #1287743)
The hardened gcc specs do not handle static linkage, so building
with -static has been broken since commit
d9235d2d90. Adjust the -ld spec
file to avoid -pie when static linkage is used, as suggested
by Florian Weimer.
2016-11-08 15:21:31 +02:00
Panu Matilainen 3234495f75 Drop unwanted + unused brp-* scripts
If java people say brp-java-repack-jars is not needed then it
probably isn't (#1235770). brp-implant-ident-static hasn't been enabled
in 13+ years, I THINK it's safe to say its not critically needed.

Leaving the actual scripts in the repo for now (amusement for
archeologists of future generations, eh?)
2016-11-07 16:14:38 +02:00
Lubomir Rintel 08a5bbb161 Add valgrind_arches macro for BuildRequires of valgrind (#1334599) 2016-11-07 15:50:01 +02:00
Stephen Gallagher 4fdceaa4c5 Add s390x build target for Node.js packages (#1391999) 2016-11-07 15:30:35 +02:00
Kalev Lember e9cc9d94a3 Add ldc_arches macro 2016-10-30 18:08:19 +01:00
Jason Tibbitts 9a4753b3e4 Remove hardcoded limit of 16 CPUs for make -j
There was a hardcoded limit of 16 on the value passed to make -j.  This
has been removed.  See
https://bugzilla.redhat.com/show_bug.cgi?id=1384938
2016-10-17 13:47:22 -05:00
Richard W.M. Jones c602b415e0 Update config.guess, config.sub to the latest versions from upstream.
These support the riscv64 architecture.
2016-10-13 16:28:32 +01:00
Richard W.M. Jones b159548b73 riscv64: Add riscv64 + global_cflags to our rpmrc. 2016-10-13 15:15:31 +01:00
Peter Robinson 47427a213e Enable aarch64 for mono arches 2016-10-12 12:44:52 +01:00
Jason Tibbitts c0b2fd19e0 Add .gitignore file. 2016-10-03 17:03:08 -05:00
Jason Tibbitts 7359cf0b80 And add a more descriptive comment. 2016-10-03 16:06:03 -05:00
Jason Tibbitts d3c4ff3299 Leave the macro undefined instead of defining to 0. 2016-10-03 14:30:19 -05:00
Jason Tibbitts a0145ecd2f Add %_configure_disable_silent_rules
Adds %_configure_disable_silent_rules, defaulting to 0, to optionally
enable the passing of --disable-silent-rules to configure scripts.
2016-10-03 12:55:00 -05:00
Jason Tibbitts 4824deaead Add dependency on qt5-srpm-macros. 2016-09-14 08:44:10 -05:00
Jason Tibbitts a5fc6e4b82 Well that was dumb; depend on the correct package. 2016-08-12 19:00:43 -05:00
Jason Tibbitts 704d7c0546 Add fedora-rpm-macros dep. 2016-08-12 18:42:36 -05:00
Jason Tibbitts 8e03aee432 Merge branch 'master' of ssh://pkgs.fedoraproject.org/rpms/redhat-rpm-config 2016-08-11 17:19:15 -05:00
Petr Písař e5530da0dc Mandatory Perl build-requires added <https://fedoraproject.org/wiki/Changes/Build_Root_Without_Perl> 2016-06-24 09:40:22 +02:00
Jason Tibbitts 818514ea62 Fix some trailing whitespace. 2016-04-12 19:45:59 -05:00
Jason Tibbitts 77e91e6469 Add fpc-srpm-macros dep. 2016-04-12 11:08:38 -05:00
30 changed files with 2461 additions and 406 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.noarch.rpm
*.src.rpm
results_redhat-rpm-config/
.build-*.log

13
brp-ldconfig Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh -efu
# Force creating of DSO symlinks.
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
# 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.

158
brp-mangle-shebangs Executable file
View File

@ -0,0 +1,158 @@
#!/bin/bash -eu
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
exclude_files=""
exclude_files_from=""
exclude_shebangs=""
exclude_shebangs_from=""
usage() {
local verbose=$1 && shift
local outfile=$1 && shift
local status=$1 && shift
(
echo 'usage: brp-mangle-shebangs [--files <regexp>] [--files-from <file>] [--shebangs <regexp>] [--shebangs-from <file>]'
if [ "${verbose}" == "yes" ]; then
echo ' --files: extended regexp of files to ignore'
echo ' --files-from: file containing a list of extended regexps of files to ignore'
echo ' --shebangs: extended regexp of shebangs to ignore'
echo ' --shebangs-from: file containing a list of extended regexps of shebangs to ignore'
fi
) >>${outfile}
exit ${status}
}
while [ $# -gt 0 ] ; do
case "$1" in
--files)
exclude_files="${2}"
shift
;;
--files=*)
exclude_files="${1##--files=}"
;;
--files-from)
exclude_files_from="${2}"
shift
;;
--files-from=*)
exclude_files_from="${1##--files-from=}"
;;
--shebangs)
exclude_shebangs="${2}"
shift
;;
--shebangs=*)
exclude_shebangs="${1##--shebangs=}"
;;
--shebangs-from)
exclude_shebangs_from="${2}"
shift
;;
--shebangs-from=*)
exclude_shebangs_from="${1##--shebangs-from=}"
;;
--help|--usage|"-?"|-h)
usage yes /dev/stdout 0
;;
*)
echo "Unknown option \"${1}\"" 1>&2
usage no /dev/stderr 1
;;
esac
shift
done
cd "$RPM_BUILD_ROOT"
# Large packages such as kernel can have thousands of executable files.
# We take care to not fork/exec thousands of "file"s and "grep"s,
# but run just two of them.
# (Take care to exclude filenames which would mangle "file" output).
find -executable -type f ! -path '*:*' ! -path $'*\n*' \
| file -N --mime-type -f - \
| grep -P ".+(?=: text/)" \
| {
fail=0
while IFS= read -r line; do
f=${line%%:*}
# Remove the dot
path="${f#.}"
if [ -n "$exclude_files" ]; then
echo "$path" | grep -q -E "$exclude_files" && continue
fi
if [ -n "$exclude_files_from" ]; then
echo "$path" | grep -q -E -f "$exclude_files_from" && continue
fi
read shebang_line < "$f"
orig_shebang="${shebang_line#\#!}"
if [ "$orig_shebang" = "$shebang_line" ]; then
echo >&2 "*** WARNING: $f is executable but has no shebang, removing executable bit"
ts=$(stat -c %y "$f")
chmod -x "$f"
touch -d "$ts" "$f"
continue
fi
# Trim spaces
while shebang="${orig_shebang// / }"; [ "$shebang" != "$orig_shebang" ]; do
orig_shebang="$shebang"
done
# Treat "#! /path/to " as "#!/path/to"
orig_shebang="${orig_shebang# }"
shebang="$orig_shebang"
if [ -z "$shebang" ]; then
echo >&2 "*** WARNING: $f is executable but has empty shebang, removing executable bit"
ts=$(stat -c %y "$f")
chmod -x "$f"
touch -d "$ts" "$f"
continue
fi
if [ -n "${shebang##/*}" ]; then
echo >&2 "*** ERROR: $f has shebang which doesn't start with '/' ($shebang)"
fail=1
continue
fi
if ! { echo "$shebang" | grep -q -P "^/(?:usr/)?(?:bin|sbin)/"; }; then
continue
fi
# Replace "special" env shebang:
# /whatsoever/env /whatever/foo → /whatever/foo
shebang=$(echo "$shebang" | sed -r -e 's@^(.+)/env /(.+)$@/\2@')
# /whatsoever/env foo → /whatsoever/foo
shebang=$(echo "$shebang" | sed -r -e 's@^(.+/)env (.+)$@\1\2@')
# If the shebang now starts with /bin, change it to /usr/bin
# https://bugzilla.redhat.com/show_bug.cgi?id=1581757
shebang=$(echo "$shebang" | sed -r -e 's@^/bin/@/usr/bin/@')
# Replace ambiguous python with python2
py_shebang=$(echo "$shebang" | sed -r -e 's@/usr/bin/python(\s|$)@/usr/bin/python2\1@')
if [ "$shebang" != "$py_shebang" ]; then
echo >&2 "*** ERROR: ambiguous python shebang in $path: #!$orig_shebang. Change it to python3 (or python2) explicitly."
fail=1
elif [ "#!$shebang" != "#!$orig_shebang" ]; then
echo "mangling shebang in $path from $orig_shebang to #!$shebang"
ts=$(stat -c %y "$f")
sed -i -e "1c #!$shebang" "$f"
touch -d "$ts" "$f"
fi
done
exit $fail
}

144
brp-python-bytecompile Executable file
View File

@ -0,0 +1,144 @@
#!/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

17
brp-strip-lto Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/sh
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
STRIP=${1:-strip}
NCPUS=${RPM_BUILD_NCPUS:-1}
case `uname -a` in
Darwin*) exit 0 ;;
*) ;;
esac
# Strip ELF binaries
find "$RPM_BUILD_ROOT" -type f -name '*.[ao]' \! -regex "$RPM_BUILD_ROOT/*usr/lib/debug.*" -print0 | \
eu-elfclassify --not-program --not-library --not-linux-kernel-module --stdin0 --print0 | xargs -0 -r -P$NCPUS -n32 sh -c "$STRIP -p -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 \"\$@\"" ARG0

390
buildflags.md Normal file
View File

@ -0,0 +1,390 @@
This document contains documentation of the individual compiler flags
and how to use them.
[TOC]
# Using RPM build flags
For packages which use autoconf to set up the build environment, use
the `%configure` macro to obtain the full complement of flags, like
this:
%configure
This will invoke the `./configure` with arguments (such as
`--prefix=/usr`) to adjust the paths to the packaging defaults.
As a side effect, this will set the environment variables `CFLAGS`,
`CXXFLAGS`, `FFLAGS`, `FCFLAGS`, `LDFLAGS` and `LT_SYS_LIBRARY_PATH`,
so they can be used by makefiles and other build tools. (However,
existing values for these variables are not overwritten.)
If your package does not use autoconf, you can still set the same
environment variables using
%set_build_flags
early in the `%build` section. (Again, existing environment variables
are not overwritten.)
Individual build flags are also available through RPM macros:
* `%{build_cflags}` for the C compiler flags (also known as the
`CFLAGS` variable). Also historically available as `%{optflags}`.
Furthermore, at the start of the `%build` section, the environment
variable `RPM_OPT_FLAGS` is set to this value.
* `%{build_cxxflags}` for the C++ compiler flags (usually assigned to
the `CXXFLAGS` shell variable).
* `%{build_fflags} for `FFLAGS` (the Fortran compiler flags, also
known as the `FCFLAGS` variable).
* `%{build_ldflags}` for the link editor (ld) flags, usually known as
`LDFLAGS`. Note that the contents quotes linker arguments using
`-Wl`, so this variable is intended for use with the `gcc` compiler
driver. At the start of the `%build` section, the environment
variable `RPM_LD_FLAGS` is set to this value.
The variable `LT_SYS_LIBRARY_PATH` is defined here to prevent the `libtool`
script (v2.4.6+) from hardcoding %_libdir into the binaries' RPATH.
These RPM macros do not alter shell environment variables.
For some other build tools separate mechanisms exist:
* CMake builds use the the `%cmake` macro from the `cmake-rpm-macros`
package.
Care must be taking not to compile the current selection of compiler
flags into any RPM package besides `redhat-rpm-config`, so that flag
changes are picked up automatically once `redhat-rpm-config` is
updated.
# Flag selection for the build type
The default flags are suitable for building applications.
For building shared objects, you must compile with `-fPIC` in
(`CFLAGS` or `CXXFLAGS`) and link with `-shared` (in `LDFLAGS`).
For other considerations involving shared objects, see:
* [Fedora Packaging Guidelines: Shared Libraries](https://docs.fedoraproject.org/en-US/packaging-guidelines/#_shared_libraries)
# Customizing compiler flags
It is possible to set RPM macros to change some aspects of the
compiler flags. Changing these flags should be used as a last
recourse if other workarounds are not available.
### Lazy binding
If your package depends on the semantics of lazy binding (e.g., it has
plugins which load additional plugins to complete their dependencies,
before which some referenced functions are undefined), you should put
`-Wl,-z,lazy` at the end of the `LDFLAGS` setting when linking objects
which have such requirements. Under these circumstances, it is
unnecessary to disable hardened builds (and thus lose full ASLR for
executables), or link everything without `-Wl,z,now` (non-lazy
binding).
### Hardened builds
By default, the build flags enable fully hardened builds. To change
this, include this in the RPM spec file:
%undefine _hardened_build
This turns off certain hardening features, as described in detail
below. The main difference is that executables will be
position-dependent (no full ASLR) and use lazy binding.
### Annotated builds/watermarking
By default, the build flags cause a special output section to be
included in ELF files which describes certain aspects of the build.
To change this for all compiler invocations, include this in the RPM
spec file:
%undefine _annotated_build
Be warned that this turns off watermarking, making it impossible to do
full hardening coverage analysis for any binaries produced.
It is possible to disable annotations for individual compiler
invocations, using the `-fplugin-arg-annobin-disable` flag. However,
the annobin plugin must still be loaded for this flag to be
recognized, so it has to come after the hardening flags on the command
line (it has to be added at the end of `CFLAGS`, or specified after
the `CFLAGS` variable contents).
### Strict symbol checks in the link editor (ld)
Optionally, the link editor will refuse to link shared objects which
contain undefined symbols. Such symbols lack symbol versioning
information and can be bound to the wrong (compatibility) symbol
version at run time, and not the actual (default) symbol version which
would have been used if the symbol definition had been available at
static link time. Furthermore, at run time, the dynamic linker will
not have complete dependency information (in the form of DT_NEEDED
entries), which can lead to errors (crashes) if IFUNC resolvers are
executed before the shared object containing them is fully relocated.
To switch on these checks, define this macro in the RPM spec file:
%define _strict_symbol_defs_build 1
If this RPM spec option is active, link failures will occur if the
linker command line does not list all shared objects which are needed.
In this case, you need to add the missing DSOs (with linker arguments
such as `-lm`). As a result, the link editor will also generated the
necessary DT_NEEDED entries.
In some cases (such as when a DSO is loaded as a plugin and is
expected to bind to symbols in the main executable), undefined symbols
are expected. In this case, you can add
%undefine _strict_symbol_defs_build
to the RPM spec file to disable these strict checks. Alternatively,
you can pass `-z undefs` to ld (written as `-Wl,-z,undefs` on the gcc
command line). The latter needs binutils 2.29.1-12.fc28 or later.
### Legacy -fcommon
Since version 10, [gcc defaults to `-fno-common`](https://gcc.gnu.org/gcc-10/porting_to.html#common).
Builds may fail with `multiple definition of ...` errors.
As a short term workaround for such failure,
it is possible to add `-fcommon` to the flags by defining `%_legacy_common_support`.
%define _legacy_common_support 1
Properly fixing the failure is always preferred!
# Individual compiler flags
Compiler flags end up in the environment variables `CFLAGS`,
`CXXFLAGS`, `FFLAGS`, and `FCFLAGS`.
The general (architecture-independent) build flags are:
* `-O2`: Turn on various GCC optimizations. See the [GCC manual](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-O2).
Optimization improves performance, the accuracy of warnings, and the
reach of toolchain-based hardening, but it makes debugging harder.
* `-g`: Generate debugging information (DWARF). In Fedora, this data
is separated into `-debuginfo` RPM packages whose installation is
optional, so debuging information does not increase the size of
installed binaries by default.
* `-pipe`: Run compiler and assembler in parallel and do not use a
temporary file for the assembler input. This can improve
compilation performance. (This does not affect code generation.)
* `-Wall`: Turn on various GCC warnings.
See the [GCC manual](https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wall).
* `-Werror=format-security`: Turn on format string warnings and treat
them as errors.
See the [GCC manual](https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wformat-security).
This can occasionally result in compilation errors. In this case,
the best option is to rewrite the source code so that only constant
format strings (string literals) are used.
* `-Wp,-D_FORTIFY_SOURCE=2`: Source fortification activates various
hardening features in glibc:
* String functions such as `memcpy` attempt to detect buffer lengths
and terminate the process if a buffer overflow is detected.
* `printf` format strings may only contain the `%n` format specifier
if the format string resides in read-only memory.
* `open` and `openat` flags are checked for consistency with the
presence of a *mode* argument.
* Plus other minor hardening changes.
(These changes can occasionally break valid programs.)
* `-fexceptions`: Provide exception unwinding support for C programs.
See the [`-fexceptions` option in the GCC
manual](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fexceptions)
and the [`cleanup` variable
attribute](https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-cleanup-variable-attribute).
This also hardens cancellation handling in C programs because
it is not required to use an on-stack jump buffer to install
a cancellation handler with `pthread_cleanup_push`. It also makes
it possible to unwind the stack (using C++ `throw` or Rust panics)
from C callback functions if a C library supports non-local exits
from them (e.g., via `longjmp`).
* `-Wp,-D_GLIBCXX_ASSERTIONS`: Enable lightweight assertions in the
C++ standard library, such as bounds checking for the subscription
operator on vectors. (This flag is added to both `CFLAGS` and
`CXXFLAGS`; C compilations will simply ignore it.)
* `-fstack-protector-strong`: Instrument functions to detect
stack-based buffer overflows before jumping to the return address on
the stack. The *strong* variant only performs the instrumentation
for functions whose stack frame contains addressable local
variables. (If the address of a variable is never taken, it is not
possible that a buffer overflow is caused by incorrect pointer
arithmetic involving a pointer to that variable.)
* `-grecord-gcc-switches`: Include select GCC command line switches in
the DWARF debugging information. This is useful for detecting the
presence of certain build flags and general hardening coverage.
For hardened builds (which are enabled by default, see above for how
to disable them), the flag
`-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1` is added to the
command line. It adds the following flag to the command line:
* `-fPIE`: Compile for a position-independent executable (PIE),
enabling full address space layout randomization (ASLR). This is
similar to `-fPIC`, but avoids run-time indirections on certain
architectures, resulting in improved performance and slightly
smaller executables. However, compared to position-dependent code
(the default generated by GCC), there is still a measurable
performance impact.
If the command line also contains `-r` (producing a relocatable
object file), `-fpic` or `-fPIC`, this flag is automatically
dropped. (`-fPIE` can only be used for code which is linked into
the main program.) Code which goes into static libraries should be
compiled with `-fPIE`, except when this code is expected to be
linked into DSOs, when `-fPIC` must be used.
To be effective, `-fPIE` must be used with the `-pie` linker flag
when producing an executable, see below.
To support [binary watermarks for ELF
objects](https://fedoraproject.org/wiki/Toolchain/Watermark) using
annobin, the `-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1` flag is
added by default. This can be switched off by undefining the
`%_annotated_build` RPM macro (see above).
### Architecture-specific compiler flags
These compiler flags are enabled for all builds (hardened/annotated or
not), but their selection depends on the architecture:
* `-fstack-clash-protection`: Turn on instrumentation to avoid
skipping the guard page in large stack frames. (Without this flag,
vulnerabilities can result where the stack overlaps with the heap,
or thread stacks spill into other regions of memory.) This flag is
fully ABI-compatible and has adds very little run-time overhead, but
is only available on certain architectures (currently aarch64, i386,
ppc64, ppc64le, s390x, x86_64).
* `-fcf-protection`: Instrument binaries to guard against
ROP/JOP attacks. Used on i686 and x86_64.
* `-m64` and `-m32`: Some GCC builds support both 32-bit and 64-bit in
the same compilation. For such architectures, the RPM build process
explicitly selects the architecture variant by passing this compiler
flag.
* `-fasynchronous-unwind-tables`: Generate full unwind information
covering all program points. This is required for support of
asynchronous cancellation and proper unwinding from signal
handlers. It also makes performance and debugging tools more
useful because unwind information is available without having to
install (and load) debugging ienformation.
Asynchronous unwind tables are enabled for aarch64, i686, ppc64,
ppc64le, s390x, and x86_64. They are not needed on armhfp due to
architectural differences in stack management. On these
architectures, `-fexceptions` (see above) still enables regular
unwind tables (or they are enabled by default even without this
option).
In addition, `redhat-rpm-config` re-selects the built-in default
tuning in the `gcc` package. These settings are:
* **armhfp**: `-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard`
selects an Arm subarchitecture based on the ARMv7-A architecture
with 16 64-bit floating point registers. `-mtune=cortex-8a` selects
tuning for the Cortex-A8 implementation (while preserving compatibility
with other ARMv7-A implementations). `-mabi=aapcs-linux` switches to
the AAPCS ABI for GNU/Linux.
* **i686**: `-march=i686` is used to select a minmum support CPU level
of i686 (corresponding to the Pentium Pro). SSE2 support is
enabled with `-msse2` (so only CPUs with SSE2 support can run the
compiled code; SSE2 was introduced first with the Pentium 4).
`-mtune=generic` activates tuning for a current blend of CPUs
(under the assumption that most users of i686 packages obtain them
through an x86_64 installation on current hardware).
`-mfpmath=sse` instructs GCC to use the SSE2 unit for floating
point math to avoid excess precision issues. `-mstackrealign`
avoids relying on the stack alignment guaranteed by the current
version of the i386 ABI.
* **ppc64le**: `-mcpu=power8 -mtune=power8` selects a minimum supported
CPU level of POWER8 (the first CPU with ppc64le support) and tunes
for POWER8.
* **s390x**: `-march=zEC12 -mtune=z13` specifies a minimum supported CPU
level of zEC12, while optimizing for a subsequent CPU generation
(z13).
* **x86_64**: `-mtune=generic` selects tuning which is expected to
beneficial for a broad range of current CPUs.
* **ppc64** and **aarch64** do not have any architecture-specific tuning.
# Individual linker flags
Linker flags end up in the environment variable `LDFLAGS`.
The linker flags listed below are injected. Note that they are
prefixed with `-Wl` because it is expected that these flags are passed
to the compiler driver `gcc`, and not directly to the link editor
`ld`.
* `-z relro`: Activate the *read-only after relocation* feature.
Constant data and relocations are placed on separate pages, and the
dynamic linker is instructed to revoke write permissions after
dynamic linking. Full protection of relocation data requires the
`-z now` flag (see below).
* `-z defs`: Refuse to link shared objects (DSOs) with undefined symbols
(optional, see above).
For hardened builds, the
`-specs=/usr/lib/rpm/redhat/redhat-hardened-ld` flag is added to the
compiler driver command line. (This can be disabled by undefining the
`%_hardened_build` macro; see above) This activates the following
linker flags:
* `-pie`: Produce a PIE binary. This is only activated for the main
executable, and only if it is dynamically linked. This requires
that all objects which are linked in the main executable have been
compiled with `-fPIE` or `-fPIC` (or `-fpie` or `-fpic`; see above).
By itself, `-pie` has only a slight performance impact because it
disables some link editor optimization, however the `-fPIE` compiler
flag has some overhead.
* `-z now`: Disable lazy binding and turn on the `BIND_NOW` dynamic
linker feature. Lazy binding involves an array of function pointers
which is writable at run time (which could be overwritten as part of
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.

197
common.lua Normal file
View File

@ -0,0 +1,197 @@
-- Convenience Lua functions that can be used within rpm macros
-- Set a spec variable
-- Echo the result if verbose
local function explicitset(rpmvar, value, verbose)
local value = value
if (value == nil) or (value == "") then
value = "%{nil}"
end
rpm.define(rpmvar .. " " .. value)
if verbose then
rpm.expand("%{echo:Setting %%{" .. rpmvar .. "} = " .. value .. "}")
end
end
-- Unset a spec variable if it is defined
-- Echo the result if verbose
local function explicitunset(rpmvar, verbose)
if (rpm.expand("%{" .. rpmvar .. "}") ~= "%{" .. rpmvar .. "}") then
rpm.define(rpmvar .. " %{nil}")
if verbose then
rpm.expand("%{echo:Unsetting %%{" .. rpmvar .. "}}")
end
end
end
-- Set a spec variable, if not already set
-- Echo the result if verbose
local function safeset(rpmvar, value, verbose)
if (rpm.expand("%{" .. rpmvar .. "}") == "%{" .. rpmvar .. "}") then
explicitset(rpmvar,value,verbose)
end
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)
for _, sfx in ipairs({{"","0"},{"0",""}}) do
for _, rpmvar in ipairs(rpmvars) do
local toalias = "%{?" .. rpmvar .. sfx[1] .. "}"
if (rpm.expand(toalias) ~= "") then
safeset(rpmvar .. sfx[2], toalias, verbose)
end
end
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
rpmvar = rpmvar .. suffix
local header = string.sub(" " .. rpmvar .. ": ",1,21)
rpm.expand("%{?" .. rpmvar .. ":%{echo:" .. header .. "%{?" .. rpmvar .. "}}}")
end
end
-- Returns an array, indexed by suffix, containing the non-empy values of
-- <rpmvar><suffix>, with suffix an integer string or the empty string
local function getsuffixed(rpmvar)
local suffixes = {}
zalias({rpmvar})
for suffix=0,9999 do
local value = rpm.expand("%{?" .. rpmvar .. suffix .. "}")
if (value ~= "") then
suffixes[tostring(suffix)] = value
end
end
-- rpm convention is to alias no suffix to zero suffix
-- only add no suffix if zero suffix is different
local value = rpm.expand("%{?" .. rpmvar .. "}")
if (value ~= "") and (value ~= suffixes["0"]) then
suffixes[""] = value
end
return suffixes
end
-- Returns the list of suffixes, including the empty string, for which
-- <rpmvar><suffix> is set to a non empty value
local function getsuffixes(rpmvar)
suffixes = {}
for suffix in pairs(getsuffixed(rpmvar)) do
table.insert(suffixes,suffix)
end
table.sort(suffixes,
function(a,b) return (tonumber(a) or 0) < (tonumber(b) or 0) end)
return suffixes
end
-- Returns the suffix for which <rpmvar><suffix> has a non-empty value that
-- matches best the beginning of the value string
local function getbestsuffix(rpmvar, value)
local best = nil
local currentmatch = ""
for suffix, setvalue in pairs(getsuffixed(rpmvar)) do
if (string.len(setvalue) > string.len(currentmatch)) and
(string.find(value, "^" .. setvalue)) then
currentmatch = setvalue
best = suffix
end
end
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
-- https://github.com/rpm-software-management/rpm/issues/566
-- Reformat a text intended to be used used in a package description, removing
-- rpm macro generation artefacts.
-- remove leading and ending empty lines
-- trim intermediary empty lines to a single line
-- fold on spaces
-- Should really be a %%{wordwrap:…} verb
local function wordwrap(text)
text = rpm.expand(text .. "\n")
text = string.gsub(text, "\t", " ")
text = string.gsub(text, "\r", "\n")
text = string.gsub(text, " +\n", "\n")
text = string.gsub(text, "\n+\n", "\n\n")
text = string.gsub(text, "^\n", "")
text = string.gsub(text, "\n( *)[-*—][  ]+", "\n%1 ")
output = ""
for line in string.gmatch(text, "[^\n]*\n") do
local pos = 0
local advance = ""
for word in string.gmatch(line, "%s*[^%s]*\n?") do
local wl, bad = utf8.len(word)
if not wl then
print("%{warn: Invalid UTF-8 sequence detected in:\n" ..
word .. "\nIt may produce unexpected results.\n}")
wl = bad
end
if (pos == 0) then
advance, n = string.gsub(word, "^(%s* ).*", "%1")
if (n == 0) then
advance = string.gsub(word, "^(%s*).*", "%1")
end
advance = string.gsub(advance, " ", " ")
pos = pos + wl
elseif (pos + wl < 81) or
((pos + wl == 81) and string.match(word, "\n$")) then
pos = pos + wl
else
word = advance .. string.gsub(word, "^%s*", "")
output = output .. "\n"
pos = utf8.len(word)
end
output = output .. word
if pos > 80 then
pos = 0
if not string.match(word, "\n$") then
output = output .. "\n"
end
end
end
end
output = string.gsub(output, "\n*$", "\n")
return output
end
return {
explicitset = explicitset,
explicitunset = explicitunset,
safeset = safeset,
zalias = zalias,
setcurrent = setcurrent,
echovars = echovars,
getsuffixed = getsuffixed,
getsuffixes = getsuffixes,
getbestsuffix = getbestsuffix,
writevars = writevars,
wordwrap = wordwrap,
}

354
config.guess vendored
View File

@ -1,8 +1,8 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2013 Free Software Foundation, Inc.
# Copyright 1992-2016 Free Software Foundation, Inc.
timestamp='2013-06-10'
timestamp='2016-10-02'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -24,12 +24,12 @@ timestamp='2013-06-10'
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# Originally written by Per Bothner.
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
#
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
# Please send patches to <config-patches@gnu.org>.
me=`echo "$0" | sed -e 's,.*/,,'`
@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2013 Free Software Foundation, Inc.
Copyright 1992-2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -149,7 +149,7 @@ Linux|GNU|GNU/*)
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
;;
esac
@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || \
echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
# to ELF recently (or will in the future) and ABI.
case "${UNAME_MACHINE_ARCH}" in
earm*)
os=netbsdelf
;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
os=netbsd
;;
esac
# Determine ABI tags.
case "${UNAME_MACHINE_ARCH}" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
echo "${machine}-${os}${release}${abi}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:Sortix:*:*)
echo ${UNAME_MACHINE}-unknown-sortix
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
UNAME_MACHINE=alpha ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
UNAME_MACHINE=alpha ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
UNAME_MACHINE=alphaev5 ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
UNAME_MACHINE=alphaev56 ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
UNAME_MACHINE=alphapca56 ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
UNAME_MACHINE=alphapca57 ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
UNAME_MACHINE=alphaev6 ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
UNAME_MACHINE=alphaev67 ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
UNAME_MACHINE=alphaev68 ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
UNAME_MACHINE=alphaev68 ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
UNAME_MACHINE=alphaev68 ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
UNAME_MACHINE=alphaev69 ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
UNAME_MACHINE=alphaev7 ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
UNAME_MACHINE=alphaev79 ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
SUN_ARCH=x86_64
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
@ -579,8 +603,9 @@ EOF
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
if [ -x /usr/bin/lslpp ] ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
@ -617,13 +642,13 @@ EOF
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
@ -662,11 +687,11 @@ EOF
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
(CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
if [ ${HP_ARCH} = hppa2.0w ]
then
eval $set_cc_for_build
@ -679,12 +704,12 @@ EOF
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
HP_ARCH=hppa2.0w
else
HP_ARCH="hppa64"
HP_ARCH=hppa64
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@ -789,14 +814,14 @@ EOF
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@ -826,7 +851,7 @@ EOF
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
@ -878,7 +903,7 @@ EOF
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
@ -901,7 +926,7 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
@ -932,6 +957,9 @@ EOF
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
e2k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
@ -944,6 +972,9 @@ EOF
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
k1om:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
@ -969,10 +1000,13 @@ EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
or1k:Linux:*:*)
mips64el:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:*)
openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
@ -1001,6 +1035,9 @@ EOF
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
riscv32:Linux:*:* | riscv64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
@ -1020,7 +1057,7 @@ EOF
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
@ -1099,7 +1136,7 @@ EOF
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
@ -1248,6 +1285,9 @@ EOF
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
SX-ACE:SUPER-UX:*:*)
echo sxace-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
@ -1260,22 +1300,32 @@ EOF
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
# that puts up a graphical alert prompting to install
# developer tools. Any system running Mac OS X 10.7 or
# later (Darwin 11 and later) is required to have a 64-bit
# processor. This is not true of the ARM version of Darwin
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
@ -1306,7 +1356,7 @@ EOF
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = "386"; then
if test "$cputype" = 386; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
@ -1348,7 +1398,7 @@ EOF
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
@ -1359,171 +1409,25 @@ EOF
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs
exit ;;
esac
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include <sys/param.h>
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 <<EOF
$0: unable to guess system type
This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
This script (version $timestamp), has failed to recognize the
operating system you are using. If your script is old, overwrite
config.guess and config.sub with the latest versions from:
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
provide the necessary information to handle your system.
config.guess timestamp = $timestamp

88
config.sub vendored
View File

@ -1,8 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2013 Free Software Foundation, Inc.
# Copyright 1992-2016 Free Software Foundation, Inc.
timestamp='2013-08-10'
timestamp='2016-09-05'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -25,7 +25,7 @@ timestamp='2013-08-10'
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
# Please send patches to <config-patches@gnu.org>.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@ -33,7 +33,7 @@ timestamp='2013-08-10'
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
@ -53,8 +53,7 @@ timestamp='2013-08-10'
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
$0 [OPTION] ALIAS
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright 1992-2013 Free Software Foundation, Inc.
Copyright 1992-2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -117,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | cloudabi*-eabi* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@ -255,16 +254,18 @@ case $basic_machine in
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| ba \
| be32 | be64 \
| bfin \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| e2k | epiphany \
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
@ -282,8 +283,10 @@ case $basic_machine in
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
@ -295,14 +298,14 @@ case $basic_machine in
| nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
| or1k | or32 \
| open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@ -310,6 +313,7 @@ case $basic_machine in
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
@ -324,7 +328,10 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@ -369,18 +376,20 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
@ -400,8 +409,10 @@ case $basic_machine in
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
@ -413,16 +424,18 @@ case $basic_machine in
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
@ -430,6 +443,7 @@ case $basic_machine in
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@ -506,6 +520,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-aros
;;
asmjs)
basic_machine=asmjs-unknown
;;
aux)
basic_machine=m68k-apple
os=-aux
@ -626,6 +643,14 @@ case $basic_machine in
basic_machine=m68k-bull
os=-sysv3
;;
e500v[12])
basic_machine=powerpc-unknown
os=$os"spe"
;;
e500v[12]-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
os=$os"spe"
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
@ -767,6 +792,9 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
@ -822,6 +850,10 @@ case $basic_machine in
basic_machine=powerpc-unknown
os=-morphos
;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos)
basic_machine=i386-pc
os=-msdos
@ -998,7 +1030,7 @@ case $basic_machine in
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
ppcle | powerpclittle)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
@ -1006,9 +1038,9 @@ case $basic_machine in
;;
ppc64) basic_machine=powerpc64-unknown
;;
ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
@ -1354,27 +1386,28 @@ case $os in
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* \
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
| -onefs* | -tirtos* | -phoenix*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@ -1506,6 +1539,8 @@ case $os in
;;
-nacl*)
;;
-ios)
;;
-none)
;;
*)
@ -1592,9 +1627,6 @@ case $basic_machine in
mips*-*)
os=-elf
;;
or1k-*)
os=-elf
;;
or32-*)
os=-coff
;;

View File

@ -1,9 +1,24 @@
#! /bin/sh
#! /bin/bash
IFS=$'\n'
for module in $(grep -E '/lib/modules/.+\.ko$'); do
nm $module \
| sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):ksym(\2) = \1:p'
done \
| sort -u
if [[ -n $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p') ]]; then
nm $module \
| sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
| awk --non-decimal-data '{printf("ksym(%s) = 0x%08x\n", $2, $1)}' \
| LC_ALL=C sort -u
else
ELFRODATA=$(readelf -R .rodata $module | awk '/0x/{printf $2$3$4$5}')
if [[ -n $(readelf -h $module | grep "little endian") ]]; then
RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g')
else
RODATA=$ELFRODATA
fi
for sym in $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do
echo $sym $RODATA
done \
| awk --non-decimal-data '{printf("ksym(%s) = 0x%08s\n", $2, substr($3,($1*2)+1,8))}' \
| LC_ALL=C sort -u
fi
done

View File

@ -2,19 +2,47 @@
IFS=$'\n'
# Extract all of the symbols provided by this module.
all_provides() {
nm "$@" \
| sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):\1\t\2:p' \
| sort -k2 -u
if [[ -n $(nm "$@" | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p') ]]; then
nm "$@" \
| sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
| awk --non-decimal-data '{printf("0x%08x\t%s\n", $1, $2)}' \
| LC_ALL=C sort -k2,2 -u
else
ELFRODATA=$(readelf -R .rodata "$@" | awk '/0x/{printf $2$3$4$5}')
if [[ -n $(readelf -h "$@" | grep "little endian") ]]; then
RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g')
else
RODATA=$ELFRODATA
fi
for sym in $(nm "$@" | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do
echo $sym $RODATA
done \
| awk --non-decimal-data '{printf("0x%08s\t%s\n", substr($3,($1*2)+1,8), $2)}' \
| LC_ALL=C sort -k2,2 -u
fi
}
# Extract all of the requirements of this module.
all_requires() {
for module in "$@"; do
set -- $(/sbin/modinfo -F vermagic "$module" | sed -e 's: .*::' -e q)
/sbin/modprobe --dump-modversions "$module" \
| sed -r -e 's:^0x0*::' -e 's:$:\t'"$1"':'
| awk --non-decimal-data '
BEGIN { FS = "\t" ; OFS = "\t" }
{printf("0x%08x\t%s\n", $1, $2)}' \
| sed -r -e 's:$:\t'"$1"':'
done \
| sort -k2 -u
| LC_ALL=C sort -k2,2 -u
}
# Filter out requirements fulfilled by the module itself.
mod_requires() {
LC_ALL=C join -t $'\t' -j 2 -v 1 \
<(all_requires "$@") \
<(all_provides "$@") \
| LC_ALL=C sort -k1,1 -u
}
if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then
@ -24,25 +52,23 @@ fi
modules=($(grep -E '/lib/modules/.+\.ko$'))
if [ ${#modules[@]} -gt 0 ]; then
symset_table=$(mktemp -t ${0##*/}.XXXXX)
/usr/lib/rpm/redhat/symset-table | sort > $symset_table
kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q)
join -t $'\t' -j 1 -a 2 $symset_table <(
# Filter out requirements that we fulfill ourself.
join -t $'\t' -j 2 -v 1 \
<(all_requires "${modules[@]}") \
<(all_provides "${modules[@]}") \
| awk '
# get all that kernel provides
symvers=$(mktemp -t ${0##*/}.XXXXX)
cat /usr/src/kernels/$kernel/Module.symvers | awk '
BEGIN { FS = "\t" ; OFS = "\t" }
{ print $3 "/" $2 "/" $1 }
' \
| sort -u) \
| sort -u \
| awk '
{ FS = "\t" ; OFS = "\t" }
NF == 3 { print "kernel(" $2 ") = " $3
next }
{ split($1, arr, "/")
print "ksym(" arr[3] ") = " arr[2] }
'
{ print $2 "\t" $1 }
' \
| sed -r -e 's:$:\t'"$kernel"':' \
| LC_ALL=C sort -k1,1 -u > $symvers
# Symbols matching with the kernel get a "kernel" dependency
LC_ALL=C join -t $'\t' -j 1 $symvers <(mod_requires "${modules[@]}") | LC_ALL=C sort -u \
| awk '{ FS = "\t" ; OFS = "\t" } { print "kernel(" $1 ") = " $2 }'
# Symbols from elsewhere get a "ksym" dependency
LC_ALL=C join -t $'\t' -j 1 -v 2 $symvers <(mod_requires "${modules[@]}") | LC_ALL=C sort -u \
| awk '{ FS = "\t" ; OFS = "\t" } { print "ksym(" $1 ") = " $2 }'
fi

299
forge.lua Normal file
View File

@ -0,0 +1,299 @@
-- Lua code used by macros.forge and derivatives
-- Computes the suffix of a version string, removing vprefix if it matches
-- For example with vprefix 1.2.3: 1.2.3.rc2 → .rc2 but 1.2.30 → 1.2.30 not 0
local function getversionsuffix(vstring,vprefix)
if (string.sub(vstring, 1, #vprefix) == vprefix) and
(not string.match(string.sub(vstring, #vprefix + 1), "^%.?%d")) then
return string.sub(vstring, #vprefix + 1)
else
return vstring
end
end
-- Check if an identified url is sane
local function checkforgeurl(url, id, silent)
local checkedurl = nil
local checkedid = nil
local urlpatterns = {
gitlab = {
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
description = 'https://(…[-.])gitlab[-.]…/owner/repo'},
pagure = {
pattern = 'https://[^/]+/[^/#?]+',
description = 'https://pagure.io/repo'},
pagure_ns = {
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
description = 'https://pagure.io/namespace/repo'},
pagure_fork = {
pattern = 'https://[^/]+/fork/[^/]+/[^/#?]+',
description = 'https://pagure.io/fork/owner/repo'},
pagure_ns_fork = {
pattern = 'https://[^/]+/fork/[^/]+/[^/]+/[^/#?]+',
description = 'https://pagure.io/fork/owner/namespace/repo'},
github = {
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
description = 'https://(…[-.])github[-.]…/owner/repo'},
["code.googlesource.com"] = {
pattern = 'https://code.googlesource.com/[^#?]*[^/#?]+',
description = 'https://code.googlesource.com/…/repo'},
["bitbucket.org"] = {
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
description = 'https://bitbucket.org/owner/repo'}}
if (urlpatterns[id] ~= nil) then
checkedurl = string.match(url,urlpatterns[id]["pattern"])
if (checkedurl == nil) then
if not silent then
rpm.expand("%{error:" .. id .. " URLs must match " .. urlpatterns[id]["description"] .. " !}")
end
else
checkedid = id
end
end
return checkedurl, checkedid
end
-- Check if an url matches a known forge
local function idforge(url, silent)
local forgeurl = nil
local forge = nil
if (url ~= "") then
forge = string.match(url, "^[^:]+://([^/]+)/")
if (forge == nil) then
if not silent then
rpm.expand("%{error:URLs must include a protocol such as https:// and a path starting with / !}")
end
else
if (forge == "pagure.io") then
if string.match(url, "[^:]+://pagure.io/fork/[^/]+/[^/]+/[^/]+") then
forge = "pagure_ns_fork"
elseif string.match(url, "[^:]+://pagure.io/fork/[^/]+/[^/]+") then
forge = "pagure_fork"
elseif string.match(url, "[^:]+://pagure.io/[^/]+/[^/]+") then
forge = "pagure_ns"
elseif string.match(url, "[^:]+://pagure.io/[^/]+") then
forge = "pagure"
end
elseif (string.match(forge, "^gitlab[%.-]") or string.match(forge, "[%.-]gitlab[%.]")) then
forge = "gitlab"
elseif (string.match(forge, "^github[%.-]") or string.match(forge, "[%.-]github[%.]")) then
forge = "github"
end
forgeurl, forge = checkforgeurl(url, forge, silent)
end
end
return forgeurl, forge
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 meta(suffix, verbose, informative, silent)
local fedora = require "fedora.common"
local ismain = (suffix == "") or (suffix == "0")
if ismain then
fedora.zalias({"forgeurl", "forgesource", "forgesetupargs",
"archivename", "archiveext", "archiveurl",
"topdir", "extractdir", "repo", "owner", "namespace",
"scm", "tag", "commit", "shortcommit", "branch", "version",
"date", "distprefix"}, verbose)
end
local variables = {
default = {
scm = "git",
archiveext = "tar.bz2",
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/[^/]+/([^/?#]+)"))}',
archivename = "%{repo" .. suffix .. "}-%{ref" .. suffix .. "}",
topdir = "%{archivename" .. suffix .. "}" },
gitlab = {
archiveurl = "%{forgeurl" .. suffix .. "}/-/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
pagure = {
archiveext = "tar.gz",
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/([^/?#]+)"))}',
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
pagure_ns = {
archiveext = "tar.gz",
namespace = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/([^/]+)/[^/?#]+"))}',
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/[^/]+/([^/?#]+)"))}',
archivename = "%{namespace" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}",
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
pagure_fork = {
archiveext = "tar.gz",
owner = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/([^/]+)/[^/?#]+"))}',
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/[^/]+/([^/?#]+)"))}',
archivename = "%{owner" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}",
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
pagure_ns_fork = {
owner = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/([^/]+)/[^/]+/[^/?#]+"))}',
namespace = '%{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 .. "}",
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
github = {
archiveext = "tar.gz",
archivename = "%{repo" .. suffix .. "}-%{fileref" .. suffix .. "}",
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
["code.googlesource.com"] = {
archiveext = "tar.gz",
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://.+/([^/?#]+)"))}',
archiveurl = "%{forgeurl" .. suffix .. "}/+archive/%{ref" .. suffix .. "}.%{archiveext" .. suffix .. "}",
topdir = "" },
["bitbucket.org"] = {
shortcommit = '%{lua:print(string.sub(rpm.expand("%{commit' .. suffix .. '}"), 1, 12))}',
owner = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/([^/?#]+)"))}',
archivename = "%{owner" .. suffix .. "}-%{repo" .. suffix .. "}-%{shortcommit" .. suffix .. "}",
archiveurl = "%{forgeurl" .. suffix .. "}/get/%{ref" .. suffix .. "}.%{archiveext" .. suffix .. "}" } }
-- Packaging a moving branch is quite a bad idea, but since at least Gitlab
-- will treat branches and tags the same way better support branches explicitly
-- than have packagers hijack %{tag} to download branch states
local spec = {}
for _, v in ipairs({'forgeurl','tag','commit','branch','version'}) do
spec[v] = rpm.expand("%{?" .. v .. suffix .. "}")
end
-- Compute the reference of the object to fetch
local isrelease = false
if (spec["tag"] ~= "") then ref = "%{?tag" .. suffix .. "}"
elseif (spec["commit"] ~= "") then ref = "%{?commit" .. suffix .. "}"
elseif (spec["branch"] ~= "") then ref = "%{?branch" .. suffix .. "}"
else ref = "%{?version" .. suffix .. "}"
isrelease = true
end
if (rpm.expand(ref) == "") then
if (suffix == "") then
rpm.expand("%{error:You need to define Version:, %{commit} or %{tag} before the macro invocation !}")
else
rpm.expand("%{error:You need to define %{version" .. suffix .. "}, %{commit" .. suffix .. "} or %{tag" .. suffix .. "} before the macro invocation !}")
end
end
local forgeurl = spec["forgeurl"]
-- For backwards compatibility only
local expliciturl = rpm.expand("%{?-u*}")
if (expliciturl ~= "") then
rpm.expand("%{warn:-u use in %%forgemeta is deprecated, use -z instead to select a separate set of rpm variables!}")
forgeurl = expliciturl
end
local forge
forgeurl, forge = idforge(forgeurl, silent)
if (forge ~= nil) then
fedora.explicitset("forgeurl" .. suffix, forgeurl, verbose)
-- Custom processing of quirky forges that can not be handled with simple variables
if (forge == "github") then
-- Workaround the way GitHub injects "v"s before some version strings (but not all!)
-- To package one of the minority of sane GitHub projects that do not munge their version
-- strings set tag to %{version} in your spec
local fileref = ref
if (ref == "%{?version" .. suffix .. "}") then
ref = "v" .. ref
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
if (ref == "%{?version" .. suffix .. "}") then
ref = "v" .. ref
end
elseif (forge == "bitbucket.org") then
if (spec["commit"] == "") then
rpm.expand("%{error:All BitBucket URLs require commit value knowledge: you need to define %{commit}!}")
end
end
fedora.safeset("ref" .. suffix, ref, verbose)
-- Mass setting of the remaining variables
for k,v in pairs(variables[forge]) do
fedora.safeset(k .. suffix, variables[forge][k], verbose)
end
for k,v in pairs(variables["default"]) do
if (variables[forge][k] == nil) then
fedora.safeset(k .. suffix, variables["default"][k], verbose)
end
end
end
-- Generic rules
for _, v in ipairs({'archiveurl','archivename','archiveext','topdir'}) do
spec[v] = rpm.expand("%{?" .. v .. suffix .. "}")
end
-- Source URL processing (computing the forgesource spec variable)
local forgesource = "%{archiveurl" .. suffix .. "}"
if (string.match(spec["archiveurl"], "/([^/]+)$") ~= spec["archivename"] .. "." .. spec["archiveext"]) then
forgesource = "%{?archiveurl" .. suffix .. "}#/%{?archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}"
end
fedora.safeset("forgesource" .. suffix, forgesource, verbose)
-- Setup processing (computing the forgesetup and extractdir variables)
local forgesetupargs = "-n %{extractdir" .. suffix .. "}"
local extractdir = "%{topdir" .. suffix .. "}"
if (spec["topdir"] == "") then
forgesetupargs = "-c " .. forgesetupargs
extractdir = "%{archivename" .. suffix .. "}"
end
if not ismain then
if (spec["topdir"] ~= "") then
forgesetupargs = "-T -D -b " .. suffix .. " " .. forgesetupargs
else
forgesetupargs = "-T -D -a " .. suffix .. " " .. forgesetupargs
end
end
fedora.safeset("forgesetupargs" .. suffix, forgesetupargs, verbose)
fedora.safeset("extractdir" .. suffix, extractdir, verbose)
-- dist processing (computing the correct prefix for snapshots)
local distprefix = ""
if not isrelease then
distprefix = string.lower(rpm.expand(ref))
if (ref == "%{?commit" .. suffix .. "}") then
distprefix = string.sub(distprefix, 1, 7)
elseif (ref ~= "%{?branch" .. suffix .. "}") then
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.','tags.v', 'tags.v.'}) do
distprefix = getversionsuffix(distprefix, p .. v)
end
distprefix = string.gsub(distprefix, "^%.", "")
end
if (distprefix ~= "") then
distprefix = "%{scm" .. suffix .. "}" .. distprefix
date = rpm.expand("%{?date" .. suffix .. "}")
if (date ~= "") then
distprefix = date .. distprefix
else
distprefix = "%([ -r %{_sourcedir}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "} ] && date +%Y%m%d -u -r %{_sourcedir}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "})" .. distprefix
end
distprefix = "." .. distprefix
end
end
if (spec["version"] ~= "") and
(spec["version"] ~= "0") and
(spec["version"] ~= rpm.expand("%{?version}")) then
distprefix = ".%{version" .. suffix .. "}" .. distprefix
end
if (rpm.expand(distprefix) ~= "") then
if not ismain then
distprefix = string.gsub(distprefix, "^%.", ".s")
end
fedora.safeset ("distprefix" .. suffix, distprefix, verbose)
end
if ismain then
fedora.zalias({"forgeurl", "forgesource", "forgesetupargs",
"archivename", "archiveext", "archiveurl",
"topdir", "extractdir", "repo", "owner", "namespace",
"scm", "shortcommit", "distprefix"}, verbose)
end
-- Final spec variable summary if the macro was called with -i
if informative then
rpm.expand("%{echo:Packaging variables read or set by %%forgemeta}")
fedora.echovars({"forgeurl", "forgesource", "forgesetupargs",
"archivename", "archiveext", "archiveurl",
"topdir", "extractdir", "repo", "owner", "namespace",
"scm", "tag", "commit", "shortcommit", "branch", "version",
"date", "distprefix"}, suffix)
fedora.echovars({"dist"},"")
rpm.expand("%{echo: (snapshot date is either manually supplied or computed once %%{_sourcedir}/%%{archivename" .. suffix .. "}.%%{archiveext" .. suffix .. "} is available)}")
end
end
return {
meta = meta,
}

111
gpgverify Executable file
View File

@ -0,0 +1,111 @@
#!/bin/bash
# Copyright 2018 B. Persson, Bjorn@Rombobeorn.se
#
# This material is provided as is, with absolutely no warranty expressed
# or implied. Any use is at your own risk.
#
# Permission is hereby granted to use or copy this shellscript
# for any purpose, provided the above notices are retained on all copies.
# Permission to modify the code and to distribute modified code is granted,
# provided the above notices are retained, and a notice that the code was
# modified is included with the above copyright notice.
function print_help {
cat <<'EOF'
Usage: gpgverify --keyring=<pathname> --signature=<pathname> --data=<pathname>
gpgverify is a wrapper around gpgv designed for easy and safe scripting. It
verifies a file against a detached OpenPGP signature and a keyring. The keyring
shall contain all the keys that are trusted to certify the authenticity of the
file, and must not contain any untrusted keys.
The differences, compared to invoking gpgv directly, are that gpgverify accepts
the keyring in either ASCII-armored or unarmored form, and that it will not
accidentally use a default keyring in addition to the specified one.
Parameters:
--keyring=<pathname> keyring with all the trusted keys and no others
--signature=<pathname> detached signature to verify
--data=<pathname> file to verify against the signature
EOF
}
fatal_error() {
message="$1" # an error message
status=$2 # a number to use as the exit code
echo "gpgverify: $message" >&2
exit $status
}
require_parameter() {
term="$1" # a term for a required parameter
value="$2" # Complain and terminate if this value is empty.
if test -z "${value}" ; then
fatal_error "No ${term} was provided." 2
fi
}
check_status() {
action="$1" # a string that describes the action that was attempted
status=$2 # the exit code of the command
if test $status -ne 0 ; then
fatal_error "$action failed." $status
fi
}
# Parse the command line.
keyring=
signature=
data=
for parameter in "$@" ; do
case "${parameter}" in
(--help)
print_help
exit
;;
(--keyring=*)
keyring="${parameter#*=}"
;;
(--signature=*)
signature="${parameter#*=}"
;;
(--data=*)
data="${parameter#*=}"
;;
(*)
fatal_error "Unknown parameter: \"${parameter}\"" 2
;;
esac
done
require_parameter 'keyring' "${keyring}"
require_parameter 'signature' "${signature}"
require_parameter 'data file' "${data}"
# Make a temporary working directory.
workdir="$(mktemp --directory)"
check_status 'Making a temporary directory' $?
workring="${workdir}/keyring.gpg"
# Decode any ASCII armor on the keyring. This is harmless if the keyring isn't
# ASCII-armored.
gpg2 --homedir="${workdir}" --yes --output="${workring}" --dearmor "${keyring}"
check_status 'Decoding the keyring' $?
# Verify the signature using the decoded keyring.
gpgv2 --homedir="${workdir}" --keyring="${workring}" "${signature}" "${data}"
check_status 'Signature verification' $?
# (--homedir isn't actually necessary. --dearmor processes only the input file,
# and if --keyring is used and contains a slash, then gpgv2 uses only that
# keyring. Thus neither command will look for a default keyring, but --homedir
# makes extra double sure that no default keyring will be touched in case
# another version of GPG works differently.)
# Clean up. (This is not done in case of an error that may need inspection.)
rm --recursive --force ${workdir}

View File

@ -1,17 +1,28 @@
#!/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'
for i in $(grep -E '(/lib/modules/.*\.ko|/lib/modules/.*/modules.builtin)');
do
kmod=$(basename $i | sed -e 's/.[xg]z//');
read -r fname || exit
if [ $kmod == "modules.builtin" ]; then
for j in $(cat $i); do
j=$(basename $j);
echo "kmod($j)"
done
else
echo "kmod($kmod)"
fi
done
# 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

160
macros
View File

@ -18,20 +18,84 @@
%_fmoddir %{_libdir}/gfortran/modules
%source_date_epoch_from_changelog 1
%_enable_debug_packages 1
%_include_minidebuginfo 1
%_include_gdb_index 1
%_debugsource_packages 1
%_debuginfo_subpackages 1
#==============================================================================
# ---- compiler flags.
# C compiler flags. This is traditionally called CFLAGS in makefiles.
# Historically also available as %%{optflags}, and %%build sets the
# environment variable RPM_OPT_FLAGS to this value.
%build_cflags %{optflags}
# C++ compiler flags. This is traditionally called CXXFLAGS in makefiles.
%build_cxxflags %{optflags}
# Fortran compiler flags. Makefiles use both FFLAGS and FCFLAGS as
# the corresponding variable names.
%build_fflags %{optflags} -I%{_fmoddir}
# Link editor flags. This is usually called LDFLAGS in makefiles.
# (Some makefiles use LFLAGS instead.) The default value assumes that
# the flags, while intended for ld, are still passed through the gcc
# compiler driver. At the beginning of %%build, the environment
# variable RPM_LD_FLAGS to this value.
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags}
# Expands to shell code to seot the compiler/linker environment
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
# not been set already. RPM_OPT_FLAGS and RPM_LD_FLAGS have already
# been set implicitly at the start of the %%build section.
# LT_SYS_LIBRARY_PATH is used by libtool script.
%set_build_flags \
CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS ; \
LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-%_libdir:}" ; export LT_SYS_LIBRARY_PATH
# 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}
%__global_fflags %{build_fflags}
%__global_fcflags %{build_fflags}
%__global_ldflags %{build_ldflags}
#==============================================================================
# ---- configure and makeinstall.
#
%_configure_gnuconfig_hack 1
%_configure_libtool_hardening_hack 1
# If defined, _configure_disable_silent_rules will cause --disable-silent-rules
# to be added to the list of options passed to the configure script.
# Eventually we'll want to turn this on by default, but this gives packagers a
# way to turn it back off.
# %_configure_disable_silent_rules 1
%configure \
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
FCFLAGS="${FCFLAGS:-%optflags -I%_fmoddir}" ; export FCFLAGS ; \
LDFLAGS="${LDFLAGS:-%__global_ldflags}"; export LDFLAGS; \
%{set_build_flags}; \
[ "%_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 ; \
done ; \
@ -42,6 +106,7 @@
%{_configure} --build=%{_build} --host=%{_host} \\\
--program-prefix=%{?_program_prefix} \\\
--disable-dependency-tracking \\\
%{?_configure_disable_silent_rules:--disable-silent-rules} \\\
--prefix=%{_prefix} \\\
--exec-prefix=%{_exec_prefix} \\\
--bindir=%{_bindir} \\\
@ -56,14 +121,6 @@
--mandir=%{_mandir} \\\
--infodir=%{_infodir}
# Maximum number of CPU's to use when building, 0 for unlimited.
%_smp_ncpus_max 16
%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
ncpus_max=%{?_smp_ncpus_max}; \\\
if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\
if [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi)
#==============================================================================
# ---- Build policy macros.
#
@ -84,19 +141,35 @@
%__arch_install_post /usr/lib/rpm/check-buildroot
%__os_install_post \
/usr/lib/rpm/brp-compress \
%{!?__debug_package:\
/usr/lib/rpm/brp-strip %{__strip} \
/usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} \
} \
/usr/lib/rpm/brp-strip-static-archive %{__strip} \
%{?py_auto_byte_compile:/usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build}} \
/usr/lib/rpm/brp-python-hardlink \
%{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \
%{nil}
# Build root policy macros. Standard naming:
# convert all '-' in basename to '_', add two leading underscores.
%__brp_ldconfig /usr/lib/rpm/redhat/brp-ldconfig
%__brp_compress /usr/lib/rpm/brp-compress
%__brp_strip /usr/lib/rpm/brp-strip %{__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_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_python_hardlink /usr/lib/rpm/brp-python-hardlink
# __brp_mangle_shebangs_exclude - 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_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}"}
# /usr/lib/rpm/redhat/brp-implant-ident-static
%__os_install_post \
%{?__brp_ldconfig} \
%{?__brp_compress} \
%{!?__debug_package:\
%{?__brp_strip} \
%{?__brp_strip_comment_note} \
} \
%{?__brp_strip_lto} \
%{?__brp_strip_static_archive} \
%{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \
%{?__brp_python_hardlink} \
%{?__brp_mangle_shebangs} \
%{nil}
%__spec_install_post\
%{?__debug_package:%{__debug_install_post}}\
@ -119,26 +192,50 @@
#
## 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
%_source_filedigest_algorithm 8
%_binary_filedigest_algorithm 8
# Use XZ compression for binary payloads
%_binary_payload w2.xzdio
# Use Zstandard compression for binary payloads
%_binary_payload w19.zstdio
%_hardening_cflags -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
# we don't escape symbols '~', '"', etc. so be careful when changing this
%_hardening_ldflags -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
%_hardening_ldflags -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
# Harden packages by default for Fedora 23:
# https://fedorahosted.org/fesco/ticket/1384 (accepted on 2014-02-11)
# Use "%undefine _hardened_build" to disable.
%_hardened_build 1
%_hardened_cflags %{?_hardened_build:%{_hardening_cflags}}
%_hardened_ldflags %{?_hardened_build:%{_hardening_ldflags}}
%__global_cflags -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches %{_hardened_cflags}
%__global_ldflags -Wl,-z,relro %{_hardened_ldflags}
%_annobin_cflags -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
# Add extra information to binary objects created by gcc for Fedora 28:
# https://pagure.io/fesco/issue/1780 (accepted on 2017-10-30)
# Use "%undefine _annotated_build" to disable.
%_annotated_build 1
%_annotated_cflags %{?_annotated_build:%{_annobin_cflags}}
# Fail linking if there are undefined symbols. Required for proper
# ELF symbol versioning support. Disabled by default.
# Use "%define _ld_strict_symbol_defs 1" to enable.
#%_ld_strict_symbol_defs 1
%_ld_symbols_flags %{?_ld_strict_symbol_defs:-Wl,-z,defs}
# https://fedoraproject.org/wiki/Changes/RemoveExcessiveLinking
# use "%undefine _ld_as_needed" to disable.
%_ld_as_needed 1
%_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}
# Automatically trim changelog entries after 2 years
%_changelog_trimtime %{lua:print(os.time() - 2 * 365 * 86400)}
#==============================================================================
# ---- Generic auto req/prov filtering macros
@ -172,3 +269,6 @@
%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}" \
}
# 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")

61
macros.fedora-misc Normal file
View File

@ -0,0 +1,61 @@
# Some miscellaneous Fedora-related macros
# List files matching inclusion globs, excluding files matching exclusion blogs
# Optional parameters:
# -i "<globs>" inclusion globs
# -x "<globs>" exclusion globs
# Globs are space-separated lists of shell globs. Such lists require %{quote:}
# use for safe rpm argument passing.
# Alternatively, set the following rpm variables before calling the macro:
# “listfiles_include” inclusion globs
# — “listfiles_exclude” exclusion globs
# Arguments passed to the macro without flags will be interpreted as inclusion
# globs.
%listfiles(i:x:) %{expand:
%if %{lua: print(string.len(rpm.expand("%{?-i*}%{?listfiles_include}%*")))}
listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u)
%if %{lua: print(string.len(rpm.expand("%{?-x*}%{?listfiles_exclude}")))}
while IFS= read -r finc ; do
realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\
| sort -u | grep -q "${finc}" || echo "${finc}"
done <<< "${listfiles_include}"
%else
echo "${listfiles_include}"
%endif
%endif
}
# 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)
}
# gpgverify verifies signed sources. There is documentation in the script.
%gpgverify(k:s:d:) %{lua:
local script = rpm.expand("%{_rpmconfigdir}/redhat/gpgverify ")
local keyring = rpm.expand("%{-k*}")
local signature = rpm.expand("%{-s*}")
local data = rpm.expand("%{-d*}")
print(script)
if keyring ~= "" then
print(rpm.expand("--keyring='%{SOURCE" .. keyring .. "}' "))
end
if signature ~= "" then
print(rpm.expand("--signature='%{SOURCE" .. signature .. "}' "))
end
if data ~= "" then
print(rpm.expand("--data='%{SOURCE" .. data .. "}' "))
end
}

View File

@ -2,3 +2,21 @@
# A directory for rpm macros
%rpmmacrodir /usr/lib/rpm/macros.d
# A directory for appdata metainfo. This has changed between releases so a
# macro is useful.
%_metainfodir %{_datadir}/metainfo
# A directory for SWID tag files describing the installation
%_swidtagdir %{_prefix}/lib/swidtag/fedoraproject.org
# A helper to apply the fedora.wordwrap filter to the content of an rpm
# variable, and print the result. Optional parameter:
# -v <variable_name> (default value: _description)
# Putting multiple lines of UTF-8 text inside a variable is usually
# accomplished with a %%{expand: some_text}.
%wordwrap(v:) %{lua:
local fedora = require "fedora.common"
local variable = "%{" .. rpm.expand("%{-v*}%{!-v:_description}") .. "}"
print(fedora.wordwrap(variable))
}

85
macros.forge Normal file
View File

@ -0,0 +1,85 @@
# Map forge information to rpm metadata. This macro will compute default spec
# variable values.
#
# The following spec variables SHOULD be set before calling the macro:
#
# forgeurl the project url on the forge, strongly recommended;
# Version if applicable, set it with Version: <version>
# tag if applicable
# commit if applicable
# date if applicable (to override the mtime of the Source archive)
#
# Use -z for multiple calls to the macro
#
# The macro will attempt to compute and set the following variables if they are
# not already set by the packager:
#
# forgesource an URL that can be used as SourceX: value
# forgesetupargs the correct arguments to pass to %setup for this source
# used by %forgesetup and %forgeautosetup
# archivename the source archive filename, without extentions
# archiveext the source archive filename extensions, without leading dot
# archiveurl the url that can be used to download the source archive,
# without renaming
# topdir the source archive top directory (can be empty)
# extractdir the source directory created inside %{_builddir} after using
# %%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 forge = require "fedora.srpm.forge"
local verbose = rpm.expand("%{-v}") ~= ""
local informative = rpm.expand("%{-i}") ~= ""
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.meta(s,verbose,informative,silent)
end
else
forge.meta(rpm.expand("%{-z*}"),verbose,informative,silent)
end
}
# Convenience macro to relay computed arguments to %setup
# Optional parameters:
# -a process all sources in one go, instead of using separate -z calls
# -z <number> read %{?forgesetupargs<number>}
# -v be verbose
%forgesetup(az:v) %{lua:
local fedora = require "fedora.common"
if (rpm.expand("%{-z}") == "") and (rpm.expand("%{-a}") ~= "") then
for _,s in pairs(fedora.getsuffixes("forgesetupargs")) do
print(rpm.expand("%setup %{!-v:-q} %{?forgesetupargs" .. s .. "}\\n"))
end
else
print( rpm.expand("%setup %{!-v:-q} %{?forgesetupargs" .. rpm.expand("%{-z*}") .. "}\\n"))
end
}
# Convenience macro to relay computed arguments to %autosetup
# Parameters relayed to %autosetup: -v -N -S -p
# Optional parameters:
# -z <number> read %{?forgesetupargs<number>}
%forgeautosetup(z:vNS:p:q) %{lua:
print(rpm.expand("%autosetup %{-v} %{-N} %{?-S} %{?-p} %{?forgesetupargs" .. rpm.expand("%{-z*}") .. "}\\n"))
}

View File

@ -45,7 +45,7 @@ kernel_module_package_release 1
done \
fi \
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
echo "%%global kernel_source() /usr/src/kernels/%kverrel.\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
if [ ! -z "%{-f*}" ] \
then \
filelist="%{-f*}" \
@ -54,9 +54,10 @@ kernel_module_package_release 1
then \
preamble="%{-p*}" \
fi \
if [ -z "%{kmodtool_generate_buildreqs}" ] \
nobuildreqs="yes" \
if [ "x%{kmodtool_generate_buildreqs}" != "x1" ] \
then \
nobuildreqs="yes" \
nobuildreqs="no" \
fi \
kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$nobuildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
)}

2
macros.ldc-srpm Normal file
View File

@ -0,0 +1,2 @@
# arches that ldc builds on
%ldc_arches %{ix86} x86_64 %{arm} aarch64

9
macros.ldconfig Normal file
View File

@ -0,0 +1,9 @@
#%ldconfig /sbin/ldconfig
%ldconfig_post(n:) %{?ldconfig:%post -p %ldconfig %{?*} %{-n:-n %{-n*}}\
%end}
%ldconfig_postun(n:) %{?ldconfig:%postun -p %ldconfig %{?*} %{-n:-n %{-n*}}\
%end}
%ldconfig_scriptlets(n:) %{?ldconfig:\
%ldconfig_post %{?*} %{-n:-n %{-n*}}\
%ldconfig_postun %{?*} %{-n:-n %{-n*}}\
}

View File

@ -1,5 +1,5 @@
# arches that mono builds on
%mono_arches %{ix86} x86_64 sparc sparcv9 ia64 %{arm} alpha s390x ppc ppc64 ppc64le
%mono_arches %{ix86} x86_64 sparc sparcv9 ia64 %{arm} aarch64 alpha s390x ppc ppc64 ppc64le
%_monodir %{_prefix}/lib/mono
%_monogacdir %{_monodir}/gac

View File

@ -1,6 +1,7 @@
# nodejs_arches lists what arches Node.js and dependent packages run on.
#
# Enabling Node.js on other arches requires porting the V8 JavaScript JIT to
# those arches. Support for POWER and aarch64 arrived in nodejs v4
# those arches. Support for POWER and aarch64 arrived in nodejs v4. Support
# for s390x arrived in nodejs v6
%nodejs_arches %{ix86} x86_64 %{arm} aarch64 %{power64}
%nodejs_arches %{ix86} x86_64 %{arm} aarch64 %{power64} s390x

3
macros.valgrind-srpm Normal file
View File

@ -0,0 +1,3 @@
# valgrind_arches lists what arches Valgrind works on
%valgrind_arches %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64

7
macros.vpath Normal file
View File

@ -0,0 +1,7 @@
# ---- VPATH default settings
# directory where CMakeLists.txt/meson.build/etc. are placed
%_vpath_srcdir .
# directory (doesn't need to exist) where all generated build files will be placed
%_vpath_builddir %_target_platform

2
redhat-annobin-cc1 Normal file
View File

@ -0,0 +1,2 @@
*cc1_options:
+ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=annobin}

View File

@ -1,5 +1,2 @@
*self_spec:
+ %{!shared:%{!r:-pie}}
*link:
+ -z now
+ %{!static:%{!shared:%{!r:-pie}}}

View File

@ -6,12 +6,11 @@
Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config
Version: 41
Version: 153
Release: 1%{?dist}
# No version specified.
License: GPL+
Group: Development/System
URL: http://pkgs.fedoraproject.org/cgit/redhat-rpm-config.git
URL: https://src.fedoraproject.org/rpms/redhat-rpm-config
# Core rpm settings
Source0: macros
@ -21,6 +20,9 @@ Source1: rpmrc
Source50: redhat-hardened-cc1
Source51: redhat-hardened-ld
# gcc specs files for annobin builds
Source52: redhat-annobin-cc1
# 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
# that would otherwise be providing the macros. other language/arch specific
@ -29,14 +31,26 @@ Source51: redhat-hardened-ld
Source100: macros.fedora-misc-srpm
Source102: macros.mono-srpm
Source103: macros.nodejs-srpm
Source104: macros.ldc-srpm
Source105: macros.valgrind-srpm
# Other misc macros
Source150: macros.dwz
Source151: macros.kmp
Source152: macros.vpath
Source153: macros.forge
Source154: macros.ldconfig
Source155: macros.fedora-misc
# Build policy scripts
Source201: brp-implant-ident-static
Source202: brp-java-repack-jars
# this comes from https://github.com/rpm-software-management/rpm/pull/344
# added a python -> python2 conversion for fedora with warning
# and an echo when the mangling happens
Source201: brp-mangle-shebangs
# this comes from rpm itself
# however, now we can do Fedora changes within
Source202: brp-python-bytecompile
# Dependency generator scripts (deprecated)
Source300: find-provides
@ -51,8 +65,9 @@ Source400: dist.sh
Source401: rpmsort
Source402: symset-table
Source403: kmodtool
Source404: gpgverify
# 16082013 snapshots from http://git.savannah.gnu.org/gitweb/?p=config.git
# 2016-10-02 snapshots from http://git.savannah.gnu.org/gitweb/?p=config.git
Source500: config.guess
Source501: config.sub
@ -61,17 +76,51 @@ Source600: kmod.attr
Source601: kmod.prov
Source602: libsymlink.attr
# BRPs
Source700: brp-ldconfig
Source701: brp-strip-lto
# Convenience lua functions
Source800: common.lua
Source801: forge.lua
# Documentation
Source900: buildflags.md
BuildArch: noarch
BuildRequires: perl-generators
Requires: coreutils
Requires: perl-srpm-macros
Requires: ocaml-srpm-macros
Requires: gnat-srpm-macros
Requires: efi-srpm-macros
Requires: fonts-srpm-macros
Requires: fpc-srpm-macros
Requires: ghc-srpm-macros
Requires: gnat-srpm-macros
Requires: go-srpm-macros
Requires: python-srpm-macros
Requires: nim-srpm-macros
Requires: ocaml-srpm-macros
Requires: openblas-srpm-macros
Requires: perl-srpm-macros
# ↓ Provides compileall2 Python module
Requires: python-srpm-macros >= 3-46
Requires: rust-srpm-macros
Requires: qt5-srpm-macros
Requires: rpm >= 4.11.0
Requires: dwz >= 0.4
Requires: zip
Requires: (annobin if gcc)
# for brp-mangle-shebangs
Requires: %{_bindir}/find
Requires: %{_bindir}/file
Requires: %{_bindir}/grep
Requires: %{_bindir}/sed
Requires: %{_bindir}/xargs
# -fstack-clash-protection and -fcf-protection require GCC 8.
Conflicts: gcc < 8.0.1-0.22
Provides: system-rpm-config = %{version}-%{release}
%global rrcdir /usr/lib/rpm/redhat
@ -80,7 +129,7 @@ Provides: system-rpm-config = %{version}-%{release}
Red Hat specific rpm configuration files.
%package -n kernel-rpm-macros
Summary: Macros and scripts for building kernel module packages.
Summary: Macros and scripts for building kernel module packages
Requires: redhat-rpm-config >= 13
%description -n kernel-rpm-macros
@ -96,14 +145,18 @@ cp -p %{sources} .
mkdir -p %{buildroot}%{rrcdir}
install -p -m 644 -t %{buildroot}%{rrcdir} macros rpmrc
install -p -m 444 -t %{buildroot}%{rrcdir} redhat-hardened-*
install -p -m 444 -t %{buildroot}%{rrcdir} redhat-annobin-*
install -p -m 755 -t %{buildroot}%{rrcdir} config.*
install -p -m 755 -t %{buildroot}%{rrcdir} dist.sh rpmsort symset-table kmodtool
install -p -m 755 -t %{buildroot}%{rrcdir} gpgverify
install -p -m 755 -t %{buildroot}%{rrcdir} brp-*
install -p -m 755 -t %{buildroot}%{rrcdir} find-*
mkdir -p %{buildroot}%{rrcdir}/find-provides.d
install -p -m 644 -t %{buildroot}%{rrcdir}/find-provides.d firmware.prov modalias.prov
install -p -m 755 -t %{buildroot}%{rrcdir} brp-*
mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d
install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.*
@ -111,20 +164,38 @@ mkdir -p %{buildroot}%{_fileattrsdir}
install -p -m 644 -t %{buildroot}%{_fileattrsdir} *.attr
install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
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/srpm forge.lua
%files
%dir %{rrcdir}
%{rrcdir}/macros
%{rrcdir}/rpmrc
%{rrcdir}/brp-*
%{rrcdir}/dist.sh
%{rrcdir}/gpgverify
%{rrcdir}/redhat-hardened-*
%{rrcdir}/redhat-annobin-*
%{rrcdir}/config.*
%{rrcdir}/find-provides
%{rrcdir}/find-requires
%{rrcdir}/brp-ldconfig
%{_fileattrsdir}/*.attr
%{_rpmconfigdir}/kmod.prov
%{_rpmconfigdir}/macros.d/macros.*-srpm
%{_rpmconfigdir}/macros.d/macros.dwz
%{_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
%{_rpmluadir}/fedora/*.lua
%{_rpmluadir}/fedora/srpm/*lua
%doc buildflags.md
%files -n kernel-rpm-macros
%dir %{rrcdir}/find-provides.d
@ -138,6 +209,374 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
%{_rpmconfigdir}/macros.d/macros.kmp
%changelog
* 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.
* Thu Feb 20 2020 Jeff Law <law@redhat.com> - 152-1
- Use eu-elfclassify to only run strip on ELF relocatables
and archive libraries.
* Fri Feb 14 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 151-1
- Fixup parallel algorithm for brp-strip-lto
* Fri Feb 14 2020 Jeff Law <law@redhat.com> - 150-1
- Strip LTO sections/symbols from installed .o/.a files
* Thu Jan 23 2020 Jeff Law <law@redhat.com> - 149-1
- Allow conditionally adding -fcommon to CFLAGS by defining %%_legacy_common_support
* Mon Jan 20 2020 Florian Weimer <fweimer@redhat.com> - 148-1
- Reenable annobin after GCC 10 integration (#1792892)
* Mon Jan 20 2020 Florian Weimer <fweimer@redhat.com> - 147-1
- Temporarily disable annobin for GCC 10 (#1792892)
* Thu Dec 05 2019 Denys Vlasenko <dvlasenk@redhat.com> - 146-1
- kmod.prov: fix and speed it up
* Tue Dec 03 15:48:18 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 145-1
- %%set_build_flags: define LT_SYS_LIBRARY_PATH
* Thu Nov 21 2019 Denys Vlasenko <dvlasenk@redhat.com> - 144-1
- Speed up brp-mangle-shebangs.
* Tue Nov 05 2019 Lumír Balhar <lbalhar@redhat.com> - 143-1
- Fix brp-python-bytecompile with the new features from compileall2
- Resolves: rhbz#1595265
* Fri Nov 01 2019 Miro Hrončok <mhroncok@redhat.com> - 142-1
- Fix the simple API of %%gpgverify.
* Thu Aug 22 2019 Jason L Tibbitts III <tibbs@math.uh.edu> - 141-2
- Simplify the API of %%gpgverify.
* Thu Jul 25 2019 Richard W.M. Jones <rjones@redhat.com> - 140-2
- Bump version and rebuild.
* Sat Jul 20 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 140-1
- Fixup python-srpm-macros version
* Wed Jul 17 2019 Lumír Balhar <lbalhar@redhat.com> - 139-1
- Use compileall2 Python module for byte-compilation in brp-python-bytecompile
* Tue Jul 09 2019 Miro Hrončok <mhroncok@redhat.com> - 138-1
- Move brp-python-bytecompile from rpm, so we can easily adapt it
* Mon Jul 08 2019 Nicolas Mailhot <nim@fedoraproject.org> - 137-1
- listfiles: make it robust against all kinds of “interesting” inputs
- wordwrap: make list indenting smarter, to produce something with enough
structure that it can be converted into AppStream metadata
* Mon Jul 08 2019 Robert-André Mauchin <zebob.m@gmail.com> - 136-1
- Revert "Fix expansion in listfiles_exclude/listfiles_include"
* Mon Jul 08 2019 Nicolas Mailhot <nim@fedoraproject.org> - 135-1
- Fix expansion in listfiles_exclude/listfiles_include
* Mon Jul 01 2019 Florian Festi <ffesti@redhat.com> - 134-1
- Switch binary payload compression to Zstandard level 19
* Thu Jun 27 2019 Vít Ondruch <vondruch@redhat.com> - 133-2
- Enable RPM to set SOURCE_DATE_EPOCH environment variable.
* Tue Jun 25 08:13:50 CEST 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 133-1
- Expand listfiles_exclude/listfiles_include
* Tue Jun 11 2019 Jitka Plesnikova <jplesnik@redhat.com> - 132-1
- Remove perl macro refugees
* Mon Jun 10 2019 Panu Matilainen <pmatilai@redhat.com> - 131-1
- Provide temporary shelter for rpm 4.15 perl macro refugees
* Tue Jun 04 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 130-1
- New macro for wrapping text %%wordwrap
- Smal fix for %%listfiles with no arguments
* Thu May 30 2019 Björn Persson <Bjorn@Rombobjörn.se> - 129-1
- Added gpgverify.
* Tue Jan 15 2019 Panu Matilainen <pmatilai@redhat.com> - 128-1
- Drop redundant _smp_mflag re-definition, use the one from rpm instead
* 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
* Thu Nov 08 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 124-1
- forge: add more distprefix cleaning (bz1646724)
* Mon Oct 22 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 123-1
- Add -q option to %%forgesetup
* Sat Oct 20 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 122-1
- Allow multiple calls to forge macros
* Thu Oct 11 2018 Jan Pazdziora <jpazdziora@redhat.com> - 121-1
- Add %_swidtagdir for directory for SWID tag files describing the
installation.
* Mon Sep 10 2018 Miro Hrončok <mhroncok@redhat.com> - 120-1
- Make ambiguous python shebangs error
https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
* Mon Aug 20 2018 Kalev Lember <klember@redhat.com> - 119-1
- Add aarch64 to ldc arches
* Wed Aug 15 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 118-1
- Enable --as-needed by default
* Mon Jul 16 2018 Miro Hrončok <mhroncok@redhat.com> - 117-1
- Mangle /bin shebnags to /usr/bin ones (#1581757)
* Tue Jul 10 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 116-1
- Add option to add -Wl,--as-needed into LDFLAGS
* Mon Jul 09 2018 Kalev Lember <klember@redhat.com> - 115-1
- Disable non-functional ppc64 support for ldc packages
* Tue Jun 26 2018 Panu Matilainen <pmatilai@redhat.com> - 114-1
- Fix kernel ABI related strings (Peter Oros, #26)
- Automatically trim changelog to two years (Zbigniew Jędrzejewski-Szmek, #22)
- Cosmetics cleanups (Zbigniew Jędrzejewski-Szmek, #22)
* Mon Jun 18 2018 Florian Weimer <fweimer@redhat.com> - 113-1
- Build flags: Require SSE2 on i686 (#1592212)
* Mon May 28 2018 Miro Hrončok <mhroncok@redhat.com> - 112-1
- Add a possibility to opt-out form automagic Python bytecompilation
https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation
* Wed May 02 2018 Peter Jones <pjones@redhat.com> - 111-1
- brp-mangle-shebangs: add %%{__brp_mangle_shebangs_exclude_file} and
%%{__brp_mangle_shebangs_exclude_from_file} to allow you to specify files
containing the shebangs to be ignore and files to be ignored regexps,
respectively, so that they can be generated during the package build.
* Wed May 2 2018 Florian Weimer <fweimer@redhat.com> - 110-1
- Reflect -fasynchronous-unwind-tables GCC default on POWER (#1550914)
* Wed May 2 2018 Florian Weimer <fweimer@redhat.com> - 109-1
- Use plain -fcf-protection compiler flag, without -mcet (#1570823)
* Tue May 01 2018 Peter Jones <pjones@redhat.com> - 108-1
- Add Requires: efi-srpm-macros for %%{efi}
* Fri Apr 20 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 107-1
- Add %%_metainfodir macro.
- %%forgeautosetup tweak to fix patch application.
* Mon Mar 05 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 106-1
- Update forge macros.
* Wed Feb 28 2018 Florian Weimer <fweimer@redhat.com> - 105-1
- Make -fasynchronous-unwind-tables explicit on aarch64 (#1536431)
* Wed Feb 28 2018 Florian Weimer <fweimer@redhat.com> - 104-1
- Use -funwind-tables on POWER (#1536431, #1548847)
* Sun Feb 25 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 103-1
- Make %%ldconfig_post/%%ldconfig_postun parameterized
* Sat Feb 24 2018 Florian Weimer <fweimer@redhat.com> - 102-1
- Second step of -z now move: removal from GCC specs file (#1548397)
* Sat Feb 24 2018 Florian Weimer <fweimer@redhat.com> - 101-1
- First step of moving -z now to the gcc command line (#1548397)
* Thu Feb 22 2018 Miro Hrončok <mhroncok@redhat.com> - 100-1
- Don't mangle shebangs with whitespace only changes (#1546993)
* Thu Feb 22 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 99-1
- Move %%end to %%ldconfig_scriptlets
* Sat Feb 17 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 98-1
- Explicitly close scriptlets with %%end (ldconfig)
* Wed Feb 14 2018 Miro Hrončok <mhroncok@redhat.com> - 97-1
- Allow to opt-out from shebang mangling for specific paths/shebangs
* Thu Feb 08 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 96-1
- Simplify/Fix check for shebang starting with "/"
* Wed Feb 07 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 95-1
- Fix mangling env shebangs with absolute paths
* Sun Feb 4 2018 Florian Weimer <fweimer@redhat.com> - 94-1
- Add RPM macros for compiler/linker flags
* Sat Feb 03 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 93-1
- Use newly available /usr/bin/grep
* Wed Jan 31 2018 Peter Robinson <pbrobinson@fedoraproject.org> 92-1
- Use generic tuning for ARMv7
* Tue Jan 30 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 91-1
- The grep package only provides /bin/grep, not /usr/bin/grep.
* Mon Jan 29 2018 Miro Hrončok <mhroncok@redhat.com> - 90-1
- Add brp-mangle-shebangs
* Mon Jan 29 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 89-1
- Add macros.ldconfig
* Mon Jan 29 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 88-1
- Create DSO symlinks automatically
* Mon Jan 29 2018 Florian Weimer <fweimer@redhat.com> - 87-1
- Build flags: Disable -z defs again (#1535422)
* Mon Jan 29 2018 Florian Weimer <fweimer@redhat.com> - 86-1
- Build flags: Enable CET on i686, x86_64 (#1538725)
* Thu Jan 25 2018 Florian Weimer <fweimer@redhat.com> - 85-1
- Build flags: Switch to generic tuning on i686 (#1538693)
* Mon Jan 22 2018 Florian Weimer <fweimer@redhat.com> - 84-1
- Link with -z defs by default (#1535422)
* Mon Jan 22 2018 Florian Weimer <fweimer@redhat.com> - 83-1
- Make armhfp flags consistent with GCC defaults
* Mon Jan 22 2018 Florian Weimer <fweimer@redhat.com> - 82-1
- Make use of -fasynchronous-unwind-tables more explicit (#1536431)
* Mon Jan 22 2018 Florian Weimer <fweimer@redhat.com> - 81-1
- Remove --param=ssp-buffer-size=4
* Mon Jan 22 2018 Florian Weimer <fweimer@redhat.com> - 80-1
- Document build flags
* Fri Jan 19 2018 Panu Matilainen <pmatilai@redhat.com> - 79-1
- Document how to disable hardened and annotated build (#1211296)
* Wed Jan 17 2018 Panu Matilainen <pmatilai@redhat.com> - 78-1
- Fix the inevitable embarrassing typo in 77, doh
* Wed Jan 17 2018 Panu Matilainen <pmatilai@redhat.com> - 77-1
- Macroize build root policies for consistent disable/override ability
* Wed Jan 17 2018 Florian Weimer <fweimer@redhat.com> - 76-1
- Add -fstack-clash-protection for supported architectures (#1515865)
* Wed Jan 17 2018 Florian Weimer <fweimer@redhat.com> - 75-1
- Add _GLIBCXX_ASSERTIONS to CFLAGS/CXXFLAGS (#1515858)
* Mon Jan 15 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 74-1
- Remove Requires: cmake-rpm-macros
* Thu Jan 11 2018 Jason L Tibbitts III <tibbs@math.uh.edu> - 73-1
- Add macros.forge for simplifying packaging of forge-hosted packages. See
https://fedoraproject.org/wiki/Forge-hosted_projects_packaging_automation and
https://bugzilla.redhat.com/show_bug.cgi?id=1523779
* Wed Jan 03 2018 Sergey Avseyev <sergey.avseyev@gmail.com> - 72-1
- Add Requires: nim-srpm-macros for %%nim_arches
* Tue Jan 02 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 71-1
- Require annobin only if gcc is installed
* Thu Dec 21 2017 Björn Esser <besser82@fedoraproject.org> - 70-2
- Add Requires: cmake-rpm-macros for CMake auto-{provides,requires} (#1498894)
* Fri Dec 08 2017 Panu Matilainen <pmatilai@redhat.com> - 70-1
- Update URL to current location at src.fedoraproject.org
* Wed Nov 22 2017 Nick Clifton <nickc@redhat.com> - 69-1
- Enable binary annotations in compiler flags
* Thu Oct 26 2017 Troy Dawson <tdawson@redhat.com> - 68-1
- Remove Requires: fedora-rpm-macros
* Mon Jul 31 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 67-1
- Define _include_gdb_index (RHBZ #1476722)
- Move _debuginfo_subpackages and _debugsource_packages from rpm (RHBZ #1476735)
* Tue Jul 18 2017 Florian Festi <ffesti@redhat.com> - 66-1
- Honor %%kmodtool_generate_buildreqs (#1472201)
* Thu Jul 13 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 65-1
- Add Requires: rust-srpm-macros for %%rust_arches
* Wed Mar 15 2017 Orion Poplawski <orion@cora.nwra.com> - 64-1
- Add Requires: openblas-srpm-macros for %%openblas_arches
* Thu Feb 02 2017 Dan Horák <dan[at]danny.cz> - 63-1
- set zEC12 as minimum architecture level for s390(x) (#1404991)
* Thu Dec 15 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 62-1
- Add macros.vpath (https://fedorahosted.org/fpc/attachment/ticket/655)
* Tue Dec 06 2016 Adam Williamson <awilliam@redhat.com> - 61-1
- revert changes from 60, they break far too much stuff (#1401231)
* Wed Nov 30 2016 Panu Matilainen <pmatilai@redhat.com> - 60-1
- Error on implicit function declaration and -return type for C (#1393492)
* Wed Nov 30 2016 Panu Matilainen <pmatilai@redhat.com> - 59-1
- Move global compiler flags to __global_compiler_flags macro
- Introduce separate __global_fooflags for C, C++ and Fortran
* Tue Nov 29 2016 Panu Matilainen <pmatilai@redhat.com> - 58-1
- Drop atom optimization on i686 (#1393492)
* Tue Nov 15 2016 Dan Horák <dan[at]danny.cz> - 57-1
- set z10 as minimum architecture level for s390(x)
* Fri Nov 11 2016 Panu Matilainen <pmatilai@redhat.com> - 56-1
- Fix directory name mismatch in kernel_source macro (#648996)
* Tue Nov 08 2016 Michal Toman <mtoman@fedoraproject.org> - 55-1
- Add default compiler flags for various MIPS architectures (#1366735)
* Tue Nov 08 2016 Panu Matilainen <pmatilai@redhat.com> - 54-1
- -pie is incompatible with static linkage (#1343892, #1287743)
* Mon Nov 07 2016 Panu Matilainen <pmatilai@redhat.com> - 53-1
- Drop brp-java-repack-jars by request (#1235770)
- Drop brp-implant-ident-static, unused for 13 years and counting
* Mon Nov 07 2016 Lubomir Rintel <lkundrak@v3.sk> - 52-1
- Add valgrind_arches macro for BuildRequires of valgrind
* Fri Nov 04 2016 Stephen Gallagher <sgallagh@redhat.com> - 51-1
- Add s390x build target for Node.js packages
* Mon Oct 31 2016 Kalev Lember <klember@redhat.com> - 50-1
- Add ldc_arches macro
* Mon Oct 17 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 49-1
- Remove hardcoded limit of 16 CPUs for makefile parallelism.
- See https://bugzilla.redhat.com/show_bug.cgi?id=1384938
* Thu Oct 13 2016 Richard W.M. Jones <rjones@redhat.com> 48-1
- Add support for riscv64.
This also updates config.sub/config.guess to the latest upstream versions.
* Wed Oct 12 2016 Peter Robinson <pbrobinson@fedoraproject.org> 47-1
- Enable aarch64 for mono arches
* Mon Oct 03 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 46-1
- Allow %%configure to optionally pass --disable-silent-rules. Define
%%_configure_disable_silent_rules (defaulting to 0) to control this.
* Wed Sep 14 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 45-1
- Add dependency on qt5-srpm-macros.
* Fri Aug 12 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 44-1
- And somehow I managed to make a typo in that dependency.
* Fri Aug 12 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 43-1
- Add dependency on fedora-rpm-macros.
* Tue Apr 12 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 42-1
- Add dependency on fpc-srpm-macros.
* Mon Apr 11 2016 Jason L Tibbitts III <tibbs@math.uh.edu> - 41-1
- Add a file for miscellaneous macros, currently containing just %%rpmmacrodir.
@ -174,7 +613,7 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
* Fri May 29 2015 Florian Festi <ffesti@redhat.com> 32-1
- Support out of source builds for %%_configure_gnuconfig_hack (#1191788)
- Fix typo in %%kernel_module_package (#1159361)
* Tue May 19 2015 Florian Festi <ffesti@redhat.com> 31-1
- Add %%py_auto_byte_compile macro controlling Python bytecompilation
(#976651)
@ -206,7 +645,7 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
* Sat May 24 2014 Brent Baude <baude@us.ibm.com> - 23-2
- Changed ppc64 to power64 macro for mono_archs
* Tue May 13 2014 Peter Robinson <pbrobinson@fedoraproject.org>
* Tue May 13 2014 Peter Robinson <pbrobinson@fedoraproject.org>
- aarch64 has Ada so add it to GNAT_arches
* Mon May 12 2014 Josh Boyer <jwboyer@fedoraproject.org> - 22-1

1
rpmlint.cf Normal file
View File

@ -0,0 +1 @@
addFilter("no-%build-section")

126
rpmrc
View File

@ -1,74 +1,82 @@
include: /usr/lib/rpm/rpmrc
optflags: i386 %{__global_cflags} -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables
optflags: i486 %{__global_cflags} -m32 -march=i486 -fasynchronous-unwind-tables
optflags: i586 %{__global_cflags} -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables
optflags: i686 %{__global_cflags} -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables
optflags: athlon %{__global_cflags} -m32 -march=athlon -fasynchronous-unwind-tables
optflags: ia64 %{__global_cflags}
optflags: x86_64 %{__global_cflags} -m64 -mtune=generic
optflags: i386 %{__global_compiler_flags} -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
optflags: i486 %{__global_compiler_flags} -m32 -march=i486 -fasynchronous-unwind-tables -fstack-clash-protection
optflags: i586 %{__global_compiler_flags} -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-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: ia64 %{__global_compiler_flags}
optflags: x86_64 %{__global_compiler_flags} -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
optflags: alpha %{__global_cflags} -mieee
optflags: alphaev5 %{__global_cflags} -mieee -mcpu=ev5
optflags: alphaev56 %{__global_cflags} -mieee -mcpu=ev56
optflags: alphapca56 %{__global_cflags} -mieee -mcpu=pca56
optflags: alphaev6 %{__global_cflags} -mieee -mcpu=ev6
optflags: alphaev67 %{__global_cflags} -mieee -mcpu=ev67
optflags: alpha %{__global_compiler_flags} -mieee
optflags: alphaev5 %{__global_compiler_flags} -mieee -mcpu=ev5
optflags: alphaev56 %{__global_compiler_flags} -mieee -mcpu=ev56
optflags: alphapca56 %{__global_compiler_flags} -mieee -mcpu=pca56
optflags: alphaev6 %{__global_compiler_flags} -mieee -mcpu=ev6
optflags: alphaev67 %{__global_compiler_flags} -mieee -mcpu=ev67
optflags: sparc %{__global_cflags} -m32 -mcpu=v7 -mtune=ultrasparc
optflags: sparcv8 %{__global_cflags} -m32 -mcpu=v8
optflags: sparcv9 %{__global_cflags} -m32 -mcpu=ultrasparc
optflags: sparcv9v %{__global_cflags} -m32 -mcpu=niagara
optflags: sparc64 %{__global_cflags} -m64 -mcpu=ultrasparc
optflags: sparc64v %{__global_cflags} -m64 -mcpu=niagara
optflags: sparc %{__global_compiler_flags} -m32 -mcpu=v7 -mtune=ultrasparc
optflags: sparcv8 %{__global_compiler_flags} -m32 -mcpu=v8
optflags: sparcv9 %{__global_compiler_flags} -m32 -mcpu=ultrasparc
optflags: sparcv9v %{__global_compiler_flags} -m32 -mcpu=niagara
optflags: sparc64 %{__global_compiler_flags} -m64 -mcpu=ultrasparc
optflags: sparc64v %{__global_compiler_flags} -m64 -mcpu=niagara
optflags: m68k %{__global_cflags}
optflags: m68k %{__global_compiler_flags}
optflags: ppc %{__global_cflags} -m32
optflags: ppciseries %{__global_cflags} -m32
optflags: ppcpseries %{__global_cflags} -m32
optflags: ppc64 %{__global_cflags} -m64
optflags: ppc64p7 %{__global_cflags} -m64 -O3 -mcpu=power7 -mtune=power7
optflags: ppc64le %{__global_cflags} -m64 -mcpu=power8 -mtune=power8
optflags: ppc64iseries %{__global_cflags} -m64
optflags: ppc64pseries %{__global_cflags} -m64
optflags: ppc8260 %{__global_cflags} -m32
optflags: ppc8560 %{__global_cflags} -m32
optflags: ppc %{__global_compiler_flags} -m32 -fasynchronous-unwind-tables
optflags: ppciseries %{__global_compiler_flags} -m32
optflags: ppcpseries %{__global_compiler_flags} -m32
optflags: ppc64 %{__global_compiler_flags} -m64 -fasynchronous-unwind-tables -fstack-clash-protection
optflags: ppc64p7 %{__global_compiler_flags} -m64 -O3 -mcpu=power7 -mtune=power7 -fasynchronous-unwind-tables -fstack-clash-protection
optflags: ppc64le %{__global_compiler_flags} -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection
optflags: ppc64iseries %{__global_compiler_flags} -m64
optflags: ppc64pseries %{__global_compiler_flags} -m64
optflags: ppc8260 %{__global_compiler_flags} -m32
optflags: ppc8560 %{__global_compiler_flags} -m32
optflags: parisc %{__global_cflags} -mpa-risc-1-0
optflags: hppa1.0 %{__global_cflags} -mpa-risc-1-0
optflags: hppa1.1 %{__global_cflags} -mpa-risc-1-0
optflags: hppa1.2 %{__global_cflags} -mpa-risc-1-0
optflags: hppa2.0 %{__global_cflags} -mpa-risc-1-0
optflags: parisc %{__global_compiler_flags} -mpa-risc-1-0
optflags: hppa1.0 %{__global_compiler_flags} -mpa-risc-1-0
optflags: hppa1.1 %{__global_compiler_flags} -mpa-risc-1-0
optflags: hppa1.2 %{__global_compiler_flags} -mpa-risc-1-0
optflags: hppa2.0 %{__global_compiler_flags} -mpa-risc-1-0
optflags: mips %{__global_cflags}
optflags: mipsel %{__global_cflags}
optflags: mips %{__global_compiler_flags} -march=mips32r2 -mfpxx
optflags: mipsel %{__global_compiler_flags} -march=mips32r2 -mfpxx
optflags: mips64 %{__global_compiler_flags} -march=mips64r2 -mabi=64
optflags: mips64el %{__global_compiler_flags} -march=mips64r2 -mabi=64
optflags: mipsr6 %{__global_compiler_flags} -march=mips32r6
optflags: mipsr6el %{__global_compiler_flags} -march=mips32r6
optflags: mips64r6 %{__global_compiler_flags} -march=mips64r6
optflags: mips64r6el %{__global_compiler_flags} -march=mips64r6
optflags: armv3l %{__global_cflags} -fsigned-char -march=armv3
optflags: armv4b %{__global_cflags} -fsigned-char -march=armv4
optflags: armv4l %{__global_cflags} -fsigned-char -march=armv4
optflags: armv4tl %{__global_cflags} -march=armv4t
optflags: armv5tel %{__global_cflags} -march=armv5te -mfloat-abi=soft
optflags: armv5tejl %{__global_cflags} -march=armv5te -mfloat-abi=soft
optflags: armv6l %{__global_cflags} -march=armv6 -mfloat-abi=soft
optflags: armv6hl %{__global_cflags} -march=armv6 -mfpu=vfp -mfloat-abi=hard
optflags: armv6hnl %{__global_cflags} -march=armv6 -mfpu=neon -mfloat-abi=hard
optflags: armv7l %{__global_cflags} -march=armv7-a -mfloat-abi=soft
optflags: armv7hl %{__global_cflags} -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard
optflags: armv7hnl %{__global_cflags} -march=armv7-a -mfpu=neon -mfloat-abi=hard
optflags: armv3l %{__global_compiler_flags} -fsigned-char -march=armv3
optflags: armv4b %{__global_compiler_flags} -fsigned-char -march=armv4
optflags: armv4l %{__global_compiler_flags} -fsigned-char -march=armv4
optflags: armv4tl %{__global_compiler_flags} -march=armv4t
optflags: armv5tel %{__global_compiler_flags} -march=armv5te -mfloat-abi=soft
optflags: armv5tejl %{__global_compiler_flags} -march=armv5te -mfloat-abi=soft
optflags: armv6l %{__global_compiler_flags} -march=armv6 -mfloat-abi=soft
optflags: armv6hl %{__global_compiler_flags} -march=armv6 -mfpu=vfp -mfloat-abi=hard
optflags: armv6hnl %{__global_compiler_flags} -march=armv6 -mfpu=neon -mfloat-abi=hard
optflags: armv7l %{__global_compiler_flags} -march=armv7-a -mfloat-abi=soft
optflags: armv7hl %{__global_compiler_flags} -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard
optflags: armv7hnl %{__global_compiler_flags} -march=armv7-a -mfpu=neon -mfloat-abi=hard
optflags: atarist %{__global_cflags}
optflags: atariste %{__global_cflags}
optflags: ataritt %{__global_cflags}
optflags: falcon %{__global_cflags}
optflags: atariclone %{__global_cflags}
optflags: milan %{__global_cflags}
optflags: hades %{__global_cflags}
optflags: atarist %{__global_compiler_flags}
optflags: atariste %{__global_compiler_flags}
optflags: ataritt %{__global_compiler_flags}
optflags: falcon %{__global_compiler_flags}
optflags: atariclone %{__global_compiler_flags}
optflags: milan %{__global_compiler_flags}
optflags: hades %{__global_compiler_flags}
optflags: s390 %{__global_cflags} -m31 -march=z9-109 -mtune=z10
optflags: s390x %{__global_cflags} -m64 -march=z9-109 -mtune=z10
optflags: s390 %{__global_compiler_flags} -m31 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables
optflags: s390x %{__global_compiler_flags} -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection
optflags: aarch64 %{__global_cflags}
optflags: aarch64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection
optflags: riscv64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection
# set build arch to fedora buildarches on hardware capable of running it
# saves having to do rpmbuild --target=