Makefile: Use more GNU-style directory variables, explicit docdir for OpenSUSE
It turns out that, while on most distributions "docdir" would be /usr/share/doc, it's /usr/share/doc/packages/ on OpenSUSE Tumbleweed. Use an explicit docdir as shown in: https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto and don't unnecessarily hardcode directory variables in the Makefile. Otherwise, RPM builds for OpenSUSE will fail now that we have a README there. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
f233d6c0f0
commit
7b710946b1
2 changed files with 21 additions and 11 deletions
26
Makefile
26
Makefile
|
@ -83,6 +83,12 @@ ifeq ($(shell :|$(CC) -fstack-protector-strong -S -xc - -o - >/dev/null 2>&1; ec
|
|||
endif
|
||||
|
||||
prefix ?= /usr/local
|
||||
exec_prefix ?= $(prefix)
|
||||
bindir ?= $(exec_prefix)/bin
|
||||
datarootdir ?= $(prefix)/share
|
||||
docdir ?= $(datarootdir)/doc/passt
|
||||
mandir ?= $(datarootdir)/man
|
||||
man1dir ?= $(mandir)/man1
|
||||
|
||||
ifeq ($(TARGET_ARCH),X86_64)
|
||||
BIN := passt passt.avx2 pasta pasta.avx2 qrap
|
||||
|
@ -126,19 +132,19 @@ clean:
|
|||
passt.pid README.plain.md
|
||||
|
||||
install: $(BIN) $(MANPAGES) docs
|
||||
mkdir -p $(DESTDIR)$(prefix)/bin $(DESTDIR)$(prefix)/share/man/man1
|
||||
cp -d $(BIN) $(DESTDIR)$(prefix)/bin
|
||||
cp -d $(MANPAGES) $(DESTDIR)$(prefix)/share/man/man1
|
||||
mkdir -p $(DESTDIR)$(prefix)/share/doc/passt
|
||||
cp -d README.plain.md $(DESTDIR)$(prefix)/share/doc/passt/README.md
|
||||
cp -d doc/demo.sh $(DESTDIR)$(prefix)/share/doc/passt
|
||||
mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
|
||||
cp -d $(BIN) $(DESTDIR)$(bindir)
|
||||
cp -d $(MANPAGES) $(DESTDIR)$(man1dir)
|
||||
mkdir -p $(DESTDIR)$(docdir)
|
||||
cp -d README.plain.md $(DESTDIR)$(docdir)/README.md
|
||||
cp -d doc/demo.sh $(DESTDIR)$(docdir)
|
||||
|
||||
uninstall:
|
||||
$(RM) $(BIN:%=$(DESTDIR)$(prefix)/bin/%)
|
||||
$(RM) $(MANPAGES:%=$(DESTDIR)$(prefix)/share/man/man1/%)
|
||||
$(RM) $(DESTDIR)$(prefix)/share/doc/passt/README.md
|
||||
$(RM) $(DESTDIR)$(prefix)/share/doc/passt/demo.sh
|
||||
-rmdir $(DESTDIR)$(prefix)/share/doc/passt
|
||||
$(RM) $(MANPAGES:%=$(DESTDIR)$(man1dir)/%)
|
||||
$(RM) $(DESTDIR)$(docdir)/README.md
|
||||
$(RM) $(DESTDIR)$(docdir)/demo.sh
|
||||
-rmdir $(DESTDIR)$(docdir)
|
||||
|
||||
pkgs: static
|
||||
tar cf passt.tar -P --xform 's//\/usr\/bin\//' $(BIN)
|
||||
|
|
|
@ -51,7 +51,11 @@ This package adds SELinux enforcement to passt(1) and pasta(1).
|
|||
%make_build
|
||||
|
||||
%install
|
||||
%if 0%{?suse_version} > 910
|
||||
%make_install DESTDIR=%{buildroot} prefix=%{_prefix} docdir=%{_prefix}/share/doc/packages/passt
|
||||
%else
|
||||
%make_install DESTDIR=%{buildroot} prefix=%{_prefix}
|
||||
%endif
|
||||
%ifarch x86_64
|
||||
ln -sr %{buildroot}%{_mandir}/man1/passt.1 %{buildroot}%{_mandir}/man1/passt.avx2.1
|
||||
ln -sr %{buildroot}%{_mandir}/man1/pasta.1 %{buildroot}%{_mandir}/man1/pasta.avx2.1
|
||||
|
|
Loading…
Reference in a new issue