%distribution Fedora Core %(tr -dc [0-9] </etc/fedora-release)

# The vendor here is the same as the packager. Use a company or

# organization if appropriate.

%vendor %{packager}

%_home %(echo $HOME)

%_topdir %{_home}/rpm

%_tmppath %{_topdir}/tmp

%_builddir %{_tmppath}

%_rpmtopdir %{_topdir}/%{name}

%_sourcedir %{_rpmtopdir}

%_specdir %{_rpmtopdir}

%_rpmdir %{_topdir}/RPMS

%_srcrpmdir %{_topdir}/RPMS

%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm

%_signature gpg

%_gpg_path %{_home}/.gnupg

%_gpgbin /usr/bin/gpg

%_gpg_name %(gpg --list-keys|sed -n 's/^uid *//p'|head -1)

You can also create this file by manually filling in the values you wish to use:

#

# ~/.rpmmacros file

#

# This gets all necessary information from environment variables and

# system utilities. The first e-mail address on your gnupg keyring

# should be your own.

#

%packager Chris Tyler

%distribution Fedora Core 6

# Use an organization or company in the next line if applicable

%vendor Chris Tyler

%_home /home/chris

%_topdir /home/chris/rpm

%_tmppath /home/chris/rpm/tmp

%_builddir /home/chris/rpm/tmp

%_rpmtopdir /home/chris/rpm/%{name}

%_sourcedir %{_rpmtopdir}

%_specdir %{_rpmtopdir}

%_rpmdir /home/chris/rpm/RPMS

%_srcrpmdir /home/chris/rpm/RPMS

%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm

%_signature gpg

%_gpg_path /home/chris/.gnupg

%_gpgbin /usr/bin/gpg

%_gpg_name Chris Tyler <[email protected]>

To test that this file has been saved in the correct location and is being correctly interpreted by rpm , execute rpm --eval followed by the name of one of the macros:

$ rpm --eval '%_gpg_name'

Chris Tyler <[email protected]>

$ rpm --eval '%_srcrpmdir'

/home/chris/rpm/RPMS

Both versions of this file use the directory ~/rpm to hold packages being built. Within this directory, there will be:

? A directory for each package being built, named after that package.

? A directory named tmp , for temporary files created during the building process.

? A directory named RPMS , to hold the final RPM packages.

You'll need to create these directories:

$ mkdir -p ~/rpm/RPMS ~/rpm/tmp

The fedora-rpmdevtools package provides the fedora- buildrpmtree command, which prepares a suitable directory structure within your home directory and creates a very basic .rpmmacros file. If you use this command, your RPMs will be built within the directory ~/rpmbuild.

5.7.1.2. Creating a spec file

The RPM building process is controlled by a spec file . Creating a good spec file is both a science and an art.

To start, create a new directory within ~/rpm to hold your source tarball and the spec file. In this example, I'm going to package up the game Critical Mass (also called critter ), available from http://sourceforge.net/projects/criticalmass . I'll name the directory after the package:

$ mkdir ~/rpm/ CriticalMass

I'll place the source tarball CriticalMass-1.0.0.tar.bz2 in this directory. The spec file will also be named after the package: CriticalMass.spec .

The first part of any spec file is called the preamble and contains the fields, or tags, outlined in Table 5-7 . Each tag is placed on a line by itself, followed by a colon and the value for that tag.

Table 5-7. Basic preamble tags in a spec file

Вы читаете Fedora Linux
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату