You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2017/07/27 17:10:52 UTC

svn commit: r1803210 - in /subversion/trunk: ./ build/ac-macros/ subversion/ subversion/libsvn_subr/ subversion/libsvn_subr/utf8proc/ subversion/tests/libsvn_subr/

Author: philip
Date: Thu Jul 27 17:10:51 2017
New Revision: 1803210

URL: http://svn.apache.org/viewvc?rev=1803210&view=rev
Log:
Build against the system utf8proc library by default instead of the
internal copy of the utf8proc code.  Add --with-utf8proc=PREFIX|internal
to allow the user to specify either where to find utf8proc or that the
internal copy be used.  The Windows build will continue to use the
internal utf8proc code.

* build/ac-macros/utf8proc.m4: New.

* aclocal.m4: Include utf8proc.m4.

* configure.ac: Call SVN_UTF8PROC.

* Makefile.in
  (SVN_UTF8PROC_LIBS, SVN_UTF8PROC_INCLUDES): New.

* build.conf
  (libsvn_subr): Add utf8proc to link.
  (utf8proc): New.

* subversion/libsvn_subr/utf8proc/utf8proc.h: Rename to ...

* subversion/libsvn_subr/utf8proc/utf8proc_internal.h: ... this.

* subversion/libsvn_subr/utf8proc/utf8proc.c: Include svn_private_config.h
   and utf8proc_internal.h, protect with SVN_INTERNAL_UTF8PROC.

* subversion/libsvn_subr/utf8proc.c: Include system utf8proc.h or internal
   utf8proc.c.

* subversion/svn_private_config.hw: Define SVN_INTERNAL_UTF8PROC to
   enable internal copy of utf8proc.

* subversion/tests/libsvn_subr/utf-test.c
  (test_utf_fuzzy_escape): Allow for small output difference between
   utf8proc 1.x and 2.x.

Added:
    subversion/trunk/build/ac-macros/utf8proc.m4
    subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc_internal.h
      - copied, changed from r1803209, subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.h
Removed:
    subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.h
Modified:
    subversion/trunk/Makefile.in
    subversion/trunk/aclocal.m4
    subversion/trunk/build.conf
    subversion/trunk/configure.ac
    subversion/trunk/subversion/libsvn_subr/utf8proc.c
    subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c
    subversion/trunk/subversion/svn_private_config.hw
    subversion/trunk/subversion/tests/libsvn_subr/utf-test.c

Modified: subversion/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/trunk/Makefile.in?rev=1803210&r1=1803209&r2=1803210&view=diff
==============================================================================
--- subversion/trunk/Makefile.in (original)
+++ subversion/trunk/Makefile.in Thu Jul 27 17:10:51 2017
@@ -55,6 +55,7 @@ SVN_SQLITE_LIBS = @SVN_SQLITE_LIBS@
 SVN_XML_LIBS = @SVN_XML_LIBS@
 SVN_ZLIB_LIBS = @SVN_ZLIB_LIBS@
 SVN_LZ4_LIBS = @SVN_LZ4_LIBS@
+SVN_UTF8PROC_LIBS = @SVN_UTF8PROC_LIBS@
 
 LIBS = @LIBS@
 
@@ -131,7 +132,8 @@ INCLUDES = -I$(top_srcdir)/subversion/in
            @SVN_DB_INCLUDES@ @SVN_GNOME_KEYRING_INCLUDES@ \
            @SVN_KWALLET_INCLUDES@ @SVN_MAGIC_INCLUDES@ \
            @SVN_SASL_INCLUDES@ @SVN_SERF_INCLUDES@ @SVN_SQLITE_INCLUDES@ \
-           @SVN_XML_INCLUDES@ @SVN_ZLIB_INCLUDES@ @SVN_LZ4_INCLUDES@
+           @SVN_XML_INCLUDES@ @SVN_ZLIB_INCLUDES@ @SVN_LZ4_INCLUDES@ \
+           @SVN_UTF8PROC_INCLUDES@
 
 APACHE_INCLUDES = @APACHE_INCLUDES@
 APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@

Modified: subversion/trunk/aclocal.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/aclocal.m4?rev=1803210&r1=1803209&r2=1803210&view=diff
==============================================================================
--- subversion/trunk/aclocal.m4 (original)
+++ subversion/trunk/aclocal.m4 Thu Jul 27 17:10:51 2017
@@ -47,6 +47,7 @@ sinclude(build/ac-macros/zlib.m4)
 sinclude(build/ac-macros/lz4.m4)
 sinclude(build/ac-macros/kwallet.m4)
 sinclude(build/ac-macros/libsecret.m4)
+sinclude(build/ac-macros/utf8proc.m4)
 sinclude(build/ac-macros/macosx.m4)
 
 # Include the libtool macros

Modified: subversion/trunk/build.conf
URL: http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1803210&r1=1803209&r2=1803210&view=diff
==============================================================================
--- subversion/trunk/build.conf (original)
+++ subversion/trunk/build.conf Thu Jul 27 17:10:51 2017
@@ -47,7 +47,7 @@ private-includes =
         subversion/bindings/javahl/native/jniwrapper/jni_*.hpp
         tools/dev/svnmover/linenoise/linenoise.h
         tools/dev/svnmover/linenoise/linenoise.c
-        subversion/libsvn_subr/utf8proc/utf8proc.h
+        subversion/libsvn_subr/utf8proc/utf8proc_internal.h
         subversion/libsvn_subr/utf8proc/utf8proc.c
         subversion/libsvn_subr/utf8proc/utf8proc_data.c
 private-built-includes =
@@ -371,7 +371,7 @@ type = lib
 install = fsmod-lib
 path = subversion/libsvn_subr
 sources = *.c lz4/*.c
-libs = aprutil apriconv apr xml zlib apr_memcache sqlite magic intl lz4
+libs = aprutil apriconv apr xml zlib apr_memcache sqlite magic intl lz4 utf8proc
 msvc-libs = kernel32.lib advapi32.lib shfolder.lib ole32.lib
             crypt32.lib version.lib
 msvc-export = 
@@ -1487,6 +1487,10 @@ msvc-static = yes
 type = lib
 external-lib = $(SVN_LZ4_LIBS)
 
+[utf8proc]
+type = lib
+external-lib = $(SVN_UTF8PROC_LIBS)
+
 [apr_memcache]
 type = lib
 external-lib = $(SVN_APR_MEMCACHE_LIBS)

Added: subversion/trunk/build/ac-macros/utf8proc.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/utf8proc.m4?rev=1803210&view=auto
==============================================================================
--- subversion/trunk/build/ac-macros/utf8proc.m4 (added)
+++ subversion/trunk/build/ac-macros/utf8proc.m4 Thu Jul 27 17:10:51 2017
@@ -0,0 +1,77 @@
+dnl ===================================================================
+dnl   Licensed to the Apache Software Foundation (ASF) under one
+dnl   or more contributor license agreements.  See the NOTICE file
+dnl   distributed with this work for additional information
+dnl   regarding copyright ownership.  The ASF licenses this file
+dnl   to you under the Apache License, Version 2.0 (the
+dnl   "License"); you may not use this file except in compliance
+dnl   with the License.  You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl   Unless required by applicable law or agreed to in writing,
+dnl   software distributed under the License is distributed on an
+dnl   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+dnl   KIND, either express or implied.  See the License for the
+dnl   specific language governing permissions and limitations
+dnl   under the License.
+dnl ===================================================================
+dnl
+dnl The default is simply to link with -lutf8proc.
+dnl
+dnl The user can specify --with-utf8proc=PREFIX to look in PREFIX or
+dnl --with-utf8proc=internal to use the internal copy of the utf8proc
+dnl code.
+
+AC_DEFUN(SVN_UTF8PROC,
+[
+  AC_ARG_WITH([utf8proc],
+    [AS_HELP_STRING([--with-utf8proc=PREFIX|internal],
+                    [look for utf8proc in PREFIX or use the internal code])],
+    [utf8proc_prefix="$withval"],
+    [utf8proc_prefix=std])
+
+  if test "$utf8proc_prefix" = "internal"; then
+    AC_MSG_NOTICE([using internal utf8proc])
+    AC_DEFINE([SVN_INTERNAL_UTF8PROC], [1],
+               [Define to use internal UTF8PROC code])
+  else
+    if test "$utf8proc_prefix" = "std"; then
+      SVN_UTF8PROC_STD
+    else
+      SVN_UTF8PROC_PREFIX
+    fi
+    if test "$utf8proc_found" != "yes"; then
+      AC_MSG_ERROR([Subversion requires UTF8PROC])
+    fi
+  fi
+  AC_SUBST(SVN_UTF8PROC_INCLUDES)
+  AC_SUBST(SVN_UTF8PROC_LIBS)
+])
+
+AC_DEFUN(SVN_UTF8PROC_STD,
+[
+  AC_MSG_NOTICE([utf8proc configuration without pkg-config])
+  AC_CHECK_LIB(utf8proc, utf8proc_version, [
+    AC_MSG_RESULT([yes])
+     utf8proc_found=yes
+     SVN_UTF8PROC_LIBS="-lutf8proc"
+  ])
+])
+
+AC_DEFUN(SVN_UTF8PROC_PREFIX,
+[
+  AC_MSG_NOTICE([utf8proc configuration via prefix])
+  save_cppflags="$CPPFLAGS"
+  CPPFLAGS="$CPPFLAGS -I$utf8proc_prefix/include"
+  save_ldflags="$LDFLAGS"
+  LDFLAGS="$LDFLAGS -L$utf8proc_prefix/lib"
+  AC_CHECK_LIB(utf8proc, utf8proc_version, [
+    AC_MSG_RESULT([yes])
+    utf8proc_found=yes
+    SVN_UTF8PROC_INCLUDES="-I$utf8proc_prefix/include"
+    SVN_UTF8PROC_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS(-L$utf8proc_prefix/lib)` -lutf8proc"
+  ])
+  LDFLAGS="$save_ldflags"
+  CPPFLAGS="$save_cppflags"
+])

Modified: subversion/trunk/configure.ac
URL: http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1803210&r1=1803209&r2=1803210&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Thu Jul 27 17:10:51 2017
@@ -1218,6 +1218,8 @@ SVN_LIB_Z
 
 SVN_LZ4
 
+SVN_UTF8PROC
+
 MOD_ACTIVATION=""
 AC_ARG_ENABLE(mod-activation,
 AS_HELP_STRING([--enable-mod-activation],

Modified: subversion/trunk/subversion/libsvn_subr/utf8proc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf8proc.c?rev=1803210&r1=1803209&r2=1803210&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf8proc.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf8proc.c Thu Jul 27 17:10:51 2017
@@ -29,12 +29,16 @@
 #include "private/svn_utf_private.h"
 #include "svn_private_config.h"
 
+#if SVN_INTERNAL_UTF8PROC
 #define UTF8PROC_INLINE
 /* Somehow utf8proc thinks it is nice to use strlen as an argument name,
    while this function is already defined via apr.h */
 #define strlen svn__strlen_var
 #include "utf8proc/utf8proc.c"
 #undef strlen
+#else
+#include <utf8proc.h>
+#endif
 
 
 

Modified: subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c?rev=1803210&r1=1803209&r2=1803210&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c Thu Jul 27 17:10:51 2017
@@ -1,3 +1,5 @@
+#include "svn_private_config.h"
+#if SVN_INTERNAL_UTF8PROC
 /*
  *  Copyright (c) 2009 Public Software Group e. V., Berlin, Germany
  *
@@ -39,7 +41,7 @@
  */
 
 
-#include "utf8proc.h"
+#include "utf8proc_internal.h"
 #include "utf8proc_data.c"
 
 
@@ -609,3 +611,4 @@ uint8_t *utf8proc_NFKC(const uint8_t *st
   return retval;
 }
 
+#endif /* SVN_INTERNAL_UTF8PROC */

Copied: subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc_internal.h (from r1803209, subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.h)
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc_internal.h?p2=subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc_internal.h&p1=subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.h&r1=1803209&r2=1803210&rev=1803210&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.h (original)
+++ subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc_internal.h Thu Jul 27 17:10:51 2017
@@ -1,3 +1,5 @@
+#include "svn_private_config.h"
+#if SVN_INTERNAL_UTF8PROC
 /*
  *  Copyright (c) 2009 Public Software Group e. V., Berlin, Germany
  *
@@ -447,4 +449,4 @@ uint8_t *utf8proc_NFKC(const uint8_t *st
 #endif
 
 #endif
-
+#endif /* SVN_INTERNAL_UTF8PROC */

Modified: subversion/trunk/subversion/svn_private_config.hw
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn_private_config.hw?rev=1803210&r1=1803209&r2=1803210&view=diff
==============================================================================
--- subversion/trunk/subversion/svn_private_config.hw (original)
+++ subversion/trunk/subversion/svn_private_config.hw Thu Jul 27 17:10:51 2017
@@ -80,6 +80,9 @@
 /* Use the internal LZ4 code */
 #define SVN_INTERNAL_LZ4 1
 
+/* Use the internal utf8proc code */
+#define SVN_INTERNAL_UTF8PROC 1
+
 /* Define to the Python/C API format character suitable for apr_int64_t */
 #if defined(_WIN64)
 #define SVN_APR_INT64_T_PYCFMT "l"

Modified: subversion/trunk/subversion/tests/libsvn_subr/utf-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/utf-test.c?rev=1803210&r1=1803209&r2=1803210&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/utf-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/utf-test.c Thu Jul 27 17:10:51 2017
@@ -664,11 +664,18 @@ test_utf_fuzzy_escape(apr_pool_t *pool)
   SVN_TEST_ASSERT(0 == strcmp(fuzzy, "Subversi{U+03BF}n"));
 
   fuzzy = svn_utf__fuzzy_escape(invalid, sizeof(invalid) - 1, pool);
-  /*fprintf(stderr, "%s\n", fuzzy);*/
+
+  /* utf8proc 1.1.15 produces {U?FDD1} while 2.x produces {U+FDD1} */
   SVN_TEST_ASSERT(0 == strcmp(fuzzy,
                               "Not Unicode: {U?FDD1};"
                               "Out of range: ?\\F4?\\90?\\80?\\81;"
                               "Not UTF-8: ?\\E6;"
+                              "Null byte: \\0;")
+                  ||
+                  0 == strcmp(fuzzy,
+                              "Not Unicode: {U+FDD1};"
+                              "Out of range: ?\\F4?\\90?\\80?\\81;"
+                              "Not UTF-8: ?\\E6;"
                               "Null byte: \\0;"));
 
   return SVN_NO_ERROR;