From 8712461867be277c4adc6cfa125d548e3ecc2a50 Mon Sep 17 00:00:00 2001
From: Roman Tsisyk <roman@tsisyk.com>
Date: Thu, 29 Sep 2016 18:06:52 +0300
Subject: [PATCH] Remove unused lz4 library

---
 .gitmodules            |  4 ----
 CMakeLists.txt         | 22 ----------------------
 cmake/FindLZ4.cmake    | 18 ------------------
 debian/control         |  1 -
 debian/copyright       |  4 ----
 rpm/tarantool.spec     |  6 ------
 src/box/CMakeLists.txt |  4 ++--
 third_party/lz4        |  1 -
 8 files changed, 2 insertions(+), 58 deletions(-)
 delete mode 100644 cmake/FindLZ4.cmake
 delete mode 160000 third_party/lz4

diff --git a/.gitmodules b/.gitmodules
index 8b181c16d5..13b1fa805d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -23,10 +23,6 @@
 	path = src/lib/small
 	url = https://github.com/tarantool/small.git
 	ignore = dirty
-[submodule "third_party/lz4"]
-	path = third_party/lz4
-	url = https://github.com/tarantool/lz4.git
-	ignore = dirty
 [submodule "third_party/zstd"]
 	path = third_party/zstd
 	url = https://github.com/tarantool/zstd.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d98745b1c..7ddd05fee9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -370,28 +370,6 @@ else()
     find_package(LibYAML)
 endif()
 
-#
-# LZ4
-#
-
-option(ENABLE_BUNDLED_LZ4 "Enable building of the bundled LZ4" ON)
-if (ENABLE_BUNDLED_LZ4)
-    add_library(lz4 STATIC
-        third_party/lz4/lib/lz4.c
-        third_party/lz4/lib/lz4frame.c
-        third_party/lz4/lib/lz4hc.c
-        third_party/lz4/lib/xxhash.c
-    )
-    set(LZ4_LIBRARIES lz4)
-    set(LZ4_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lz4/lib)
-    find_package_message(LZ4 "Using bundled LZ4"
-        "${LZ4_LIBRARIES}:${LZ4_INCLUDE_DIRS}")
-    add_dependencies(build_bundled_libs lz4)
-else()
-    set(LZ4_FIND_REQUIRED ON)
-    find_package(LZ4)
-endif()
-
 #
 # zstd
 #
diff --git a/cmake/FindLZ4.cmake b/cmake/FindLZ4.cmake
deleted file mode 100644
index 46a9828afd..0000000000
--- a/cmake/FindLZ4.cmake
+++ /dev/null
@@ -1,18 +0,0 @@
-# - Find liblz4 library
-# The module defines the following variables:
-#
-#  LZ4_FOUND - true if MsgPuck was found
-#  LZ4_INCLUDE_DIRS - the directory of the MsgPuck headers
-#  LZ4_LIBRARIES - the MsgPuck static library needed for linking
-#
-
-find_path(LZ4_INCLUDE_DIR lz4.h lz4frame.h lz4hc.h PATH_SUFFIXES lz4)
-find_library(LZ4_LIBRARY NAMES lz4)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(LZ4
-    REQUIRED_VARS LZ4_INCLUDE_DIR LZ4_LIBRARY)
-set(LZ4_INCLUDE_DIRS ${LZ4_INCLUDE_DIR})
-set(LZ4_LIBRARIES ${LZ4_LIBRARY})
-mark_as_advanced(LZ4_INCLUDE_DIR LZ4_INCLUDE_DIRS
-                 LZ4_LIBRARY LZ4_LIBRARIES)
diff --git a/debian/control b/debian/control
index 2337ea0994..3a6a708063 100644
--- a/debian/control
+++ b/debian/control
@@ -16,7 +16,6 @@ Build-Depends: cdbs (>= 0.4.100), debhelper (>= 9), dpkg-dev (>= 1.16.1~),
  binutils-dev,
 # zlib is implicitly needed by libbfd #808516
  zlib1g-dev,
-# liblz4-dev (>= r131),
  libssl-dev
 Section: database
 Standards-Version: 3.9.8
diff --git a/debian/copyright b/debian/copyright
index 22ca33782a..a481713716 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -255,10 +255,6 @@ Copyright: 2013 Advanced Computing Technologies LLC,
  Written by: John H. Baldwin <jhb@FreeBSD.org>
 License: BSD-2-Clause
 
-Files: third_party/lz4/*
-Copyright: 2011-2014, Yann Collet
-License: BSD-2-Clause
-
 Files: third_party/zstd/*
 Copyright: 2014-2015, Yann Collet
 License: BSD-2-Clause
diff --git a/rpm/tarantool.spec b/rpm/tarantool.spec
index 1a9bdcc3fb..136d76a866 100644
--- a/rpm/tarantool.spec
+++ b/rpm/tarantool.spec
@@ -12,9 +12,6 @@ BuildRequires: sed
 BuildRequires: readline-devel
 BuildRequires: libyaml-devel
 BuildRequires: openssl-devel
-%if 0%{?fedora} >= 22
-BuildRequires: lz4-devel >= r131
-%endif
 #BuildRequires: msgpuck-devel
 %if 0%{?fedora} > 0
 # pod2man is needed to build man pages
@@ -106,9 +103,6 @@ C and Lua/C modules.
          -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=%{_localstatedir} \
          -DCMAKE_INSTALL_SYSCONFDIR:PATH=%{_sysconfdir} \
          -DENABLE_BUNDLED_LIBYAML:BOOL=OFF \
-%if 0%{?fedora} >= 22
-         -DENABLE_BUNDLED_LZ4:BOOL=OFF \
-%endif
 %if %{with backtrace}
          -DENABLE_BACKTRACE:BOOL=ON \
 %else
diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
index df3ecf98ff..6e8cdf7601 100644
--- a/src/box/CMakeLists.txt
+++ b/src/box/CMakeLists.txt
@@ -16,7 +16,7 @@ add_custom_target(box_generate_lua_sources
     DEPENDS ${lua_sources})
 set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${lua_sources})
 
-include_directories(${LZ4_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIRS})
+include_directories(${ZSTD_INCLUDE_DIRS})
 
 add_library(box STATIC
     iproto.cc
@@ -81,5 +81,5 @@ add_library(box STATIC
     lua/net_box.c
     ${bin_sources})
 
-target_link_libraries(box ${LZ4_LIBRARIES} ${ZSTD_LIBRARIES})
+target_link_libraries(box ${ZSTD_LIBRARIES})
 add_dependencies(box build_bundled_libs)
diff --git a/third_party/lz4 b/third_party/lz4
deleted file mode 160000
index d86dc91677..0000000000
--- a/third_party/lz4
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit d86dc916771c126afb797637dda9f6421c0cb998
-- 
GitLab