From 046a9dcf2dfee981fa0679752fd1bb7420ec48dc Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: May 26 2018 16:31:40 +0000
Subject: [PATCH 1/9] BUILD: Remove unnecessary *flags from test_ipa_dn


sh-4.4$ grep wrap src/providers/ipa/ipa_dn.c src/tests/cmocka/test_ipa_dn.c
sh-4.4$ grep UNIT_TESTING src/providers/ipa/ipa_dn.c src/tests/cmocka/test_ipa_dn.c

---

diff --git a/Makefile.am b/Makefile.am
index 9c65aed..0d63013 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3391,18 +3391,13 @@ test_ipa_dn_SOURCES = \
     src/providers/ipa/ipa_dn.c \
     src/tests/cmocka/test_ipa_dn.c \
     $(NULL)
-test_ipa_dn_CFLAGS = \
-    $(AM_CFLAGS) \
-    -DUNIT_TESTING \
-    $(NULL)
-test_ipa_dn_LDFLAGS = \
-    -Wl,-wrap,_tevent_add_timer \
-    $(NULL)
 test_ipa_dn_LDADD = \
     $(CMOCKA_LIBS) \
-    $(SSSD_LIBS) \
+    $(POPT_LIBS) \
+    $(LDB_LIBS) \
+    $(TEVENT_LIBS) \
+    $(TALLOC_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
-    $(LIBADD_DL) \
     libsss_test_common.la \
     $(NULL)
 

From 3ab081a953bea83ee99702802cd08dcec6c563e8 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: May 26 2018 19:59:51 +0000
Subject: [PATCH 2/9] BUILD: Remove ldap libraries from SSSD_LIBS


They are not used in any responder.

---

diff --git a/Makefile.am b/Makefile.am
index 0d63013..131e052 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -616,7 +616,6 @@ SSSD_LIBS = \
     $(INI_CONFIG_LIBS) \
     $(COLLECTION_LIBS) \
     $(DHASH_LIBS) \
-    $(OPENLDAP_LIBS) \
     $(SELINUX_LIBS) \
     $(TDB_LIBS)
 
@@ -2603,6 +2602,7 @@ nestedgroups_tests_CFLAGS = \
     $(NULL)
 nestedgroups_tests_LDADD = \
     $(CMOCKA_LIBS) \
+    $(OPENLDAP_LIBS) \
     $(SSSD_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     libsss_idmap.la \
@@ -2740,6 +2740,7 @@ ad_gpo_tests_CFLAGS = \
     $(NULL)
 ad_gpo_tests_LDADD = \
     $(CMOCKA_LIBS) \
+    $(OPENLDAP_LIBS) \
     $(SSSD_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     $(NDR_NBT_LIBS) \

From 76ef3299272e7d5989492a4865dd92a9eef2f717 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: May 26 2018 19:59:51 +0000
Subject: [PATCH 3/9] BUILD: Remove ldap libraries from TOOL_LIBS


Just backed need to be linked with openldap libraries.
Neither of tools need them.

---

diff --git a/Makefile.am b/Makefile.am
index 131e052..b29bdc4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -636,7 +636,6 @@ TOOLS_LIBS = \
     $(INI_CONFIG_LIBS) \
     $(COLLECTION_LIBS) \
     $(DHASH_LIBS) \
-    $(OPENLDAP_LIBS) \
     $(TDB_LIBS)
 
 if BUILD_SELINUX

From 920e1240afc7da82f45c0ffed579a54cf55ae134 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: May 26 2018 19:59:51 +0000
Subject: [PATCH 4/9] BUILD: Remove pcre libs from common *_LIBS


PCRE is used just in libsss_util and krb5 provider
(+ few unit tests)

sh$ git grep pcre_free
src/providers/krb5/krb5_init.c:        pcre_free(ctx->illegal_path_re);
src/tests/krb5_child-test.c:        pcre_free(ctx->illegal_path_re);
src/tests/krb5_utils-tests.c:    pcre_free(illegal_re);
src/util/usertools.c:        pcre_free(snctx->re);
src/util/usertools.c:        pcre_free_substring(result);
src/util/usertools.c:                pcre_free_substring(result);
src/util/usertools.c:                pcre_free_substring(result);

---

diff --git a/Makefile.am b/Makefile.am
index b29bdc4..d3872b0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -612,7 +612,6 @@ SSSD_LIBS = \
     $(POPT_LIBS) \
     $(LDB_LIBS) \
     $(DBUS_LIBS) \
-    $(PCRE_LIBS) \
     $(INI_CONFIG_LIBS) \
     $(COLLECTION_LIBS) \
     $(DHASH_LIBS) \
@@ -632,7 +631,6 @@ TOOLS_LIBS = \
     $(POPT_LIBS) \
     $(LDB_LIBS) \
     $(DBUS_LIBS) \
-    $(PCRE_LIBS) \
     $(INI_CONFIG_LIBS) \
     $(COLLECTION_LIBS) \
     $(DHASH_LIBS) \
@@ -1064,6 +1062,7 @@ libsss_util_la_LIBADD = \
     $(SSSD_LIBS) \
     $(SYSTEMD_LOGIN_LIBS) \
     $(UNICODE_LIBS) \
+    $(PCRE_LIBS) \
     libsss_debug.la \
     libsss_child.la \
     libsss_crypt.la \
@@ -2009,6 +2008,7 @@ krb5_utils_tests_LDADD = \
     $(CARES_LIBS) \
     $(KRB5_LIBS) \
     $(CHECK_LIBS) \
+    $(PCRE_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 
@@ -2288,6 +2288,7 @@ krb5_child_test_LDADD = \
     $(CARES_LIBS) \
     $(KRB5_LIBS) \
     $(CHECK_LIBS) \
+    $(PCRE_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     libsss_test_common.la
 

From 08ffad3e1d3d7320c9c06702a7755336f231e41c Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: May 26 2018 19:59:51 +0000
Subject: [PATCH 5/9] BUILD: Remove pcre from krb5_child


sh# objdump -T /usr/libexec/sssd/krb5_child | grep pcre
sh# echo $?
1

---

diff --git a/Makefile.am b/Makefile.am
index d3872b0..30d3137 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4140,7 +4140,6 @@ krb5_child_CFLAGS = \
     $(AM_CFLAGS) \
     $(POPT_CFLAGS) \
     $(KRB5_CFLAGS) \
-    $(PCRE_CFLAGS) \
     $(SYSTEMD_LOGIN_CFLAGS) \
     $(NULL)
 krb5_child_LDADD = \
@@ -4150,7 +4149,6 @@ krb5_child_LDADD = \
     $(DHASH_LIBS) \
     $(KRB5_LIBS) \
     $(CLIENT_LIBS) \
-    $(PCRE_LIBS) \
     $(SYSTEMD_LOGIN_LIBS) \
     $(NULL)
 

From 6614d7555f5d5d38916dbaaf3131eba3440d5fc9 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: May 26 2018 19:59:51 +0000
Subject: [PATCH 6/9] BUILD: Remove libcollection form common *libs


libcollection is not used directly by sssd.

sh$ git grep " col_"
sh$ echo $?
1

---

diff --git a/Makefile.am b/Makefile.am
index 30d3137..1580655 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -497,7 +497,6 @@ AM_CPPFLAGS = \
     $(LDB_CFLAGS) \
     $(DBUS_CFLAGS) \
     $(PCRE_CFLAGS) \
-    $(COLLECTION_CFLAGS) \
     $(INI_CONFIG_CFLAGS) \
     $(DHASH_CFLAGS) \
     $(LIBNL_CFLAGS) \
@@ -613,7 +612,6 @@ SSSD_LIBS = \
     $(LDB_LIBS) \
     $(DBUS_LIBS) \
     $(INI_CONFIG_LIBS) \
-    $(COLLECTION_LIBS) \
     $(DHASH_LIBS) \
     $(SELINUX_LIBS) \
     $(TDB_LIBS)
@@ -632,7 +630,6 @@ TOOLS_LIBS = \
     $(LDB_LIBS) \
     $(DBUS_LIBS) \
     $(INI_CONFIG_LIBS) \
-    $(COLLECTION_LIBS) \
     $(DHASH_LIBS) \
     $(TDB_LIBS)
 

From 93fbe6374d3c4a909e0266f462dbb5975f2de1be Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: May 26 2018 19:59:51 +0000
Subject: [PATCH 7/9] BUILD: reduce dependencies of sss_signal


sss_signal is tiny binary which can call only
function "sss_signal" or debug related functions

---

diff --git a/Makefile.am b/Makefile.am
index 1580655..a470a76 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1711,11 +1711,10 @@ sss_seed_LDADD = \
 
 sss_signal_SOURCES = \
     src/tools/sss_signal.c \
-    $(SSSD_TOOLS_OBJ) \
+    src/tools/common/sss_process.c
     $(NULL)
 sss_signal_LDADD = \
-    $(TOOLS_LIBS) \
-    $(SSSD_INTERNAL_LTLIBS) \
+    libsss_debug.la \
     $(NULL)
 
 sss_override_SOURCES = \

From aed3af7862abcfcb5f9d26affe0f1d6f76f6ef8a Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: May 26 2018 19:59:51 +0000
Subject: [PATCH 8/9] BUILD: Remove cares from sssd_secrets


The secrets responder does not use any name resolution functions.

sh$ objdump -T /usr/libexec/sssd/sssd_secrets | grep ares
sh$ echo $?
1

---

diff --git a/Makefile.am b/Makefile.am
index a470a76..93f65f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1516,7 +1516,6 @@ sssd_secrets_LDADD = \
     $(TDB_LIBS) \
     $(SSSD_LIBS) \
     $(SYSTEMD_DAEMON_LIBS) \
-    $(CARES_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     $(CURL_LIBS) \
     $(NULL)

From 9caf5d9afbbc086d6fb5b43c07ef396b6fa2dd54 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: May 26 2018 19:59:51 +0000
Subject: [PATCH 9/9] BUILD: Remove libini_config from common libs


The libini_config is not directly used by responders or tools.

---

diff --git a/Makefile.am b/Makefile.am
index 93f65f3..734ddaf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -611,7 +611,6 @@ SSSD_LIBS = \
     $(POPT_LIBS) \
     $(LDB_LIBS) \
     $(DBUS_LIBS) \
-    $(INI_CONFIG_LIBS) \
     $(DHASH_LIBS) \
     $(SELINUX_LIBS) \
     $(TDB_LIBS)
@@ -629,7 +628,6 @@ TOOLS_LIBS = \
     $(POPT_LIBS) \
     $(LDB_LIBS) \
     $(DBUS_LIBS) \
-    $(INI_CONFIG_LIBS) \
     $(DHASH_LIBS) \
     $(TDB_LIBS)
 
@@ -1060,6 +1058,7 @@ libsss_util_la_LIBADD = \
     $(SYSTEMD_LOGIN_LIBS) \
     $(UNICODE_LIBS) \
     $(PCRE_LIBS) \
+    $(INI_CONFIG_LIBS) \
     libsss_debug.la \
     libsss_child.la \
     libsss_crypt.la \
@@ -1744,6 +1743,7 @@ sssctl_SOURCES = \
     $(NULL)
 sssctl_LDADD = \
     $(TOOLS_LIBS) \
+    $(INI_CONFIG_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     $(PAM_LIBS) \
     $(PAM_MISC_LIBS) \

