[Libreoffice-commits] core.git: configure.ac external/nss

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 23 13:32:50 UTC 2020


 configure.ac                        |   49 ++++++++++++++++++++++++++++++++++++
 external/nss/ExternalProject_nss.mk |    6 +++-
 external/nss/buildsystem.patch.0    |   11 ++++++++
 3 files changed, 65 insertions(+), 1 deletion(-)

New commits:
commit fecca49c309fc723c524f12fa671114b316a5562
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Sat Mar 21 15:28:36 2020 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon Mar 23 14:32:09 2020 +0100

    add a configure check for ninja
    
    Internal NSS now needs it for building on most platforms, so better
    check early in configure.
    
    Change-Id: I45d7038536ea1416443f3b2523f25eee22911485
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90859
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/configure.ac b/configure.ac
index 34708eab7e8f..2e074cf50b78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -586,6 +586,7 @@ test_fontconfig=yes
 test_cairo=no
 test_gdb_index=no
 test_split_debug=no
+nss_needs_ninja=no
 
 # Default values, as such probably valid just for Linux, set
 # differently below just for Mac OSX, but at least better than
@@ -609,6 +610,7 @@ solaris*)
     build_gstreamer_1_0=yes
     test_freetype=yes
     build_skia=yes
+    nss_needs_ninja=yes
     _os=SunOS
 
     dnl ===========================================================
@@ -638,6 +640,7 @@ linux-gnu*|k*bsd*-gnu*)
     build_skia=yes
     test_gdb_index=yes
     test_split_debug=yes
+    nss_needs_ninja=yes
     if test "$enable_fuzzers" != yes; then
         test_freetype=yes
         test_fontconfig=yes
@@ -675,6 +678,7 @@ cygwin*|interix*)
     test_freetype=no
     test_fontconfig=no
     build_skia=yes
+    nss_needs_ninja=yes
     _os=WINNT
 
     DLLPOST=".dll"
@@ -730,6 +734,7 @@ freebsd*)
     test_gtk3_kde5=yes
     test_freetype=yes
     build_skia=yes
+    nss_needs_ninja=yes
     AC_MSG_CHECKING([the FreeBSD operating system release])
     if test -n "$with_os_version"; then
         OSVERSION="$with_os_version"
@@ -758,6 +763,7 @@ freebsd*)
     test_gtk3_kde5=yes
     test_freetype=yes
     build_skia=yes
+    nss_needs_ninja=yes
     PTHREAD_LIBS="-pthread -lpthread"
     _os=NetBSD
     ;;
@@ -771,6 +777,7 @@ aix*)
 
 openbsd*)
     test_freetype=yes
+    nss_needs_ninja=yes
     PTHREAD_CFLAGS="-D_THREAD_SAFE"
     PTHREAD_LIBS="-pthread"
     _os=OpenBSD
@@ -782,6 +789,7 @@ dragonfly*)
     test_gtk3_kde5=yes
     test_freetype=yes
     build_skia=yes
+    nss_needs_ninja=yes
     PTHREAD_LIBS="-pthread"
     _os=DragonFly
     ;;
@@ -9676,6 +9684,47 @@ elif test $_os != iOS ; then
 fi
 AC_SUBST(ENABLE_NSS)
 
+dnl ===================================================================
+dnl Search for ninja
+dnl ===================================================================
+AC_MSG_CHECKING([for ninja])
+
+# try to use our own ninja if it is available and NINJA was not already defined
+if test -z "$NINJA"; then
+    if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ninja" ; then
+        NINJA="$LODE_HOME/opt/bin/ninja"
+    elif test -x "/opt/lo/bin/ninja"; then
+        NINJA="/opt/lo/bin/ninja"
+    fi
+fi
+
+for a in "$NINJA" ninja ninja-build; do
+    if test -n "$a"; then
+        $a --version > /dev/null 2>/dev/null
+        if test $? -eq 0;  then
+            if test "$build_os" = "cygwin"; then
+                # nss requires the Windows version of ninja
+                if test -n "$($a -t list | grep 'msvc')" ; then
+                    NINJA="$(cygpath -m "$(which "$(cygpath -u $a)")")"
+                fi
+            else
+                NINJA=`which $a`
+            fi
+        fi
+        if test -n "$NINJA"; then
+            break
+        fi
+    fi
+done
+if test -n "$NINJA"; then
+    AC_MSG_RESULT($NINJA)
+else
+    AC_MSG_RESULT(not found)
+fi
+if test -z "$NINJA" -a "$nss_needs_ninja" = "yes" -a -n "$ENABLE_NSS" -a -z "$SYSTEM_NSS"; then
+    AC_MSG_ERROR([Not found. NSS build requires Ninja (https://ninja-build.org/).])
+fi
+
 dnl ===================================================================
 dnl Check for TLS/SSL and cryptographic implementation to use
 dnl ===================================================================
diff --git a/external/nss/ExternalProject_nss.mk b/external/nss/ExternalProject_nss.mk
index ee1a9446d41d..1ddcc1fc70e8 100644
--- a/external/nss/ExternalProject_nss.mk
+++ b/external/nss/ExternalProject_nss.mk
@@ -38,6 +38,7 @@ $(call gb_ExternalProject_get_state_target,nss,build): \
 			COMMA=$(COMMA) \
 			PATH=$$(cygpath $(call gb_UnpackedTarball_get_dir,nss)):$$(cygpath $(call gb_UnpackedTarball_get_dir,gyp)):$$PATH \
 			MAKE=$(MAKE) \
+			NINJA=$(NINJA) \
 			NSINSTALL='$(SRCDIR)/external/nss/nsinstall.py' \
 			LIB="$(ILIB)" \
 			RC="rc.exe $(SOLARINC)" \
@@ -51,7 +52,9 @@ $(call gb_ExternalProject_get_state_target,nss,build): \
 	for f in $(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib/*.dll.lib; do mv "$$f" "$${f%.dll.lib}".lib; done
 	$(call gb_Trace_EndRange,nss,EXTERNAL)
 
-else ifneq (,$(filter FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS))) # non-WNT gyp-based
+# non-WNT gyp-based
+# update nss_needs_ninja in configure.ac if the list changes
+else ifneq (,$(filter FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)))
 
 # The nss build system uses 'python', so make it find our internal python if necessary.
 nss_PYTHON := $(call gb_UnpackedTarball_get_dir,nss)/python
@@ -69,6 +72,7 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecuta
 	$(call gb_ExternalProject_run,build,\
 			COMMA=$(COMMA) \
 			PATH=$(call gb_UnpackedTarball_get_dir,nss):$(call gb_UnpackedTarball_get_dir,gyp):$$PATH \
+			NINJA=$(NINJA) \
 			./build.sh -v --disable-tests --enable-libpkix \
 				$(if $(ENABLE_DBGUTIL),,--opt) \
 		&& rm -f $(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib/*.a \
diff --git a/external/nss/buildsystem.patch.0 b/external/nss/buildsystem.patch.0
index f4b876e67620..23583d1e87ba 100644
--- a/external/nss/buildsystem.patch.0
+++ b/external/nss/buildsystem.patch.0
@@ -60,6 +60,17 @@
      fi
  
      run_verbose run_scanbuild ${GYP} -f ninja "${gyp_params[@]}" "$cwd/nss.gyp"
+@@ -261,7 +261,9 @@ if [ "$rebuild_gyp" = 1 ]; then
+ fi
+ 
+ # ninja.
+-if hash ninja-build 2>/dev/null; then
++if test -n "$NINJA"; then
++    ninja="$NINJA"
++elif hash ninja-build 2>/dev/null; then
+     ninja=ninja-build
+ elif hash ninja 2>/dev/null; then
+     ninja=ninja
 @@ -263,4 +263,4 @@
      echo "Building NSS requires an installation of ninja: https://ninja-build.org/" 1>&2
      exit 3


More information about the Libreoffice-commits mailing list