2018-06-25 01:11:07 +00:00
|
|
|
HERE:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
|
|
ROOT:=$(HERE)/../..
|
|
|
|
VTABLE:=$(ROOT)/parquet
|
|
|
|
SQLITE:=$(ROOT)/sqlite
|
|
|
|
|
|
|
|
# Directories
|
|
|
|
ARROW=$(HERE)/arrow
|
2018-06-26 12:17:18 +00:00
|
|
|
ARROW_RELEASE=$(ARROW)/cpp/release
|
2018-06-27 02:44:50 +00:00
|
|
|
BOOST_ROOT=$(ARROW_RELEASE)/boost_ep-prefix/src/boost_ep
|
|
|
|
BOOST=$(BOOST_ROOT)/stage/lib
|
2019-11-14 04:20:40 +00:00
|
|
|
|
|
|
|
BROTLI=$(PARQUET_CPP)/arrow_ep-prefix/src/arrow_ep-build/brotli_ep/src/brotli_ep-install/lib/x86_64-linux-gnu
|
2018-06-27 02:44:50 +00:00
|
|
|
ICU=$(HERE)/icu
|
2018-06-26 12:17:18 +00:00
|
|
|
LZ4=$(ARROW_RELEASE)/lz4_ep-prefix/src/lz4_ep/lib
|
2018-06-25 01:11:07 +00:00
|
|
|
PARQUET_CPP=$(HERE)/parquet-cpp
|
2018-06-26 12:17:18 +00:00
|
|
|
SNAPPY=$(ARROW_RELEASE)/snappy_ep/src/snappy_ep-install/lib
|
2019-11-14 04:20:40 +00:00
|
|
|
|
|
|
|
ZLIB=$(PARQUET_CPP)/zlib_ep/src/zlib_ep-install/lib
|
|
|
|
ZSTD=$(PARQUET_CPP)/arrow_ep-prefix/src/arrow_ep-build/zstd_ep-prefix/src/zstd_ep/lib
|
2018-06-25 01:11:07 +00:00
|
|
|
|
|
|
|
# Libraries
|
2018-06-28 02:23:22 +00:00
|
|
|
# profile_gen, profile_build for PGO
|
|
|
|
APACHE_BUILD=release
|
|
|
|
|
|
|
|
ARROW_LIB = $(ARROW_RELEASE)/$(APACHE_BUILD)/libarrow.a
|
2018-06-27 02:44:50 +00:00
|
|
|
BOOST_FILESYSTEM_LIB = $(BOOST)/libboost_filesystem.a
|
|
|
|
BOOST_REGEX_LIB = $(BOOST)/libboost_regex.a
|
|
|
|
BOOST_SYSTEM_LIB = $(BOOST)/libboost_system.a
|
2018-06-26 12:17:18 +00:00
|
|
|
BROTLI_COMMON_LIB = $(BROTLI)/libbrotlicommon.a
|
|
|
|
BROTLI_DEC_LIB = $(BROTLI)/libbrotlidec.a
|
|
|
|
BROTLI_ENC_LIB = $(BROTLI)/libbrotlienc.a
|
2018-06-27 02:44:50 +00:00
|
|
|
ICU_I18N_LIB=$(ICU)/source/lib/libicui18n.a
|
|
|
|
ICU_UC_LIB=$(ICU)/source/lib/libicuuc.a
|
|
|
|
ICU_DATA_LIB=$(ICU)/source/lib/libicudata.a
|
2018-06-26 12:17:18 +00:00
|
|
|
LZ4_LIB = $(LZ4)/liblz4.a
|
2018-06-28 02:23:22 +00:00
|
|
|
PARQUET_CPP_LIB = $(PARQUET_CPP)/build/$(APACHE_BUILD)/libparquet.a
|
2018-06-26 12:17:18 +00:00
|
|
|
SNAPPY_LIB = $(SNAPPY)/libsnappy.a
|
2018-06-25 01:11:07 +00:00
|
|
|
THRIFT_LIB = $(PARQUET_CPP)/thrift_ep/src/thrift_ep-install/lib/libthrift.a
|
|
|
|
ZLIB_LIB = $(ZLIB)/libz.a
|
2018-06-26 12:17:18 +00:00
|
|
|
ZSTD_LIB = $(ZSTD)/libzstd.a
|
2018-06-25 01:11:07 +00:00
|
|
|
|
|
|
|
# Flags
|
2018-07-05 13:09:18 +00:00
|
|
|
CC = gcc
|
|
|
|
CXX = g++
|
2018-07-05 22:47:33 +00:00
|
|
|
OPTIMIZATIONS = -O3
|
2018-06-25 01:11:07 +00:00
|
|
|
CPUS:=$(shell nproc)
|
2019-11-14 04:20:40 +00:00
|
|
|
CFLAGS = -I $(SQLITE) -I $(PARQUET_CPP)/arrow_ep-prefix/src/arrow_ep/cpp/src -I $(PARQUET_CPP)/src -I $(ARROW)/cpp/src $(OPTIMIZATIONS) -std=c++11 -Wall -fPIC -g
|
2018-06-25 01:11:07 +00:00
|
|
|
|
2018-07-05 01:45:59 +00:00
|
|
|
ALL_LIBS = $(PARQUET_CPP_LIB) $(LZ4_LIB) $(ZSTD_LIB) $(THRIFT_LIB) $(SNAPPY_LIB) $(ARROW_LIB) \
|
|
|
|
$(ICU_I18N_LIB) $(ICU_UC_LIB) $(ICU_DATA_LIB) \
|
|
|
|
$(BROTLI_ENC_LIB) $(BROTLI_COMMON_LIB) $(BROTLI_DEC_LIB) $(BOOST_REGEX_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB)
|
|
|
|
|
2018-07-05 22:47:33 +00:00
|
|
|
LDFLAGS = $(OPTIMIZATIONS) \
|
2018-07-05 01:45:59 +00:00
|
|
|
-Wl,--whole-archive $(ALL_LIBS) \
|
2018-06-27 02:44:50 +00:00
|
|
|
-Wl,--no-whole-archive -lz -lcrypto -lssl
|
2018-06-25 01:11:07 +00:00
|
|
|
OBJ = parquet.o parquet_filter.o parquet_table.o parquet_cursor.o
|
2018-06-27 02:44:50 +00:00
|
|
|
LIBS = $(ARROW_LIB) $(PARQUET_CPP_LIB) $(ICU_I18N_LIB)
|
2018-06-25 01:11:07 +00:00
|
|
|
|
2018-06-27 03:50:11 +00:00
|
|
|
PROF =
|
|
|
|
|
2018-06-25 17:20:04 +00:00
|
|
|
libparquet.so: $(LIBS) $(OBJ)
|
2018-07-05 13:09:18 +00:00
|
|
|
$(CXX) $(PROF) -shared -o $@ $(OBJ) $(LDFLAGS)
|
2018-06-25 01:11:07 +00:00
|
|
|
|
2018-07-05 02:36:43 +00:00
|
|
|
parquet_filter.o: $(VTABLE)/parquet_filter.cc $(VTABLE)/parquet_filter.h $(ARROW) $(PARQUET_CPP)
|
2018-07-05 13:09:18 +00:00
|
|
|
$(CXX) $(PROF) -c -o $@ $< $(CFLAGS)
|
2018-06-25 01:11:07 +00:00
|
|
|
|
2018-07-05 02:36:43 +00:00
|
|
|
parquet_cursor.o: $(VTABLE)/parquet_cursor.cc $(VTABLE)/parquet_cursor.h $(VTABLE)/parquet_table.h $(VTABLE)/parquet_filter.h $(ARROW) $(PARQUET_CPP)
|
2018-07-05 13:09:18 +00:00
|
|
|
$(CXX) $(PROF) -c -o $@ $< $(CFLAGS)
|
2018-06-25 01:11:07 +00:00
|
|
|
|
2018-07-05 02:36:43 +00:00
|
|
|
parquet_table.o: $(VTABLE)/parquet_table.cc $(VTABLE)/parquet_table.h $(ARROW) $(PARQUET_CPP)
|
2018-07-05 13:09:18 +00:00
|
|
|
$(CXX) $(PROF) -c -o $@ $< $(CFLAGS)
|
2018-06-25 01:11:07 +00:00
|
|
|
|
2018-07-05 02:36:43 +00:00
|
|
|
parquet.o: $(VTABLE)/parquet.cc $(VTABLE)/parquet_cursor.h $(VTABLE)/parquet_table.h $(VTABLE)/parquet_filter.h $(ARROW) $(PARQUET_CPP)
|
2018-07-05 13:09:18 +00:00
|
|
|
$(CXX) $(PROF) -c -o $@ $< $(CFLAGS)
|
2018-06-25 01:11:07 +00:00
|
|
|
|
2018-07-05 01:58:59 +00:00
|
|
|
$(ARROW):
|
2018-06-25 01:11:07 +00:00
|
|
|
rm -rf $(ARROW)
|
|
|
|
git clone https://github.com/apache/arrow.git $(ARROW)
|
2019-11-14 04:20:40 +00:00
|
|
|
cd $(ARROW) && git checkout apache-arrow-0.15.1
|
2018-07-05 12:55:46 +00:00
|
|
|
mkdir $(ARROW)/cpp/release
|
|
|
|
cd $(ARROW)/cpp/release && cmake -DCMAKE_BUILD_TYPE=$(APACHE_BUILD) -DARROW_BOOST_VENDORED=ON -DARROW_BOOST_USE_SHARED=OFF -DPARQUET_BUILD_SHARED=OFF ..
|
2018-07-05 02:13:10 +00:00
|
|
|
touch -d @0 $(ARROW)
|
2018-07-05 01:58:59 +00:00
|
|
|
|
|
|
|
$(ARROW_LIB): $(ARROW)
|
2018-07-05 00:50:47 +00:00
|
|
|
cd $(ARROW)/cpp/release && make -j$(CPUS)
|
2018-06-25 01:11:07 +00:00
|
|
|
|
2018-06-27 02:44:50 +00:00
|
|
|
# This is pretty gross. I'm sure someone who knows what they're doing could do this more cleanly.
|
|
|
|
$(ICU_I18N_LIB):
|
|
|
|
rm -rf $(ICU)
|
|
|
|
mkdir $(ICU)
|
2018-06-28 03:20:33 +00:00
|
|
|
cd $(ICU) && wget http://download.icu-project.org/files/icu4c/$(ICU_VERSION)/icu4c-$(ICU_VERSION_U)-src.tgz
|
|
|
|
cd $(ICU) && tar xf icu4c-$(ICU_VERSION_U)-src.tgz --strip-components=1
|
2018-06-27 02:44:50 +00:00
|
|
|
cd $(ICU)/source && ./configure --enable-static
|
|
|
|
cd $(ICU)/source && make -j$(CPUS) LIBCFLAGS='-fPIC' LIBCXXFLAGS='-fPIC'
|
|
|
|
|
2018-07-05 01:58:59 +00:00
|
|
|
$(PARQUET_CPP):
|
2018-06-25 01:11:07 +00:00
|
|
|
rm -rf $(PARQUET_CPP)
|
|
|
|
git clone https://github.com/apache/parquet-cpp.git $(PARQUET_CPP)
|
|
|
|
cd $(PARQUET_CPP) && git checkout apache-parquet-cpp-1.4.0
|
2018-07-05 12:55:46 +00:00
|
|
|
cd $(PARQUET_CPP) && BOOST_ROOT=$(BOOST_ROOT) BOOST_STATIC_REGEX_LIBRARY=$(BOOST_REGEX_LIB) SNAPPY_STATIC_LIB=$(SNAPPY_LIB) BROTLI_STATIC_LIB_ENC=$(BROTLI_ENC_LIB) BROTLI_STATIC_LIB_DEC=$(BROTLI_DEC_LIB) BROTLI_STATIC_LIB_COMMON=$(BROTLI_COMMON_LIB) ZLIB_STATIC_LIB=$(ZLIB_LIB) LZ4_STATIC_LIB=$(LZ4_LIB) ZSTD_STATIC_LIB=$(ZSTD_LIB) cmake -DCMAKE_BUILD_TYPE=$(APACHE_BUILD) -DPARQUET_MINIMAL_DEPENDENCY=ON -DPARQUET_ARROW_LINKAGE=static -DPARQUET_BOOST_USE_SHARED=OFF -DPARQUET_BUILD_SHARED=OFF .
|
2018-07-05 02:13:10 +00:00
|
|
|
touch -d @0 $(PARQUET_CPP)
|
2018-07-05 01:58:59 +00:00
|
|
|
|
|
|
|
$(PARQUET_CPP_LIB): $(PARQUET_CPP) $(ARROW_LIB)
|
2018-06-25 01:11:07 +00:00
|
|
|
cd $(PARQUET_CPP) && make -j$(CPUS)
|
|
|
|
|
2018-07-06 03:08:52 +00:00
|
|
|
.PHONY: clean arrow icu parquet publish_libs
|
2018-06-25 01:11:07 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f *.o *.so
|
|
|
|
|
|
|
|
distclean:
|
|
|
|
rm -rf $(SQLITE) $(HERE)
|
|
|
|
|
|
|
|
|
|
|
|
arrow: $(ARROW_LIB)
|
|
|
|
|
2018-06-27 02:44:50 +00:00
|
|
|
icu: $(ICU_I18N_LIB)
|
|
|
|
|
2018-06-25 01:11:07 +00:00
|
|
|
parquet: $(PARQUET_CPP_LIB)
|
|
|
|
|
2018-07-05 01:45:59 +00:00
|
|
|
publish_libs:
|
2018-07-06 03:08:52 +00:00
|
|
|
tar -cJf libs.tar.xz $(ALL_LIBS) $(SQLITE)/sqlite3
|
|
|
|
s3cmd put libs.tar.xz s3://cldellow/public/libparquet/$$(lsb_release -s -r)/libs.tar.xz
|