I see your point about having everything under a single dir. In that case, it's recommended to use %define inst_target /opt and use that as the toplevel dir. Install appropriate symlinks to %{_bindir} as required.
You can also be more distro-agnostic in your BuildRequires rather than use multiple %if conditions by using pkgconfig() or cmake() based BuildRequires. For example, if you replace
With %{inst_target} instead of Prefix: it looks like the shell env RPM_INSTALL_PREFIX would need to be replaced with something else, but this seems to be the mechanism for making relocatable packages.
Another question - what is the best way to define a meta-package? Initially defined it without a %files section, but then it didn't get created (or I did something else wrong). With an empty %files entry, rpmlint complains a bit, but does something.
Comments 5
I see your point about having everything under a single dir. In that case, it's recommended to use
%define inst_target /opt
and use that as the toplevel dir. Install appropriate symlinks to%{_bindir}
as required.You can also be more distro-agnostic in your BuildRequires rather than use multiple
%if
conditions by usingpkgconfig()
orcmake()
based BuildRequires. For example, if you replacewith
BuildRequires: cmake(CGAL)
that will pull in the right devel pkg for both distros.With
%{inst_target}
instead ofPrefix:
it looks like the shell envRPM_INSTALL_PREFIX
would need to be replaced with something else, but this seems to be the mechanism for making relocatable packages.Another question - what is the best way to define a meta-package? Initially defined it without a
%files
section, but then it didn't get created (or I did something else wrong). With an empty%files
entry, rpmlint complains a bit, but does something.Have a
%files
section and put in aREADME
there. See how llvm does it: https://build.opensuse.org/package/show/openSUSE:Factory/llvmThanks for the pointers