Skip to content
Snippets Groups Projects
Commit 8072092b authored by Seva's avatar Seva
Browse files

docker: switch to cmake build & remove conan

parent 624f3646
No related branches found
No related tags found
No related merge requests found
...@@ -3,38 +3,35 @@ MAINTAINER Adrien Béraud <adrien.beraud@savoirfairelinux.com> ...@@ -3,38 +3,35 @@ MAINTAINER Adrien Béraud <adrien.beraud@savoirfairelinux.com>
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
build-essential cmake git wget libncurses5-dev libreadline-dev nettle-dev \ build-essential cmake git wget libncurses5-dev libreadline-dev nettle-dev \
libgnutls28-dev libuv1-dev cython3 python3-dev libcppunit-dev libjsoncpp-dev \ libgnutls28-dev libuv1-dev cython3 python3-dev libcppunit-dev libjsoncpp-dev \
libasio-dev libssl-dev python3-setuptools \
&& apt-get clean && apt-get clean
RUN echo "*** Installing libssl, libasio & libhttp-parser ***" \
&& apt-get update && apt-get install -y libasio-dev libssl-dev libhttp-parser-dev \
&& apt-get clean
RUN echo "*** Installing libfmt ***" \
&& wget https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz \
&& tar -xzf 5.3.0.tar.gz && cd fmt-5.3.0/ && ls -l \
&& cmake -j8 -DCMAKE_INSTALL_PREFIX=/usr . \
&& make install
#patch for https://github.com/Stiffstream/restinio-conan-example/issues/2 #patch for https://github.com/Stiffstream/restinio-conan-example/issues/2
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y python3-pip \
python3-pip libasio-dev && pip3 install --upgrade cmake
RUN pip3 install --upgrade cmake
#install conan & add restinio remotes RUN echo "*** Downloading RESTinio ***" \
RUN pip3 install conan && \ && mkdir restinio && cd restinio \
conan remote add stiffstream https://api.bintray.com/conan/stiffstream/public && \ && wget https://github.com/Stiffstream/restinio/archive/v.0.5.1.tar.gz \
conan remote add public-conan https://api.bintray.com/conan/bincrafters/public-conan && ls -l && tar -xzf v.0.5.1.tar.gz \
#setup restinio docker project && cd restinio-v.0.5.1/dev \
RUN mkdir restinio-conan && sed -i.bak '/find_package(Boost*/d' CMakeLists.txt \
COPY conan/restinio/conanfile.txt restinio-conan/conanfile.txt && sed -i.bak '/find_package(PCRE)/d' CMakeLists.txt \
COPY conan/restinio/conanfile.py restinio-conan/conanfile.py && sed -i.bak '/find_package(PCRE2)/d' CMakeLists.txt \
#build restinio from source && sed -i.bak '/add_subdirectory(so_5)/d' CMakeLists.txt \
RUN echo "*** Installing RESTinio & dependencies ***" \ && cmake -DCMAKE_INSTALL_PREFIX=/usr -DRESTINIO_TEST=OFF -DRESTINIO_SAMPLE=OFF \
&& cd restinio-conan \ -DRESTINIO_INSTALL_SAMPLES=OFF -DRESTINIO_BENCH=OFF -DRESTINIO_INSTALL_BENCHES=OFF \
&& conan source . \ -DRESTINIO_FIND_DEPS=ON -DRESTINIO_USE_BOOST_ASIO=none . \
&& conan install -o restinio:boost_libs=none --build=missing . \ && cd ../../ && rm -rf restinio*
&& conan package . -pf /usr/local \
&& cd ../ && rm -rf restinio*
#installing dependencies
RUN echo "*** Installing asio & fmt dependencies ***" \
&& cp -r ~/.conan/data/asio/*/bincrafters/stable/package/*/include/* /usr/local/include/ \
&& cp -r ~/.conan/data/fmt/*/bincrafters/stable/package/*/lib/* /usr/local/lib/ \
&& cp -r ~/.conan/data/fmt/*/bincrafters/stable/package/*/include/* /usr/local/include/
#build http_parser fork
RUN echo "*** Building http_parser dependency for custom HTTP methods ***" \
&& git clone https://github.com/eao197/http-parser.git \
&& cd http-parser && make -j8 && make install PREFIX=/usr \
&& cd ../ && rm -rf restinio-conan/
#build msgpack from source #build msgpack from source
RUN wget https://github.com/msgpack/msgpack-c/releases/download/cpp-2.1.5/msgpack-2.1.5.tar.gz \ RUN wget https://github.com/msgpack/msgpack-c/releases/download/cpp-2.1.5/msgpack-2.1.5.tar.gz \
......
...@@ -7,35 +7,33 @@ RUN apt-get update \ ...@@ -7,35 +7,33 @@ RUN apt-get update \
ENV CC cc ENV CC cc
ENV CXX c++ ENV CXX c++
RUN echo "*** Installing libssl, libasio & libhttp-parser ***" \
&& apt-get update && apt-get install -y libasio-dev libssl-dev libhttp-parser-dev \
&& apt-get clean
RUN echo "*** Installing libfmt ***" \
&& wget https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz \
&& tar -xzf 5.3.0.tar.gz && cd fmt-5.3.0/ && ls -l \
&& cmake -j8 -DCMAKE_INSTALL_PREFIX=/usr . \
&& make install
#patch for https://github.com/Stiffstream/restinio-conan-example/issues/2 #patch for https://github.com/Stiffstream/restinio-conan-example/issues/2
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y python3-pip \
python3-pip libasio-dev && pip3 install --upgrade cmake
RUN pip3 install --upgrade cmake
#install conan & add restinio remotes RUN echo "*** Downloading RESTinio ***" \
RUN pip3 install conan && \ && mkdir restinio && cd restinio \
conan remote add stiffstream https://api.bintray.com/conan/stiffstream/public && \ && wget https://github.com/Stiffstream/restinio/archive/v.0.5.1.tar.gz \
conan remote add public-conan https://api.bintray.com/conan/bincrafters/public-conan && ls -l && tar -xzf v.0.5.1.tar.gz \
#setup restinio docker project && cd restinio-v.0.5.1/dev \
RUN mkdir restinio-conan && sed -i.bak '/find_package(Boost*/d' CMakeLists.txt \
COPY conan/restinio/conanfile.txt restinio-conan/conanfile.txt && sed -i.bak '/find_package(PCRE)/d' CMakeLists.txt \
COPY conan/restinio/conanfile.py restinio-conan/conanfile.py && sed -i.bak '/find_package(PCRE2)/d' CMakeLists.txt \
#build restinio from source && sed -i.bak '/add_subdirectory(so_5)/d' CMakeLists.txt \
RUN echo "*** Installing RESTinio & dependencies ***" \ && cmake -DCMAKE_INSTALL_PREFIX=/usr -DRESTINIO_TEST=OFF -DRESTINIO_SAMPLE=OFF \
&& cd restinio-conan \ -DRESTINIO_INSTALL_SAMPLES=OFF -DRESTINIO_BENCH=OFF -DRESTINIO_INSTALL_BENCHES=OFF \
&& conan source . \ -DRESTINIO_FIND_DEPS=ON -DRESTINIO_USE_BOOST_ASIO=none . \
&& conan install -o restinio:boost_libs=none --build=missing . \ && cd ../../ && rm -rf restinio*
&& conan package . -pf /usr/local \
&& cd ../ && rm -rf restinio*
#installing dependencies
RUN echo "*** Installing asio & fmt dependencies ***" \
&& cp -r ~/.conan/data/asio/*/bincrafters/stable/package/*/include/* /usr/local/include/ \
&& cp -r ~/.conan/data/fmt/*/bincrafters/stable/package/*/lib/* /usr/local/lib/ \
&& cp -r ~/.conan/data/fmt/*/bincrafters/stable/package/*/include/* /usr/local/include/
#build http_parser fork
RUN echo "*** Building http_parser dependency for custom HTTP methods ***" \
&& git clone https://github.com/eao197/http-parser.git \
&& cd http-parser && make -j8 && make install PREFIX=/usr \
&& cd ../ && rm -rf restinio-conan/
#build msgpack from source #build msgpack from source
RUN wget https://github.com/msgpack/msgpack-c/releases/download/cpp-2.1.5/msgpack-2.1.5.tar.gz \ RUN wget https://github.com/msgpack/msgpack-c/releases/download/cpp-2.1.5/msgpack-2.1.5.tar.gz \
......
from conans import ConanFile, CMake, tools
import os
class SobjectizerConan(ConanFile):
name = "restinio"
version = "0.5.1"
license = "BSD-3-Clause"
url = "https://github.com/Stiffstream/restinio-conan"
description = (
"RESTinio is a header-only C++14 library that gives you "
"an embedded HTTP/Websocket server."
)
settings = "os", "compiler", "build_type", "arch"
options = {'boost_libs': ['none', 'static', 'shared']}
default_options = {'boost_libs': 'none'}
generators = "cmake"
source_subfolder = "restinio"
build_policy = "missing"
def requirements(self):
self.requires.add("http-parser/2.8.1@bincrafters/stable")
self.requires.add("fmt/5.3.0@bincrafters/stable")
if self.options.boost_libs == "none":
self.requires.add("asio/1.12.2@bincrafters/stable")
else:
self.requires.add("boost/1.69.0@conan/stable")
if self.options.boost_libs == "shared":
self.options["boost"].shared = True
else:
self.options["boost"].shared = False
def source(self):
source_url = "https://bitbucket.org/sobjectizerteam/restinio/downloads"
tools.get("{0}/restinio-{1}.zip".format(source_url, self.version))
extracted_dir = "restinio-" + self.version
os.rename(extracted_dir, self.source_subfolder)
def _configure_cmake(self):
cmake = CMake(self)
cmake.definitions['RESTINIO_INSTALL'] = True
cmake.definitions['RESTINIO_FIND_DEPS'] = False
cmake.definitions['RESTINIO_USE_BOOST_ASIO'] = self.options.boost_libs
cmake.configure(source_folder = self.source_subfolder + "/dev/restinio")
return cmake
def package(self):
cmake = self._configure_cmake()
self.output.info(cmake.definitions)
cmake.install()
def package_info(self):
self.info.header_only()
if self.options.boost_libs != "none":
self.cpp_info.defines.append("RESTINIO_USE_BOOST_ASIO")
[requires]
restinio/0.5.1@stiffstream/stable
[generators]
cmake
[options]
[imports]
bin, *.dll -> ./bin # Copies all dll files from packages bin folder to my "bin" folder
lib, *.dylib* -> ./bin # Copies all dylib files from packages lib folder to my "bin" folder
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment