aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-08-21 11:23:54 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-08-21 22:25:51 +0200
commit7b710946b152fabab0f3c838e5518576beb9020c (patch)
treeb86c61f2deab1d2f1569f3efb3d79d017689c3be
parentf233d6c0f0680d4d0fdd6278faa58a574088e424 (diff)
downloadpasst-7b710946b152fabab0f3c838e5518576beb9020c.tar
passt-7b710946b152fabab0f3c838e5518576beb9020c.tar.gz
passt-7b710946b152fabab0f3c838e5518576beb9020c.tar.bz2
passt-7b710946b152fabab0f3c838e5518576beb9020c.tar.lz
passt-7b710946b152fabab0f3c838e5518576beb9020c.tar.xz
passt-7b710946b152fabab0f3c838e5518576beb9020c.tar.zst
passt-7b710946b152fabab0f3c838e5518576beb9020c.zip
Makefile: Use more GNU-style directory variables, explicit docdir for OpenSUSE2022_08_21.7b71094
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>
-rw-r--r--Makefile28
-rw-r--r--contrib/fedora/passt.spec4
2 files changed, 21 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 81b997e..26e64d5 100644
--- a/Makefile
+++ b/Makefile
@@ -82,7 +82,13 @@ ifeq ($(shell :|$(CC) -fstack-protector-strong -S -xc - -o - >/dev/null 2>&1; ec
CFLAGS += -fstack-protector-strong
endif
-prefix ?= /usr/local
+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)
diff --git a/contrib/fedora/passt.spec b/contrib/fedora/passt.spec
index 8bbe0d0..87c3e93 100644
--- a/contrib/fedora/passt.spec
+++ b/contrib/fedora/passt.spec
@@ -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