| 57 | |
| 58 | In this case, ''%configure'' is another macro, and it will be expanded to add proper paths for common variables, like prefix, exec_prefix and others. Keep in mind that rpmbuild will use /@unixroot/usr as prefix, so all built software will go to the same tree layout. Also programs will be able to be executed from other drives. |
| 59 | Most of the times, the CONFIG_SHELL variable is required, otherwise bash shell will be selected if available: bash does not work very well, ash is more compatible. |
| 60 | CFLAGS will be added by rpm. |
| 61 | |
| 62 | == Install binaries == |
| 63 | Done in the %install section: most of the times, make install is the required step, |
| 64 | |
| 65 | {{{ |
| 66 | %install |
| 67 | rm -rf $RPM_BUILD_ROOT |
| 68 | make DESTDIR="$RPM_BUILD_ROOT" install |
| 69 | }}} |
| 70 | |
| 71 | DESTDIR is usually a macro supported in most recent build environments. |
| 72 | |
| 73 | == File packaging == |
| 74 | Done in the %files section: here all required package files must be listed. While /* could be fine since it will include all files, it is better to have a detailed list, so it is easier to catch make install errors. |
| 75 | |
| 76 | {{{ |
| 77 | %files |
| 78 | %defattr(-,root,root,-) |
| 79 | %{_bindir}/rpm.exe |
| 80 | %{_mandir}/man8/rpm.8* |
| 81 | %{_libdir}/rpm*.dll |
| 82 | }}} |
| 83 | |
| 84 | == Building package == |
| 85 | When the .spec file is in place, packaging of binary files and source code can be started with |
| 86 | {{{ |
| 87 | rpmbuild -ba myfile.spec |
| 88 | }}} |
| 89 | |
| 90 | Special parameters can be used instead of -ba: |
| 91 | * -bb build only binaries |
| 92 | * -bs build only sources |
| 93 | * -bc compile only code and stop. |
| 94 | * -bi install only code and stop. |
| 95 | * -bl check file list only and stop. |
| 96 | |
| 97 | Since -bc, -bi, -bl are performing also previous steps, you can add the special option ''--short-circuit': this will skip all previous steps (rpmbuild will assume they are already ok), and do only the selected task. |