Makefile.am     |   14 +++++++-------
 configure.ac    |   21 +++++++++++++++++++++
 debian/rules    |    6 +-----
 loolwsd.spec.in |    7 ++++---
 4 files changed, 33 insertions(+), 15 deletions(-)

New commits:
commit 51993b8990c8eb0123e860088df09e3ad6436079
Author: Christian Glombek <christian.glom...@rwth-aachen.de>
Date:   Thu Feb 1 14:49:44 2018 +0100

    Adds ENABLE_SETCAP build variable to avoid using env in build system.
    
    Change-Id: Id38d2225238f8b3a48481a08e62cfa7544958cc9
    Reviewed-on: https://gerrit.libreoffice.org/49097
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Tested-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/Makefile.am b/Makefile.am
index 2fce7fdd..542f8d53 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -314,13 +314,13 @@ clang-tidy:
 # installing the RPM or Debian package.
 
 all-local: loolforkit @JAILS_PATH@ $(SYSTEM_STAMP)
-       @if test "$$BUILDING_FROM_RPMBUILD" != yes; then \
-           sudo @SETCAP@ cap_fowner,cap_mknod,cap_sys_chroot=ep loolforkit; \
-           sudo @SETCAP@ cap_sys_admin=ep loolmount; \
-           echo "Set required capabilities"; \
-       else \
-           echo "Skipping capability setting"; \
-       fi
+if ENABLE_SETCAP
+           sudo @SETCAP@ cap_fowner,cap_mknod,cap_sys_chroot=ep loolforkit
+           sudo @SETCAP@ cap_sys_admin=ep loolmount
+           echo "Set required capabilities"
+else
+           echo "Skipping capability setting"
+endif
 
 # just run the build without any tests
 build-nocheck: all-am
diff --git a/configure.ac b/configure.ac
index 3172f12b..ff96e7a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,6 +113,10 @@ AC_ARG_WITH([compiler-plugins],
                 [Experimental! Unlikely to work for anyone except Noel! Enable 
compiler plugins that will perform additional checks during
                  building.]))
 
+AC_ARG_ENABLE([setcap],
+            AS_HELP_STRING([--disable-setcap],
+                          [Do not set capabilities on files. For packaging 
builds]))
+
 # Handle options
 AS_IF([test "$enable_debug" = yes -a -n "$with_poco_libs"],
       [POCO_DEBUG_SUFFIX=d],
@@ -395,6 +399,22 @@ AC_SUBST(LOOLWSD_CONFIGDIR)
 LOOLWSD_DATADIR=${datadir}/${PACKAGE}
 AC_SUBST(LOOLWSD_DATADIR)
 
+AS_IF([test "$enable_setcap" != "no"],
+      [AC_DEFINE([ENABLE_SETCAP],1,[Whether to enable setting of 
capabilities])],
+      [AC_DEFINE([ENABLE_SETCAP],0,[Whether to enable setting of 
capabilities])])
+
+AM_CONDITIONAL([ENABLE_SETCAP], [test "$enable_setcap" != "no"])
+
+ENABLE_SETCAP=
+if test "$enable_setcap" != "no"; then
+    ENABLE_SETCAP=true
+    setcap_msg="setcap enabled"
+else
+    setcap_msg="setcap disabled"
+fi
+
+AC_SUBST(ENABLE_SETCAP)
+
 AC_CONFIG_FILES([Makefile
                  test/Makefile
                  loleaflet/Makefile
@@ -414,6 +434,7 @@ Configuration:
     LO integration tests    ${lo_msg}
     SSL support             $ssl_msg
     Debug & low security    $debug_msg
+    Set capabilities        $setcap_msg
 
     \$ make # to compile"
 if test -n "$with_lo_path"; then
diff --git a/debian/rules b/debian/rules
index 976dbde7..fe3d10b3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,11 +5,7 @@ DPKG_EXPORT_BUILDFLAGS = 1
 
 include /usr/share/dpkg/default.mk
 
-CONFFLAGS = --enable-silent-rules --prefix=/usr --localstatedir=/var 
--sysconfdir=/etc --with-lokit-path=`pwd`/bundled/include $(CONFIG_OPTIONS)
-
-# Avoid setcap when doing "make", when building for packaging
-# the setcap is done at installation time
-export BUILDING_FROM_RPMBUILD=yes
+CONFFLAGS = --enable-silent-rules --prefix=/usr --localstatedir=/var 
--sysconfdir=/etc --with-lokit-path=`pwd`/bundled/include --disable-setcap 
$(CONFIG_OPTIONS)
 
 # main packaging script based on dh7 syntax
 %:
diff --git a/loolwsd.spec.in b/loolwsd.spec.in
index 0933b1a3..ebfdf7f7 100644
--- a/loolwsd.spec.in
+++ b/loolwsd.spec.in
@@ -65,17 +65,18 @@ Obsoletes:      loleaflet <= 1.5.8
        --enable-silent-rules \
        --with-lokit-path=bundled/include \
        --with-lo-path=%{loroot} \
+       --disable-setcap \
 %if 0%{?config_options:1}
        %{config_options}
 %endif
 
-env BUILDING_FROM_RPMBUILD=yes make %{?_smp_mflags}
+make %{?_smp_mflags}
 
 %check
-#env BUILDING_FROM_RPMBUILD=yes make check
+#make check
 
 %install
-env BUILDING_FROM_RPMBUILD=yes make install DESTDIR=%{buildroot}
+make install DESTDIR=%{buildroot}
 %__install -D -m 444 loolwsd.service %{buildroot}%{_unitdir}/loolwsd.service
 install -d -m 755 %{buildroot}/var/adm/fillup-templates
 %if 0%{?fedora} || 0%{?rhel} >= 7
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to