summaryrefslogtreecommitdiff
path: root/external/libjpeg-turbo
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-09-13 22:50:14 +0200
committerMichael Stahl <mstahl@redhat.com>2017-09-15 10:55:59 +0200
commit77d297f3e8ff4af58718d166dcbf23c39ce47ca3 (patch)
tree57b02931d6ccfbbd1c09fbf5aac7295621a80be5 /external/libjpeg-turbo
parent2406e8fa5af19e0a8c97fb2461e3c12bfbfe373c (diff)
consistent naming of externals: jpeg-turbo->libjpeg-turbo
Change-Id: I63fcebc36559c2698bbedd3501285a388ce8c257 Reviewed-on: https://gerrit.libreoffice.org/42291 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'external/libjpeg-turbo')
-rw-r--r--external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk39
-rw-r--r--external/libjpeg-turbo/Makefile7
-rw-r--r--external/libjpeg-turbo/Module_libjpeg-turbo.mk17
-rw-r--r--external/libjpeg-turbo/README6
-rw-r--r--external/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk23
-rw-r--r--external/libjpeg-turbo/jpeg-turbo.build.patch.158
-rw-r--r--external/libjpeg-turbo/jpeg-turbo.iOS.patch.120
-rw-r--r--external/libjpeg-turbo/jpeg-turbo.win_build.patch.154
-rw-r--r--external/libjpeg-turbo/ubsan.patch19
9 files changed, 243 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 000000000000..3175c433b0bf
--- /dev/null
+++ b/external/libjpeg-turbo/ExternalProject_libjpeg-turbo.mk
@@ -0,0 +1,39 @@
+# -*- 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_ExternalProject_run,build,\
+ $(MAKE) \
+ )
+
+$(call gb_ExternalProject_get_state_target,libjpeg-turbo,configure) :
+ $(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)) \
+ $(if $(CROSS_COMPILING),--host=$(HOST_PLATFORM)) \
+ --with-pic \
+ --enable-static \
+ --disable-shared \
+ --without-java \
+ --without-turbojpeg \
+ $(if $(NASM),,--without-simd) \
+ CFLAGS='$(if $(debug),$(gb_DEBUGINFO_FLAGS) $(gb_DEBUG_CFLAGS)) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(CFLAGS) $(gb_VISIBILITY_FLAGS)' \
+ )
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libjpeg-turbo/Makefile b/external/libjpeg-turbo/Makefile
new file mode 100644
index 000000000000..e4968cf85fb6
--- /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 000000000000..137e7557bacf
--- /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 000000000000..46eff7cb7487
--- /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 000000000000..dd0f88becb2d
--- /dev/null
+++ b/external/libjpeg-turbo/UnpackedTarball_libjpeg-turbo.mk
@@ -0,0 +1,23 @@
+# -*- 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_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 \
+ external/libjpeg-turbo/jpeg-turbo.iOS.patch.1 \
+))
+
+# 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 000000000000..4d01ad4b9aed
--- /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.iOS.patch.1 b/external/libjpeg-turbo/jpeg-turbo.iOS.patch.1
new file mode 100644
index 000000000000..d81ab59c19ad
--- /dev/null
+++ b/external/libjpeg-turbo/jpeg-turbo.iOS.patch.1
@@ -0,0 +1,20 @@
+--- jpeg.org/config.sub 2017-06-10 20:48:27.000000000 +0200
++++ jpeg/config.sub 2017-06-10 20:53:22.000000000 +0200
+@@ -253,7 +253,7 @@
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arceb \
+- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
++ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] | arm64 \
+ | avr | avr32 \
+ | be32 | be64 \
+ | bfin \
+@@ -374,7 +374,7 @@
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
+- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
++ | arm-* | armbe-* | armle-* | armeb-* | armv*-* | arm64-* \
+ | avr-* | avr32-* \
+ | be32-* | be64-* \
+ | bfin-* | bs2000-* \
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 000000000000..00b642703f3a
--- /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 000000000000..81ff148c57d6
--- /dev/null
+++ b/external/libjpeg-turbo/ubsan.patch
@@ -0,0 +1,19 @@
+--- 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;
+ }
+