I need to build a RPM, with the sole purpose of installing a few fonts. I have read several tutorials about that, however everyone seems to suggests something different and I haven't been able to find something like a very basic setup to do that.
Is it possible to just reference the files within the %files
section of the spec? I tried however, RMP always tries to find the files within the tmp
directory. Do I need to add a specific build step that copies everything I need to the tmp
directory?
Should these files go into the SOURCE
or the BUILD
directory when building the RPM? I have been finding a lot of different information on that. Some suggest to build a tarball that contains the files and place that under the SOURCE
directory, however that seems kind of wrong, as font files are not actual source files to me.
Ideally, I would like to just put all the font files within the BUILD folder under a directory structure like ./usr/share/fonts/
and then reference that within the %file
section of the SPEC and let rpm
do its magic. Probably I am missing or misunderstanding something here.
Does the %files
section always expect to find the source files within the tmp
directory, or is there something wrong with my setup? I have created ~/.rpmmacros
which contains
%_topdir /Users/user/rpm
which is the root build directory and contains the BUILD, RPMS, SOURCES, SPECS and tmp directories.
I would be glad if someone could provide which are the least required items in the spec file to get that to work cleanly.
Edit
Following user3159253's suggestions, I am using the following spec file:
Name: test
Version: 1.0.0
Release: 1
Copyright: Copyright info
Group: Applications/System
BuildArch: noarch
%description
Brief description of software package.
%prep
%build
%install
mkdir -p %{buildroot}/usr/share/fonts
cp ./usr/share/fonts/* %buildroot/usr/share/fonts/
%clean
%files
/usr/share/fonts/*
I copied the fonts into the BUILD/usr/share/fonts/ directory. If I query the rpm for a list of files, all fonts are there. However, when I install the rpm, it complains about
/usr/share/fonts is needed by test-1.0.0-1.noarch
However, it doesn't matter if this directory exists or not, so I guess rpm
is complaining that this resource is not listed in its database.
I have been able to fix this by changing the %file
section to:
/usr/
/usr/share/
/usr/share/fonts/
/usr/share/fonts/*
However, I doubt that this is such a good idea. Is there a better way to fix this?