RPM spec language preview
1. A minimal package spec
preamble tags, section headers, and macros
horizon-dark
Name: mypackage
Version: 1.0
Release: 1%{?dist}
Summary: An example package
License: MIT
BuildRequires: gcc
%description
This is an example package.
%prep
%autosetup
%build
%configure
%make_build
%install
%make_install
%files
%license LICENSE
%{_bindir}/mypackage
%changelog
* Mon Jan 01 2024 Jane Doe <jane@example.com> - 1.0-1
- Initial package
atom-one-dark
Name: mypackage
Version: 1.0
Release: 1%{?dist}
Summary: An example package
License: MIT
BuildRequires: gcc
%description
This is an example package.
%prep
%autosetup
%build
%configure
%make_build
%install
%make_install
%files
%license LICENSE
%{_bindir}/mypackage
%changelog
* Mon Jan 01 2024 Jane Doe <jane@example.com> - 1.0-1
- Initial package
github-dark
Name: mypackage
Version: 1.0
Release: 1%{?dist}
Summary: An example package
License: MIT
BuildRequires: gcc
%description
This is an example package.
%prep
%autosetup
%build
%configure
%make_build
%install
%make_install
%files
%license LICENSE
%{_bindir}/mypackage
%changelog
* Mon Jan 01 2024 Jane Doe <jane@example.com> - 1.0-1
- Initial package
dracula
Name: mypackage
Version: 1.0
Release: 1%{?dist}
Summary: An example package
License: MIT
BuildRequires: gcc
%description
This is an example package.
%prep
%autosetup
%build
%configure
%make_build
%install
%make_install
%files
%license LICENSE
%{_bindir}/mypackage
%changelog
* Mon Jan 01 2024 Jane Doe <jane@example.com> - 1.0-1
- Initial package
nord
Name: mypackage
Version: 1.0
Release: 1%{?dist}
Summary: An example package
License: MIT
BuildRequires: gcc
%description
This is an example package.
%prep
%autosetup
%build
%configure
%make_build
%install
%make_install
%files
%license LICENSE
%{_bindir}/mypackage
%changelog
* Mon Jan 01 2024 Jane Doe <jane@example.com> - 1.0-1
- Initial package
github
Name: mypackage
Version: 1.0
Release: 1%{?dist}
Summary: An example package
License: MIT
BuildRequires: gcc
%description
This is an example package.
%prep
%autosetup
%build
%configure
%make_build
%install
%make_install
%files
%license LICENSE
%{_bindir}/mypackage
%changelog
* Mon Jan 01 2024 Jane Doe <jane@example.com> - 1.0-1
- Initial package
2. Conditionals
the %if/%endif preprocessor directives
horizon-dark
%if 0%{?fedora}
BuildRequires: fedora-only-package
%endif
%bcond_with tests atom-one-dark
%if 0%{?fedora}
BuildRequires: fedora-only-package
%endif
%bcond_with tests github-dark
%if 0%{?fedora}
BuildRequires: fedora-only-package
%endif
%bcond_with tests dracula
%if 0%{?fedora}
BuildRequires: fedora-only-package
%endif
%bcond_with tests nord
%if 0%{?fedora}
BuildRequires: fedora-only-package
%endif
%bcond_with tests github
%if 0%{?fedora}
BuildRequires: fedora-only-package
%endif
%bcond_with tests 3. File attributes
%doc, %config, and %dir in the files section
horizon-dark
%files
%doc README.md
%config(noreplace) %{_sysconfdir}/mypackage.conf
%dir %{_datadir}/mypackage atom-one-dark
%files
%doc README.md
%config(noreplace) %{_sysconfdir}/mypackage.conf
%dir %{_datadir}/mypackage github-dark
%files
%doc README.md
%config(noreplace) %{_sysconfdir}/mypackage.conf
%dir %{_datadir}/mypackage dracula
%files
%doc README.md
%config(noreplace) %{_sysconfdir}/mypackage.conf
%dir %{_datadir}/mypackage nord
%files
%doc README.md
%config(noreplace) %{_sysconfdir}/mypackage.conf
%dir %{_datadir}/mypackage github
%files
%doc README.md
%config(noreplace) %{_sysconfdir}/mypackage.conf
%dir %{_datadir}/mypackage