So I’m trying to package some RPMs of other people’s software(for both personal and public use depending on the package), but I’m having a little bit of trouble resolving dependencies, provided files and libraries. First for dependencies, packages are relatively simple(most READMEs just tell you which packages are required) but how can I resolve which libraries that a package needs? For example how does a packager know that qt5-qtbase requires libc.so.6(GLIBC_2.10)(64bit)? Same goes for libraries that a package provides. I assume it’s easy if I can track the files that a software provides, but I’m having a little trouble with that as well. For example MakeMKV, it has 2 makefiles(for makemkv-bin and makemkv-oss payloads) if that helps. I just don’t know how to effectively track what files it installs so I can declare it in the SPEC. I also can’t seem to find any good documentation on this, but maybe I’m just looking in the wrong places.
For the first question, runtime dependencies are generated automatically for the most part. You only need to specify build dependencies, and you can use the pkgconfig()
syntax for any dependency that has a .pc file.
Thanks for the info, generally I tend not to spend much time on Fedora docs because it’s not as good as RHEL docs, but I suppose in this case it makes sense to use Fedora docs. Don’t quite understand the pkgconfig() thing at first glance, but I’m sure I’ll get it eventually.
dnf provides 'libc.so.6(GLIBC_2.10)'
EDIT: Sorry, I read this in the wrong direction. As a package maintainer, it can be a journey, but you usually know when you’re doing rpmbuild and it fails to configure or make step, or in testing out the runtime after the fact. I often work from there until dependencies are resolved. This isn’t just for building packages but also for compiling software or images in general.
It is typical for there to be a make install
target and for that target to use variables
DESTDIR=%{buildroot}
and PREFIX=%prefix
.
So in the %install you might have this:
%install
make install DESTDIR=%{buildroot} PREFIX=%{_prefix}
If you build that RPM then all files not listed in %files
will be reported as errors.
You can add then to a %files section. But its also possible to use wildcards in %files.
A simple %files section could just be:
%files
%{_prefix}/*
Edit: replace %prefix with %{_prefix}
That helps a lot, thank you.
Just wanted to double check, I’m a little bit confused for the PREFIX=%prefix part of your comment, is that correct or did you mistype it? rpm --eval %prefix doesn’t yield anything.
Doh! I knew %prefix was wrong and looked up the correct spell - only fixed in one place.
I will edit in the fix above but here is the section with the fix.
%install
make install DESTDIR=%{buildroot} PREFIX=%{_prefix}
Thank you. I’ll test this out, although I’m not 100% sure if it will catch everything under %files because %{_prefix} is /usr but RPMs can plant files in other locations like /etc, but maybe I’m just missing something.
If a file is not listed in %files you with get a error report from rpmbuild/mock that will help you fix it. Indeed you would need to handle files in /etc if you install any.
Note files in /etc are expected to be edited by system administrators so you have to mark the files very carefully. Better is to not install anything in /etc but have you app search in /etc and then in /usr/share for config.
That way an administer’s override goes in /etc and your defaults go in /usr/share.
Config files can be marked with %config(noreplace) for exactly that reason.