From 7e1056679a6593dd5582778d83cbf4b46e1a0f40 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Aug 15 2018 20:42:29 +0000
Subject: [PATCH 1/3] BUILD: Fix issue with installation of libsss_secrets


libsss_secret.so is linked with libsss_util.so therefore it shoudl be
added into pkglib_LTLIBRARIES after libsss_util.so.
Otherwise there can failure in linking phase.

libtool: warning: relinking 'libsss_secrets.la'
libtool: install: (cd /home/build/sssd/ci-build-debug/intg/bld; /bin/sh
  "/home/build/sssd/ci-build-debug/intg/bld/libtool"  --tag CC
  --mode=relink gcc -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith
  -Wcast-qual -Wcast-align -Wwrite-strings -Wundef
  -Werror-implicit-function-declaration -Winit-self -Wmissing-include-dirs
  -fno-strict-aliasing -std=gnu99 -O2 -g -g3 -O2 -Werror
  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
  -avoid-version -o libsss_secrets.la -rpath
  /tmp/sssd-intg.l7nl5pgb/lib/sssd
  src/util/secrets/libsss_secrets_la-secrets.lo
  src/util/secrets/libsss_secrets_la-config.lo -ltalloc -lldb
  libsss_crypt.la libsss_debug.la libsss_util.la )
libtool: relink: gcc -shared  -fPIC -DPIC
  src/util/secrets/.libs/libsss_secrets_la-secrets.o
  src/util/secrets/.libs/libsss_secrets_la-config.o   -Wl,-rpath
  -Wl,/tmp/sssd-intg.l7nl5pgb/lib/sssd -ltalloc -lldb
  -L/tmp/sssd-intg.l7nl5pgb/lib/sssd -lsss_crypt -lsss_debug -lsss_util
  -O2 -g -g3 -O2   -Wl,-soname -Wl,libsss_secrets.so -o
  .libs/libsss_secrets.so
/usr/bin/ld: cannot find -lsss_util
collect2: error: ld returned 1 exit status
libtool:   error: error: relink 'libsss_secrets.la' with the above
command before installing it

Merges: https://pagure.io/SSSD/sssd/pull-request/3808

---

diff --git a/Makefile.am b/Makefile.am
index d313957..a2d8ea4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1209,28 +1209,6 @@ libsss_iface_sync_la_LDFLAGS = \
     -avoid-version \
     $(NULL)
 
-if BUILD_WITH_LIBSECRET
-pkglib_LTLIBRARIES += libsss_secrets.la
-
-libsss_secrets_la_SOURCES = \
-    src/util/secrets/secrets.c \
-    src/util/secrets/config.c \
-    $(NULL)
-libsss_secrets_la_CFLAGS = \
-    $(AM_CFLAGS) \
-    $(NULL)
-libsss_secrets_la_LIBADD = \
-    $(TALLOC_LIBS) \
-    $(LDB_LIBS) \
-    libsss_crypt.la \
-    libsss_debug.la \
-    libsss_util.la \
-    $(NULL)
-libsss_secrets_la_LDFLAGS = \
-    -avoid-version \
-    $(NULL)
-endif
-
 pkglib_LTLIBRARIES += libsss_util.la
 libsss_util_la_SOURCES = \
     src/confdb/confdb.c \
@@ -1314,6 +1292,27 @@ libsss_util_la_LIBADD += stap_generated_probes.lo
 endif
 libsss_util_la_LDFLAGS = -avoid-version
 
+if BUILD_WITH_LIBSECRET
+pkglib_LTLIBRARIES += libsss_secrets.la
+libsss_secrets_la_SOURCES = \
+    src/util/secrets/secrets.c \
+    src/util/secrets/config.c \
+    $(NULL)
+libsss_secrets_la_CFLAGS = \
+    $(AM_CFLAGS) \
+    $(NULL)
+libsss_secrets_la_LIBADD = \
+    $(TALLOC_LIBS) \
+    $(LDB_LIBS) \
+    libsss_crypt.la \
+    libsss_debug.la \
+    libsss_util.la \
+    $(NULL)
+libsss_secrets_la_LDFLAGS = \
+    -avoid-version \
+    $(NULL)
+endif
+
 pkglib_LTLIBRARIES += libsss_semanage.la
 libsss_semanage_la_CFLAGS = \
     $(AM_CFLAGS) \

From a493a815690d5a6cc803505c692e1038c153f7e0 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Aug 15 2018 20:42:43 +0000
Subject: [PATCH 2/3] BUILD: Add missing deps to libsss_sbus*.so


It indirectly caused failures when linking unit test.

  CCLD     test_sbus_opath
/usr/bin/ld: ./.libs/libsss_sbus.so: undefined reference to `g_utf8_validate'
/usr/bin/ld: ./.libs/libsss_sbus.so: undefined reference to `g_free'
/usr/bin/ld: ./.libs/libsss_sbus.so: undefined reference to `g_malloc'
/usr/bin/ld: ./.libs/libsss_sbus.so: undefined reference to `g_utf8_casefold'
/usr/bin/ld: ./.libs/libsss_sbus.so: undefined reference to `g_utf8_collate'
/usr/bin/ld: ./.libs/libsss_sbus.so: undefined reference to `g_utf8_strlen'
/usr/bin/ld: ./.libs/libsss_sbus.so: undefined reference to `g_utf8_strdown'

Merges: https://pagure.io/SSSD/sssd/pull-request/3808

---

diff --git a/Makefile.am b/Makefile.am
index a2d8ea4..1b4f044 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1105,6 +1105,7 @@ libsss_sbus_la_LIBADD = \
     $(TALLOC_LIBS) \
     $(TEVENT_LIBS) \
     $(DBUS_LIBS) \
+    $(UNICODE_LIBS) \
     $(NULL)
 libsss_sbus_la_CFLAGS = \
     $(AM_CFLAGS) \
@@ -1146,6 +1147,7 @@ libsss_sbus_sync_la_CFLAGS = \
     $(AM_CFLAGS) \
     $(TALLOC_CFLAGS) \
     $(DBUS_CFLAGS) \
+    $(UNICODE_LIBS) \
     $(NULL)
 libsss_sbus_sync_la_LDFLAGS = \
     -avoid-version \

From d9d58e3dea4d714ee2d516c3d23fdb46bada5e2f Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Aug 15 2018 20:42:49 +0000
Subject: [PATCH 3/3] BUILD: Reduce compilation of unnecessary files


We safe compilation of 52 files 2 times with linking to existing
internal libraries.

It also fixes issue with multiple definition of the same symbol

  CCLD     responder_common-tests
/usr/bin/ld: .libs/libsss_debug.so and ../../../src/util/responder_common_tests-debug.o:
  warning: multiple common of `sss_logger'
collect2: error: ld returned 1 exit status

Merges: https://pagure.io/SSSD/sssd/pull-request/3808

---

diff --git a/src/tests/cwrap/Makefile.am b/src/tests/cwrap/Makefile.am
index d5778d1..b63c695 100644
--- a/src/tests/cwrap/Makefile.am
+++ b/src/tests/cwrap/Makefile.am
@@ -66,67 +66,7 @@ SSSD_CACHE_REQ_OBJ = \
     ../../../src/responder/common/cache_req/plugins/cache_req_host_by_name.c \
     $(NULL)
 
-SSSD_SBUS_OBJ = \
-    ../../../src/util/check_and_open.c \
-    ../../../src/util/debug.c \
-    ../../../src/util/sss_ptr_hash.c \
-    ../../../src/util/sss_ptr_list.c \
-    ../../../src/util/sss_utf8.c \
-    ../../../src/util/util.c \
-    ../../../src/util/util_errors.c \
-    ../../../src/util/util_ext.c \
-    ../../../src/util/strtonum.c \
-    ../../../src/sbus/sbus_errors.c \
-    ../../../src/sbus/sbus_opath.c \
-    ../../../src/sbus/connection/sbus_connection.c \
-    ../../../src/sbus/connection/sbus_connection_connect.c \
-    ../../../src/sbus/connection/sbus_dbus.c \
-    ../../../src/sbus/connection/sbus_dispatcher.c \
-    ../../../src/sbus/connection/sbus_reconnect.c \
-    ../../../src/sbus/connection/sbus_send.c \
-    ../../../src/sbus/connection/sbus_watch.c \
-    ../../../src/sbus/interface_dbus/sbus_dbus_arguments.c \
-    ../../../src/sbus/interface_dbus/sbus_dbus_client_async.c \
-    ../../../src/sbus/interface_dbus/sbus_dbus_invokers.c \
-    ../../../src/sbus/interface_dbus/sbus_dbus_keygens.c \
-    ../../../src/sbus/interface_dbus/sbus_dbus_symbols.c \
-    ../../../src/sbus/interface/sbus_interface.c \
-    ../../../src/sbus/interface/sbus_introspection.c \
-    ../../../src/sbus/interface/sbus_iterator_readers.c \
-    ../../../src/sbus/interface/sbus_iterator_writers.c \
-    ../../../src/sbus/interface/sbus_properties.c \
-    ../../../src/sbus/interface/sbus_properties_parser.c \
-    ../../../src/sbus/interface/sbus_std_signals.c \
-    ../../../src/sbus/request/sbus_message.c \
-    ../../../src/sbus/request/sbus_request.c \
-    ../../../src/sbus/request/sbus_request_call.c \
-    ../../../src/sbus/request/sbus_request_hash.c \
-    ../../../src/sbus/request/sbus_request_sender.c \
-    ../../../src/sbus/request/sbus_request_util.c \
-    ../../../src/sbus/router/sbus_router.c \
-    ../../../src/sbus/router/sbus_router_handler.c \
-    ../../../src/sbus/router/sbus_router_hash.c \
-    ../../../src/sbus/server/sbus_server_handler.c \
-    ../../../src/sbus/server/sbus_server_interface.c \
-    ../../../src/sbus/server/sbus_server_match.c \
-    ../../../src/sbus/server/sbus_server.c \
-    $(NULL)
-
-SSSD_IFACE_OBJ = \
-    ../../../src/sss_iface/sbus_sss_arguments.c \
-    ../../../src/sss_iface/sbus_sss_client_async.c \
-    ../../../src/sss_iface/sbus_sss_invokers.c \
-    ../../../src/sss_iface/sbus_sss_keygens.c \
-    ../../../src/sss_iface/sbus_sss_symbols.c \
-    ../../../src/sss_iface/sss_iface_types.c \
-    ../../../src/sss_iface/sss_iface.c \
-    ../../../src/util/domain_info_utils.c \
-    ../../../src/util/sss_pam_data.c \
-    $(NULL)
-
 SSSD_RESPONDER_IFACE_OBJ = \
-    $(SSSD_SBUS_OBJ) \
-    $(SSSD_IFACE_OBJ) \
     ../../../src/responder/common/responder_iface.c \
     $(NULL)
 
@@ -244,6 +184,8 @@ responder_common_tests_LDADD = \
     $(abs_top_builddir)/libsss_util.la \
     $(abs_top_builddir)/libsss_debug.la \
     $(abs_top_builddir)/libsss_test_common.la \
+    $(abs_top_builddir)/libsss_iface.la \
+    $(abs_top_builddir)/libsss_sbus.la \
     $(NULL)
 
 negcache_tests_SOURCES =\
@@ -262,6 +204,8 @@ negcache_tests_LDADD = \
     $(abs_top_builddir)/libsss_util.la \
     $(abs_top_builddir)/libsss_debug.la \
     $(abs_top_builddir)/libsss_test_common.la \
+    $(abs_top_builddir)/libsss_iface.la \
+    $(abs_top_builddir)/libsss_sbus.la \
     $(NULL)
 
 tests: $(check_PROGRAMS)

