diff options
Diffstat (limited to '')
-rw-r--r-- | external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk | 43 | ||||
-rw-r--r-- | external/libjpeg-turbo/Makefile | 7 | ||||
-rw-r--r-- | external/libjpeg-turbo/Module_libjpeg-turbo.mk | 17 | ||||
-rw-r--r-- | external/libjpeg-turbo/README | 6 | ||||
-rw-r--r-- | external/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk | 24 | ||||
-rw-r--r-- | external/libjpeg-turbo/jpeg-turbo.build.patch.1 | 58 | ||||
-rw-r--r-- | external/libjpeg-turbo/jpeg-turbo.win_build.patch.1 | 54 | ||||
-rw-r--r-- | external/libjpeg-turbo/ubsan.patch | 39 |
8 files changed, 248 insertions, 0 deletions
diff --git a/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk b/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk new file mode 100644 index 000000000..a6c8f0d77 --- /dev/null +++ b/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk @@ -0,0 +1,43 @@ +# -*- 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,libjpeg-turbo)) + +$(eval $(call gb_ExternalProject_use_autoconf,libjpeg-turbo,configure)) +$(eval $(call gb_ExternalProject_use_autoconf,libjpeg-turbo,build)) + +$(eval $(call gb_ExternalProject_register_targets,libjpeg-turbo,\ + configure \ + build \ +)) + +$(call gb_ExternalProject_get_state_target,libjpeg-turbo,build) : $(call gb_ExternalProject_get_state_target,libjpeg-turbo,configure) + $(call gb_Trace_StartRange,libjpeg-turbo,EXTERNAL) + +$(call gb_ExternalProject_run,build,\ + $(MAKE) \ + ) + $(call gb_Trace_EndRange,libjpeg-turbo,EXTERNAL) + +$(call gb_ExternalProject_get_state_target,libjpeg-turbo,configure) : + $(call gb_Trace_StartRange,libjpeg-turbo,EXTERNAL) + $(call gb_ExternalProject_run,configure,\ + MAKE=$(MAKE) ./configure \ + --build=$(if $(filter WNT,$(OS)),$(if $(filter INTEL,$(CPUNAME)),i686-pc-cygwin,x86_64-pc-cygwin),$(BUILD_PLATFORM)) \ + --host=$(if $(filter WNT,$(OS)),$(if $(filter INTEL,$(CPUNAME)),i686-pc-cygwin,x86_64-pc-cygwin),$(HOST_PLATFORM)) \ + --with-pic \ + --enable-static \ + --disable-shared \ + --without-java \ + --without-turbojpeg \ + $(if $(NASM),,--without-simd) \ + CFLAGS='$(if $(debug),$(gb_DEBUGINFO_FLAGS)) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(CFLAGS) $(gb_VISIBILITY_FLAGS)' \ + ) + $(call gb_Trace_EndRange,libjpeg-turbo,EXTERNAL) + +# vim: set noet sw=4 ts=4: diff --git a/external/libjpeg-turbo/Makefile b/external/libjpeg-turbo/Makefile new file mode 100644 index 000000000..e4968cf85 --- /dev/null +++ b/external/libjpeg-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/libjpeg-turbo/Module_libjpeg-turbo.mk b/external/libjpeg-turbo/Module_libjpeg-turbo.mk new file mode 100644 index 000000000..137e7557b --- /dev/null +++ b/external/libjpeg-turbo/Module_libjpeg-turbo.mk @@ -0,0 +1,17 @@ +# -*- 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,libjpeg-turbo)) + +$(eval $(call gb_Module_add_targets,libjpeg-turbo,\ + ExternalProject_libjpeg-turbo \ + UnpackedTarball_libjpeg-turbo \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/libjpeg-turbo/README b/external/libjpeg-turbo/README new file mode 100644 index 000000000..46eff7cb7 --- /dev/null +++ b/external/libjpeg-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/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk b/external/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk new file mode 100644 index 000000000..a99df67bb --- /dev/null +++ b/external/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk @@ -0,0 +1,24 @@ +# -*- 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,libjpeg-turbo)) + +$(eval $(call gb_UnpackedTarball_set_tarball,libjpeg-turbo,$(LIBJPEG_TURBO_TARBALL))) + +$(eval $(call gb_UnpackedTarball_update_autoconf_configs,libjpeg-turbo)) + +$(eval $(call gb_UnpackedTarball_set_patchlevel,libjpeg-turbo,0)) + +$(eval $(call gb_UnpackedTarball_add_patches,libjpeg-turbo,\ + external/libjpeg-turbo/jpeg-turbo.build.patch.1 \ + $(if $(filter WNT,$(OS)),external/libjpeg-turbo/jpeg-turbo.win_build.patch.1) \ + external/libjpeg-turbo/ubsan.patch \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/libjpeg-turbo/jpeg-turbo.build.patch.1 b/external/libjpeg-turbo/jpeg-turbo.build.patch.1 new file mode 100644 index 000000000..4d01ad4b9 --- /dev/null +++ b/external/libjpeg-turbo/jpeg-turbo.build.patch.1 @@ -0,0 +1,58 @@ +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 +@@ -174,8 +174,6 @@ + rm -rf `find $(distdir) -name .svn` + + +-SUBDIRS += md5 +- + if WITH_12BIT + + TESTORIG = testorig12.jpg +diff -ru jpeg-turbo.orig/Makefile.in jpeg-turbo/Makefile.in +--- jpeg-turbo.orig/Makefile.in 2015-09-21 20:48:45.000000000 +0200 ++++ jpeg-turbo/Makefile.in 2015-11-22 16:17:10.326527000 +0100 +@@ -405,7 +405,7 @@ + ETAGS = etags + CTAGS = ctags + CSCOPE = cscope +-DIST_SUBDIRS = java simd md5 ++DIST_SUBDIRS = java simd + am__DIST_COMMON = $(dist_man1_MANS) $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(srcdir)/jconfig.h.in \ + $(srcdir)/jconfigint.h.in $(srcdir)/libjpeg.map.in \ +@@ -622,7 +622,7 @@ + jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ + jquant2.c jutils.c jmemmgr.c jmemnobs.c $(am__append_4) \ + $(am__append_5) $(am__append_6) $(am__append_11) +-SUBDIRS = java $(am__append_10) md5 ++SUBDIRS = java $(am__append_10) + @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 -ru jpeg-turbo.orig/configure jpeg-turbo/configure +--- jpeg-turbo.orig/configure 2015-09-21 20:48:41.000000000 +0200 ++++ jpeg-turbo/configure 2015-11-22 15:23:25.387071000 +0100 +@@ -14630,9 +14630,7 @@ + $as_echo "yes" >&6; } + else + rm -rf conftest* +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +- as_fn_error $? "configuration problem: maybe object file format mismatch." "$LINENO" 5 ++ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + fi + + +@@ -14828,9 +14826,7 @@ + $as_echo "yes" >&6; } + else + rm -rf conftest* +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +- as_fn_error $? "configuration problem: maybe object file format mismatch." "$LINENO" 5 ++ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + fi + + diff --git a/external/libjpeg-turbo/jpeg-turbo.win_build.patch.1 b/external/libjpeg-turbo/jpeg-turbo.win_build.patch.1 new file mode 100644 index 000000000..00b642703 --- /dev/null +++ b/external/libjpeg-turbo/jpeg-turbo.win_build.patch.1 @@ -0,0 +1,54 @@ +Copy definitions of "boolean", "INT16", "INT32" from win/jconfig.h.in + +... into jconfig.h.in, which is the one we use via configure. + +diff -ru jpeg-turbo.orig/simd/Makefile.in jpeg-turbo/simd/Makefile.in +--- jpeg-turbo.orig/simd/Makefile.in 2015-09-21 20:48:45.000000000 +0200 ++++ jpeg-turbo/simd/Makefile.in 2015-11-22 10:52:46.975285184 +0100 +@@ -769,8 +769,8 @@ + .asm.lo: + $(AM_V_GEN) $(LIBTOOL) $(AM_V_lt) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(AM_V_lt) $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@ + +-jsimdcfg.inc: $(srcdir)/jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h +- $(AM_V_GEN) $(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. +diff -ru jpeg-turbo.orig/configure jpeg-turbo/configure +--- jpeg-turbo.orig/configure 2015-11-22 15:57:23.702656000 +0100 ++++ jpeg-turbo/configure 2015-11-22 15:59:37.084285000 +0100 +@@ -13931,7 +13931,7 @@ + + else + +-$as_echo "#define NEED_BSD_STRINGS 1" >>confdefs.h ++$as_echo "#undef NEED_BSD_STRINGS" >>confdefs.h + + fi + done +--- jpeg-turbo/jconfig.h.in.orig 2016-11-02 22:43:55.012600000 +0100 ++++ jpeg-turbo/jconfig.h.in 2016-11-02 22:45:01.905400000 +0100 +@@ -71,3 +71,21 @@ + + /* Define to `unsigned int' if <sys/types.h> does not define. */ + #undef size_t ++ ++#ifdef _MSC_VER ++ ++/* Define "boolean" as unsigned char, not int, per Windows custom */ ++#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ ++typedef unsigned char boolean; ++#endif ++#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ ++ ++/* Define "INT32" as int, not long, per Windows custom */ ++#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */ ++typedef short INT16; ++typedef signed int INT32; ++#endif ++#define XMD_H /* prevent jmorecfg.h from redefining it */ ++ ++#endif /* _MSC_VER */ ++ diff --git a/external/libjpeg-turbo/ubsan.patch b/external/libjpeg-turbo/ubsan.patch new file mode 100644 index 000000000..33d3c15a8 --- /dev/null +++ b/external/libjpeg-turbo/ubsan.patch @@ -0,0 +1,39 @@ +--- jcphuff.c ++++ jcphuff.c +@@ -14,6 +14,7 @@ + * suspension. + */ + ++#include <stdint.h> + #define JPEG_INTERNALS + #include "jinclude.h" + #include "jpeglib.h" +@@ -255,7 +256,7 @@ + if (c == 0xFF) { /* need to stuff a zero byte? */ + emit_byte(entropy, 0); + } +- put_buffer <<= 8; ++ put_buffer = (uint_least32_t) put_buffer << 8; + put_bits -= 8; + } + +--- jdarith.c ++++ jdarith.c +@@ -306,7 +306,7 @@ + while (m >>= 1) + if (arith_decode(cinfo, st)) v |= m; + v += 1; if (sign) v = -v; +- entropy->last_dc_val[ci] += v; ++ entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff; + } + + /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */ +@@ -564,7 +564,7 @@ + while (m >>= 1) + if (arith_decode(cinfo, st)) v |= m; + v += 1; if (sign) v = -v; +- entropy->last_dc_val[ci] += v; ++ entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff; + } + + if (block) |