Date: Tue, 31 Jan 2017 03:42:07 +0000 (UTC) From: Don Lewis <truckman@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r432898 - in head/editors/openoffice-4: . files Message-ID: <201701310342.v0V3g7lH033123@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: truckman Date: Tue Jan 31 03:42:07 2017 New Revision: 432898 URL: https://svnweb.freebsd.org/changeset/ports/432898 Log: On amd64, clang++ 4.0 uses the MOVAPS SSE instruction to initialize sufficiently large objects returned by the "new" operator. This requires that the object have 16-byte alignment. The FreeBSD malloc() implementation does the correct thing here, but OpenOffice has a couple of internal memory allocator implementations that only align to 8-byte boundaries at most. In addition OpenOffice overrides the new operator to interpose a couple of layers of wrappers. If the --enable-debug option is passed to configure, the wrapper adds 8 to the size passed to the allocator and adds an 8 byte offset to the pointer returned by the allocator to make room for a signature that it adds to the beginning of the memory block (the signature is validated and the inverse transformation is done when the memory is freed). This breaks the proper alignment done by the mamory allocator. Fix these problems by adding an EXTRA_PATCH that teaches the internal OpenOffice memory allocators to do 16-byte alignment and to use a 16-byte offset in the "new" wrapper, and apply this patch on amd64 if clang 4.0 is the system compiler. Pass the --with-alloc=system flag to configure so that the libc version of malloc() is used instead of one of the internal memory allocator implementations. Fix a few mis-sorts in BUILD_DEPENDS and don't list www/p5-libwww twice. Fix a compile error in the bridges code when --enable-debug is specified. Fix a sporadic failure in the clear_001 QA test that occasionally breaks the build. The nominal mutex hold time is 5 seconds, but because it is only checked one per second, the actual time is more likely to be around 6 seconds. When the before time value is subtracted from the after time value, the result might be 7 whole seconds and a large negative number of nanoseconds. Since the pass/fail check only looks at the difference in the seconds fields, it will fail the "< 7" assertion. Relax the assertion to "<= 7" as a quick fix. The editors/openoffice-4 port does not need poppler. It is only needed for the PDF import extension, which is not built in OpenOffice 4.1.x. Cherrypick some cleanups from PR 216245 [1]: * The --without-stlport configure flag is not needed. * Pass the -with-build-version flag to configure (but use ${PKGNAME} for completeness instead of just ${PORTNAME}-${PORTVERSION}) * Tweak a comment in the Makefile. PR: 216245 Submitted by: pfg [1] Added: head/editors/openoffice-4/files/extra-patch-align16 (contents, props changed) head/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__x86-64_uno2cpp.cxx (contents, props changed) head/editors/openoffice-4/files/patch-sal_qa_osl_mutex_osl__Mutex.cxx (contents, props changed) Modified: head/editors/openoffice-4/Makefile Modified: head/editors/openoffice-4/Makefile ============================================================================== --- head/editors/openoffice-4/Makefile Tue Jan 31 03:40:46 2017 (r432897) +++ head/editors/openoffice-4/Makefile Tue Jan 31 03:42:07 2017 (r432898) @@ -3,7 +3,7 @@ PORTNAME= apache-openoffice PORTVERSION= ${AOOVERSION} -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= editors java MASTER_SITES= APACHE/openoffice/${PORTVERSION}/source \ http://tools.openoffice.org/unowinreg_prebuild/680/:unoreg \ @@ -20,7 +20,7 @@ EXTRACT_ONLY= ${AOOSRC} MAINTAINER= office@FreeBSD.org #de facto maintainer is truckman@FreeBSD.org -#Frequent Patch submitters should optionally sign Apache iCLA +#Frequent Patch submitters should (optionally) sign the Apache iCLA COMMENT= Integrated wordprocessor/dbase/spreadsheet/drawing/chart/browser LICENSE= APACHE20 ADOBE BSD3CLAUSE BSD4CLAUSE BSL ICU MIT MPL \ @@ -48,9 +48,6 @@ LICENSE_PERMS_W3C= dist-mirror dist-sell BUILD_DEPENDS= \ p5-Archive-Zip>=0:archivers/p5-Archive-Zip \ - p5-libwww>=0:www/p5-libwww \ - p5-LWP-Protocol-https>0:www/p5-LWP-Protocol-https \ - p5-XML-Parser>=0:textproc/p5-XML-Parser \ ${LOCALBASE}/bin/unzip:archivers/unzip \ zip:archivers/zip \ ant:devel/apache-ant \ @@ -68,14 +65,15 @@ BUILD_DEPENDS= \ ${JAVALIBDIR}/bsh.jar:lang/bsh \ bash:shells/bash \ ${JAVALIBDIR}/lucene-core-3.6.2.jar:textproc/lucene \ - p5-libwww>=0:www/p5-libwww + p5-XML-Parser>=0:textproc/p5-XML-Parser \ + p5-libwww>=0:www/p5-libwww \ + p5-LWP-Protocol-https>0:www/p5-LWP-Protocol-https LIB_DEPENDS= \ libapr-1.so:devel/apr1 \ libnspr4.so:devel/nspr \ libcurl.so:ftp/curl \ libcairo.so:graphics/cairo \ libpng.so:graphics/png \ - libpoppler-glib.so:graphics/poppler-glib \ libgraphite.so:graphics/silgraphite \ libCoinMP.so:math/coinmp \ libfreetype.so:print/freetype2 \ @@ -178,6 +176,9 @@ TARGET_ORDER_OVERRIDE= 710:gnome-post-ic .if ${COMPILER_TYPE} == clang CPPFLAGS+= -I${LOCALBASE}/include +. if ${COMPILER_VERSION} >= 40 && ${ARCH} == amd64 +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-align16 +. endif .endif .if ${ARCH} == amd64 @@ -216,6 +217,7 @@ SUB_LIST= EXECBASE=${EXECBASE} AOOTAG=${ CONFIGURE_ARGS+= \ --with-unix-wrapper=${EXECBASE} \ + --with-alloc=system \ --with-system-apache-commons=yes \ --with-commons-codec-jar=${JAVALIBDIR}/commons-codec.jar \ --with-commons-lang-jar=${JAVALIBDIR}/commons-lang.jar \ @@ -260,14 +262,13 @@ CONFIGURE_ARGS+= \ --enable-opengl \ --with-system-openssl \ --with-package-format="archive" \ - --with-system-poppler \ --with-system-python \ --with-system-redland \ --with-system-sane \ --with-system-serf \ --with-system-stdlibs \ - --without-stlport \ --with-vendor="FreeBSD ports system" \ + --with-build-version="PKGNAME: ${PKGNAME:S/,/@/g}" \ --enable-verbose \ --with-system-vigra \ --with-system-xrender \ Added: head/editors/openoffice-4/files/extra-patch-align16 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/editors/openoffice-4/files/extra-patch-align16 Tue Jan 31 03:42:07 2017 (r432898) @@ -0,0 +1,70 @@ +--- sal/cpprt/operators_new_delete.cxx.orig 2014-09-19 17:58:40 UTC ++++ sal/cpprt/operators_new_delete.cxx +@@ -68,7 +68,7 @@ struct AllocatorTraits + { + n = std::max(n, std::size_t(1)); + #if OSL_DEBUG_LEVEL > 0 +- n += sizeof(signature_type); ++ n += 2*sizeof(signature_type); + #endif /* OSL_DEBUG_LEVEL */ + return n; + } +@@ -77,7 +77,7 @@ struct AllocatorTraits + { + #if OSL_DEBUG_LEVEL > 0 + memcpy (p, m_signature, sizeof(signature_type)); +- p = static_cast<char*>(p) + sizeof(signature_type); ++ p = static_cast<char*>(p) + 2*sizeof(signature_type); + #endif /* OSL_DEBUG_LEVEL */ + return p; + } +@@ -85,7 +85,7 @@ struct AllocatorTraits + void* fini (void * p) const SAL_THROW(()) + { + #if OSL_DEBUG_LEVEL > 0 +- p = static_cast<char*>(p) - sizeof(signature_type); ++ p = static_cast<char*>(p) - 2*sizeof(signature_type); + if (memcmp (p, m_signature, sizeof(signature_type)) != 0) + { + OSL_ENSURE(0, "operator delete mismatch"); +--- sal/rtl/source/alloc_cache.c.orig 2016-06-21 21:57:07 UTC ++++ sal/rtl/source/alloc_cache.c +@@ -894,7 +894,9 @@ rtl_cache_activate ( + if (objalign == 0) + { + /* determine default alignment */ +- if (objsize >= RTL_MEMORY_ALIGNMENT_8) ++ if (objsize >= RTL_MEMORY_ALIGNMENT_16) ++ objalign = RTL_MEMORY_ALIGNMENT_16; ++ else if (objsize >= RTL_MEMORY_ALIGNMENT_8) + objalign = RTL_MEMORY_ALIGNMENT_8; + else + objalign = RTL_MEMORY_ALIGNMENT_4; +--- sal/rtl/source/alloc_global.c.orig 2016-06-21 21:57:06 UTC ++++ sal/rtl/source/alloc_global.c +@@ -75,8 +75,8 @@ static rtl_cache_type * g_alloc_caches[R + 0, + }; + +-#define RTL_MEMALIGN 8 +-#define RTL_MEMALIGN_SHIFT 3 ++#define RTL_MEMALIGN 16 ++#define RTL_MEMALIGN_SHIFT 4 + + static rtl_cache_type * g_alloc_table[RTL_MEMORY_CACHED_LIMIT >> RTL_MEMALIGN_SHIFT] = + { +--- sal/rtl/source/alloc_impl.h.orig 2014-09-19 17:59:16 UTC ++++ sal/rtl/source/alloc_impl.h +@@ -45,6 +45,12 @@ extern "C" { + #define RTL_MEMORY_ALIGNMENT_8 sizeof(void*) + #endif /* SAL_TYPES_ALIGNMENT8 */ + ++#if defined(SAL_TYPES_ALIGNMENT16) && SAL_TYPES_ALIGNMENT16 > 1 ++#define RTL_MEMORY_ALIGNMENT_16 SAL_TYPES_ALIGNMENT16 ++#else ++#define RTL_MEMORY_ALIGNMENT_16 16 ++#endif /* SAL_TYPES_ALIGNMENT16 */ ++ + #if 0 /* @@@ */ + #define RTL_MEMORY_ALIGNMENT_1 8 + #define RTL_MEMORY_ALIGNMENT_2 (sizeof(void*) * 2) Added: head/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__x86-64_uno2cpp.cxx ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/editors/openoffice-4/files/patch-bridges_source_cpp__uno_gcc3__freebsd__x86-64_uno2cpp.cxx Tue Jan 31 03:42:07 2017 (r432898) @@ -0,0 +1,12 @@ +--- bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx.orig 2016-09-10 13:54:56 UTC ++++ bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx +@@ -28,6 +28,9 @@ + #include <exception> + #include <cstddef> + #include <cxxabi.h> ++#if OSL_DEBUG_LEVEL > 1 ++#include <stdio.h> ++#endif + #include <stdlib.h> + #include <string.h> + Added: head/editors/openoffice-4/files/patch-sal_qa_osl_mutex_osl__Mutex.cxx ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/editors/openoffice-4/files/patch-sal_qa_osl_mutex_osl__Mutex.cxx Tue Jan 31 03:42:07 2017 (r432898) @@ -0,0 +1,11 @@ +--- sal/qa/osl/mutex/osl_Mutex.cxx.orig 2016-09-10 13:55:07 UTC ++++ sal/qa/osl/mutex/osl_Mutex.cxx +@@ -773,7 +773,7 @@ namespace osl_ClearableGuard + myThread.join(); + + CPPUNIT_ASSERT_MESSAGE("ClearableGuard method: clear", +- nSec < 7 && nSec > 1); ++ nSec <= 7 && nSec > 1); + } + + void clear_002( )
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701310342.v0V3g7lH033123>