From 92cd463b344fd85fb74c9c4040a1175ad4fe9210 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Wed, 3 Jun 2020 01:37:11 +0300 Subject: [PATCH] [gbinder] Respect arch specific lib dir. JB#49681 --- .gitignore | 10 ++++------ Makefile | 23 ++++++++++++++++------- debian/control | 2 +- debian/libgbinder-dev.install | 3 --- debian/libgbinder-dev.install.in | 3 +++ debian/libgbinder.install | 1 - debian/libgbinder.install.in | 1 + debian/rules | 7 ++++++- libgbinder.pc.in | 6 +++--- rpm/libgbinder.spec | 4 ++-- 10 files changed, 36 insertions(+), 24 deletions(-) delete mode 100644 debian/libgbinder-dev.install create mode 100644 debian/libgbinder-dev.install.in delete mode 100644 debian/libgbinder.install create mode 100644 debian/libgbinder.install.in diff --git a/.gitignore b/.gitignore index 91288e4..da53184 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,11 @@ *~ debian/files -debian/libgbinder-dev.debhelper.log -debian/libgbinder-dev.substvars debian/libgbinder-dev -debian/libgbinder.debhelper.log -debian/libgbinder.postinst.debhelper -debian/libgbinder.postrm.debhelper -debian/libgbinder.substvars debian/libgbinder +debian/*.debhelper.log +debian/*.debhelper +debian/*.substvars +debian/*.install debian/tmp documentation.list installroot diff --git a/Makefile b/Makefile index ed524ac..4175235 100644 --- a/Makefile +++ b/Makefile @@ -132,10 +132,7 @@ DEBUG_FLAGS = -g RELEASE_FLAGS = COVERAGE_FLAGS = -g -ifndef KEEP_SYMBOLS -KEEP_SYMBOLS = 0 -endif - +KEEP_SYMBOLS ?= 0 ifneq ($(KEEP_SYMBOLS),0) RELEASE_FLAGS += -g endif @@ -233,6 +230,7 @@ clean: rm -fr debian/tmp debian/libgbinder debian/libgbinder-dev rm -f documentation.list debian/files debian/*.substvars rm -f debian/*.debhelper.log debian/*.debhelper debian/*~ + rm -f debian/*.install test: make -C unit test @@ -291,8 +289,19 @@ $(COVERAGE_LIB): $(COVERAGE_OBJS) $(AR) rc $@ $? ranlib $@ +# +# LIBDIR usually gets substituted with arch specific dir. +# It's relative in deb build and can be whatever in rpm build. +# + +LIBDIR ?= usr/lib +ABS_LIBDIR := $(shell echo /$(LIBDIR) | sed -r 's|/+|/|g') + $(PKGCONFIG): $(LIB_NAME).pc.in Makefile - sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@ + sed -e 's|@version@|$(PCVERSION)|g' -e 's|@libdir@|$(ABS_LIBDIR)|g' $< > $@ + +debian/%.install: debian/%.install.in + sed 's|@LIBDIR@|$(LIBDIR)|g' $< > $@ # # Install @@ -304,9 +313,9 @@ INSTALL = install INSTALL_DIRS = $(INSTALL) -d INSTALL_FILES = $(INSTALL) -m $(INSTALL_PERM) -INSTALL_LIB_DIR = $(DESTDIR)/usr/lib +INSTALL_LIB_DIR = $(DESTDIR)$(ABS_LIBDIR) INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/$(NAME) -INSTALL_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig +INSTALL_PKGCONFIG_DIR = $(DESTDIR)$(ABS_LIBDIR)/pkgconfig install: $(INSTALL_LIB_DIR) $(INSTALL_FILES) $(RELEASE_SO) $(INSTALL_LIB_DIR) diff --git a/debian/control b/debian/control index 17e106f..d4dcf4c 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: libgbinder Section: libs Priority: optional Maintainer: Slava Monich -Build-Depends: debhelper (>= 7), libglib2.0-dev (>= 2.0), libglibutil (>= 1.0.35) +Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev (>= 2.0), libglibutil (>= 1.0.35) Standards-Version: 3.8.4 Package: libgbinder diff --git a/debian/libgbinder-dev.install b/debian/libgbinder-dev.install deleted file mode 100644 index 4a41b34..0000000 --- a/debian/libgbinder-dev.install +++ /dev/null @@ -1,3 +0,0 @@ -debian/tmp/usr/lib/libgbinder.so usr/lib -include/*.h usr/include/gbinder -build/libgbinder.pc usr/lib/pkgconfig diff --git a/debian/libgbinder-dev.install.in b/debian/libgbinder-dev.install.in new file mode 100644 index 0000000..a1f92a2 --- /dev/null +++ b/debian/libgbinder-dev.install.in @@ -0,0 +1,3 @@ +debian/tmp/@LIBDIR@/libgbinder.so @LIBDIR@ +debian/tmp/@LIBDIR@/pkgconfig/libgbinder.pc @LIBDIR@/pkgconfig +debian/tmp/usr/include/* usr/include diff --git a/debian/libgbinder.install b/debian/libgbinder.install deleted file mode 100644 index 5f891ac..0000000 --- a/debian/libgbinder.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libgbinder.so.* usr/lib diff --git a/debian/libgbinder.install.in b/debian/libgbinder.install.in new file mode 100644 index 0000000..171b31d --- /dev/null +++ b/debian/libgbinder.install.in @@ -0,0 +1 @@ +debian/tmp/@LIBDIR@/libgbinder.so.* @LIBDIR@ diff --git a/debian/rules b/debian/rules index 3a92007..e09bcc0 100755 --- a/debian/rules +++ b/debian/rules @@ -4,8 +4,13 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + +override_dh_auto_build: + dh_auto_build -- LIBDIR=$(LIBDIR) release pkgconfig debian/libgbinder.install debian/libgbinder-dev.install + override_dh_auto_install: - dh_auto_install -- install-dev + dh_auto_install -- LIBDIR=$(LIBDIR) install-dev %: dh $@ diff --git a/libgbinder.pc.in b/libgbinder.pc.in index 1fff93d..11313d5 100644 --- a/libgbinder.pc.in +++ b/libgbinder.pc.in @@ -1,10 +1,10 @@ name=gbinder -libdir=/usr/lib +libdir=@libdir@ includedir=/usr/include Name: libgbinder Description: Binder client library -Version: [version] -Requires: glib-2.0 libglibutil +Version: @version@ +Requires.private: glib-2.0 libglibutil Libs: -L${libdir} -l${name} Cflags: -I${includedir} -I${includedir}/${name} diff --git a/rpm/libgbinder.spec b/rpm/libgbinder.spec index 63d01ab..a729af0 100644 --- a/rpm/libgbinder.spec +++ b/rpm/libgbinder.spec @@ -29,11 +29,11 @@ This package contains the development library for %{name}. %setup -q %build -make KEEP_SYMBOLS=1 release pkgconfig +make LIBDIR=%{_libdir} KEEP_SYMBOLS=1 release pkgconfig %install rm -rf %{buildroot} -make install-dev DESTDIR=%{buildroot} +make LIBDIR=%{_libdir} DESTDIR=%{buildroot} install-dev %check make -C unit test