summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2014-08-12 09:37:33 +0200
committerStefan Schmidt <s.schmidt@samsung.com>2014-08-22 16:27:28 +0200
commit3fe554e0b648a9f03ca150ec3b44f20f277b261c (patch)
tree91099b28f71242f57c0159fccec848de4e31ee99
parent8c8a2b1098932ebd6f40ef064dfa652bbdf7edc0 (diff)
downloadefl-3fe554e0b648a9f03ca150ec3b44f20f277b261c.tar.gz
build: Allow to use external liblz4 instead of embedded copy
While we are likely will keep the embedded copy for a while to avoid a really new dependency we allow now to use the external liblz4. You need at least revision r120 and a package that ships the pc file for it. Personally I would like to get rid of it rather sooner than later due to the security implications and a bunch of code we ship but have no idea about. Reality is that it will need some time until this new lib is actually packaged and shipped with releases for a a majority of people. This patch was co-worked with Doug Newgard <scimmia22@outlook.com>
-rw-r--r--configure.ac22
-rw-r--r--src/Makefile_Eet.am21
-rw-r--r--src/Makefile_Evas.am40
-rw-r--r--src/lib/eet/eet_image.c9
-rw-r--r--src/lib/eet/eet_lib.c9
-rw-r--r--src/modules/evas/loaders/tgv/evas_image_load_tgv.c7
-rw-r--r--src/modules/evas/savers/tgv/evas_image_save_tgv.c10
7 files changed, 98 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index 801ac1e15c..3247ee6866 100644
--- a/configure.ac
+++ b/configure.ac
@@ -374,6 +374,28 @@ AC_DEFINE_IF([ENABLE_LUA_OLD], [test "${want_lua_old}" = "yes"],
[1], [Use interpreted Lua (5.1 or 5.2)])
AC_SUBST([want_lua_old])
+
+want_liblz4="no"
+AC_ARG_ENABLE([liblz4],
+ [AS_HELP_STRING([--enable-liblz4],[Enable usage of liblz4 instead of our embedded copy. @<:@default=disabled@:>@])],
+ [
+ if test "x${enableval}" = "xyes" ; then
+ # Only ships pc file since r120
+ PKG_CHECK_MODULES([LIBLZ4], [liblz4])
+ EFL_DEPEND_PKG([EET], [LIBLZ4], [liblz4])
+ EFL_DEPEND_PKG([EVAS], [LIBLZ4], [liblz4])
+ want_liblz4="yes"
+ else
+ want_liblz4="no"
+ fi
+ ],
+ [want_liblz4="no"])
+
+AM_CONDITIONAL([ENABLE_LIBLZ4], [test "${want_liblz4}" = "yes"])
+AC_DEFINE_IF([ENABLE_LIBLZ4], [test "${want_liblz4}" = "yes"], [1], [Use liblz4 external library instead of embedded copy])
+AC_SUBST([want_liblz4])
+AC_SUBST([ENABLE_LIBLZ4])
+
#### Checks for header files
# Common Checks (keep names sorted for ease of use):
diff --git a/src/Makefile_Eet.am b/src/Makefile_Eet.am
index d5a308b10c..8e7f56a675 100644
--- a/src/Makefile_Eet.am
+++ b/src/Makefile_Eet.am
@@ -17,27 +17,38 @@ lib/eet/eet_image.c \
lib/eet/eet_lib.c \
lib/eet/eet_node.c \
lib/eet/eet_utils.c \
-static_libs/lz4/lz4.c \
-static_libs/lz4/lz4.h \
-static_libs/lz4/lz4hc.c \
-static_libs/lz4/lz4hc.h \
static_libs/rg_etc/rg_etc1.c \
static_libs/rg_etc/rg_etc2.c \
static_libs/rg_etc/etc2_encoder.c \
static_libs/rg_etc/rg_etc1.h
+if ! ENABLE_LIBLZ4
+lib_eet_libeet_la_SOURCES += \
+static_libs/lz4/lz4.c \
+static_libs/lz4/lz4.h \
+static_libs/lz4/lz4hc.c \
+static_libs/lz4/lz4hc.h
+endif
lib_eet_libeet_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
--I$(top_srcdir)/src/static_libs/lz4 \
-I$(top_srcdir)/src/static_libs/rg_etc \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/eet\" \
@EET_CFLAGS@
+if ! ENABLE_LIBLZ4
+lib_eet_libeet_la_CPPFLAGS += \
+-I$(top_srcdir)/src/static_libs/lz4
+endif
lib_eet_libeet_la_LIBADD = @EET_LIBS@ @EVIL_LIBS@
+if ENABLE_LIBLZ4
+lib_eet_libeet_la_LIBADD += @LIBLZ4_LIBS@
+endif
lib_eet_libeet_la_DEPENDENCIES = @EET_INTERNAL_LIBS@
lib_eet_libeet_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
+if ! ENABLE_LIBLZ4
EXTRA_DIST += static_libs/lz4/README
+endif
### Binary
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 3fe513c2f1..4f0ec0c915 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -1904,30 +1904,42 @@ modules/evas/savers/tgv/evas_image_save_tgv.c \
static_libs/rg_etc/rg_etc1.c \
static_libs/rg_etc/rg_etc2.c \
static_libs/rg_etc/rg_etc1.h \
-static_libs/rg_etc/etc2_encoder.c \
+static_libs/rg_etc/etc2_encoder.c
+if ! ENABLE_LIBLZ4
+lib_evas_libevas_la_SOURCES += \
static_libs/lz4/lz4.c \
static_libs/lz4/lz4.h \
static_libs/lz4/lz4hc.c \
static_libs/lz4/lz4hc.h
+endif
lib_evas_libevas_la_CPPFLAGS += \
--I$(top_srcdir)/src/static_libs/lz4 \
-I$(top_srcdir)/src/static_libs/rg_etc \
@evas_image_loader_tgv_cflags@
+if ! ENABLE_LIBLZ4
+lib_evas_libevas_la_CPPFLAGS += \
+-I$(top_srcdir)/src/static_libs/lz4
+endif
lib_evas_libevas_la_LIBADD += @evas_image_loader_tgv_libs@
if EVAS_CSERVE2
bin_evas_evas_cserve2_slave_SOURCES += \
modules/evas/loaders/tgv/evas_image_load_tgv.c \
static_libs/rg_etc/rg_etc1.c \
static_libs/rg_etc/rg_etc2.c \
-static_libs/rg_etc/rg_etc1.h \
+static_libs/rg_etc/rg_etc1.h
+if ! ENABLE_LIBLZ4
+bin_evas_evas_cserve2_slave_SOURCES += \
static_libs/lz4/lz4.c \
static_libs/lz4/lz4.h
+endif
bin_evas_evas_cserve2_slave_CPPFLAGS += \
-I$(top_builddir)/src/lib/efl \
--I$(top_srcdir)/src/static_libs/lz4 \
-I$(top_srcdir)/src/static_libs/rg_etc \
-I$(top_srcdir)/src/lib/evas/ \
@evas_image_loader_tgv_cflags@
+if ! ENABLE_LIBLZ4
+bin_evas_evas_cserve2_slave_CPPFLAGS += \
+-I$(top_srcdir)/src/static_libs/lz4
+endif
bin_evas_evas_cserve2_slave_LDADD += @evas_image_loader_tgv_libs@
endif
else
@@ -1937,16 +1949,22 @@ modules_evas_loaders_tgv_module_la_SOURCES = \
modules/evas/loaders/tgv/evas_image_load_tgv.c \
static_libs/rg_etc/rg_etc1.c \
static_libs/rg_etc/rg_etc2.c \
-static_libs/rg_etc/rg_etc1.h \
+static_libs/rg_etc/rg_etc1.h
+if ! ENABLE_LIBLZ4
+modules_evas_loaders_tgv_module_la_SOURCES += \
static_libs/lz4/lz4.c \
static_libs/lz4/lz4.h
+endif
modules_evas_loaders_tgv_module_la_CPPFLAGS = \
-I$(top_builddir)/src/lib/efl \
--I$(top_srcdir)/src/static_libs/lz4 \
-I$(top_srcdir)/src/static_libs/rg_etc \
-I$(top_srcdir)/src/lib/evas/ \
@EVAS_CFLAGS@ \
@evas_image_loader_tgv_cflags@
+if ! ENABLE_LIBLZ4
+modules_evas_loaders_tgv_module_la_CPPFLAGS += \
+-I$(top_srcdir)/src/static_libs/lz4
+endif
modules_evas_loaders_tgv_module_la_LIBADD = \
@USE_EVAS_LIBS@ \
@evas_image_loader_tgv_libs@
@@ -1960,18 +1978,24 @@ modules_evas_savers_tgv_module_la_SOURCES = \
modules/evas/savers/tgv/evas_image_save_tgv.c \
static_libs/rg_etc/rg_etc1.c \
static_libs/rg_etc/rg_etc1.h \
-static_libs/rg_etc/etc2_encoder.c \
+static_libs/rg_etc/etc2_encoder.c
+if ! ENABLE_LIBLZ4
+modules_evas_savers_tgv_module_la_SOURCES += \
static_libs/lz4/lz4.c \
static_libs/lz4/lz4.h \
static_libs/lz4/lz4hc.c \
static_libs/lz4/lz4hc.h
+endif
modules_evas_savers_tgv_module_la_CPPFLAGS = \
-I$(top_builddir)/src/lib/efl \
--I$(top_srcdir)/src/static_libs/lz4 \
-I$(top_srcdir)/src/static_libs/rg_etc \
-I$(top_srcdir)/src/lib/evas/ \
@EVAS_CFLAGS@ \
@evas_image_saver_tgv_cflags@
+if ! ENABLE_LIBLZ4
+modules_evas_savers_tgv_module_la_CPPFLAGS += \
+-I$(top_srcdir)/src/static_libs/lz4
+endif
modules_evas_savers_tgv_module_la_LIBADD = \
@USE_EVAS_LIBS@ \
@evas_image_saver_tgv_libs@
diff --git a/src/lib/eet/eet_image.c b/src/lib/eet/eet_image.c
index effe990666..1530f62284 100644
--- a/src/lib/eet/eet_image.c
+++ b/src/lib/eet/eet_image.c
@@ -25,8 +25,13 @@
#include "Eet.h"
#include "Eet_private.h"
-#include "lz4.h"
-#include "lz4hc.h"
+#ifdef ENABLE_LIBLZ4
+# include <lz4.h>
+# include <lz4hc.h>
+#else
+# include "lz4.h"
+# include "lz4hc.h"
+#endif
#include "rg_etc1.h"
diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index 40fc366459..6135b3541b 100644
--- a/src/lib/eet/eet_lib.c
+++ b/src/lib/eet/eet_lib.c
@@ -44,8 +44,13 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
#include "Eet.h"
#include "Eet_private.h"
-#include "lz4.h"
-#include "lz4hc.h"
+#ifdef ENABLE_LIBLZ4
+# include <lz4.h>
+# include <lz4hc.h>
+#else
+# include "lz4.h"
+# include "lz4hc.h"
+#endif
#ifndef O_BINARY
# define O_BINARY 0
diff --git a/src/modules/evas/loaders/tgv/evas_image_load_tgv.c b/src/modules/evas/loaders/tgv/evas_image_load_tgv.c
index 20517ad610..878b758a2d 100644
--- a/src/modules/evas/loaders/tgv/evas_image_load_tgv.c
+++ b/src/modules/evas/loaders/tgv/evas_image_load_tgv.c
@@ -10,7 +10,12 @@
# include <winsock2.h>
#endif /* ifdef _WIN32 */
-#include "lz4.h"
+#ifdef ENABLE_LIBLZ4
+# include <lz4.h>
+#else
+# include "lz4.h"
+#endif
+
#include "rg_etc1.h"
#include "Evas_Loader.h"
diff --git a/src/modules/evas/savers/tgv/evas_image_save_tgv.c b/src/modules/evas/savers/tgv/evas_image_save_tgv.c
index b1ed42629f..6319d79380 100644
--- a/src/modules/evas/savers/tgv/evas_image_save_tgv.c
+++ b/src/modules/evas/savers/tgv/evas_image_save_tgv.c
@@ -9,8 +9,14 @@
# include <winsock2.h>
#endif /* ifdef _WIN32 */
-#include "lz4.h"
-#include "lz4hc.h"
+#ifdef ENABLE_LIBLZ4
+# include <lz4.h>
+# include <lz4hc.h>
+#else
+# include "lz4.h"
+# include "lz4hc.h"
+#endif
+
#include "rg_etc1.h"
// FIXME: Remove DEBUG