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>
This commit is contained in:
Stefan Schmidt 2014-08-12 09:37:33 +02:00
parent 8c8a2b1098
commit 3fe554e0b6
7 changed files with 98 additions and 20 deletions

View File

@ -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):

View File

@ -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

View File

@ -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@

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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