| |
@@ -895,6 +895,21 @@
|
| |
|
| |
Macro forms of system executables SHOULD NOT be used except when there is a need to allow the location of those executables to be configurable. For example, `+rm+` should be used in preference to `+%{__rm}+`, but `+%{__python}+` is acceptable.
|
| |
|
| |
+ Note that the macros for paths such as `+%{_bindir}+` refer to the installation location of a package.
|
| |
+ Spec files must not use these macros to locate files from build dependencies,
|
| |
+ since build dependencies may have been built with a different `+%{_prefix}+`.
|
| |
+ (This happens when packages are being rebuilt with a prefix of `+/app+` to bundle with a Flatpak.)
|
| |
+ When possible,
|
| |
+ build dependencies should be located using mechanisms
|
| |
+ that are robust against different installation locations,
|
| |
+ such as relying on $PATH lookup,
|
| |
+ using pkg-config,
|
| |
+ or using RPM macros provided by the build dependencies.
|
| |
+ If no such mechanism is available,
|
| |
+ and it's necessary to specify an absolute path to a file in a dependency,
|
| |
+ assume that the build dependency is installed with prefix=/usr.
|
| |
+ (`+/usr/%{_lib}+` may be used to handle the difference between `+/usr/lib+` and `+/usr/lib64+`.)
|
| |
+
|
| |
Having macros in a Source: or Patch: line is a matter of style. Some people enjoy the ready readability of a source line without macros. Others prefer the ease of updating for new versions when macros are used. In all cases, remember to be consistent in your spec file and verify that the URLs you list are valid. spectool (from the rpmdevtools package) can aid you in checking that whether the URL contains macros or not.
|
| |
|
| |
If you need to determine the actual string when it contains macros, you can use rpm. For example, to determine the actual Source: value, you can run:
|
| |
Packages should not use %{_prefix} and friends to refer to absolute
paths for build dependencies, since this breaks rebuilding a package
with a different prefix than the system.
See https://lists.fedorahosted.org/archives/list/packaging@lists.fedoraproject.org/thread/BILZSHLQ7Y2GFIP3AMYNB6FFOFTLQNGM/
I haven't actually seen any examples where using absolute paths was necessary as described in the second part of the text - the one example I found - copying config.guess/sub from automake - turned out to be unnecessary since %configure uses its own copies. But included here for completeness.