Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 92 additions & 17 deletions docker/centos7/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,122 @@
FROM centos:7
#MAINTAINER Banana Team <team@banan.com>
RUN yum -y update && yum clean all
RUN yum install -y which wget texinfo
RUN yum install -y epel-release
RUN yum groupinstall -y "Development Tools"
RUN yum install -y python-devel libxslt-devel libxml2-devel
RUN yum install -y libmpc-devel mpfr-devel gmp-devel
#RUN yum install -y gmp-devel mpfr-devel libmpc-devel glibc-devel.i686 libgcc.i686

RUN cd /tmp \
&& wget http://mirrors.concertpass.com/gcc/releases/gcc-6.4.0/gcc-6.4.0.tar.gz \
&& tar -xvf gcc-6.4.0.tar.gz \
&& cd gcc-6.4.0 \
&& ./configure --disable-multilib --enable-languages=c,c++ \
&& make -j 8 \
&& make install
#RUN yum install -y cmake
RUN cd /tmp \
&& wget https://cmake.org/files/v3.9/cmake-3.9.1.tar.gz \

ENV LD_LIBRARY_PATH /usr/local/lib64/:/usr/local/lib/:$LD_LIBRARY_PATH

WORKDIR /tmp

RUN yum install -y ncurses-devel

RUN wget https://cmake.org/files/v3.9/cmake-3.9.1.tar.gz \
&& tar -xvf cmake-3.9.1.tar.gz \
&& cd cmake-3.9.1 \
&& export LD_LIBRARY_PATH=/usr/local/lib64/:$LD_LIBRARY_PATH \
&& ./bootstrap \
&& make \
&& make install

RUN cd /tmp \
&& wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.zip \
RUN wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.zip \
&& unzip boost_1_64_0.zip \
&& cd boost_1_64_0 \
&& ./bootstrap.sh \
# && ./bootstrap.sh --libdir=/usr/local/lib64/ \
&& echo "using gcc : 6.4 : /usr/local/bin/g++ ;" >> ./tools/build/src/user-config.jam \
&& ./b2 --toolset=gcc-6.4 \
&& ./b2 install

RUN yum install -y gflags glog
RUN yum install -y gflags-devel glog-devel
#RUN cd /tmp \
# && wget https://github.com/facebook/folly/archive/v2017.05.15.00.zip \
# && unzip v2017.05.15.00.zip \
# && cd folly-2017.05.15.00 \
# && mkdir build \
# && cd build \
# && cmake .. \
# && make \
# && make install
RUN wget https://github.com/google/double-conversion/archive/v3.0.0.zip \
&& unzip v3.0.0.zip \
&& cd double-conversion-3.0.0/ \
&& cmake . -DBUILD_TESTING=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \
&& make \
&& test/cctest/cctest --list | tr -d '<' | xargs test/cctest/cctest \
&& make install

RUN yum install -y libevent-devel snappy-devel lz4-devel lzma-sdk457-devel perl-core

RUN wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_0f.zip \
&& unzip OpenSSL_1_1_0f.zip \
&& cd openssl-OpenSSL_1_1_0f/ \
&& ./config \
&& make \
# && make test \
&& make install

RUN wget https://github.com/gflags/gflags/archive/v2.2.1.zip \
&& unzip v2.2.1.zip \
&& cd gflags-2.2.1/ \
&& mkdir build && cd build \
&& cmake -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON .. \
&& make && make test && make install
# && cmake -DBUILD_SHARED_LIBS=ON -DLIBRARY_INSTALL_DIR=/usr/local/lib64 -DBUILD_TESTING=ON .. \
# && make && make test && make install

RUN wget https://github.com/google/glog/archive/v0.3.5.zip \
&& unzip v0.3.5.zip \
&& cd glog-0.3.5/ \
&& mkdir build && cd build \
&& cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. \
&& make && make test && make install

RUN wget https://github.com/google/googletest/archive/release-1.8.0.zip \
&& unzip release-1.8.0.zip \
&& cd googletest-release-1.8.0/ \
&& mkdir build && cd build \
&& cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. \
&& make && make test && make install

RUN wget https://github.com/facebook/folly/archive/v2017.08.21.00.zip \
&& unzip v2017.08.21.00.zip \
&& cd folly-2017.08.21.00/folly \
&& autoreconf -ivf \
&& ./configure \
&& make \
# && make check \
&& make install

COPY wangle/CMakeLists.txt .

RUN mkdir wangle && cd wangle \
&& wget https://github.com/facebook/wangle/archive/v2017.08.21.00.zip \
&& unzip v2017.08.21.00.zip \
&& cd wangle-2017.08.21.00/wangle/ \
&& cp -f /tmp/CMakeLists.txt . \
&& mkdir build && cd build \
&& cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. \
&& make \
# && make test \ --> docker network issue
&& make install

RUN wget http://mirrors.ustc.edu.cn/gnu/autoconf-archive/autoconf-archive-2010.06.04.tar.gz \
&& tar -xvf autoconf-archive-2010.06.04.tar.gz \
&& cd autoconf-archive-2010.06.04 \
&& ./configure \
&& make && make install

RUN yum install -y libcap-devel gperf

RUN mkdir proxygen && cd proxygen \
&& wget https://github.com/facebook/proxygen/archive/v2017.08.21.00.zip \
&& unzip v2017.08.21.00.zip \
&& cd proxygen-2017.08.21.00/proxygen \
&& ACLOCAL='aclocal -I /usr/local/share/aclocal' autoreconf -ivf \
&& ./configure \
&& make && make install

WORKDIR ~

RUN rm -rf /tmp/*
231 changes: 231 additions & 0 deletions docker/centos7/wangle/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.

cmake_minimum_required(VERSION 2.8)

add_compile_options(-std=c++1y)
add_compile_options(-fPIC)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)

# When installing Folly & Wangle in a non-default prefix, this will let
# projects linking against libwangle.so to find libfolly.so automatically.
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

find_package(Folly REQUIRED)
find_package(Boost REQUIRED COMPONENTS system thread filesystem regex context)
find_package(OpenSSL REQUIRED)
find_package(Glog REQUIRED)
find_package(Gflags REQUIRED)
find_package(Libevent REQUIRED)
find_package(DoubleConversion REQUIRED)
find_package(Threads REQUIRED)
find_package(Libdl)
if (UNIX AND NOT APPLE)
find_package(Librt)
endif()

include(CheckAtomic)

include_directories(
${CMAKE_SOURCE_DIR}/..
${FOLLY_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${GLOG_INCLUDE_DIRS}
${GFLAGS_INCLUDE_DIRS}
${LIBEVENT_INCLUDE_DIRS}
${DOUBLE_CONVERSION_INCLUDE_DIRS}
${INCLUDE_DIR}
)

set(WANGLE_HEADER_DIRS
acceptor
bootstrap
channel
client
codec
concurrent
deprecated
service
ssl
util
)

foreach(dir ${WANGLE_HEADER_DIRS})
file(GLOB_RECURSE headers ${dir}/*.h)
set(WANGLE_HEADERS
${WANGLE_HEADERS}
${headers})
endforeach()

set(WANGLE_SOURCES
acceptor/Acceptor.cpp
acceptor/AcceptorHandshakeManager.cpp
acceptor/ConnectionManager.cpp
acceptor/LoadShedConfiguration.cpp
acceptor/ManagedConnection.cpp
acceptor/SecureTransportType.cpp
acceptor/SocketOptions.cpp
acceptor/SSLAcceptorHandshakeHelper.cpp
acceptor/TLSPlaintextPeekingCallback.cpp
acceptor/TransportInfo.cpp
bootstrap/ServerBootstrap.cpp
channel/FileRegion.cpp
channel/Pipeline.cpp
codec/LengthFieldBasedFrameDecoder.cpp
codec/LengthFieldPrepender.cpp
codec/LineBasedFrameDecoder.cpp
concurrent/ThreadedExecutor.cpp
concurrent/CPUThreadPoolExecutor.cpp
concurrent/Codel.cpp
concurrent/GlobalExecutor.cpp
concurrent/IOThreadPoolExecutor.cpp
concurrent/SerialExecutor.cpp
concurrent/ThreadPoolExecutor.cpp
deprecated/rx/Dummy.cpp
ssl/PasswordInFile.cpp
ssl/ServerSSLContext.cpp
ssl/SSLContextManager.cpp
ssl/SSLSessionCacheManager.cpp
ssl/SSLUtil.cpp
ssl/TLSTicketKeyManager.cpp
ssl/TLSCredProcessor.cpp
util/FilePoller.cpp
)

add_library(wangle
${WANGLE_HEADERS}
${WANGLE_SOURCES}
)

if (BUILD_SHARED_LIBS)
set_target_properties(wangle
PROPERTIES VERSION 1.0.0 SOVERSION 1)
endif()

target_link_libraries(wangle
${FOLLY_LIBRARIES}
${Boost_LIBRARIES}
${OPENSSL_LIBRARIES}
${GLOG_LIBRARIES}
${GFLAGS_LIBRARIES}
${LIBEVENT_LIBRARIES}
${DOUBLE_CONVERSION_LIBRARIES}
${LIBDL_LIBRARIES}
${LIBRT_LIBRARIES})

install(TARGETS wangle DESTINATION lib)
foreach(dir ${WANGLE_HEADER_DIRS})
install(DIRECTORY ${dir} DESTINATION include/wangle
FILES_MATCHING PATTERN "*.h")
endforeach()

IF(CMAKE_CROSSCOMPILING)
option(BUILD_TESTS "BUILD_TESTS" OFF)
ELSE(CMAKE_CROSSCOMPILING)
option(BUILD_TESTS "BUILD_TESTS" ON)
ENDIF(CMAKE_CROSSCOMPILING)

if(BUILD_TESTS)
enable_testing()

include(ExternalProject)

# Download and install GoogleMock
ExternalProject_Add(
gtest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.0
PREFIX gtest
CMAKE_ARGS -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
# Disable install step
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
LOG_UPDATE 1
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_TEST 1
LOG_INSTALL 1
)

# Create a libgmock target to be used as a dependency by test programs
add_library(libgmock IMPORTED STATIC GLOBAL)
add_dependencies(libgmock gtest)
add_library(libgmock_main IMPORTED STATIC GLOBAL)
add_dependencies(libgmock_main gtest)

# Set gmock properties
ExternalProject_Get_Property(gtest source_dir binary_dir)
set_target_properties(libgmock PROPERTIES
"IMPORTED_LOCATION" "${binary_dir}/googlemock/libgmock.a"
"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
)
set_target_properties(libgmock_main PROPERTIES
"IMPORTED_LOCATION" "${binary_dir}/googlemock/libgmock_main.a"
"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
)

include_directories("${source_dir}/googlemock/include")
include_directories("${source_dir}/googletest/include")

macro(add_gtest test_source test_name)
add_executable(${test_name} ${test_source} test/TestMain.cpp)
target_link_libraries(${test_name} wangle libgmock libgmock_main)
add_test(${test_name} bin/${test_name})
endmacro(add_gtest)

# this test segfaults
add_gtest(acceptor/test/AcceptorTest.cpp AcceptorTest)
add_gtest(acceptor/test/ConnectionManagerTest.cpp ConnectionManagerTest)
add_gtest(acceptor/test/LoadShedConfigurationTest.cpp LoadShedConfigurationTest)
add_gtest(acceptor/test/PeekingAcceptorHandshakeHelperTest.cpp PeekingAcceptorHandshakeHelperTest)
add_gtest(bootstrap/BootstrapTest.cpp BootstrapTest)
add_gtest(channel/broadcast/test/BroadcastHandlerTest.cpp BroadcastHandlerTest)
add_gtest(channel/broadcast/test/BroadcastPoolTest.cpp BroadcastPoolTest)
add_gtest(channel/broadcast/test/ObservingHandlerTest.cpp ObservingHandlerTest)
add_gtest(channel/test/AsyncSocketHandlerTest.cpp AsyncSocketHandlerTest)
add_gtest(channel/test/OutputBufferingHandlerTest.cpp OutputBufferingHandlerTest)
add_gtest(channel/test/PipelineTest.cpp PipelineTest)
add_gtest(codec/CodecTest.cpp CodecTest)
add_gtest(concurrent/test/AsyncTest.cpp AsyncTest)
add_gtest(concurrent/test/CodelTest.cpp CodelTest)
add_gtest(concurrent/test/GlobalExecutorTest.cpp GlobalExecutorTest)
add_gtest(concurrent/test/SerialExecutorTest.cpp SerialExecutorTest)
add_gtest(concurrent/test/ThreadedExecutorTest.cpp ThreadedExecutorTest)
add_gtest(concurrent/test/ThreadPoolExecutorTest ThreadPoolExecutorTest)
add_gtest(deprecated/rx/test/RxTest.cpp RxTest)
# this test fails with an exception
# add_gtest(service/ServiceTest.cpp ServiceTest)
# this test requires arguments?
# add_gtest(ssl/test/SSLCacheTest.cpp SSLCacheTest)
add_gtest(ssl/test/SSLContextManagerTest.cpp SSLContextManagerTest)
add_gtest(ssl/test/TLSCredProcessorTest.cpp TLSCredProcessorTest)
add_gtest(util/test/FilePollerTest.cpp FilePollerTest)
endif()

option(BUILD_EXAMPLES "BUILD_EXAMPLES" OFF)

if(BUILD_EXAMPLES)
add_executable(EchoClient example/echo/EchoClient.cpp)
target_link_libraries(EchoClient wangle)
add_executable(EchoServer example/echo/EchoServer.cpp)
target_link_libraries(EchoServer wangle)
add_executable(TelnetClient example/telnet/TelnetClient.cpp)
target_link_libraries(TelnetClient wangle)
add_executable(TelnetServer example/telnet/TelnetServer.cpp)
target_link_libraries(TelnetServer wangle)
add_executable(ProxyServer example/proxy/Proxy.cpp)
target_link_libraries(ProxyServer wangle)
add_executable(AcceptServer example/accept_steering/accept_steering_server.cpp)
target_link_libraries(AcceptServer wangle)
add_executable(BroadcastProxy example/broadcast/BroadcastProxy.cpp)
target_link_libraries(BroadcastProxy wangle)
endif()