Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement zlib buffers [#METR-23582] #304

Merged
merged 6 commits into from
Jan 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# emacs files
*~
*\#
.tramp_history

# auto generated files
*.logrt
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/MongoDB/inc
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/Zip/include/)
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libboost/boost_1_62_0/)

if (USE_STATIC_LIBRARIES)
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libzlib-ng/)
endif ()

include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/libs/libcommon/include/)
include_directories (BEFORE ${ClickHouse_BINARY_DIR}/libs/libcommon/include/)
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/libs/libdaemon/include/)
Expand Down
1 change: 1 addition & 0 deletions contrib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ add_subdirectory (libzookeeper)
add_subdirectory (libcityhash)
add_subdirectory (libfarmhash)
add_subdirectory (libmetrohash)
add_subdirectory (libzlib-ng)

if (ENABLE_LIBTCMALLOC)
add_subdirectory (libtcmalloc)
Expand Down
4 changes: 2 additions & 2 deletions contrib/libpoco/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ endif ()

if (POCO_UNBUNDLED)
add_definitions( -DPOCO_UNBUNDLED)
message(STATUS "Build with using external sqlite, libz, pcre, expat ...")
message(STATUS "Build with using external sqlite, pcre, expat ...")
else ()
message(STATUS "Build with using internal copy of sqlite, libz, pcre, expat, ...")
message(STATUS "Build with using internal copy of sqlite, pcre, expat, ...")
endif ()

include(CheckTypeSize)
Expand Down
33 changes: 10 additions & 23 deletions contrib/libpoco/Foundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ if (POCO_UNBUNDLED)
src/pcre_ucd.c
src/pcre_tables.c
)

find_package(ZLIB REQUIRED)
set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
else()
# pcre
POCO_SOURCES( SRCS pcre
Expand All @@ -73,27 +69,18 @@ else()
src/pcre_valid_utf8.c
src/pcre_xclass.c
)

# zlib
POCO_HEADERS( SRCS zlib
include/Poco/zconf.h
include/Poco/zlib.h
)

POCO_SOURCES( SRCS zlib
src/adler32.c
src/compress.c
src/crc32.c
src/deflate.c
src/infback.c
src/inffast.c
src/inflate.c
src/inftrees.c
src/trees.c
src/zutil.c
)
endif (POCO_UNBUNDLED)

if (USE_STATIC_LIBRARIES)
# Use zlib from clickhouse contrib.
set(SYSLIBS ${SYSLIBS} zlibstatic)
include_directories("${ClickHouse_SOURCE_DIR}/contrib/libzlib-ng/")
else()
find_package(ZLIB REQUIRED)
set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
endif (USE_STATIC_LIBRARIES)

Copy link
Contributor Author

@ztlpn ztlpn Jan 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed zlib that was bundled with Poco from build (or else zlib symbols would be duplicated everywhere, leading to one of the two sets of symbols selected based on link order).

if(WIN32)
set(SYSLIBS ${SYSLIBS} iphlpapi)
endif(WIN32)
Expand Down
4 changes: 0 additions & 4 deletions contrib/libpoco/Foundation/include/Poco/DeflatingStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
#include "Poco/BufferedStreamBuf.h"
#include <istream>
#include <ostream>
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "Poco/zlib.h"
#endif


namespace Poco {
Expand Down
4 changes: 0 additions & 4 deletions contrib/libpoco/Foundation/include/Poco/InflatingStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
#include "Poco/BufferedStreamBuf.h"
#include <istream>
#include <ostream>
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "Poco/zlib.h"
#endif


namespace Poco {
Expand Down
4 changes: 0 additions & 4 deletions contrib/libpoco/Foundation/src/Checksum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@


#include "Poco/Checksum.h"
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "Poco/zlib.h"
#endif


namespace Poco {
Expand Down
4 changes: 0 additions & 4 deletions contrib/libpoco/Zip/src/ZipStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
#include "Poco/Exception.h"
#include "Poco/InflatingStream.h"
#include "Poco/DeflatingStream.h"
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "Poco/zlib.h"
#endif


namespace Poco {
Expand Down
52 changes: 52 additions & 0 deletions contrib/libzlib-ng/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
*.diff
*.patch
*.orig
*.rej

*~
*.a
*.lo
*.o
*.dylib

*.gcda
*.gcno
*.gcov

/example
/example64
/examplesh
/libz.so*
/minigzip
/minigzip64
/minigzipsh
/zlib.pc
/CVE-2003-0107

.DS_Store
*.obj
*.exe
*.pdb
*.exp
*.lib
*.dll
*.res
foo.gz
*.manifest

CMakeCache.txt
CMakeFiles
Testing
*.cmake
*.stackdump
zconf.h
zconf.h.cmakein
zconf.h.included
ztest*

configure.log
a.out

/arch/arm/Makefile
/arch/generic/Makefile
/arch/x86/Makefile
12 changes: 12 additions & 0 deletions contrib/libzlib-ng/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: c
compiler:
- gcc
- clang
env:
- BUILDDIR=. TOOL="./configure --zlib-compat"
- BUILDDIR=../build TOOL="../zlib-ng/configure --zlib-compat"
- BUILDDIR=. TOOL="./configure --zlib-compat --without-optimizations --without-new-strategies"
- BUILDDIR=. TOOL="cmake ."
- BUILDDIR=../build TOOL="cmake ../zlib-ng"
script: mkdir -p $BUILDDIR && cd $BUILDDIR &&
$TOOL && make && make test