summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.fetch1
-rw-r--r--RepositoryExternal.mk14
-rw-r--r--config_host.mk.in2
-rw-r--r--configure.ac67
-rw-r--r--download.lst2
-rw-r--r--external/Module_external.mk1
-rw-r--r--external/jpeg-turbo/ExternalProject_jpeg-turbo.mk37
-rw-r--r--external/jpeg-turbo/Makefile7
-rw-r--r--external/jpeg-turbo/Module_jpeg-turbo.mk21
-rw-r--r--external/jpeg-turbo/README6
-rw-r--r--external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk19
-rw-r--r--external/jpeg-turbo/jpeg-turbo.build.patch.158
-rw-r--r--external/jpeg-turbo/jpeg-turbo.win_build.patch.115
-rw-r--r--vcl/source/filter/jpeg/transupp.c4
14 files changed, 250 insertions, 4 deletions
diff --git a/Makefile.fetch b/Makefile.fetch
index 18b12be72b30..7aee66a1435e 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 911dab1fd748..47f6e90d9268 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 b507562b034d..a23629f05098 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 e4015693ef94..8ee0ab46e80b 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 13e26e030c23..aa700aad79f9 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 688e33503e53..6d38fd583939 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 000000000000..d9ac7e56d0e4
--- /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 000000000000..e4968cf85fb6
--- /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 000000000000..87cd24770973
--- /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 000000000000..46eff7cb7487
--- /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 000000000000..2cb2aa44a627
--- /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 000000000000..cf4cc2ad7ded
--- /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@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 000000000000..1dc5b1e48ee8
--- /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@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 9d4b7b82028c..b6e289870a42 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"