try again
[debian/sudo] / debian / rules
index 3f924fa9558037fbd95638101d31094e2af73b94..87d7432e816bcda5845ea661bba3c7a612e72bc0 100755 (executable)
@@ -2,23 +2,33 @@
 
 export DH_VERBOSE=1
 
-CFLAGS = -Wall -Wno-comment -g
-ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
-    CFLAGS += -O0
-else
-    CFLAGS += -O2
+CFLAGS = `dpkg-buildflags --get CFLAGS`
+CFLAGS += -Wall -Wno-comment
+LDFLAGS = `dpkg-buildflags --get LDFLAGS`
+CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
+
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
+ifeq ($(DEB_HOST_ARCH_OS),linux)
+  configure_args += --with-selinux
 endif
-export CFLAGS
+
+reconf-stamp:
+       cp -f /usr/share/misc/config.sub config.sub
+       cp -f /usr/share/misc/config.guess config.guess
+       autoconf -I m4
+       touch $@
 
 configure: configure-stamp
-configure-stamp:
+configure-stamp: reconf-stamp
        dh_testdir
        cp -f /usr/share/misc/config.sub config.sub
        cp -f /usr/share/misc/config.guess config.guess
 
        # simple version
        mkdir -p build-simple
-       cd build-simple && NROFFPROG=/usr/bin/nroff $(CURDIR)/configure \
+       cd build-simple && NROFFPROG=/usr/bin/nroff CFLAGS="$(CFLAGS)" \
+           CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(CURDIR)/configure \
                --prefix=/usr -v \
                --with-all-insults \
                --with-pam \
@@ -34,11 +44,14 @@ configure-stamp:
                --with-sendmail=/usr/sbin/sendmail \
                --with-timedir=/var/lib/sudo \
                --mandir=/usr/share/man \
-               --libexecdir=/usr/lib/sudo
+               --libexecdir=/usr/lib/sudo \
+               --with-sssd --with-sssd-lib=/usr/lib/$(DEB_HOST_MULTIARCH) \
+               $(configure_args)
 
        # LDAP version
        mkdir -p build-ldap
-       cd build-ldap && NROFFPROG=/usr/bin/nroff $(CURDIR)/configure \
+       cd build-ldap && NROFFPROG=/usr/bin/nroff CFLAGS="$(CFLAGS)" \
+           CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(CURDIR)/configure \
                --prefix=/usr -v \
                --with-all-insults \
                --with-pam \
@@ -131,13 +144,19 @@ install: build-stamp
        install -o root -g root -m 0440 debian/README \
                debian/sudo-ldap/etc/sudoers.d/README
 
+       install -o root -g root -m 0644 debian/sudo.service \
+               debian/sudo/lib/systemd/system/sudo.service
+       install -o root -g root -m 0644 debian/sudo.service \
+               debian/sudo-ldap/lib/systemd/system/sudo.service
+
 binary-indep: build install
 
 binary-arch: build install
        dh_testdir
        dh_testroot
        dh_installdocs -A
-       dh_installinit -psudo -psudo-ldap --name=sudo
+       dh_installinit -psudo --name=sudo
+       dh_installinit -psudo-ldap --name=sudo-ldap
        dh_installman -A
        dh_installinfo -A
        dh_installchangelogs ChangeLog