When building RPM's for Mandrake Linux, you have more macros to simplify the specfile.
Handling the info pages. An example is the best teacher:
%post %_install_info %{name}.info %preun %_remove_install_info %{name}.info |
The menu system. (detailed presentation in Appendix D)
%post %{update_menus} %postun %{clean_menus} |
Handling internationalization cleanly. The best way is not to put by hand the .mo files that usually are in /usr/share/locale/.., but to use a special macro in the %install section, which will fill up a special file for that:
%find_lang %{name} |
Then you will use the file in the file list:
%files -f %{name}.lang |
Build macros. The build macros %configure and %makeinstall are quite big at present time. They specify the prefix, but also every common directories (such as bindir, datadir, and so on); in that respect, they work flawlessly with small and medium sized packages, but always need some attention for the rest. The macro %make performs the make command with appropriate -j<num> option to scale well with multiprocessors. If you need to call manually the ./configure script, remember to NEVER hardcode the architecture; the macro %{_target_platform} is made for that purpose (or even, %{_target_cpu} if necessary).
Building servers. To build safer servers, we use a specific macro, %serverbuild, to be used before actual build occurs. This allows for safer optimization flags. The %build section will often look like:
%build %serverbuild %configure make |
Initscript macros. When you install a package which will provide its own initscript (the files in the directory /etc/init.d), it needs to be added through a call which look like chkconfig --add .., but not in the case of upgrades, and it needs to be restarted if already running; when uninstalling, similar (opposite) things must be done; we have specific macros to do that without a glitch:
%post %_post_service <initscript-name> %preun %_preun_service <initscript-name> |