diff --git a/.gitignore b/.gitignore index 6496a2e..1cd7712 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ debian/libmce-glib debian/libmce-glib-dev debian/*.debhelper.log debian/*.debhelper +debian/*.install debian/*.substvars debian/tmp documentation.list diff --git a/Makefile b/Makefile index 41c39aa..5b4d8b3 100644 --- a/Makefile +++ b/Makefile @@ -63,10 +63,7 @@ RELEASE_BUILD_DIR = $(BUILD_DIR)/release # Tools and flags # -ifndef CC -CC = $(CROSS_COMPILE)gcc -endif - +CC ?= $(CROSS_COMPILE)gcc LD = $(CC) DEFINES += -DGLIB_DISABLE_DEPRECATION_WARNINGS WARNINGS = -Wall -Wno-unused-parameter -Wno-multichar @@ -74,14 +71,12 @@ INCLUDES = -I$(INCLUDE_DIR) -I$(GEN_DIR) BASE_FLAGS = -fPIC $(CFLAGS) FULL_CFLAGS = $(BASE_FLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \ $(shell pkg-config --cflags $(PKGS)) -FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIB_SONAME) +FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIB_SONAME) \ + -Wl,--version-script=$(LIB_NAME).map DEBUG_FLAGS = -g RELEASE_FLAGS = -ifndef KEEP_SYMBOLS -KEEP_SYMBOLS = 0 -endif - +KEEP_SYMBOLS ?= 0 ifneq ($(KEEP_SYMBOLS),0) RELEASE_FLAGS += -g endif @@ -138,14 +133,13 @@ debug: $(DEBUG_LIB) $(DEBUG_LINK) release: $(RELEASE_LIB) $(RELEASE_LINK) -pkgconfig: $(PKGCONFIG) - clean: rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~ rpm/*~ rm -fr $(BUILD_DIR) RPMS installroot 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 debian/*~ + rm -f debian/*.install $(GEN_DIR): mkdir -p $@ @@ -186,24 +180,29 @@ $(DEBUG_LINK): $(RELEASE_LINK): ln -sf $(LIB) $@ +# This one could be substituted with arch specific dir +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 $< > $@ + 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 = install INSTALL_DIRS = $(INSTALL) -d -INSTALL_FILES = $(INSTALL) -m $(INSTALL_PERM) +INSTALL_FILES = $(INSTALL) -m 644 -INSTALL_LIB_DIR = $(DESTDIR)/usr/lib +INSTALL_LIB_DIR = $(DESTDIR)$(ABS_LIBDIR) INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/$(LIB_NAME) -INSTALL_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig - -INSTALL_ALIAS = $(INSTALL_LIB_DIR)/$(LIB_SHORTCUT) +INSTALL_PKGCONFIG_DIR = $(DESTDIR)$(ABS_LIBDIR)/pkgconfig install: $(INSTALL_LIB_DIR) $(INSTALL_FILES) $(RELEASE_LIB) $(INSTALL_LIB_DIR) diff --git a/debian/control b/debian/control index 980b66b..2c66284 100644 --- a/debian/control +++ b/debian/control @@ -2,13 +2,13 @@ Source: libmce-glib Section: libs Priority: optional Maintainer: Slava Monich -Build-Depends: debhelper (>= 7), libglib2.0-dev (>= 2.0), libglibutil-dev, mce-dev +Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev (>= 2.0), libglibutil-dev, mce-dev Standards-Version: 3.8.4 Package: libmce-glib Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: libglibutil (>= 1.0.5), ${shlibs:Depends}, ${misc:Depends} Description: Client library for mce Package: libmce-glib-dev diff --git a/debian/libmce-glib-dev.install b/debian/libmce-glib-dev.install deleted file mode 100644 index cce5a7d..0000000 --- a/debian/libmce-glib-dev.install +++ /dev/null @@ -1,3 +0,0 @@ -debian/tmp/usr/lib/libmce-glib.so usr/lib -include/*.h usr/include/libmce-glib -build/libmce-glib.pc usr/lib/pkgconfig diff --git a/debian/libmce-glib-dev.install.in b/debian/libmce-glib-dev.install.in new file mode 100644 index 0000000..c07d428 --- /dev/null +++ b/debian/libmce-glib-dev.install.in @@ -0,0 +1,3 @@ +debian/tmp/@LIBDIR@/libmce-glib.so @LIBDIR@ +debian/tmp/@LIBDIR@/pkgconfig/libmce-glib.pc @LIBDIR@/pkgconfig +debian/tmp/usr/include/* usr/include diff --git a/debian/libmce-glib.install b/debian/libmce-glib.install deleted file mode 100644 index 6a4fd9f..0000000 --- a/debian/libmce-glib.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/libmce-glib.so.* usr/lib diff --git a/debian/libmce-glib.install.in b/debian/libmce-glib.install.in new file mode 100644 index 0000000..661666a --- /dev/null +++ b/debian/libmce-glib.install.in @@ -0,0 +1 @@ +debian/tmp/@LIBDIR@/libmce-glib.so.* @LIBDIR@ diff --git a/debian/rules b/debian/rules index 3a92007..fd7b2a3 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/libmce-glib.install debian/libmce-glib-dev.install + override_dh_auto_install: - dh_auto_install -- install-dev + dh_auto_install -- LIBDIR=$(LIBDIR) install-dev %: dh $@ diff --git a/libmce-glib.map b/libmce-glib.map new file mode 100644 index 0000000..e0d8ab8 --- /dev/null +++ b/libmce-glib.map @@ -0,0 +1,6 @@ +{ + global: + mce_*; + local: + *; +}; diff --git a/libmce-glib.pc.in b/libmce-glib.pc.in index f44a058..c89a268 100644 --- a/libmce-glib.pc.in +++ b/libmce-glib.pc.in @@ -1,9 +1,9 @@ -libdir=/usr/lib +libdir=@libdir@ includedir=/usr/include Name: libmce-glib Description: MCE client library -Version: [version] +Version: @version@ Requires.private: libglibutil glib-2.0 gio-2.0 Libs: -lmce-glib Cflags: -I${includedir}/libmce-glib diff --git a/rpm/libmce-glib.spec b/rpm/libmce-glib.spec index df3dec7..6f4c6e9 100644 --- a/rpm/libmce-glib.spec +++ b/rpm/libmce-glib.spec @@ -28,11 +28,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 diff --git a/src/mce_proxy.c b/src/mce_proxy.c index dcb9ab6..21dc043 100644 --- a/src/mce_proxy.c +++ b/src/mce_proxy.c @@ -1,6 +1,6 @@ /* - * Copyright (C) 2016 Jolla Ltd. - * Contact: Slava Monich + * Copyright (C) 2016-2020 Jolla Ltd. + * Copyright (C) 2016-2020 Slava Monich * * You may use this file under the terms of BSD license as follows: * @@ -13,9 +13,9 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Jolla Ltd nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. + * 3. Neither the names of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -60,6 +60,7 @@ enum mce_proxy_signal { static guint mce_proxy_signals[SIGNAL_COUNT] = { 0 }; typedef GObjectClass MceProxyClass; +GType mce_proxy_get_type() MCE_INTERNAL; G_DEFINE_TYPE(MceProxy, mce_proxy, G_TYPE_OBJECT) #define PARENT_CLASS mce_proxy_parent_class #define MCE_PROXY_TYPE (mce_proxy_get_type()) diff --git a/src/mce_proxy.h b/src/mce_proxy.h index 6f9adbd..f8f0ee9 100644 --- a/src/mce_proxy.h +++ b/src/mce_proxy.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2016 Jolla Ltd. - * Contact: Slava Monich + * Copyright (C) 2016-2020 Jolla Ltd. + * Copyright (C) 2016-2020 Slava Monich * * You may use this file under the terms of BSD license as follows: * @@ -13,9 +13,9 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Jolla Ltd nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. + * 3. Neither the names of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -37,7 +37,7 @@ #ifndef MCE_PROXY_H #define MCE_PROXY_H -#include "mce_types.h" +#include "mce_types_p.h" typedef struct mce_proxy_priv MceProxyPriv; struct _ComNokiaMceSignal; @@ -58,26 +58,31 @@ typedef void MceProxy* mce_proxy_new( - void); + void) + MCE_INTERNAL; MceProxy* mce_proxy_ref( - MceProxy* proxy); + MceProxy* proxy) + MCE_INTERNAL; void mce_proxy_unref( - MceProxy* proxy); + MceProxy* proxy) + MCE_INTERNAL; gulong mce_proxy_add_valid_changed_handler( MceProxy* proxy, MceProxyFunc fn, - void* arg); + void* arg) + MCE_INTERNAL; void mce_proxy_remove_handler( MceProxy* proxy, - gulong id); + gulong id) + MCE_INTERNAL; #endif /* MCE_PROXY_H */ diff --git a/src/mce_types_p.h b/src/mce_types_p.h new file mode 100644 index 0000000..5945069 --- /dev/null +++ b/src/mce_types_p.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2020 Jolla Ltd. + * Copyright (C) 2020 Slava Monich + * + * You may use this file under the terms of BSD license as follows: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation + * are those of the authors and should not be interpreted as representing + * any official policies, either expressed or implied. + */ + +#ifndef MCE_TYPES_PRIVATE_H +#define MCE_TYPES_PRIVATE_H + +#include + +/* Macros */ +#define MCE_INTERNAL G_GNUC_INTERNAL + +#endif /* MCE_TYPES_PRIVATE_H */ + +/* + * Local Variables: + * mode: C + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */