Commit Graph

186 Commits

Author SHA1 Message Date
6ccdef292e platform.in: add %pre_service_stop_posttrans_start and %post_service_posttrans_restart
The names of the macros were proposed by Vitaly Chikunov (vt@) and were
approved by Dmitry V. Levin (ldv@).
2021-12-12 00:26:51 +00:00
ff43db6168 Revert "Add support for --runstatedir configure option"
Unfortunately, many generated configure files do not accept this option,
failing build with the following diagnostics:
configure: error: unrecognized option: `--runstatedir=/var/run'

This reverts commit 9bed7dcbad.
2021-08-25 08:00:00 +00:00
01d2120325 platform.in: add more systemd macros 2021-08-25 02:57:37 +03:00
e080be091a platform.in: Parallelize LTO with -flto=auto
Man gcc: "Use -flto=auto to use GNU make's job server, if available, or
otherwise fall back to autodetection of the number of CPU threads
present in your system."
2021-08-24 22:34:59 +03:00
9bed7dcbad Add support for --runstatedir configure option
Update %configure macro to pass --runstatedir=%_runtimedir
option to configure.
Update %makeinstall macro to pass runstatedir=%buildroot%_runtimedir
argument to make.
2021-08-24 08:00:00 +00:00
9fdc144edd platform.in: Enable LTO by default
To opt out:

  %define optflags_lto %nil

To compile libs add `-ffat-lto-objects' like this:

  %define optflags_lto %optflags_lto -ffat-lto-objects

Do not use `-ffat-lto-objects' for anything except exported libs as it
doubles compile time.
2021-08-24 00:52:22 +03:00
Arseny Maslennikov
87424e1d65 Introduce %_smp_build_ncpus macro
This macro offers %{_smp_mflags}, but without the -j prefix, to signify
the configured number of processor cores to use.
We can use this to pass that number to utilities that do not understand
the -j number syntax, for example:
`cmake --build %_cmake__builddir --verbose --parallel %_smp_build_ncpus'

The name was picked to be compatible with RH:
https://github.com/rpm-software-management/rpm/blob/rpm-4.16.1.3/platform.in#L51
We preserve ALT semantics though.
2021-06-08 18:38:35 +03:00
5e710ba046 Add fixup method: gnuconfig
Replaces all config.guess and config.sub files outside gnu-config
to symlinks leading to /usr/share/gnu-config/{config.guess,config.sub}.
2020-12-21 08:00:00 +00:00
a2e3f87824 Add a wrapper for install in %install section to skip strip
`strip' is called by `install -s` that could occur in unpatched
Makefiles, breaking debuginfo generation.

Try to catch `install` invocations via:

- %__install macro used in `make INSTALL=`.
- Prefix PATH with `/usr/libexec/rpm-build` with install and strip
  wrappers.

Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
2020-12-15 04:05:15 +03:00
117a2e6042 platform.in: change %__nprocs definition to use %getncpus instead of nproc(1)
Both use sched_getaffinity(2), but %getncpus is built-in and saves fork
and execve.

Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
2020-12-08 22:49:11 +03:00
7bae988692 Remove obsolete install info macros
This removes %install_info and %uninstall_info macros which point
to stabs since texinfo-4.13-alt1 released back in 2009.
2020-08-24 19:38:47 +00:00
c4685d6094 Remove obsolete ldconfig macros
This removes %post_ldconfig, %post_ldconfig_lib, %post_ldconfig_sys,
and %postun_ldconfig macros which were marked as obsolete by commit
da3de4082f back in 2008.
2020-08-24 19:38:47 +00:00
1b3396c94c Remove obsolete update menu macros
This removes %_update_menus_bin, %update_menus, and %clean_menus macros
which were marked as obsolete by commit
c9231cb270 back in 2008.
2020-08-24 19:38:47 +00:00
e66c512280 platform.in: remove @redhat@ and @mandrake@ lines, strip @alt@ prefix
The former are long unused and irrelevant,
the @alt@ prefix is a useless noise.
2020-08-24 19:38:47 +00:00
aba565d889 debuginfo: Implement %_stripped_files_terminate_build
Terminate build if stripped ELF files are found. Usage:

  %define _stripped_files_terminate_build 1

Formatting suggestions by Dmitry V. Levin <ldv@altlinux.org>.
2020-08-23 17:01:20 +03:00
Andrew Savchenko
dae6334333
Export FCFLAGS as well as FFLAGS
FCFLAGS is modern replacement of FFLAGS for gfortran.
Details can be found in [1].

Modern Fortran applications use FCFLAGS instead of FFLAGS, so we have
them built without platform-specific and general optimizations.
As an example one may look how libgfortran is being built within gcc-9:
libgfortran/Makefile.in uses only FCFLAGS, not FFLAGS and mary other
applications follow.

[1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Fortran-Compiler.html
2020-05-29 11:46:12 +03:00
Gleb Fotengauer-Malinovskiy
3dfc13a782 Add %_pointer_size, %_is_ilp32, and %_is_lp64 macros 2019-05-11 17:26:56 +03:00
37bfd938fd %configure: add --disable-silent-rules
It's always annoying when important information such as compilation
options used for build is not available in build logs just because
silent build rules are enabled by default.

Fix this for the case of build rules generated by configure
by disabling silent rules.
2019-04-16 18:46:34 +00:00
Ivan Zakharyaschev
6f68e5cbc0 Revert "%%EVR macro (for intersubpackage deps) upgraded to include %%disttag (ALT#35930)"
This reverts commit 66e8bff6e4.
2019-02-26 23:19:51 +03:00
Ivan Zakharyaschev
66e8bff6e4 %%EVR macro (for intersubpackage deps) upgraded to include %%disttag (ALT#35930)
%EVR was introduced to be used in spec-files for intersubpackage
(strict) dependencies.

What if we write (when substituting %%EVR) E:V-R:D into dependencies
instead of the previously written E:V-R? Will the interpretation of
these dependencies by rpm change (when installing packages) in a good
or bad way in any cases?

The "dependencies" can be Requires, Conflicts, Obsoletes.

rpm-build already produces packages which include disttags (D), and
Provides in the form of E:V-R:D, and strict intersubpackage
dependencies of such form (Requires; generated automatically).
Intersubpackage Requires in the form "< %EVR" or "> %EVR" don't make
sense. So, the interesting cases this change can affect are:

* Conflicts of the form "< %EVR" or "> %EVR" or "= %EVR" (the last one
must be quite rare);

* Obsoletes of the form "< %EVR" ("= %EVR" makes little sense;
"> %EVR" looks strange because it's about obsoleting packages from future).

The rpm program can be "new" (which knows how to compare E:V-R:Ds with
disttags; since 4.13.0.1-alt5) or "old" (does not yet know it;
4.13.0.1-alt4 or earlier).
(rpm-build already produces "new" packages, i.e., with disttags.)

The "new" rpm program is considered to be the correct reference way to
treat disttags. According to it, the presence of a disttag in a < or >
dependency cannot affect its interpretation (whether it is satisfied
by another package). Adding a disttag to a = dependency would simply
make it more strict (and that's what rpm-build already does under the
hood for intersubpackage deps). So, E:V-R:D deps are OK for the "new"
rpm.

So, what about about the "old" rpm?

Let's pay attention to the cases where the "old" rpm behaves
differently from the "new" rpm.

Such differences can be demonstrated by running
rpminstall-tests-1.0-alt2.M70P.1 in a system with an "old" rpm and a
"new" rpm-build (that can produce packages with disttags).

Here are the interesting failed test cases without disttag in the dependencies
(like before the change made by this commit), i.e. with dependencies
in the form E:V-R written in Conflicts or Obsoletes:

* installable_dummyDisttag_with_conflGreaterEpoch (and similar ones)

$ rpm -qp RPMS/dummyDisttag/noarch/dummy-1-alt1.noarch.rpm --provides
dummy = 1-alt1:zzz+777.66
$ rpm -qp RPMS/conflGreaterEpoch/noarch/conflGreaterEpoch-1-alt1.noarch.rpm --conflicts
dummy > 0:1-alt1
$ rpm -i RPMS/dummyDisttag/noarch/dummy-1-alt1.noarch.rpm RPMS/conflGreaterEpoch/noarch/conflGreaterEpoch-1-alt1.noarch.rpm
error: Failed dependencies:
	dummy > 0:1-alt1 conflicts with conflGreaterEpoch-1-alt1.noarch

NOT OK (ALT#35930): this form of Conflicts is used to ensure that no
subpackages from different releases/builds get installed together.

* noninstallable_dummyDisttag_with_conflEqualEpoch (and similar ones)

$ rpm -qp RPMS/conflEqualEpoch/noarch/conflEqualEpoch-1-alt1.noarch.rpm --conflicts
dummy = 0:1-alt1
$ rpm -i RPMS/dummyDisttag/noarch/dummy-1-alt1.noarch.rpm RPMS/conflEqualEpoch/noarch/conflEqualEpoch-1-alt1.noarch.rpm

succeeds

NOT OK: this form of conflicts could be used to declare conflicting subpackages.

Here are the interesting failed test cases with disttag in the
dependencies (like after the change made by this commit), i.e. with
dependencies in the form E:V-R:D written in Conflicts or Obsoletes:

* installable_dummy_with_conflLessEpochDisttag (and similar ones),

$ rpm -qp RPMS/dummy/noarch/dummy-1-alt1.noarch.rpm --provides
dummy = 1-alt1
$ rpm -qp RPMS/conflLessEpochDisttag/noarch/conflLessEpochDisttag-1-alt1.noarch.rpm --conflicts
dummy < 0:1-alt1:zzz+777.66
$ rpm -i RPMS/dummy/noarch/dummy-1-alt1.noarch.rpm RPMS/conflLessEpochDisttag/noarch/conflLessEpochDisttag-1-alt1.noarch.rpm
error: Failed dependencies:
	dummy < 0:1-alt1:zzz+777.66 conflicts with conflLessEpochDisttag-1-alt1.noarch

OK: dummy-1-alt1.noarch.rpm is from another build (if built with the
"new" rpm-build, it would include the disttag in Provides). This form
of Conflicts is used to ensure that no subpackages from different
releases/builds get installed together. The difference in behavior
with the "new" rpm is explained by that the "new" rpm cannot
(unfortunately) detect this subtle mismatch.

* nonobsoleted_dummy_with_obsolLessEpochDisttag (and similar ones)

(like the previous case)

$ rpm -qp RPMS/obsolLessEpochDisttag/noarch/obsolLessEpochDisttag-1-alt1.noarch.rpm --obsoletes
dummy < 0:1-alt1:zzz+777.66
$ rpm -i RPMS/dummy/noarch/dummy-1-alt1.noarch.rpm RPMS/obsolLessEpochDisttag/noarch/obsolLessEpochDisttag-1-alt1.noarch.rpm
$ rpm -q dummy
package dummy is not installed

OK

* nonobsoleted_dummyDisttag_with_obsolLessEpochDisttag (and similar ones)

$ rpm -qp RPMS/dummyDisttag/noarch/dummy-1-alt1.noarch.rpm --provides
dummy = 1-alt1:zzz+777.66
$ rpm -qp RPMS/obsolLessEpochDisttag/noarch/obsolLessEpochDisttag-1-alt1.noarch.rpm --obsoletes
dummy < 0:1-alt1:zzz+777.66
$ rpm -i RPMS/dummyDisttag/noarch/dummy-1-alt1.noarch.rpm RPMS/obsolLessEpochDisttag/noarch/obsolLessEpochDisttag-1-alt1.noarch.rpm
$ rpm -q dummy
package dummy is not installed

NOT OK, but very improbable (the real name of the subpackage must be
the same as the obsoleted name of an older package, but the obsoleting
package is a different subpackage; so, it's improbable that one keeps
the old name of a subpackage, but wants to obsolete it with another
subpackage).

So, introducing this change to the %EVR value would make the new
packages be treated better by the "old" rpm; even the treatment in the
cases where the behavior is different from the behavior of the "new"
rpm is good (except for one improbable case).
2019-02-19 21:55:21 +03:00
Ivan Zakharyaschev
bad28062d6 platform.in: completely expand %%_libsuff (/usr/lib%%nil was ugly) 2019-01-31 21:58:32 +03:00
133654713d platform.in: remove harmless bash4 noise from %filter_from_* macros (ALT#35803) 2018-12-21 03:20:01 +00:00
Gleb Fotengauer-Malinovskiy
0ca04d42f3 Introduce %_libsuff and %_is_libsuff macros
Previously one who wanted to use only suffix from %_lib macro (without
'lib' prefix) had to either strip it with shell or try to guess it
from %_lib macro.
New macros allow to simplify library suffix logics in spec files:
* %_libsuff is always defined (to %nil on targets where %_lib = lib);
* %_is_libsuff is defined only on those targets where suffix
is not empty (it is useful for %{?...} expressions).
2018-05-29 13:12:26 +03:00
0fa98ef233 platform.in: change %__nprocs definition to use nproc(1) instead of /proc/stat
nproc(1) based approach has two advantages over /proc/stat based
calculations.  Firstly, nproc(1) uses sched_getaffinity(2) and therefore
is not affected by /proc availability.  Secondly, nproc(1) outputs
the number of processors actually available which may be less than
the number of online processors.

nproc(1) was introduced in coreutils-8.1.
2018-05-22 00:09:29 +00:00
7b57257398 platform.in: add -O option to MAKEFLAGS 2018-01-17 21:53:02 +00:00
d625d26666 platform.in (%_smp_mflags): change to use %__nprocs
glibc-2.26~154 changed behaviour of "getconf _NPROCESSORS_ONLN":
it now returns 2 instead of 1 when /proc is not mounted.

Change %_smp_mflags to use %__nprocs that is set to 1 when /proc
is not available.
2018-01-17 21:48:55 +00:00
153086afe1 platform.in (%optflags_core): add -frecord-gcc-switches (ALT#34162)
gcc -frecord-gcc-switches adds .GCC.command.line section to each
generated ELF file.  These sections have the same type (PROGBITS) and
flags (MERGE, STRINGS) as .comment sections.  Like .comment sections,
.GCC.command.line sections are moved to .debug files by debugedit.
2017-12-12 00:33:57 +00:00
117c7f9a6a platform.in (%make_build): implement as a simple command (ALT#34237)
New implementation allows to invoke %make_build with a variable
assignments, e.g. LD_LIBRARY_PATH=.libs %make_build check.

A side effect of old %make_build was initialization of NPROCS
environment variable.  New %make_build no longer initializes NPROCS,
but, according to specfile scan made by Igor Vlasenko, packages
in Sisyphus do not rely on NPROCS being initialized by %make_build.
2017-12-12 00:33:57 +00:00
7a81369647 Introduce brp-check_contents
Add a brp interface for checking contents of files in buildroot.
The initial revision of brp-check_contents scripts checks
for suspicious path names like /var/lib/run, complementing
the change introduced in sisyphus_check-0.8.43-alt1.
2017-10-25 03:16:59 +00:00
Ivan Zakharyaschev
3172abb8c1 %%distribution: ALT Linux --> ALT (ALT#32707) and some minor corrections of old @altlinux.ru addresses 2016-11-29 15:12:34 +03:00
Gleb Fotengauer-Malinovskiy
6ebedc2f12 platform.in: add gcc >= 5 support to __gcc_version_base macro 2015-05-18 13:12:14 +03:00
Gleb Fotengauer-Malinovskiy
1045bebe41 Revert "platform.in: add -Wtrampolines to %optflags_warnings"
This reverts commit d0d01af035.
2015-03-18 18:01:09 +03:00
d0d01af035 platform.in: add -Wtrampolines to %optflags_warnings 2015-01-28 17:04:55 +00:00
eb4ce41fd4 platform.in: add %add_debuginfo_skiplist and related macros 2013-10-29 00:51:06 +00:00
53c1895bb7 platform.in: add more systemd macros 2013-03-08 14:43:13 +00:00
c6fb9bfb27 %_configure_update_config: handle the case when %_configure_script is a symlink 2013-03-07 14:03:55 +00:00
98f832220b platform.in: add %EVR macro
%EVR is a handy macro to use in inter-package dependencies, e.g.
Requires: %name = %EVR
2013-01-24 21:18:47 +00:00
1949b7d5df platform.in (%configure): Export -m* part of %optflags as ASFLAGS
Some of %optflags options, -m* in particular, have to be passed to
assembler so that the output it produces would be consistent with the
output made by compilers.
2012-10-28 23:48:09 +00:00
Sergey Bolshakov
56d12e6708 platform.in: add hook to update config.sub and config.guess right before configure 2012-08-17 16:37:18 +00:00
e7cd0f8ed2 platform.in: add %_unitdir 2012-05-10 11:37:08 +00:00
17b988d408 %_sharedstatedir: change to /var/lib
The old value (/usr/com) was pure nonsense.

Suggested-by: Alexey Gladkov <legion@altlinux.org>
2012-01-12 22:13:54 +00:00
c0926a3c14 platform.in (%___build_pre): export RPM_DATADIR 2011-10-06 20:35:38 +00:00
Alexey Tourbin
4d747a6312 removed brp-strip & related macros 2011-09-23 03:36:28 +04:00
Igor Vlasenko
54babd022d drop obsolete alt macros %update_scrollkeeper/%clean_scrollkeeper 2011-05-17 18:31:42 +03:00
Igor Vlasenko
9dcc998b63 drop obsolete alt macros %update_wms/%clean_wms 2011-05-17 18:28:22 +03:00
Igor Vlasenko
2b3028a966 fixup-desktop: new file that does trivial fixes in desktop files
Some of the fixes for the freedesktop .desktop files are so routine
and trivial that they better be performed by script.
2011-05-13 21:43:39 +00:00
99554e894c platform.in: add %systemd_unitdir 2011-04-04 20:28:42 +00:00
Alexey Tourbin
abc7218045 platform.in: added %brp_strip_debug and %brp_strip_none macros 2011-02-03 11:52:06 +03:00
Alexey Tourbin
2c2529cf98 build/files.c (runPkgScript): new helper function for autodep-like scripts 2011-01-31 03:02:36 +03:00
Alexey Tourbin
f144e129b1 platform.in: always use %optflags_debug 2011-01-30 03:31:11 +03:00