diff --git a/.gitignore b/.gitignore index 4ace0c8..96762b4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,11 @@ *~ debian/files -debian/libgbinder-radio-dev.debhelper.log -debian/libgbinder-radio-dev.substvars debian/libgbinder-radio-dev -debian/libgbinder-radio.debhelper.log -debian/libgbinder-radio.postinst.debhelper -debian/libgbinder-radio.postrm.debhelper -debian/libgbinder-radio.substvars debian/libgbinder-radio +debian/*.debhelper.log +debian/*.debhelper +debian/*.substvars +debian/*.install debian/tmp documentation.list installroot diff --git a/Makefile b/Makefile index e487496..22e519f 100644 --- a/Makefile +++ b/Makefile @@ -78,10 +78,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 @@ -144,6 +141,10 @@ pkgconfig: $(PKGCONFIG) clean: rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~ rm -fr $(BUILD_DIR) RPMS installroot + rm -fr debian/tmp debian/libgbinder-radio debian/libgbinder-radio-dev + rm -f documentation.list debian/files debian/*.substvars + rm -f debian/*.debhelper.log debian/*.debhelper debian/*~ + rm -f debian/*.install $(BUILD_DIR): mkdir -p $@ @@ -189,8 +190,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 @@ -198,15 +210,14 @@ $(PKGCONFIG): $(LIB_NAME).pc.in Makefile INSTALL = install INSTALL_DIRS = $(INSTALL) -d -INSTALL_LIBS = $(INSTALL) -m 755 INSTALL_FILES = $(INSTALL) -m 644 -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_LIBS) $(RELEASE_SO) $(INSTALL_LIB_DIR) + $(INSTALL_FILES) $(RELEASE_SO) $(INSTALL_LIB_DIR) ln -sf $(LIB_SO) $(INSTALL_LIB_DIR)/$(LIB_SYMLINK2) ln -sf $(LIB_SYMLINK2) $(INSTALL_LIB_DIR)/$(LIB_SYMLINK1) diff --git a/debian/libgbinder-radio-dev.install b/debian/libgbinder-radio-dev.install deleted file mode 100644 index 5f1dd8b..0000000 --- a/debian/libgbinder-radio-dev.install +++ /dev/null @@ -1,3 +0,0 @@ -debian/tmp/usr/lib/libgbinder-radio.so usr/lib -include/*.h usr/include/gbinder-radio -build/libgbinder-radio.pc usr/lib/pkgconfig diff --git a/debian/libgbinder-radio-dev.install.in b/debian/libgbinder-radio-dev.install.in new file mode 100644 index 0000000..9e8b7a4 --- /dev/null +++ b/debian/libgbinder-radio-dev.install.in @@ -0,0 +1,3 @@ +debian/tmp/@LIBDIR@/libgbinder-radio.so @LIBDIR@ +debian/tmp/@LIBDIR@/pkgconfig/libgbinder-radio.pc @LIBDIR@/pkgconfig +debian/tmp/usr/include/* usr/include diff --git a/debian/libgbinder-radio.install b/debian/libgbinder-radio.install deleted file mode 100644 index 08b1af8..0000000 --- a/debian/libgbinder-radio.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libgbinder-radio.so.* usr/lib diff --git a/debian/libgbinder-radio.install.in b/debian/libgbinder-radio.install.in new file mode 100644 index 0000000..89a9294 --- /dev/null +++ b/debian/libgbinder-radio.install.in @@ -0,0 +1 @@ +debian/tmp/@LIBDIR@/libgbinder-radio.so.* @LIBDIR@ diff --git a/debian/rules b/debian/rules index 96b0425..20b9467 100755 --- a/debian/rules +++ b/debian/rules @@ -2,8 +2,13 @@ # Uncomment to enable verbose build #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-radio.install debian/libgbinder-radio-dev.install + override_dh_auto_install: - dh_auto_install -- install-dev + dh_auto_install -- LIBDIR=$(LIBDIR) install-dev %: dh $@ diff --git a/libgbinder-radio.pc.in b/libgbinder-radio.pc.in index 3a34423..79e5b4c 100644 --- a/libgbinder-radio.pc.in +++ b/libgbinder-radio.pc.in @@ -1,10 +1,10 @@ name=gbinder-radio -libdir=/usr/lib +libdir=@libdir@ includedir=/usr/include Name: libgbinder-radio Description: Binder client library for Android radio interfaces -Version: [version] -Requires: glib-2.0 libglibutil libgbinder +Version: @version@ +Requires.private: glib-2.0 libglibutil libgbinder Libs: -L${libdir} -l${name} Cflags: -I${includedir} -I${includedir}/${name} diff --git a/rpm/libgbinder-radio.spec b/rpm/libgbinder-radio.spec index 99145dd..8308b1e 100644 --- a/rpm/libgbinder-radio.spec +++ b/rpm/libgbinder-radio.spec @@ -31,11 +31,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 %post -p /sbin/ldconfig