[SSSD] [PATCH] Makefile: Use alternative method to replace *bindir

Lukas Slebodnik lslebodn at redhat.com
Fri Apr 4 13:28:46 UTC 2014


On (04/04/14 14:47), Jakub Hrozek wrote:
>On Fri, Apr 04, 2014 at 10:35:59AM +0200, Lukas Slebodnik wrote:
>> ehlo,
>> 
>> attached patch resolves #2293
>> 
>> LS
>
>I tested the usual builds, both in-tree and parallel and also distcheck
>and just ./configure without parameters. All tests showed expected
>results in the systemd service file.
>
>ACK for master.
>
>Can you send a version that applies on top of sssd-1-11 ? Only the
>journald files must be removed.
If there is a probelm with another file we can use the same approach.
But I want to rely on replacing values by configure script.

Attached patch is for branch 1-11. (journal.conf is not in 1-11 branch)

LS
-------------- next part --------------
>From cc2b6402d536f66061cd0118461d33e007b5a288 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Fri, 4 Apr 2014 10:13:44 +0200
Subject: [PATCH] Makefile: Use alternative method to replace *bindir
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Installation-Directory-Variables.html

Most of these variables have values that rely on prefix or exec_prefix. It is
deliberate that the directory output variables keep them unexpanded: typically
‘@sbindir@’ is replaced by ‘${exec_prefix}/sbin’, not ‘/usr/local/sbin’.
This behavior is mandated by the GNU Coding Standards.

Installation directory variables (sbindir, pkgdatadir ...) should be used
only in makefiles. Similarly, we should not rely on AC_CONFIG_FILES to replace
sbindir and friends in shell scripts and other files; instead, let make
manage their replacement.

Resolves:
https://fedorahosted.org/sssd/ticket/2293
---
 Makefile.am  | 21 +++++++++++++++++++++
 configure.ac |  3 +--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 9056f29d7edde7973416f55069b61a3d08046c3a..5abaf1778de4fd5286b13d3bc0bb35817800e3d8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2032,6 +2032,26 @@ dist_sssdapiplugin_DATA = \
     src/config/etc/sssd.api.d/sssd-proxy.conf \
     src/config/etc/sssd.api.d/sssd-simple.conf
 
+edit_cmd = $(SED) \
+        -e 's|@sbindir[@]|$(sbindir)|g' \
+        -e 's|@environment_file[@]|$(environment_file)|g' \
+        -e 's|@localstatedir[@]|$(localstatedir)|g' \
+        -e 's|@prefix[@]|$(prefix)|g'
+
+replace_script = \
+    @rm -f $@ $@.tmp; \
+    srcdir=''; \
+        test -f ./$@.in || srcdir=$(srcdir)/; \
+        $(edit_cmd) $${srcdir}$@.in >$@.tmp; \
+    mv $@.tmp $@
+
+EXTRA_DIST += \
+    src/sysv/systemd/sssd.service.in
+
+src/sysv/systemd/sssd.service: src/sysv/systemd/sssd.service.in Makefile
+	@$(MKDIR_P) src/sysv/systemd/
+	$(replace_script)
+
 installsssddirs::
 	mkdir -p \
     $(DESTDIR)$(includedir) \
@@ -2139,6 +2159,7 @@ endif
 		rm -Rf $$doc; \
 	done;
 	rm -Rf ldb_mod_test_dir
+	rm -f $(builddir)/src/sysv/systemd/sssd.service
 
 CLEANFILES = *.X */*.X */*/*.X
 
diff --git a/configure.ac b/configure.ac
index c389bec4f2600568e73be4034d29ebcc44bb047f..b7601317d7788d69519691385c6407945e54de24 100644
--- a/configure.ac
+++ b/configure.ac
@@ -306,8 +306,7 @@ AC_DEFINE_UNQUOTED([ABS_BUILD_DIR], ["$abs_build_dir"], [Absolute path to the bu
 AC_SUBST([abs_builddir], $abs_build_dir)
 
 AC_CONFIG_FILES([Makefile contrib/sssd.spec src/examples/rwtab src/doxy.config
-                 src/sysv/systemd/sssd.service src/sysv/sssd
-                 src/sysv/gentoo/sssd src/sysv/SUSE/sssd
+                 src/sysv/sssd src/sysv/gentoo/sssd src/sysv/SUSE/sssd
                  po/Makefile.in src/man/Makefile
                  src/providers/ipa/ipa_hbac.pc src/providers/ipa/ipa_hbac.doxy
                  src/lib/idmap/sss_idmap.pc src/lib/idmap/sss_idmap.doxy
-- 
1.9.0



More information about the sssd-devel mailing list