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 /optand 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
%ifconditions by usingpkgconfig()orcmake()based BuildRequires. For example, if you replace%if 0%{?suse_version} BuildRequires: cgal-devel %endif %if 0%{?fedora} BuildRequires: CGAL-devel %endifwith
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_PREFIXwould 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
%filessection, but then it didn't get created (or I did something else wrong). With an empty%filesentry, rpmlint complains a bit, but does something.Have a
%filessection and put in aREADMEthere. See how llvm does it: https://build.opensuse.org/package/show/openSUSE:Factory/llvmThanks for the pointers