Macros in Fedora Packages
These macros are not default in RPM, rather they are available in the Fedora package repos.
R-rpm-macros
blender-rpm-macros
moby-rpm-macros
pyproject-rpm-macros
cargo-rpm-macros
cmake-rpm-macros
cmake-rpm-macros
erlang-rpm-macros
fedora-rpm-macros
flatpak-rpm-macros
folly-rpm-macros
fonts-rpm-macros
gap-rpm-macros
ghc-rpm-macros
go-rpm-macros
kernel-rpm-macros
lua-rpm-macros
magicmirror-rpm-macros
ocaml-rpm-macros
python-rpm-macros
rpmautospec-rpm-macros
rocm-rpm-macros
sgx-rpm-macros
systemd-rpm-macros
zig-rpm-macros
cargo-rpm-macros
epel-rpm-macros
kde-apps-rpm-macros
qt6-rpm-macros
build2-rpm-macros
build-constraints-rpm-macros
kf5-rpm-macros
kf6-rpm-macros
postgresql-test-rpm-macros
qt5-rpm-macros
go-rpm-macros-epel
python-pyqt6-rpm-macros
postgresql17-test-rpm-macros
python-qt5-rpm-macros
romc-rpm-macros7.2
the srpm ones I don't feel like listing rn
Other
This is a non exhaustive list of macros that non *-rpm-macros packages in Fedora provide
%vimfiles_root 🔢🔦🛠️
Provided by the vim-filesystem package.
Expands to %{_datadir}/vim/vimfiles
%vimfiles_root in Terra
%_vpath_srcdir
Provided by the redhat-rpm-config package.
Expands to .
Yes, it juse expands to .. It is described as "directory where CMakeLists.txt/meson.build/etc. are placed."
%_vpath_srcdir in Terra
%_vpath_builddir
Provided by the redhat-rpm-config package.
Expands to %{_vendor}-%{_target_os}-build
described as "directory (doesn't need to exist) where all generated build files will be placed"
Language Provided Macros
If your language / buildsystem is not listed here, go to https://docs.fedoraproject.org/en-US/packaging-guidelines/ and find them on the navigation rail on the left.
C and C++
%configure
Expand to ./configure with the correct flags and arguments.
If you need to execute ./configure, in most cases you should use this macro instead.
In some cases where ./configure is not directly available, you may need to run
autoreconf -fi or -fiv.
You SHOULD use this macro within the %conf section.
%configure in Terra
%make_build 🔰
⇒ %__make -O -j${RPM_BUILD_NCPUS} V=1 VERBOSE=1,
where %{__make} ⇒ /usr/bin/make.
Further arguments to make can be attached.
%make_build in Terra
%make_install 🔰
⇒ %__make install DESTDIR=%?buildroot INSTALL="%__install -p".
%make_install in Terra
%makeinstall 🚸
Deprecated. Use %make_install instead.
%make_install in Terra
%cmake 🔰
Expand to %{__cmake} (⇒ /usr/bin/cmake) with the correct flags,
such as -B "%__cmake_builddir" (⇒ -B "redhat-linux-build").
%cmake in Terra
%cmake_build 🔰
⇒ %__cmake --build "%__cmake_builddir" %?_smp_mflags --verbose.
%cmake_build in Terra
%cmake_install 🔰
⇒ DESTDIR="%buildroot" %__cmake --install "%__cmake_builddir".
%cmake_install in Terra
%meson 🔰
≈ %__meson setup with correct flags.
%meson in Terra
%meson_build 🔰
⇒ %__meson compile -C "%_vpath_builddir" -j %_smp_build_ncpus %{?__meson_verbose:--verbose}
⇒ /usr/bin/meson compile -C redhat-linux-build -j 20 --verbose (on my machine).
%meson_build in Terra
%meson_install 🔰
⇒ DESTDIR=%buildroot %__meson install -C %_vpath_builddir --no-rebuild.
Used in %install.
%meson_install in Terra
%meson_test 🔰
⇒ %__meson test -C %_vpath_builddir --no-rebuild %{!?__meson_verbose:--quiet}.
Used in %check.
%meson_test in Terra
%ninja_build
⇒ %__ninja %__ninja_common_opts
⇒ %__ninja -v -j${RPM_BUILD_NCPUS}.
%ninja_build in Terra
%ninja_install
⇒ DESTDIR=%buildroot %__ninja install %__ninja_common_opts.
%ninja_install in Terra
%ninja_test
⇒ %__ninja test %__ninja_common_opts.
%ninja_test in Terra
%build_cflags 🏷️
Flags to be passed to the C compiler.
⇒ %{__build_flags_lang_c} %{?_distro_extra_cflags}
%build_cflags in Terra
%_distro_extra_cflags 🏷️
For example, if the compiler is emitting errors that could be disabled with some
-Wno-… flags, you can define this macro with extra flags.
This macro is not defined by default on Fedora.
Find examples of%_distro_extra_cflags in Terra
%build_cxxflags 🏷️
Flags to be passed to the C++ compiler.
⇒ %{__build_flags_lang_cxx} %{?_distro_extra_cxxflags}
%build_cxxflags in Terra
%_distro_extra_cxxflags 🏷️
For example, if the compiler is emitting errors that could be disabled with some
-Wno-… flags, you can define this macro with extra flags.
This macro is not defined by default on Fedora.
Find examples of%_distro_extra_cxxflags in Terra
D
%ldc_arches
Find examples of %ldc_arches in Terra
%_d_optflags
Find examples of %_d_optflags in Terra
Java
https://docs.fedoraproject.org/en-US/java-packaging-howto/
Nim
This section is only applicable to Terra (because Fedora does not ship Nim).
%nim_prep
Set mold as the linker and run nimble setup -y.
%nim_prep in Terra
%nim_build
Same as %nim_c.
%nim_build in Terra
%nim_c
⇒ nim c -d:release -t:"%nim_tflags" -l:"%nim_lflags".
%nim_c in Terra
Python
https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/
Rust
https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/
%rustflags_debuginfo 🏷️
If gdb crashes in find-debuginfo, you might want to lower the value to 1 or even 0.
The default value is 2.
https://github.com/terrapkg/packages/blob/2df55dad60a58ecf5f8fbe962f877f2834bdfa25/anda/devs/zed/nightly/zed-nightly.spec#L14
%bcond_with check
# Exclude input files from mangling
%global __brp_mangle_shebangs_exclude_from ^/usr/src/.*$
%global crate zed
%global app_id dev.zed.Zed-Nightly
%global rustflags_debuginfo 0%rustflags_debuginfo in Terra