Commit e768cbbd authored by Slava Monich's avatar Slava Monich

[libwspcodec] Respect arch specific lib dir. JB#49681

parent 7742eb86
*~
build
debian/*.log
debian/*substvars
debian/files
debian/libwspcodec
debian/libwspcodec-dev
debian/libwspcodec.postinst.debhelper
debian/libwspcodec.postrm.debhelper
debian/files
debian/*.debhelper.log
debian/*.debhelper
debian/*.install
debian/*.substvars
debian/tmp
documentation.list
installroot
......
......@@ -18,9 +18,13 @@ all: debug release pkgconfig
VERSION_MAJOR = 2
VERSION_MINOR = 2
VERSION_RELEASE = 1
VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
LIB_SHORTCUT = libwspcodec-$(VERSION).so
NAME = wspcodec
LIB_NAME = lib$(NAME)
LIB_SHORTCUT = $(LIB_NAME)-$(VERSION).so
LIB_SONAME = $(LIB_SHORTCUT)
LIB = $(LIB_SONAME).$(VERSION_RELEASE)
......@@ -48,31 +52,29 @@ LD = $(CC)
WARNINGS = -Wall
INCLUDES = -I$(SRC_DIR)
BASE_FLAGS = -fPIC
CFLAGS = $(BASE_FLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \
$(shell pkg-config --cflags $(PKGS))
LDFLAGS = $(BASE_FLAGS) -shared -Wl,-soname,$(LIB_SONAME) \
FULL_CFLAGS = $(BASE_FLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) \
-MMD -MP $(shell pkg-config --cflags $(PKGS))
FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname=$(LIB_SONAME) \
$(shell pkg-config --libs $(PKGS))
DEBUG_FLAGS = -g
RELEASE_FLAGS =
ifndef KEEP_SYMBOLS
KEEP_SYMBOLS = 0
endif
KEEP_SYMBOLS ?= 0
ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif
DEBUG_LDFLAGS = $(LDFLAGS) $(DEBUG_FLAGS)
RELEASE_LDFLAGS = $(LDFLAGS) $(RELEASE_FLAGS)
DEBUG_CFLAGS = $(CFLAGS) $(DEBUG_FLAGS) -DDEBUG
RELEASE_CFLAGS = $(CFLAGS) $(RELEASE_FLAGS) -O2
DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_FLAGS)
RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG
RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
#
# Files
#
PKGCONFIG = $(BUILD_DIR)/libwspcodec.pc
PKGCONFIG = $(BUILD_DIR)/$(LIB_NAME).pc
DEBUG_OBJS = $(SRC:%.c=$(DEBUG_BUILD_DIR)/%.o)
RELEASE_OBJS = $(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
......@@ -87,6 +89,10 @@ ifneq ($(strip $(DEPS)),)
endif
endif
$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
$(PKGCONFIG): | $(BUILD_DIR)
#
# Rules
#
......@@ -98,14 +104,13 @@ debug: $(DEBUG_LIB)
release: $(RELEASE_LIB)
pkgconfig: $(PKGCONFIG)
clean:
rm -f *~ $(SRC_DIR)/*~
rm -fr $(BUILD_DIR) RPMS installroot
rm -fr debian/tmp debian/libwspcodec debian/libwspcodec-dev
rm -fr debian/tmp debian/$(LIB_NAME) debian/$(LIB_NAME)-dev
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper
rm -f debian/*.install debian/*~
$(BUILD_DIR):
mkdir -p $@
......@@ -116,39 +121,47 @@ $(DEBUG_BUILD_DIR):
$(RELEASE_BUILD_DIR):
mkdir -p $@
$(DEBUG_LIB): $(DEBUG_BUILD_DIR) $(DEBUG_OBJS)
$(DEBUG_LIB): $(DEBUG_OBJS)
$(LD) $(DEBUG_OBJS) $(DEBUG_LDFLAGS) -o $@
$(RELEASE_LIB): $(RELEASE_BUILD_DIR) $(RELEASE_OBJS)
$(RELEASE_LIB): $(RELEASE_OBJS)
$(LD) $(RELEASE_OBJS) $(RELEASE_LDFLAGS) -o $@
ifeq ($(KEEP_SYMBOLS),0)
strip $@
endif
$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(DEBUG_CFLAGS) -MF"$(@:%.o=%.d)" $< -o $@
$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(RELEASE_CFLAGS) -MF"$(@:%.o=%.d)" $< -o $@
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(PKGCONFIG): libwspcodec.pc.in
sed -e 's/\[version\]/'$(VERSION)/g $< > $@
#
# 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: $(PKGCONFIG)
$(PKGCONFIG): $(LIB_NAME).pc.in Makefile
sed -e 's|@version@|$(PCVERSION)|g' -e 's|@libdir@|$(ABS_LIBDIR)|g' $< > $@
debian/%.install: debian/%.install.in
sed 's|@LIBDIR@|$(LIBDIR)|g' $< > $@
#
# Install
#
INSTALL_PERM = 644
INSTALL_OWNER = $(shell id -u)
INSTALL_GROUP = $(shell id -g)
INSTALL = install
INSTALL_DIRS = $(INSTALL) -d
INSTALL_FILES = $(INSTALL) -m $(INSTALL_PERM)
INSTALL_FILES = $(INSTALL) -m 644
INSTALL_LIB_DIR = $(DESTDIR)/usr/lib
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/libwspcodec/wspcodec
INSTALL_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig
INSTALL_LIB_DIR = $(DESTDIR)$(ABS_LIBDIR)
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/$(NAME)
INSTALL_PKGCONFIG_DIR = $(DESTDIR)$(ABS_LIBDIR)/pkgconfig
INSTALL_ALIAS = $(INSTALL_LIB_DIR)/$(LIB_SHORTCUT)
......
......@@ -2,7 +2,7 @@ Source: libwspcodec
Section: libs
Priority: optional
Maintainer: Slava Monich <slava.monich@jolla.com>
Build-Depends: debhelper (>= 7), libglib2.0-dev (>= 2.0)
Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev (>= 2.0)
Standards-Version: 3.8.4
Package: libwspcodec
......
wspcodec/wspcodec.h usr/include/libwspcodec/wspcodec
wspcodec/wsputil.h usr/include/libwspcodec/wspcodec
build/libwspcodec.pc usr/lib/pkgconfig
debian/tmp/@LIBDIR@/pkgconfig/libwspcodec.pc @LIBDIR@/pkgconfig
debian/tmp/usr/include/* usr/include
debian/tmp/usr/lib/libwspcodec*.so* usr/lib
debian/tmp/@LIBDIR@/libwspcodec*.so* @LIBDIR@
......@@ -4,5 +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/libwspcodec.install debian/libwspcodec-dev.install
override_dh_auto_install:
dh_auto_install -- LIBDIR=$(LIBDIR) install-dev
%:
dh $@
libdir=/usr/lib
includedir=/usr/include/libwspcodec
name=wspcodec
libdir=@libdir@
includedir=/usr/include
Name: libwspcodec
Description: WSP encoder and decoder library
Version: [version]
Requires: glib-2.0
Libs: -L${libdir} -lwspcodec-[version]
Cflags: -I${includedir} -I${includedir}/wspcodec
Version: @version@
Requires.private: glib-2.0
Libs: -L${libdir} -l${name}-2.2
Cflags: -I${includedir} -I${includedir}/${name}
......@@ -4,7 +4,7 @@ Release: 0
Summary: WSP encoder and decoder library
Group: Development/Libraries
License: GPLv2
URL: https://git.merproject.org/mer-core/libwspcodec
URL: https://git.sailfishos.org/mer-core/libwspcodec
Source: %{name}-%{version}.tar.bz2
BuildRequires: glib2-devel >= 2.0
Requires(post): /sbin/ldconfig
......@@ -25,11 +25,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
......@@ -37,11 +37,9 @@ make install-dev DESTDIR=%{buildroot}
%files
%defattr(-,root,root,-)
%{_libdir}/%{name}*.so.*
%{_libdir}/%{name}*.so*
%files devel
%defattr(-,root,root,-)
%{_libdir}/%{name}-2.2.so
%{_libdir}/pkgconfig/libwspcodec.pc
%{_includedir}/libwspcodec/wspcodec/wsputil.h
%{_includedir}/libwspcodec/wspcodec/wspcodec.h
%{_libdir}/pkgconfig/*.pc
%{_includedir}/wspcodec
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment