[Libreoffice-commits] core.git: config_host.mk.in configure.ac download.lst external/jpeg-turbo external/Module_external.mk Makefile.fetch RepositoryExternal.mk vcl/source

Matúš Kukan matus.kukan at collabora.com
Mon Nov 17 05:48:54 PST 2014


 Makefile.fetch                                    |    1 
 RepositoryExternal.mk                             |   14 ++++
 config_host.mk.in                                 |    2 
 configure.ac                                      |   67 +++++++++++++++++++++-
 download.lst                                      |    2 
 external/Module_external.mk                       |    1 
 external/jpeg-turbo/ExternalProject_jpeg-turbo.mk |   37 ++++++++++++
 external/jpeg-turbo/Makefile                      |    7 ++
 external/jpeg-turbo/Module_jpeg-turbo.mk          |   21 ++++++
 external/jpeg-turbo/README                        |    6 +
 external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk |   19 ++++++
 external/jpeg-turbo/jpeg-turbo.build.patch.1      |   58 +++++++++++++++++++
 external/jpeg-turbo/jpeg-turbo.win_build.patch.1  |   15 ++++
 vcl/source/filter/jpeg/transupp.c                 |    4 -
 14 files changed, 250 insertions(+), 4 deletions(-)

New commits:
commit 71fae5db27255fb51a25a307205a8fe76cc56b6a
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Mon Nov 17 09:16:34 2014 +0100

    Add internal libjpeg-turbo library to be used instead of libjpeg
    
    Unfortunately requires nasm - the netwide assembler -
    http://www.nasm.us/
    
    Upstream libjpeg-turbo is meant to be built with CMake on Windows but
    thanks to our gcc-wrappers we are able to avoid that.
    
    jpeg is kept mostly for platforms we are cross-compiling to. For now,
    it's used also for Mac OS X because jpeg-turbo does not build there,
    which should be fixed later.
    
    Change-Id: Id87b7072a8acc2578c3abf7e82cb1499e5094dbf

diff --git a/Makefile.fetch b/Makefile.fetch
index 18b12be..7aee66a 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -151,6 +151,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBXML_TARBALL) \
 		$(call fetch_Optional,JFREEREPORT,JFREEREPORT_SAC_TARBALL) \
 		$(call fetch_Optional,JPEG,JPEG_TARBALL) \
+		$(call fetch_Optional,JPEG_TURBO,JPEG_TURBO_TARBALL) \
 		$(call fetch_Optional,LANGUAGETOOL,LANGUAGETOOL_TARBALL) \
 		$(call fetch_Optional,LCMS2,LCMS2_TARBALL) \
 		$(call fetch_Optional,LIBATOMIC_OPS,LIBATOMIC_OPS_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 911dab1..47f6e90 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -444,6 +444,20 @@ $(call gb_LinkTarget_set_ldflags,$(1),\
 
 endef
 
+else ifeq ($(WITH_JPEG_TURBO),TRUE)
+
+define gb_LinkTarget__use_jpeg
+$(call gb_LinkTarget_set_include,$(1),\
+	-I$(call gb_UnpackedTarball_get_dir,jpeg-turbo) \
+	$$(INCLUDE) \
+)
+$(call gb_LinkTarget_add_libs,$(1),\
+	$(call gb_UnpackedTarball_get_dir,jpeg-turbo)/.libs/libjpeg$(gb_StaticLibrary_PLAINEXT) \
+)
+$(call gb_LinkTarget_use_external_project,$(1),jpeg-turbo)
+
+endef
+
 else # !SYSTEM_JPEG
 
 define gb_LinkTarget__use_jpeg
diff --git a/config_host.mk.in b/config_host.mk.in
index b507562..a23629f 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -411,6 +411,7 @@ export MWAW_CFLAGS=$(gb_SPACE)@MWAW_CFLAGS@
 export MWAW_LIBS=$(gb_SPACE)@MWAW_LIBS@
 export MYTHES_CFLAGS=$(gb_SPACE)@MYTHES_CFLAGS@
 export MYTHES_LIBS=$(gb_SPACE)@MYTHES_LIBS@
+export NASM=@NASM@
 export NEON_CFLAGS=$(gb_SPACE)@NEON_CFLAGS@
 export NEON_LIBS=$(gb_SPACE)@NEON_LIBS@
 export NEON_VERSION=@NEON_VERSION@
@@ -619,6 +620,7 @@ export WITH_FONTS=@WITH_FONTS@
 export WITH_GALLERY_BUILD=@WITH_GALLERY_BUILD@
 export WITH_GSSAPI=@WITH_GSSAPI@
 export WITH_HELPPACK_INTEGRATION=@WITH_HELPPACK_INTEGRATION@
+export WITH_JPEG_TURBO=@WITH_JPEG_TURBO@
 export WITH_KRB5=@WITH_KRB5@
 export WITH_LANG=@WITH_LANG@
 export WITH_LANG_LIST=@WITH_LANG_LIST@
diff --git a/configure.ac b/configure.ac
index e401569..8ee0ab4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1890,6 +1890,11 @@ AC_ARG_WITH(system-npapi-headers,
     [with_system_npapi_headers="$with_system_headers"]
 )
 
+AC_ARG_WITH(jpeg-turbo,
+    AS_HELP_STRING([--with-jpeg-turbo],
+        [Use internal libjpeg-turbo library.]),,
+    [with_jpeg_turbo=auto])
+
 AC_ARG_WITH(webdav,
     AS_HELP_STRING([--with-webdav],
         [Specify which library to use for webdav implementation.
@@ -7342,6 +7347,18 @@ if test "$with_system_jpeg" = "auto"; then
     esac
 fi
 
+if test "$with_jpeg_turbo" = "auto"; then
+    # TODO use jpeg-turbo on Darwin too
+    case "$_os" in
+    WINNT)
+        with_jpeg_turbo=yes
+        ;;
+    *)
+        with_jpeg_turbo=no
+        ;;
+    esac
+fi
+
 if test "$with_system_jpeg" = "yes"; then
     AC_MSG_RESULT([external])
     SYSTEM_JPEG=TRUE
@@ -7351,12 +7368,56 @@ if test "$with_system_jpeg" = "yes"; then
     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
     libo_MINGW_CHECK_DLL([libjpeg])
 else
-    AC_MSG_RESULT([internal])
     SYSTEM_JPEG=
-    BUILD_TYPE="$BUILD_TYPE JPEG"
+    if test "$with_jpeg_turbo" = "yes"; then
+        AC_MSG_RESULT([internal, jpeg-turbo])
+        WITH_JPEG_TURBO=TRUE
+        BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
+        AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
+        if test -z "$NASM" -a "$build_os" = "cygwin" -a -x "/opt/lo/bin/nasm"; then
+            NASM="/opt/lo/bin/nasm"
+        fi
+        if test -z "$NASM"; then
+cat << _EOS
+****************************************************************************
+You need nasm (Netwide Assembler) to build internal jpeg library.
+To get one please do:
+
+_EOS
+        if test "$build_os" = "cygwin"; then
+cat << _EOS
+install a pre-compiled binary for Win32
+
+ mkdir -p /opt/lo/bin
+ cd /opt/lo/bin
+ wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
+ chmod +x nasm
+_EOS
+            else
+cat << _EOS
+consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
+_EOS
+            fi
+cat << _EOS
+
+or get and install one from http://www.nasm.us/
+
+Then re-run autogen.sh
+
+Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
+Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
+
+_EOS
+        AC_MSG_ERROR([no nasm (Netwide Assembler) found])
+        fi
+    else
+        AC_MSG_RESULT([internal, jpeg])
+        BUILD_TYPE="$BUILD_TYPE JPEG"
+    fi
 fi
+AC_SUBST(NASM)
 AC_SUBST(SYSTEM_JPEG)
-
+AC_SUBST(WITH_JPEG_TURBO)
 
 dnl ===================================================================
 dnl Check for system clucene
diff --git a/download.lst b/download.lst
index 13e26e0..aa700aa 100644
--- a/download.lst
+++ b/download.lst
@@ -79,6 +79,8 @@ export JFREEREPORT_LIBXML_TARBALL := ace6ab49184e329db254e454a010f56d-libxml-1.1
 export JFREEREPORT_SAC_TARBALL := 39bb3fcea1514f1369fcfc87542390fd-sacjava-1.3.zip
 export JPEG_MD5SUM := 3353992aecaee1805ef4109aadd433e7
 export JPEG_TARBALL := jpegsrc.v9a.tar.gz
+export JPEG_TURBO_MD5SUM := 2c3a68129dac443a72815ff5bb374b05
+export JPEG_TURBO_TARBALL := libjpeg-turbo-1.3.1.tar.gz
 export LANGTAGREG_MD5SUM := 49c94710f7858b1969d74ff72e6aac84
 export LANGTAGREG_TARBALL := language-subtag-registry-2014-04-10.tar.bz2
 export LANGUAGETOOL_TARBALL := b63e6340a02ff1cacfeadb2c42286161-JLanguageTool-1.7.0.tar.bz2
diff --git a/external/Module_external.mk b/external/Module_external.mk
index 688e335..6d38fd5 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -52,6 +52,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
 	$(call gb_Helper_optional,ICU,icu) \
 	$(call gb_Helper_optional,JFREEREPORT,jfreereport) \
 	$(call gb_Helper_optional,JPEG,jpeg) \
+	$(call gb_Helper_optional,JPEG_TURBO,jpeg-turbo) \
 	$(call gb_Helper_optional,LANGUAGETOOL,languagetool) \
 	$(call gb_Helper_optional,LCMS2,lcms2) \
 	$(call gb_Helper_optional,LIBATOMIC_OPS,libatomic_ops) \
diff --git a/external/jpeg-turbo/ExternalProject_jpeg-turbo.mk b/external/jpeg-turbo/ExternalProject_jpeg-turbo.mk
new file mode 100644
index 0000000..d9ac7e5
--- /dev/null
+++ b/external/jpeg-turbo/ExternalProject_jpeg-turbo.mk
@@ -0,0 +1,37 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,jpeg-turbo))
+
+$(eval $(call gb_ExternalProject_use_autoconf,jpeg-turbo,configure))
+$(eval $(call gb_ExternalProject_use_autoconf,jpeg-turbo,build))
+
+$(eval $(call gb_ExternalProject_register_targets,jpeg-turbo,\
+	configure \
+	build \
+))
+
+$(call gb_ExternalProject_get_state_target,jpeg-turbo,build) : $(call gb_ExternalProject_get_state_target,jpeg-turbo,configure)
+	+$(call gb_ExternalProject_run,build,\
+		$(MAKE) \
+	)
+
+$(call gb_ExternalProject_get_state_target,jpeg-turbo,configure) :
+	$(call gb_ExternalProject_run,configure,\
+		MAKE=$(MAKE) ./configure \
+			--build=$(if $(filter WNT,$(OS)),i686-pc-cygwin,$(BUILD_PLATFORM)) \
+			--with-pic \
+			--enable-static \
+			--disable-shared \
+			--with-jpeg8 \
+			--without-java \
+			--without-turbojpeg \
+	)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/jpeg-turbo/Makefile b/external/jpeg-turbo/Makefile
new file mode 100644
index 0000000..e4968cf
--- /dev/null
+++ b/external/jpeg-turbo/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/jpeg-turbo/Module_jpeg-turbo.mk b/external/jpeg-turbo/Module_jpeg-turbo.mk
new file mode 100644
index 0000000..87cd247
--- /dev/null
+++ b/external/jpeg-turbo/Module_jpeg-turbo.mk
@@ -0,0 +1,21 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,jpeg-turbo))
+
+ifeq ($(WITH_JPEG_TURBO),TRUE)
+
+$(eval $(call gb_Module_add_targets,jpeg-turbo,\
+	ExternalProject_jpeg-turbo \
+	UnpackedTarball_jpeg-turbo \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/jpeg-turbo/README b/external/jpeg-turbo/README
new file mode 100644
index 0000000..46eff7c
--- /dev/null
+++ b/external/jpeg-turbo/README
@@ -0,0 +1,6 @@
+External library for reading/writing jpegs
+
+This is only used by the jpeg import filter that is provided
+for use by VCL see [[vcl/source/filter/jpeg]]
+
+From [http://www.libjpeg-turbo.org/].
diff --git a/external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk b/external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk
new file mode 100644
index 0000000..2cb2aa4
--- /dev/null
+++ b/external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk
@@ -0,0 +1,19 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,jpeg-turbo))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,jpeg-turbo,$(JPEG_TURBO_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_add_patches,jpeg-turbo,\
+	external/jpeg-turbo/jpeg-turbo.build.patch.1 \
+	$(if $(filter WNT,$(OS)),external/jpeg-turbo/jpeg-turbo.win_build.patch.1) \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/jpeg-turbo/jpeg-turbo.build.patch.1 b/external/jpeg-turbo/jpeg-turbo.build.patch.1
new file mode 100644
index 0000000..cf4cc2a
--- /dev/null
+++ b/external/jpeg-turbo/jpeg-turbo.build.patch.1
@@ -0,0 +1,58 @@
+diff -ur jpeg.org/configure jpeg/configure
+--- jpeg.org/configure	2014-11-14 12:05:43.345386578 +0100
++++ jpeg/configure	2014-11-14 12:08:59.077388882 +0100
+@@ -22977,10 +22977,6 @@
+ else
+   rm -rf conftest*
+   echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6
+-  { { echo "$as_me:$LINENO: error: configuration problem: maybe object file format mismatch." >&5
+-echo "$as_me: error: configuration problem: maybe object file format mismatch." >&2;}
+-   { (exit 1); exit 1; }; }
+ fi
+ 
+ 
+@@ -23179,10 +23175,6 @@
+ else
+   rm -rf conftest*
+   echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6
+-  { { echo "$as_me:$LINENO: error: configuration problem: maybe object file format mismatch." >&5
+-echo "$as_me: error: configuration problem: maybe object file format mismatch." >&2;}
+-   { (exit 1); exit 1; }; }
+ fi
+ 
+ 
+diff -ur jpeg.org/Makefile.am jpeg/Makefile.am
+--- jpeg.org/Makefile.am	2014-11-14 12:05:43.349386578 +0100
++++ jpeg/Makefile.am	2014-11-14 12:06:21.005387021 +0100
+@@ -160,8 +160,6 @@
+ 	rm -rf `find $(distdir) -name .svn`
+ 
+ 
+-SUBDIRS += md5
+-
+ MD5_JPEG_INT = 9a68f56bc76e466aa7e52f415d0f4a5f
+ MD5_JPEG_FAST = 0e1502e7fa421835e376a314fac2a39f
+ MD5_JPEG_FAST_100 = 7bf72a8e741d64eecb960c97323af77c
+diff -ur jpeg.org/Makefile.in jpeg/Makefile.in
+--- jpeg.org/Makefile.in	2014-11-14 12:05:43.333386578 +0100
++++ jpeg/Makefile.in	2014-11-14 12:20:00.689396668 +0100
+@@ -264,7 +264,7 @@
+ HEADERS = $(include_HEADERS) $(nodist_include_HEADERS)
+ ETAGS = etags
+ CTAGS = ctags
+-DIST_SUBDIRS = java simd md5
++DIST_SUBDIRS = java simd
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ distdir = $(PACKAGE)-$(VERSION)
+ top_distdir = $(distdir)
+@@ -442,7 +442,7 @@
+ 	jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
+ 	jquant2.c jutils.c jmemmgr.c jmemnobs.c $(am__append_3) \
+ 	$(am__append_4) $(am__append_5) $(am__append_10)
+-SUBDIRS = java $(am__append_9) md5
++SUBDIRS = java $(am__append_9)
+ @WITH_TURBOJPEG_TRUE at libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) \
+ @WITH_TURBOJPEG_TRUE@	turbojpeg.c turbojpeg.h transupp.c \
+ @WITH_TURBOJPEG_TRUE@	transupp.h jdatadst-tj.c jdatasrc-tj.c \
diff --git a/external/jpeg-turbo/jpeg-turbo.win_build.patch.1 b/external/jpeg-turbo/jpeg-turbo.win_build.patch.1
new file mode 100644
index 0000000..1dc5b1e
--- /dev/null
+++ b/external/jpeg-turbo/jpeg-turbo.win_build.patch.1
@@ -0,0 +1,15 @@
+diff -ur jpeg.org/simd/Makefile.in jpeg/simd/Makefile.in
+--- jpeg.org/simd/Makefile.in	2014-11-14 21:55:21.557802955 +0100
++++ jpeg/simd/Makefile.in	2014-11-14 21:57:16.845804312 +0100
+@@ -583,8 +583,9 @@
+ .asm.lo:
+ 	$(LIBTOOL) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@
+ 
+-jsimdcfg.inc: $(srcdir)/jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h
+-	$(CPP) -I$(top_builddir) -I$(top_builddir)/simd $(srcdir)/jsimdcfg.inc.h | $(EGREP) "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's@% define@%define at g' > $@
++jsimdcfg.inc: $(top_srcdir)/win/jsimdcfg.inc
++	cp $< $@
++
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
diff --git a/vcl/source/filter/jpeg/transupp.c b/vcl/source/filter/jpeg/transupp.c
index 9d4b7b8..b6e2898 100644
--- a/vcl/source/filter/jpeg/transupp.c
+++ b/vcl/source/filter/jpeg/transupp.c
@@ -14,8 +14,10 @@
  * interfaces.
  */
 
-#include "jerror.h"
+#include <sal/config.h>
+
 #include "jinclude.h"
+#include "jerror.h"
 #include "jpeglib.h"
 #include "transupp.h"       /* My own external interface */
 #include "jpegcomp.h"


More information about the Libreoffice-commits mailing list