Changes between Version 3 and Version 4 of RpmHowToPackagers


Ignore:
Timestamp:
Sep 9, 2010, 5:59:44 PM (14 years ago)
Author:
Yuri Dario
Comment:

Initial packager information's

Legend:

Unmodified
Added
Removed
Modified
  • RpmHowToPackagers

    v3 v4  
    22[[PageOutline]]
    33Basic informations for packagers: from writing a spec file, to testing a package, to releasing a package.
     4
     5== Introduction ==
     6RPM uses a special file to compile source code, prepare installation and create .rpm files: it is a .spec file, which is just a bunch of shell commands to prepare, build, install, check and clean the setup.
     7Instead of writing a .spec file from scratch, you can get an existing one: a good source for them is the [http://www.rpmfind.net RPM find service]. Enter the name of your package, and choose a distribution. Usually packages for Fedora or OpenSUSE 11.3 are good. Select your package from the left link, you will get a page with all details; one of them is the .src.rpm package, it contains the spec file, platform specific patches, package sources (in .tar.gz, .tar.bz2, .tar.xz format). Use  unrpm.cmd (check bootstrap directory) to extract all files to a temporary location.
     8
     9The first time you start ''rpmbuild.exe'', it will create a set of directories in your %HOME% directory:
     10 * %HOME%\rpmbuild\BUILD (temporary storage for compiled files)
     11 * %HOME%\rpmbuild\BUILDROOT (temporary storage for installed files)
     12 * %HOME%\rpmbuild\RPMS (destinations of built .rpm files)
     13 * %HOME%\rpmbuild\SOURCES (source files and patches)
     14 * %HOME%\rpmbuild\SPECS (spec files)
     15 * %HOME%\rpmbuild\SRPMS (destination of built .src.rpm files)
     16
     17Basic RPM tags:
     18''name:''
     19''version:''
     20''license:''
     21''source:''
     22''source1:''
     23''patch0:''
     24''patch1:''
     25
     26== Prepare source code ==
     27This is done in the ''%prep'' section. Here the ''%setup'' macro will expand your source package (the one in the ''Source:'' line) and write the files by default in the %HOME%\rpmbuild\BUILD\{name}-
     28{version} directory. You can change this with ''-n'' parameter for %setup macro.
     29If you need to extract more source files, use the ''-a'' parameter.
     30To apply first patch add ''patch0 -p1 -b .my_suffix''; the second will use ''patch1...' and so on.
     31Example:
     32{{{
     33%prep
     34# -D Do not delete the directory before unpacking.
     35# -T Disable the automatic unpacking of the archives.
     36%setup -q -n %{name}-%{srcver} %{?with_int_bdb:-a 1} -a 2
     37%patch001 -p1 -b .base
     38}}}
     39
     40== Build source code ==
     41Done in the %build section: common steps are execution of the configure script and use of gnu make to build code (this may be different for other programs).
     42Example:
     43{{{
     44%build
     45CONFIG_SHELL="/bin/sh" ; export CONFIG_SHELL ; \
     46LDFLAGS="-Zbin-files -Zhigh-mem -Zomf -Zargs-wild -Zargs-resp" ; export LDFLAGS ; \
     47LIBS="-lurpo -lmmap -lpthread" ; export LIBS ; \
     48%configure \
     49    --enable-shared --disable-static --without-lua \
     50    %{!?with_int_bdb: --with-external-db} \
     51    %{?with_sqlite: --enable-sqlite3} \
     52    --enable-python \
     53    "--cache-file=%{_topdir}/cache/%{name}.cache"
     54}}}