diff --git a/CMakeLists.txt b/CMakeLists.txt index 0277a02318b5fd146bc98fb27e7c353951712de9..b0491fe452dbad86b1a4d39d4d3925fc51e9501a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,6 @@ ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "GNU") SET(BUILD_SHARED_LIBS OFF) ENDIF(WIN32) - #TODO: Better way then GLOBAL PROPERTY IF(WIN32) find_package(Threads REQUIRED) diff --git a/consumer/api/cpp/CMakeLists.txt b/consumer/api/cpp/CMakeLists.txt index ae5ce7be29c02946bca3c43445319356322d7a00..49b92eeb62c980fa869194eeea44f4a983085dc6 100644 --- a/consumer/api/cpp/CMakeLists.txt +++ b/consumer/api/cpp/CMakeLists.txt @@ -42,6 +42,19 @@ set(TEST_LIBRARIES "${TARGET_NAME}") gtest(${TARGET_NAME} "${TEST_SOURCE_FILES}" "${TEST_LIBRARIES}") -install(TARGETS ${TARGET_NAME} DESTINATION lib) +set(CPACK_PACKAGE_VERSION ${ASAPO_VERSION}) +set(CPACK_GENERATOR "RPM") +set(CPACK_PACKAGE_NAME "asapo_consumer") +set(CPACK_PACKAGE_RELEASE 1) +set(CPACK_PACKAGE_CONTACT "IT") +set(CPACK_PACKAGE_VENDOR "DESY") +set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) +set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}") +include(CPack) + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/consumer.spec.in" "${CMAKE_CURRENT_BINARY_DIR}/consumer.spec" @ONLY IMMEDIATE) +set(CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_BINARY_DIR}/my_project.spec") + +install(TARGETS ${TARGET_NAME} DESTINATION lib) install(DIRECTORY include/ DESTINATION include) diff --git a/consumer/api/cpp/CPackConfig.cmake b/consumer/api/cpp/CPackConfig.cmake new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/consumer/api/cpp/consumer.spec.in b/consumer/api/cpp/consumer.spec.in new file mode 100644 index 0000000000000000000000000000000000000000..7f0cd6d10ea1ddd83bcae122a2ad9626c91056ea --- /dev/null +++ b/consumer/api/cpp/consumer.spec.in @@ -0,0 +1,38 @@ +Buildroot: @CMAKE_CURRENT_BINARY_DIR@/_CPack_Packages/Linux/RPM/@CPACK_PACKAGE_FILE_NAME@ +Summary: Asapo Consumer +Name: @CPACK_PACKAGE_NAME@ +Version: @CPACK_PACKAGE_VERSION@ +Release: @CPACK_PACKAGE_RELEASE@ +License: MIT +Group: Development/Tools/Other +Vendor: @CPACK_PACKAGE_VENDOR@ +Prefix: @CPACK_PACKAGING_INSTALL_PREFIX@ +#Requires: opencv >= 2.4 + +%define _rpmdir @CMAKE_CURRENT_BINARY_DIR@/_CPack_Packages/Linux/RPM +%define _rpmfilename @CPACK_PACKAGE_FILE_NAME@.rpm +%define _unpackaged_files_terminate_build 0 +%define _topdir @CMAKE_CURRENT_BINARY_DIR@/_CPack_Packages/Linux/RPM + +%description +Cool project solving the problems of many colleagues. + +# This is a shortcutted spec file generated by CMake RPM generator +# we skip _install step because CPack does that for us. +# We do only save CPack installed tree in _prepr +# and then restore it in build. +%prep +mv $RPM_BUILD_ROOT @CMAKE_CURRENT_BINARY_DIR@/_CPack_Packages/Linux/RPM/tmpBBroot + +%install +if [ -e $RPM_BUILD_ROOT ]; +then + rm -Rf $RPM_BUILD_ROOT +fi +mv "@CMAKE_CURRENT_BINARY_DIR@/_CPack_Packages/Linux/RPM/tmpBBroot" $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +@CPACK_PACKAGING_INSTALL_PREFIX@/@LIB_INSTALL_DIR@/* +@CPACK_PACKAGING_INSTALL_PREFIX@/bin/my_project + diff --git a/consumer/api/python/source_dist_linux/CMakeLists.txt b/consumer/api/python/source_dist_linux/CMakeLists.txt index cc3b1dc5e259f1098c8811cf4754bc6a1aadd618..ba4a4fd8353470919df2c413732abe709f386a3e 100644 --- a/consumer/api/python/source_dist_linux/CMakeLists.txt +++ b/consumer/api/python/source_dist_linux/CMakeLists.txt @@ -6,6 +6,14 @@ ADD_CUSTOM_TARGET(python-dist ALL COMMAND ${Python_EXECUTABLE} setup.py sdist ) +ADD_CUSTOM_TARGET(python-rpm + COMMAND PACKAGE_PREFIX=python- python setup.py bdist_rpm + ) + +ADD_CUSTOM_TARGET(python3-rpm + COMMAND PACKAGE_PREFIX=python3- python3 setup.py bdist_rpm + ) + #get_property(ASAPO_CONSUMER_LIB TARGET asapo-consumer PROPERTY LOCATION) ADD_CUSTOM_TARGET(copy_python_dist ALL diff --git a/consumer/api/python/source_dist_linux/setup.py.in b/consumer/api/python/source_dist_linux/setup.py.in index 2fcefc2e001868a33b67d345f0b1e5bba1269ac7..7e0ac60487791e8de67c9c9c9e0eb46dfa1caf27 100644 --- a/consumer/api/python/source_dist_linux/setup.py.in +++ b/consumer/api/python/source_dist_linux/setup.py.in @@ -1,6 +1,7 @@ from distutils.core import setup from distutils.core import Extension import numpy +import os # TODO 'lib/libcurl.a' seems to have no effect, because there is a libcurl.so file ext_modules = [ @@ -13,7 +14,7 @@ ext_modules = [ ] setup( - name ="asapo_consumer", + name = os.environ.get('PACKAGE_PREFIX', '') + "asapo_consumer", ext_modules = ext_modules, version = "@PYTHON_ASAPO_VERSION@", setup_requires=["numpy>=@NUMPY_VERSION@", "cython>=0.28"], diff --git a/deploy/build_env/Centos7.7/Dockerfile b/deploy/build_env/Centos7.7/Dockerfile deleted file mode 100644 index fee61a4d1d3bf013e84e86ac5677216ddddfa7d2..0000000000000000000000000000000000000000 --- a/deploy/build_env/Centos7.7/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -from centos:7 - -ENV GOPATH /tmp - -RUN yum update -y && yum install -y cmake g++ golang zlib1g-dev python cython python-numpy python3 cython3 python3-numpy git wget - -RUN yum -y install gcc - -RUN yum -y install epel-release make - -ADD install_curl.sh install_curl.sh -RUN ./install_curl.sh /curl - -RUN yum install -y python-pip python3-pip && pip install --upgrade cython && pip3 install --upgrade cython -RUN pip3 install sphinx - -ADD build.sh /bin/build.sh - -RUN yum -y install gcc-c++ - -ADD install_cmake.sh install_cmake.sh -RUN ./install_cmake.sh - -RUN yum -y install zlib-devel - -RUN yum -y install python3-numpy python-numpy - -RUN yum -y install numpy - -RUN yum -y install python-devel python36-devel -RUN yum -y install glibc-static libstdc++-static \ No newline at end of file diff --git a/deploy/build_env/Centos7.7/build.sh b/deploy/build_env/Centos7.7/build.sh deleted file mode 100755 index b902e0e679a08c4af1a4ec85aa5e424673654638..0000000000000000000000000000000000000000 --- a/deploy/build_env/Centos7.7/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -cd /asapo/build -cmake \ - -DCMAKE_BUILD_TYPE="Release" \ - -DLIBCURL_DIR=/curl \ - -DBUILD_PYTHON_DOCS=ON \ - -DBUILD_EVENT_MONITOR_PRODUCER=ON \ - .. -cd consumer && make -cd ../producer && make -cd ../sphinx && make - diff --git a/deploy/build_env/Centos7.7/build_image.sh b/deploy/build_env/Centos7.7/build_image.sh deleted file mode 100755 index f158b90984d2a73cdb41e61077a95bca4de902e4..0000000000000000000000000000000000000000 --- a/deploy/build_env/Centos7.7/build_image.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -docker build -t yakser/asapo-env:centos7.7 . -#docker push yakser/asapo-env:ubuntu16.04 diff --git a/deploy/build_env/centos/Dockerfile.7.9.2009 b/deploy/build_env/centos/Dockerfile.7.9.2009 new file mode 100644 index 0000000000000000000000000000000000000000..2903c19a51c24af5ac839d56bd250d6e3719126a --- /dev/null +++ b/deploy/build_env/centos/Dockerfile.7.9.2009 @@ -0,0 +1,21 @@ +from centos:7.9.2009 + +RUN yum update -y && yum install -y epel-release make g++ python python3 git wget rpm-build +RUN yum -y install gcc gcc-c++ glibc-static libstdc++-static zlib-devel libcurl-devel python-pip python3-pip python-devel python3-devel numpy python3-numpy +RUN pip install --upgrade pip +RUN pip install cython +RUN pip3 install cython + +ADD install_cmake.sh install_cmake.sh +RUN ./install_cmake.sh + +ADD install_curl.sh install_curl.sh +RUN ./install_curl.sh /curl + +RUN yum -y install autoconf libtool libibverbs librdmacm librdmacm-devel + +ADD install_libfabric.sh install_libfabric.sh +RUN ./install_libfabric.sh + +ENV GOPATH /tmp +ADD build.sh /bin/build.sh \ No newline at end of file diff --git a/deploy/build_env/centos/build.sh b/deploy/build_env/centos/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..662e4888d36a5191828147949d7b06b026530750 --- /dev/null +++ b/deploy/build_env/centos/build.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +cd /asapo/build +cmake \ + -DCMAKE_BUILD_TYPE="Release" \ + -DLIBCURL_DIR=/curl \ + .. +cd consumer && make && make python-rpm && make python3-rpm +cd ../producer && make && make python-rpm && make python3-rpm + + diff --git a/deploy/build_env/centos/build_image.sh b/deploy/build_env/centos/build_image.sh new file mode 100755 index 0000000000000000000000000000000000000000..407078a615f876d5fdf360abac74500e78025174 --- /dev/null +++ b/deploy/build_env/centos/build_image.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +docker build -t yakser/asapo-env:centos7.9.2009 -f Dockerfile.7.9.2009 . diff --git a/deploy/build_env/Centos7.7/install_cmake.sh b/deploy/build_env/centos/install_cmake.sh similarity index 100% rename from deploy/build_env/Centos7.7/install_cmake.sh rename to deploy/build_env/centos/install_cmake.sh diff --git a/deploy/build_env/Centos7.7/install_curl.sh b/deploy/build_env/centos/install_curl.sh similarity index 100% rename from deploy/build_env/Centos7.7/install_curl.sh rename to deploy/build_env/centos/install_curl.sh diff --git a/deploy/build_env/centos/install_libfabric.sh b/deploy/build_env/centos/install_libfabric.sh new file mode 100755 index 0000000000000000000000000000000000000000..e6970a094b8cd38a95838ff47e47d35326a36a17 --- /dev/null +++ b/deploy/build_env/centos/install_libfabric.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +wget https://github.com/ofiwg/libfabric/archive/v1.11.0.tar.gz +tar xzf v1.11.0.tar.gz +cd libfabric-1.11.0 +./autogen.sh +./configure +make +make install +cd - +rm -rf libfabric-1.11.0 +rm v1.11.0.tar.gz