diff --git a/.gitignore b/.gitignore index 3c857e633c..01dd7502ff 100644 --- a/.gitignore +++ b/.gitignore @@ -93,3 +93,4 @@ Builds/VisualStudio2015/*.sdf *.pdb .vs/ CMakeSettings.json +compile_commands.json diff --git a/Builds/CMake/CMakeFuncs.cmake b/Builds/CMake/CMakeFuncs.cmake index b7336f9654..2f16fb7d81 100644 --- a/Builds/CMake/CMakeFuncs.cmake +++ b/Builds/CMake/CMakeFuncs.cmake @@ -108,10 +108,15 @@ macro(group_sources curdir) group_sources_in(${PROJECT_SOURCE_DIR} ${curdir}) endmacro() +macro (exclude_from_default target_) + set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_ALL ON) + set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON) +endmacro () + macro (exclude_if_included target_) - if (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) - set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_ALL ON) - set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON) + get_directory_property(has_parent PARENT_DIRECTORY) + if (has_parent) + exclude_from_default (${target_}) endif () endmacro () @@ -246,3 +251,30 @@ endif() set(${cmd_var} "${command}" PARENT_SCOPE) endfunction() +find_package(Git) + +# function that calls git log to get current hash +function (git_hash hash_val) + # note: optional second extra string argument not in signature + if (NOT GIT_FOUND) + return () + endif () + set (_hash "unknown") + set (_format "%H") + if (ARGC GREATER_EQUAL 2) + string (TOLOWER ${ARGV1} _short) + if (_short STREQUAL "short") + set (_format "%h") + endif () + endif () + execute_process (COMMAND ${GIT_EXECUTABLE} "log" "--pretty=${_format}" "-n1" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + RESULT_VARIABLE _git_exit_code + OUTPUT_VARIABLE _temp_hash + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + if (_git_exit_code EQUAL 0) + set (_hash ${_temp_hash}) + endif () + set (${hash_val} "${_hash}" PARENT_SCOPE) +endfunction () diff --git a/Builds/containers/README.md b/Builds/containers/README.md new file mode 100644 index 0000000000..9d96eb7719 --- /dev/null +++ b/Builds/containers/README.md @@ -0,0 +1,31 @@ + +# rippled Packaging and Containers + +This folder contains docker container definitions and configuration +files to support building rpm and deb packages of rippled. The container +definitions include some additional software/packages that are used +for general build/test CI workflows of rippled but are not explicitly +needed for the package building workflow. + +## CMake Targets + +If you have docker installed on your local system, then the main +CMake file will enable several targets related to building packages: +`rpm_container`, `rpm`, `dpkg_container`, and `dpkg`. The package targets +depend on the container targets and will trigger a build of those first. +The container builds can take several dozen minutes to complete (depending +on hardware specs), so quick build cycles are not possible currently. As +such, these targets are often best suited to CI/automated build systems. + +The package build can be invoked like any other cmake target from the +rippled root folder: +``` +mkdir -p build/pkg && cd build/pkg +cmake -Dpackages_only=ON ../.. +cmake --build . --target rpm +``` +Upon successful completion, the generated package files will be in +the `build/pkg/packages` directory. For deb packages, simply replace +`rpm` with `dpkg` in the build command above. + + diff --git a/Builds/containers/centos-builder/Dockerfile b/Builds/containers/centos-builder/Dockerfile new file mode 100644 index 0000000000..63b8543bd8 --- /dev/null +++ b/Builds/containers/centos-builder/Dockerfile @@ -0,0 +1,38 @@ +ARG GIT_COMMIT=unknown + +FROM centos:7 +LABEL git-commit=$GIT_COMMIT + +COPY centos-builder/centos_setup.sh /tmp/ +COPY shared/build_deps.sh /tmp/ +COPY shared/install_cmake.sh /tmp/ +COPY centos-builder/extras.sh /tmp/ +RUN chmod +x /tmp/centos_setup.sh && \ + chmod +x /tmp/build_deps.sh && \ + chmod +x /tmp/install_cmake.sh && \ + chmod +x /tmp/extras.sh +RUN /tmp/centos_setup.sh +RUN /tmp/install_cmake.sh +ENV PATH="/opt/local/cmake/bin:$PATH" +RUN source scl_source enable devtoolset-6 python27 && \ + /tmp/build_deps.sh +ENV PLANTUML_JAR="/opt/plantuml/plantuml.jar" +ENV BOOST_ROOT="/opt/local/boost" +ENV OPENSSL_ROOT="/opt/local/openssl" +ENV GDB_ROOT="/opt/local/gdb" +RUN source scl_source enable devtoolset-6 python27 && \ + /tmp/extras.sh + +# prep files for package building +RUN mkdir -m 777 -p /opt/rippled_bld/pkg +WORKDIR /opt/rippled_bld/pkg + +COPY packaging/rpm/rippled.spec ./ +COPY shared/update_sources.sh ./ +RUN mkdir -m 777 ./rpmbuild +RUN mkdir -m 777 ./rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + +COPY packaging/rpm/build_rpm.sh ./ +CMD ./build_rpm.sh + + diff --git a/Builds/containers/centos-builder/centos_setup.sh b/Builds/containers/centos-builder/centos_setup.sh new file mode 100755 index 0000000000..be507d2fdd --- /dev/null +++ b/Builds/containers/centos-builder/centos_setup.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +set -ex + +source /etc/os-release + +yum -y upgrade +yum -y update +yum -y install epel-release centos-release-scl +yum -y install \ + wget curl time gcc-c++ time yum-utils \ + libstdc++-static rpm-build gnupg which make cmake \ + devtoolset-4 devtoolset-4-gdb devtoolset-4-libasan-devel devtoolset-4-libtsan-devel devtoolset-4-libubsan-devel \ + devtoolset-6 devtoolset-6-gdb devtoolset-6-libasan-devel devtoolset-6-libtsan-devel devtoolset-6-libubsan-devel \ + devtoolset-7 devtoolset-7-gdb devtoolset-7-libasan-devel devtoolset-7-libtsan-devel devtoolset-7-libubsan-devel \ + llvm-toolset-7 llvm-toolset-7-runtime llvm-toolset-7-build llvm-toolset-7-clang \ + llvm-toolset-7-clang-analyzer llvm-toolset-7-clang-devel llvm-toolset-7-clang-libs \ + llvm-toolset-7-clang-tools-extra llvm-toolset-7-compiler-rt llvm-toolset-7-lldb \ + llvm-toolset-7-lldb-devel llvm-toolset-7-python-lldb \ + flex flex-devel bison bison-devel \ + ncurses ncurses-devel ncurses-libs graphviz graphviz-devel \ + lzip p7zip bzip2 \ + zlib zlib-devel zlib-static texinfo openssl-static \ + jemalloc jemalloc-devel \ + libicu-devel htop \ + python27-python rh-python35-python \ + python-devel python27-python-devel rh-python35-python-devel \ + python27 rh-python35 \ + ninja-build git svn \ + protobuf protobuf-static protobuf-c-devel \ + protobuf-compiler protobuf-devel \ + swig ccache perl-Digest-MD5 python2-pip + +# TODO need permanent link +yum -y install ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora-secondary/updates/26/i386/Packages/p/python2-six-1.10.0-9.fc26.noarch.rpm + diff --git a/Builds/containers/centos-builder/extras.sh b/Builds/containers/centos-builder/extras.sh new file mode 100755 index 0000000000..d7b7ef1999 --- /dev/null +++ b/Builds/containers/centos-builder/extras.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -ex + +cd /tmp +wget https://ftp.gnu.org/gnu/gdb/gdb-8.2.tar.xz +tar xf gdb-8.2.tar.xz +cd gdb-8.2 +./configure CFLAGS="-w -O2" CXXFLAGS="-std=gnu++11 -g -O2 -w" --prefix=/opt/local/gdb-8.2 +make -j$(nproc) +make install +ln -s /opt/local/gdb-8.2 /opt/local/gdb +cd .. +rm -f gdb-8.2.tar.xz +rm -rf gdb-8.2 + +# clang from source +RELEASE=tags/RELEASE_701/final +INSTALL=/opt/llvm-7.0.1/ +mkdir -p /tmp/clang-src +cd /tmp/clang-src +TOPDIR=`pwd` +svn co -q http://llvm.org/svn/llvm-project/llvm/${RELEASE} llvm +cd ${TOPDIR}/llvm/tools +svn co -q http://llvm.org/svn/llvm-project/cfe/${RELEASE} clang +cd ${TOPDIR}/llvm/tools/clang/tools +svn co -q http://llvm.org/svn/llvm-project/clang-tools-extra/${RELEASE} extra +cd ${TOPDIR}/llvm/tools +svn co -q http://llvm.org/svn/llvm-project/lld/${RELEASE} lld +cd ${TOPDIR}/llvm/tools +svn co -q http://llvm.org/svn/llvm-project/polly/${RELEASE} polly +cd ${TOPDIR}/llvm/projects +svn co -q http://llvm.org/svn/llvm-project/compiler-rt/${RELEASE} compiler-rt +cd ${TOPDIR}/llvm/projects +svn co -q http://llvm.org/svn/llvm-project/openmp/${RELEASE} openmp +cd ${TOPDIR}/llvm/projects +svn co -q http://llvm.org/svn/llvm-project/libcxx/${RELEASE} libcxx +svn co -q http://llvm.org/svn/llvm-project/libcxxabi/${RELEASE} libcxxabi +cd ${TOPDIR}/llvm/projects +## config/build +cd ${TOPDIR} +mkdir mybuilddir && cd mybuilddir +cmake ../llvm -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${INSTALL} \ + -DLLVM_LIBDIR_SUFFIX=64 \ + -DLLVM_ENABLE_EH=ON \ + -DLLVM_ENABLE_RTTI=ON +cmake --build . --parallel --target install +cd /tmp +rm -rf clang-src + diff --git a/Builds/containers/gitlab-ci/build_container.sh b/Builds/containers/gitlab-ci/build_container.sh new file mode 100644 index 0000000000..ff4b7ac561 --- /dev/null +++ b/Builds/containers/gitlab-ci/build_container.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env sh +set -ex +pkgtype=$1 +if [ "${pkgtype}" = "rpm" ] ; then + container_name="${RPM_CONTAINER_NAME}" +elif [ "${pkgtype}" = "dpkg" ] ; then + container_name="${DPKG_CONTAINER_NAME}" +else + echo "invalid package type" + exit 1 +fi +if docker pull "${ARTIFACTORY_HUB}/${container_name}:${CI_COMMIT_SHA}"; then + echo "${pkgtype} container for ${CI_COMMIT_SHA} already exists" \ + "- skipping container build!" + exit 0 +else + echo "no existing ${pkgtype} container for this branch - searching history." + for CID_PREV in $(git log --pretty=%H -n5) ; do + if docker pull "${ARTIFACTORY_HUB}/${container_name}:${CID_PREV}"; then + echo "found container for previous commit ${CID_PREV}" \ + "- using as cache." + docker tag \ + "${ARTIFACTORY_HUB}/${container_name}:${CID_PREV}" \ + "${container_name}:${CID_PREV}" + CMAKE_EXTRA="-D${pkgtype}_cache_from=${container_name}:${CID_PREV}" + break + fi + done +fi +cmake --version +test -d build && rm -rf build +mkdir -p build/container && cd build/container +eval time \ + cmake -Dpackages_only=ON -DCMAKE_VERBOSE_MAKEFILE=ON ${CMAKE_EXTRA} \ + -G Ninja ../.. +time cmake --build . --target "${pkgtype}_container" -- -v +docker tag \ + "${container_name}:${CI_COMMIT_SHA}" \ + "${ARTIFACTORY_HUB}/${container_name}:${CI_COMMIT_SHA}" +time docker push "${ARTIFACTORY_HUB}/${container_name}:${CI_COMMIT_SHA}" + diff --git a/Builds/containers/gitlab-ci/build_package.sh b/Builds/containers/gitlab-ci/build_package.sh new file mode 100644 index 0000000000..66e8fc8e9e --- /dev/null +++ b/Builds/containers/gitlab-ci/build_package.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env sh +set -ex +pkgtype=$1 +if [ "${pkgtype}" = "rpm" ] ; then + container_name="${RPM_CONTAINER_NAME}" +elif [ "${pkgtype}" = "dpkg" ] ; then + container_name="${DPKG_CONTAINER_NAME}" +else + echo "invalid package type" + exit 1 +fi +time docker pull "${ARTIFACTORY_HUB}/${container_name}:${CI_COMMIT_SHA}" +docker tag \ + "${ARTIFACTORY_HUB}/${container_name}:${CI_COMMIT_SHA}" \ + "${container_name}:${CI_COMMIT_SHA}" +docker images +test -d build && rm -rf build +mkdir -p build/${pkgtype} && cd build/${pkgtype} +time cmake \ + -Dpackages_only=ON -Dhave_package_container=ON -DCMAKE_VERBOSE_MAKEFILE=ON \ + -G Ninja ../.. +time cmake --build . --target ${pkgtype} -- -v + diff --git a/Builds/containers/gitlab-ci/docker_alpine_setup.sh b/Builds/containers/gitlab-ci/docker_alpine_setup.sh new file mode 100644 index 0000000000..43eeed8a91 --- /dev/null +++ b/Builds/containers/gitlab-ci/docker_alpine_setup.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +set -ex +# used as a before/setup script for docker steps in gitlab-ci +# expects to be run in standard alpine/dind image +echo $(nproc) +docker login -u rippled \ + -p ${ARTIFACTORY_DEPLOY_KEY_RIPPLED} ${ARTIFACTORY_HUB} +apk add \ + bash util-linux coreutils binutils grep \ + make ninja cmake build-base gcc g++ abuild git \ + python3 python3-dev +pip3 install awscli +# list curdir contents to build log: +ls -la + diff --git a/Builds/containers/gitlab-ci/get_component.sh b/Builds/containers/gitlab-ci/get_component.sh new file mode 100644 index 0000000000..99963f4086 --- /dev/null +++ b/Builds/containers/gitlab-ci/get_component.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env sh +case ${CI_COMMIT_REF_NAME} in + develop) + export COMPONENT="nightly" + ;; + release) + export COMPONENT="unstable" + ;; + master) + export COMPONENT="stable" + ;; + *) + export COMPONENT="_unknown_" + ;; +esac + diff --git a/Builds/containers/gitlab-ci/pkgbuild.yml b/Builds/containers/gitlab-ci/pkgbuild.yml new file mode 100644 index 0000000000..41aea553db --- /dev/null +++ b/Builds/containers/gitlab-ci/pkgbuild.yml @@ -0,0 +1,439 @@ +######################################################################### +## ## +## gitlab CI defintition for rippled build containers and distro ## +## packages (rpm and dpkg). ## +## ## +######################################################################### + +# NOTE: these are sensible defaults for Ripple pipelines. These +# can be overridden by project or group variables as needed. +variables: + RPM_CONTAINER_NAME: "rippled-rpm-builder" + DPKG_CONTAINER_NAME: "rippled-dpkg-builder" + ARTIFACTORY_HOST: "artifactory.ops.ripple.com" + ARTIFACTORY_HUB: "${ARTIFACTORY_HOST}:6555" + GIT_SIGN_PUBKEYS_URL: "https://gitlab.ops.ripple.com/snippets/11/raw" + PUBLIC_REPO_ROOT: "https://mirrors1.ripple.com/repos" + # also need to define this variable ONLY for the primary + # build/publish pipeline on the mainline repo: + # IS_PRIMARY_REPO = "true" + +stages: + - build_containers + - build_packages + - smoketest + - verify_sig + - tag_images + - push_to_test + - verify_from_test + - push_to_prod + - verify_from_prod + - get_final_hashes + +.dind_template: &dind_param + before_script: + - . ./Builds/containers/gitlab-ci/docker_alpine_setup.sh + variables: + docker_driver: overlay2 + image: + name: docker:latest + services: + - docker:dind + tags: + - docker-4xlarge + +.only_primary_template: &only_primary + only: + refs: + - /^(master|release|develop)$/ + variables: + - $IS_PRIMARY_REPO == "true" + +.smoketest_local_template: &run_local_smoketest + tags: + - xlarge + script: + - . ./Builds/containers/gitlab-ci/smoketest.sh local + +.smoketest_repo_template: &run_repo_smoketest + tags: + - xlarge + script: + - . ./Builds/containers/gitlab-ci/smoketest.sh repo + +######################################################################### +## ## +## stage: build_containers ## +## ## +## build containers from docker definitions. These containers are ## +## subsequently used to build the rpm and deb packages. ## +## ## +######################################################################### + +build_centos_container: + stage: build_containers + <<: *dind_param + cache: + key: containers + paths: + - .nih_c + script: + - . ./Builds/containers/gitlab-ci/build_container.sh rpm + +build_ubuntu_container: + stage: build_containers + <<: *dind_param + cache: + key: containers + paths: + - .nih_c + script: + - . ./Builds/containers/gitlab-ci/build_container.sh dpkg + +######################################################################### +## ## +## stage: build_packages ## +## ## +## build packages using containers from previous stage. ## +## ## +######################################################################### + +rpm_build: + stage: build_packages + dependencies: + - build_centos_container + <<: *dind_param + artifacts: + paths: + - build/rpm/packages/ + cache: + key: rpm + paths: + - .nih_c/pkgbuild + script: + - . ./Builds/containers/gitlab-ci/build_package.sh rpm + +dpkg_build: + stage: build_packages + dependencies: + - build_ubuntu_container + <<: *dind_param + artifacts: + paths: + - build/dpkg/packages/ + cache: + key: dpkg + paths: + - .nih_c/pkgbuild + script: + - . ./Builds/containers/gitlab-ci/build_package.sh dpkg + +######################################################################### +## ## +## stage: smoketest ## +## ## +## install unsigned packages from previous step and run unit tests. ## +## ## +######################################################################### + +centos_smoketest: + stage: smoketest + dependencies: + - rpm_build + image: + name: centos:latest + <<: *run_local_smoketest + +fedora_smoketest: + stage: smoketest + dependencies: + - rpm_build + image: + name: fedora:latest + <<: *run_local_smoketest + +ubuntu_18_smoketest: + stage: smoketest + dependencies: + - dpkg_build + image: + name: ubuntu:18.04 + <<: *run_local_smoketest + +ubuntu_16_smoketest: + stage: smoketest + dependencies: + - dpkg_build + image: + name: ubuntu:16.04 + <<: *run_local_smoketest + +debian_smoketest: + stage: smoketest + dependencies: + - dpkg_build + image: + name: debian:stable + <<: *run_local_smoketest + +######################################################################### +## ## +## stage: verify_sig ## +## ## +## use git/gpg to verify that HEAD is signed by an approved ## +## committer. The whitelist of pubkeys is manually mantained ## +## and fetched from GIT_SIGN_PUBKEYS_URL (currently a snippet ## +## link). ## +## ONLY RUNS FOR PRIMARY BRANCHES/REPO ## +## ## +######################################################################### + +verify_head_signed: + stage: verify_sig + image: + name: ubuntu:latest + <<: *only_primary + script: + - . ./Builds/containers/gitlab-ci/verify_head_commit.sh + +######################################################################### +## ## +## stage: tag_images ## +## ## +## apply rippled version tag to containers from previous stage. ## +## ONLY RUNS FOR PRIMARY BRANCHES/REPO ## +## ## +######################################################################### + +tag_bld_images: + stage: tag_images + variables: + docker_driver: overlay2 + image: + name: docker:latest + services: + - docker:dind + tags: + - docker-large + dependencies: + - rpm_build + - dpkg_build + <<: *only_primary + script: + - . ./Builds/containers/gitlab-ci/tag_docker_image.sh + +######################################################################### +## ## +## stage: push_to_test ## +## ## +## push packages to artifactory repositories (test) ## +## ONLY RUNS FOR PRIMARY BRANCHES/REPO ## +## ## +######################################################################### + +push_test: + stage: push_to_test + variables: + DEB_REPO: "rippled-deb-test-mirror" + RPM_REPO: "rippled-rpm-test-mirror" + image: + name: alpine:latest + artifacts: + paths: + - files.info + dependencies: + - rpm_build + - dpkg_build + <<: *only_primary + script: + - . ./Builds/containers/gitlab-ci/push_to_artifactory.sh "PUT" "." + +######################################################################### +## ## +## stage: verify_from_test ## +## ## +## install/test packages from test repos. ## +## ONLY RUNS FOR PRIMARY BRANCHES/REPO ## +## ## +######################################################################### + +centos_verify_repo_test: + stage: verify_from_test + variables: + RPM_REPO: "rippled-rpm-test-mirror" + image: + name: centos:latest + dependencies: + - rpm_build + <<: *only_primary + <<: *run_repo_smoketest + +fedora_verify_repo_test: + stage: verify_from_test + variables: + RPM_REPO: "rippled-rpm-test-mirror" + image: + name: fedora:latest + dependencies: + - rpm_build + <<: *only_primary + <<: *run_repo_smoketest + +ubuntu_18_verify_repo_test: + stage: verify_from_test + variables: + DISTRO: "stretch" + DEB_REPO: "rippled-deb-test-mirror" + image: + name: ubuntu:18.04 + dependencies: + - dpkg_build + <<: *only_primary + <<: *run_repo_smoketest + +ubuntu_16_verify_repo_test: + stage: verify_from_test + variables: + DISTRO: "xenial" + DEB_REPO: "rippled-deb-test-mirror" + image: + name: ubuntu:16.04 + dependencies: + - dpkg_build + <<: *only_primary + <<: *run_repo_smoketest + +debian_verify_repo_test: + stage: verify_from_test + variables: + DISTRO: "bionic" + DEB_REPO: "rippled-deb-test-mirror" + image: + name: debian:stable + dependencies: + - dpkg_build + <<: *only_primary + <<: *run_repo_smoketest + +######################################################################### +## ## +## stage: push_to_prod ## +## ## +## push packages to artifactory repositories (prod) ## +## ONLY RUNS FOR PRIMARY BRANCHES/REPO ## +## ## +######################################################################### + +push_prod: + variables: + DEB_REPO: "rippled-deb" + RPM_REPO: "rippled-rpm" + image: + name: alpine:latest + stage: push_to_prod + artifacts: + paths: + - files.info + dependencies: + - rpm_build + - dpkg_build + <<: *only_primary + script: + - . ./Builds/containers/gitlab-ci/push_to_artifactory.sh "PUT" "." +# if we want to make the push to prod +# an explicit/manual step, uncomment this: +# when: manual + +######################################################################### +## ## +## stage: verify_from_prod ## +## ## +## install/test packages from prod repos. ## +## ONLY RUNS FOR PRIMARY BRANCHES/REPO ## +## ## +######################################################################### + +centos_verify_repo_prod: + stage: verify_from_prod + variables: + RPM_REPO: "rippled-rpm" + image: + name: centos:latest + dependencies: + - rpm_build + <<: *only_primary + <<: *run_repo_smoketest + +fedora_verify_repo_prod: + stage: verify_from_prod + variables: + RPM_REPO: "rippled-rpm" + image: + name: fedora:latest + dependencies: + - rpm_build + <<: *only_primary + <<: *run_repo_smoketest + +ubuntu_18_verify_repo_prod: + stage: verify_from_prod + variables: + DISTRO: "stretch" + DEB_REPO: "rippled-deb" + image: + name: ubuntu:18.04 + dependencies: + - dpkg_build + <<: *only_primary + <<: *run_repo_smoketest + +ubuntu_16_verify_repo_prod: + stage: verify_from_prod + variables: + DISTRO: "xenial" + DEB_REPO: "rippled-deb" + image: + name: ubuntu:16.04 + dependencies: + - dpkg_build + <<: *only_primary + <<: *run_repo_smoketest + +debian_verify_repo_prod: + stage: verify_from_prod + variables: + DISTRO: "bionic" + DEB_REPO: "rippled-deb" + image: + name: debian:stable + dependencies: + - dpkg_build + <<: *only_primary + <<: *run_repo_smoketest + +######################################################################### +## ## +## stage: get_final_hashes ## +## ## +## fetch final hashes from artifactory. ## +## ONLY RUNS FOR PRIMARY BRANCHES/REPO ## +## ## +######################################################################### + +get_prod_hashes: + variables: + DEB_REPO: "rippled-deb" + RPM_REPO: "rippled-rpm" + image: + name: alpine:latest + stage: get_final_hashes + artifacts: + paths: + - files.info + dependencies: + - rpm_build + - dpkg_build + <<: *only_primary + script: + - . ./Builds/containers/gitlab-ci/push_to_artifactory.sh "GET" ".checksums" + diff --git a/Builds/containers/gitlab-ci/push_to_artifactory.sh b/Builds/containers/gitlab-ci/push_to_artifactory.sh new file mode 100644 index 0000000000..e9e6412aea --- /dev/null +++ b/Builds/containers/gitlab-ci/push_to_artifactory.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env sh +set -ex +action=$1 +filter=$2 + +. ./Builds/containers/gitlab-ci/get_component.sh + +apk add curl jq coreutils util-linux +TOPDIR=$(pwd) + +# DPKG + +cd $TOPDIR +cd build/dpkg/packages +CURLARGS="-sk -X${action} -urippled:${ARTIFACTORY_DEPLOY_KEY_RIPPLED}" +RIPPLED_PKG=$(ls rippled_*.deb) +RIPPLED_DEV_PKG=$(ls rippled-dev_*.deb) +RIPPLED_DBG_PKG=$(ls rippled-dbgsym_*.deb) +# TODO - where to upload src tgz? +RIPPLED_SRC=$(ls rippled_*.orig.tar.gz) +DEB_MATRIX=";deb.component=${COMPONENT};deb.architecture=amd64" +for dist in stretch buster xenial bionic ; do + DEB_MATRIX="${DEB_MATRIX};deb.distribution=${dist}" +done +for deb in ${RIPPLED_PKG} ${RIPPLED_DEV_PKG} ${RIPPLED_DBG_PKG} ; do + echo "FILE --> ${deb}" | tee -a "${TOPDIR}/files.info" + ca="${CURLARGS}" + if [ "${action}" = "PUT" ] ; then + url="https://${ARTIFACTORY_HOST}/artifactory/${DEB_REPO}/pool/${deb}${DEB_MATRIX}" + ca="${ca} -T${deb}" + elif [ "${action}" = "GET" ] ; then + url="https://${ARTIFACTORY_HOST}/artifactory/api/storage/${DEB_REPO}/pool/${deb}" + fi + echo "url --> ${url}" + eval "curl ${ca} \"${url}\"" | jq -M "${filter}" | tee -a "${TOPDIR}/files.info" +done + +# RPM + +cd $TOPDIR +cd build/rpm/packages +RIPPLED_PKG=$(ls rippled-[0-9]*.x86_64.rpm) +RIPPLED_DEV_PKG=$(ls rippled-devel*.rpm) +RIPPLED_DBG_PKG=$(ls rippled-debuginfo*.rpm) +# TODO - where to upload src rpm ? +RIPPLED_SRC=$(ls rippled-[0-9]*.src.rpm) +for rpm in ${RIPPLED_PKG} ${RIPPLED_DEV_PKG} ${RIPPLED_DBG_PKG} ; do + echo "FILE --> ${rpm}" | tee -a "${TOPDIR}/files.info" + ca="${CURLARGS}" + if [ "${action}" = "PUT" ] ; then + url="https://${ARTIFACTORY_HOST}/artifactory/${RPM_REPO}/${COMPONENT}/" + ca="${ca} -T${rpm}" + elif [ "${action}" = "GET" ] ; then + url="https://${ARTIFACTORY_HOST}/artifactory/api/storage/${RPM_REPO}/${COMPONENT}/${rpm}" + fi + echo "url --> ${url}" + eval "curl ${ca} \"${url}\"" | jq -M "${filter}" | tee -a "${TOPDIR}/files.info" +done + diff --git a/Builds/containers/gitlab-ci/smoketest.sh b/Builds/containers/gitlab-ci/smoketest.sh new file mode 100644 index 0000000000..50cb2ca40d --- /dev/null +++ b/Builds/containers/gitlab-ci/smoketest.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env sh +set -ex +install_from=$1 +use_private=${2:-0} # this option not currently needed by any CI scripts, + # reserved for possible future use +if [ "$use_private" -gt 0 ] ; then + REPO_ROOT="https://rippled:${ARTIFACTORY_DEPLOY_KEY_RIPPLED}@${ARTIFACTORY_HOST}/artifactory" +else + REPO_ROOT="${PUBLIC_REPO_ROOT}" +fi + +. ./Builds/containers/gitlab-ci/get_component.sh + +. /etc/os-release +case ${ID} in + ubuntu|debian) + pkgtype="dpkg" + ;; + fedora|centos|rhel|scientific) + pkgtype="rpm" + ;; + *) + echo "unrecognized distro!" + exit 1 + ;; +esac + +if [ "${pkgtype}" = "dpkg" ] ; then + if [ "${install_from}" = "repo" ] ; then + apt -y upgrade + apt -y update + apt -y install apt apt-transport-https ca-certificates coreutils util-linux wget gnupg + wget -q -O - "${REPO_ROOT}/api/gpg/key/public" | apt-key add - + echo "deb ${REPO_ROOT}/${DEB_REPO} ${DISTRO} ${COMPONENT}" >> /etc/apt/sources.list + # sometimes update fails and requires a cleanup + if ! apt -y update ; then + rm -vf /var/lib/apt/lists/* + apt -y update + fi + apt-get -y install rippled + elif [ "${install_from}" = "local" ] ; then + # cached pkg install + apt -y update + apt -y install libprotobuf-dev libssl-dev + rm -f build/dpkg/packages/rippled-dbgsym*.* + dpkg --no-debsig -i build/dpkg/packages/*.deb + else + echo "unrecognized pkg source!" + exit 1 + fi +else + yum -y update + if [ "${install_from}" = "repo" ] ; then + yum -y install yum-utils coreutils util-linux + REPOFILE="/etc/yum.repos.d/artifactory.repo" + echo "[Artifactory]" > ${REPOFILE} + echo "name=Artifactory" >> ${REPOFILE} + echo "baseurl=${REPO_ROOT}/${RPM_REPO}/${COMPONENT}/" >> ${REPOFILE} + echo "enabled=1" >> ${REPOFILE} + echo "gpgcheck=0" >> ${REPOFILE} + echo "gpgkey=${REPO_ROOT}/${RPM_REPO}/${COMPONENT}/repodata/repomd.xml.key" >> ${REPOFILE} + echo "repo_gpgcheck=1" >> ${REPOFILE} + yum -y update + yum -y install rippled + elif [ "${install_from}" = "local" ] ; then + # cached pkg install + yum install -y yum-utils openssl-static zlib-static + rm -f build/rpm/packages/rippled-debug*.rpm + rm -f build/rpm/packages/*.src.rpm + rpm -i build/rpm/packages/*.rpm + else + echo "unrecognized pkg source!" + exit 1 + fi +fi + +# verify installed version +INSTALLED=$(/opt/ripple/bin/rippled --version | awk '{print $NF}') +. build/${pkgtype}/packages/build_vars +if [ "${rippled_version}" != "${INSTALLED}" ] ; then + echo "INSTALLED version ${INSTALLED} does not match ${rippled_version}" + exit 1 +fi +# run unit tests +/opt/ripple/bin/rippled --unittest --unittest-jobs $(nproc) +/opt/ripple/bin/validator-keys --unittest + + diff --git a/Builds/containers/gitlab-ci/tag_docker_image.sh b/Builds/containers/gitlab-ci/tag_docker_image.sh new file mode 100644 index 0000000000..ea072dab1a --- /dev/null +++ b/Builds/containers/gitlab-ci/tag_docker_image.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env sh +set -ex +docker login -u rippled \ + -p ${ARTIFACTORY_DEPLOY_KEY_RIPPLED} "${ARTIFACTORY_HUB}" +# this gives us rippled_version : +source build/rpm/packages/build_vars +docker pull "${ARTIFACTORY_HUB}/${RPM_CONTAINER_NAME}:${CI_COMMIT_SHA}" +docker pull "${ARTIFACTORY_HUB}/${DPKG_CONTAINER_NAME}:${CI_COMMIT_SHA}" +docker tag \ + "${ARTIFACTORY_HUB}/${RPM_CONTAINER_NAME}:${CI_COMMIT_SHA}" \ + "${ARTIFACTORY_HUB}/${RPM_CONTAINER_NAME}:${rippled_version}_${CI_COMMIT_REF_SLUG}" +docker tag \ + "${ARTIFACTORY_HUB}/${DPKG_CONTAINER_NAME}:${CI_COMMIT_SHA}" \ + "${ARTIFACTORY_HUB}/${DPKG_CONTAINER_NAME}:${rippled_version}_${CI_COMMIT_REF_SLUG}" +docker push "${ARTIFACTORY_HUB}/${RPM_CONTAINER_NAME}" +docker push "${ARTIFACTORY_HUB}/${DPKG_CONTAINER_NAME}" + diff --git a/Builds/containers/gitlab-ci/verify_head_commit.sh b/Builds/containers/gitlab-ci/verify_head_commit.sh new file mode 100644 index 0000000000..2cc223b8ad --- /dev/null +++ b/Builds/containers/gitlab-ci/verify_head_commit.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env sh +set -ex +apt -y update +apt -y install software-properties-common curl git gnupg +curl -sk -o rippled-pubkeys.txt "${GIT_SIGN_PUBKEYS_URL}" +gpg --import rippled-pubkeys.txt +if git verify-commit HEAD; then + echo "git commit signature check passed" +else + echo "git commit signature check failed" + git log -n 5 --color + --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an> [%G?]%Creset' + --abbrev-commit + exit 1 +fi + diff --git a/Builds/containers/packaging/dpkg/build_dpkg.sh b/Builds/containers/packaging/dpkg/build_dpkg.sh new file mode 100755 index 0000000000..1058a63df5 --- /dev/null +++ b/Builds/containers/packaging/dpkg/build_dpkg.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +set -ex + +source update_sources.sh + +# Build the dpkg + +#dpkg uses - as separator, so we need to change our -bN versions to tilde +RIPPLED_DPKG_VERSION=$(echo "${RIPPLED_VERSION}" | sed 's!-!~!g') + +cd rippled +if [[ -n $(git status --porcelain) ]]; then + git status + error "Unstaged changes in this repo - please commit first" +fi +git archive --format tar.gz --prefix rippled-${RIPPLED_DPKG_VERSION}/ -o ../rippled-${RIPPLED_DPKG_VERSION}.tar.gz HEAD +cd .. +# dpkg debmake would normally create this link, but we do it manually +ln -s ./rippled-${RIPPLED_DPKG_VERSION}.tar.gz rippled_${RIPPLED_DPKG_VERSION}.orig.tar.gz +tar xvf rippled-${RIPPLED_DPKG_VERSION}.tar.gz +cd rippled-${RIPPLED_DPKG_VERSION} +cp -pr ../debian . + +# dpkg requires a changelog. We don't currently maintain +# a useable one, so let's just fake it with our current version +# TODO : not sure if the "unstable" will need to change for +# release packages (?) +NOWSTR=$(TZ=UTC date -R) +cat << CHANGELOG > ./debian/changelog +rippled (${RIPPLED_DPKG_VERSION}-1) unstable; urgency=low + + * see RELEASENOTES + + -- Ripple Labs Inc. ${NOWSTR} +CHANGELOG + +# PATH must be preserved for our more modern cmake in /opt/local +# TODO : consider allowing lintian to run in future ? +export DH_BUILD_DDEBS=1 +debuild --no-lintian --preserve-envvar PATH --preserve-env -us -uc +rc=$?; if [[ $rc != 0 ]]; then + error "error building dpkg" +fi +cd .. +ls -latr + +# copy artifacts +cp rippled-dev_${RIPPLED_DPKG_VERSION}-1_amd64.deb ${PKG_OUTDIR} +cp rippled_${RIPPLED_DPKG_VERSION}-1_amd64.deb ${PKG_OUTDIR} +cp rippled_${RIPPLED_DPKG_VERSION}-1.dsc ${PKG_OUTDIR} +# dbgsym suffix is ddeb under newer debuild, but just deb under earlier +cp rippled-dbgsym_${RIPPLED_DPKG_VERSION}-1_amd64.* ${PKG_OUTDIR} +cp rippled_${RIPPLED_DPKG_VERSION}-1_amd64.changes ${PKG_OUTDIR} +cp rippled_${RIPPLED_DPKG_VERSION}-1_amd64.build ${PKG_OUTDIR} +cp rippled_${RIPPLED_DPKG_VERSION}.orig.tar.gz ${PKG_OUTDIR} +cp rippled_${RIPPLED_DPKG_VERSION}-1.debian.tar.xz ${PKG_OUTDIR} +# buildinfo is only generated by later version of debuild +if [ -e rippled_${RIPPLED_DPKG_VERSION}-1_amd64.buildinfo ] ; then + cp rippled_${RIPPLED_DPKG_VERSION}-1_amd64.buildinfo ${PKG_OUTDIR} +fi + +cat rippled_${RIPPLED_DPKG_VERSION}-1_amd64.changes +# extract the text in the .changes file that appears between +# Checksums-Sha256: ... +# and +# Files: ... +awk '/Checksums-Sha256:/{hit=1;next}/Files:/{hit=0}hit' \ + rippled_${RIPPLED_DPKG_VERSION}-1_amd64.changes | \ + sed -E 's!^[[:space:]]+!!' > shasums +DEB_SHA256=$(cat shasums | \ + grep "rippled_${RIPPLED_DPKG_VERSION}-1_amd64.deb" | cut -d " " -f 1) +DBG_SHA256=$(cat shasums | \ + grep "rippled-dbgsym_${RIPPLED_DPKG_VERSION}-1_amd64.*" | cut -d " " -f 1) +DEV_SHA256=$(cat shasums | \ + grep "rippled-dev_${RIPPLED_DPKG_VERSION}-1_amd64.deb" | cut -d " " -f 1) +SRC_SHA256=$(cat shasums | \ + grep "rippled_${RIPPLED_DPKG_VERSION}.orig.tar.gz" | cut -d " " -f 1) +echo "deb_sha256=${DEB_SHA256}" >> ${PKG_OUTDIR}/build_vars +echo "dbg_sha256=${DBG_SHA256}" >> ${PKG_OUTDIR}/build_vars +echo "dev_sha256=${DEV_SHA256}" >> ${PKG_OUTDIR}/build_vars +echo "src_sha256=${SRC_SHA256}" >> ${PKG_OUTDIR}/build_vars +echo "rippled_version=${RIPPLED_VERSION}" >> ${PKG_OUTDIR}/build_vars +echo "dpkg_version=${RIPPLED_DPKG_VERSION}" >> ${PKG_OUTDIR}/build_vars + diff --git a/Builds/containers/packaging/dpkg/debian/README.Debian b/Builds/containers/packaging/dpkg/debian/README.Debian new file mode 100644 index 0000000000..25ba6b55f7 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/README.Debian @@ -0,0 +1,3 @@ +rippled daemon + + -- Mike Ellery Tue, 04 Dec 2018 18:19:03 +0000 diff --git a/Builds/containers/packaging/dpkg/debian/compat b/Builds/containers/packaging/dpkg/debian/compat new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/compat @@ -0,0 +1 @@ +9 diff --git a/Builds/containers/packaging/dpkg/debian/conffiles b/Builds/containers/packaging/dpkg/debian/conffiles new file mode 100644 index 0000000000..a1fa7a15bb --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/conffiles @@ -0,0 +1,2 @@ +opt/ripple/etc/rippled.cfg +opt/ripple/etc/validators.txt diff --git a/Builds/containers/packaging/dpkg/debian/control b/Builds/containers/packaging/dpkg/debian/control new file mode 100644 index 0000000000..e09c0895ec --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/control @@ -0,0 +1,21 @@ +Source: rippled +Section: misc +Priority: extra +Maintainer: Ripple Labs Inc. +Build-Depends: cmake, debhelper (>=9), libprotobuf-dev, libssl-dev, zlib1g-dev, dh-systemd, ninja-build +Standards-Version: 3.9.7 +Homepage: http://ripple.com/ + +Package: rippled +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: rippled daemon + +Package: rippled-dev +Section: devel +Recommends: rippled (= ${binary:Version}) +Architecture: any +Multi-Arch: same +Depends: ${misc:Depends}, ${shlibs:Depends}, libprotobuf-dev, libssl-dev +Description: development files for applications using xrpl core library (serialize + sign) diff --git a/Builds/containers/packaging/dpkg/debian/copyright b/Builds/containers/packaging/dpkg/debian/copyright new file mode 100644 index 0000000000..dce318fd76 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/copyright @@ -0,0 +1,86 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: rippled +Source: https://github.com/ripple/rippled + +Files: * +Copyright: 2012-2019 Ripple Labs Inc. + +License: __UNKNOWN__ + +The accompanying files under various copyrights. + +Copyright (c) 2012, 2013, 2014 Ripple Labs Inc. + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +The accompanying files incorporate work covered by the following copyright +and previous license notice: + +Copyright (c) 2011 Arthur Britto, David Schwartz, Jed McCaleb, +Vinnie Falco, Bob Way, Eric Lombrozo, Nikolaos D. Bougalis, Howard Hinnant + +Some code from Raw Material Software, Ltd., provided under the terms of the + ISC License. See the corresponding source files for more details. + Copyright (c) 2013 - Raw Material Software Ltd. + Please visit http://www.juce.com + +Some code from ASIO examples: +// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +Some code from Bitcoin: +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2011 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file license.txt or http://www.opensource.org/licenses/mit-license.php. + +Some code from Tom Wu: +This software is covered under the following copyright: + +/* + * Copyright (c) 2003-2005 Tom Wu + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following condition applies: + * + * All redistributions must retain an intact copy of this copyright notice + * and disclaimer. + */ + +Address all questions regarding this license to: + + Tom Wu + tjw@cs.Stanford.EDU diff --git a/Builds/containers/packaging/dpkg/debian/dirs b/Builds/containers/packaging/dpkg/debian/dirs new file mode 100644 index 0000000000..aed307ee17 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/dirs @@ -0,0 +1,3 @@ +/var/log/rippled/ +/var/lib/rippled/ +/etc/systemd/system/rippled.service.d/ diff --git a/Builds/containers/packaging/dpkg/debian/docs b/Builds/containers/packaging/dpkg/debian/docs new file mode 100644 index 0000000000..4742cb8378 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/docs @@ -0,0 +1,3 @@ +README.md +LICENSE +RELEASENOTES.md diff --git a/Builds/containers/packaging/dpkg/debian/rippled-dev.install b/Builds/containers/packaging/dpkg/debian/rippled-dev.install new file mode 100644 index 0000000000..a222857c0b --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/rippled-dev.install @@ -0,0 +1,3 @@ +opt/ripple/include +opt/ripple/lib/*.a +opt/ripple/lib/cmake/ripple diff --git a/Builds/containers/packaging/dpkg/debian/rippled.install b/Builds/containers/packaging/dpkg/debian/rippled.install new file mode 100644 index 0000000000..6f43ba5e1a --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/rippled.install @@ -0,0 +1,6 @@ +opt/ripple/bin/rippled +opt/ripple/bin/validator-keys +opt/ripple/bin/update-rippled.sh +opt/ripple/etc/rippled.cfg +opt/ripple/etc/validators.txt +opt/ripple/etc/update-rippled-cron diff --git a/Builds/containers/packaging/dpkg/debian/rippled.links b/Builds/containers/packaging/dpkg/debian/rippled.links new file mode 100644 index 0000000000..ff2abd82b3 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/rippled.links @@ -0,0 +1,3 @@ +opt/ripple/etc/rippled.cfg etc/opt/ripple/rippled.cfg +opt/ripple/etc/validators.txt etc/opt/ripple/validators.txt +opt/ripple/bin/rippled usr/local/bin/rippled diff --git a/Builds/containers/packaging/dpkg/debian/rippled.postinst b/Builds/containers/packaging/dpkg/debian/rippled.postinst new file mode 100644 index 0000000000..ec9fb6faec --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/rippled.postinst @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +USER_NAME=rippled +GROUP_NAME=rippled +case "$1" in + configure) + id -u $USER_NAME >/dev/null 2>&1 || \ + adduser --system --quiet \ + --home /nonexistent --no-create-home \ + --disabled-password \ + --group "$GROUP_NAME" + chown -R $USER_NAME:$GROUP_NAME /var/log/rippled/ + chown -R $USER_NAME:$GROUP_NAME /var/lib/rippled/ + chown -R $USER_NAME:$GROUP_NAME /opt/ripple + chmod 755 /var/log/rippled/ + chmod 755 /var/lib/rippled/ + chmod 644 /opt/ripple/etc/update-rippled-cron + chown -R root:$GROUP_NAME /opt/ripple/etc/update-rippled-cron + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + + +#DEBHELPER# + +exit 0 diff --git a/Builds/containers/packaging/dpkg/debian/rippled.postrm b/Builds/containers/packaging/dpkg/debian/rippled.postrm new file mode 100644 index 0000000000..9086993a1f --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/rippled.postrm @@ -0,0 +1,17 @@ +#!/bin/sh +set -e + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + + +#DEBHELPER# + +exit 0 diff --git a/Builds/containers/packaging/dpkg/debian/rippled.preinst b/Builds/containers/packaging/dpkg/debian/rippled.preinst new file mode 100644 index 0000000000..10575345a2 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/rippled.preinst @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + + +#DEBHELPER# + +exit 0 diff --git a/Builds/containers/packaging/dpkg/debian/rippled.prerm b/Builds/containers/packaging/dpkg/debian/rippled.prerm new file mode 100644 index 0000000000..adabdbfb72 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/rippled.prerm @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + + +#DEBHELPER# + +exit 0 diff --git a/Builds/containers/packaging/dpkg/debian/rules b/Builds/containers/packaging/dpkg/debian/rules new file mode 100755 index 0000000000..64ce6ec8e3 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/rules @@ -0,0 +1,45 @@ +#!/usr/bin/make -f +export DH_VERBOSE = 1 +export DH_OPTIONS = -v +# debuild sets some warnings that don't work well +# for our curent build..so try to remove those flags here: +export CFLAGS:=$(subst -Wformat,,$(CFLAGS)) +export CFLAGS:=$(subst -Werror=format-security,,$(CFLAGS)) +export CXXFLAGS:=$(subst -Wformat,,$(CXXFLAGS)) +export CXXFLAGS:=$(subst -Werror=format-security,,$(CXXFLAGS)) + +%: + dh $@ --with systemd + +override_dh_auto_configure: + env + rm -rf bld + mkdir -p bld + cd bld && \ + cmake .. -G Ninja \ + -DCMAKE_INSTALL_PREFIX=/opt/ripple \ + -DCMAKE_BUILD_TYPE=Release \ + -Dstatic=true \ + -Dlocal_protobuf=ON \ + -DCMAKE_VERBOSE_MAKEFILE=ON + +override_dh_auto_build: + cd bld && \ + cmake --build . --parallel -- -v + +override_dh_auto_install: + cd bld && DESTDIR=../debian/tmp cmake --build . --target install -- -v + rm -rf bld_vl + mkdir -p bld_vl + cd bld_vl && \ + cmake ../../validator-keys-tool -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=../debian/tmp/opt/ripple/ \ + -Dstatic=true \ + -DCMAKE_VERBOSE_MAKEFILE=ON && \ + cmake --build . --parallel -- -v + install -D bld_vl/validator-keys debian/tmp/opt/ripple/bin/validator-keys + install -D Builds/containers/shared/update-rippled.sh debian/tmp/opt/ripple/bin/update-rippled.sh + install -D Builds/containers/shared/update-rippled-cron debian/tmp/opt/ripple/etc/update-rippled-cron + rm -rf bld + rm -rf bld_vl diff --git a/Builds/containers/packaging/dpkg/debian/source/format b/Builds/containers/packaging/dpkg/debian/source/format new file mode 100644 index 0000000000..163aaf8d82 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/Builds/containers/packaging/dpkg/debian/source/local-options b/Builds/containers/packaging/dpkg/debian/source/local-options new file mode 100644 index 0000000000..00131ee8c4 --- /dev/null +++ b/Builds/containers/packaging/dpkg/debian/source/local-options @@ -0,0 +1,2 @@ +#abort-on-upstream-changes +#unapply-patches diff --git a/Builds/containers/packaging/rpm/50-rippled.preset b/Builds/containers/packaging/rpm/50-rippled.preset new file mode 100644 index 0000000000..854e20a087 --- /dev/null +++ b/Builds/containers/packaging/rpm/50-rippled.preset @@ -0,0 +1 @@ +enable rippled.service \ No newline at end of file diff --git a/Builds/containers/packaging/rpm/build_rpm.sh b/Builds/containers/packaging/rpm/build_rpm.sh new file mode 100755 index 0000000000..4396f20f49 --- /dev/null +++ b/Builds/containers/packaging/rpm/build_rpm.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +set -ex + +source update_sources.sh + +# Build the rpm + +IFS='-' read -r RIPPLED_RPM_VERSION RELEASE <<< "$RIPPLED_VERSION" +export RIPPLED_RPM_VERSION + +RPM_RELEASE=${RPM_RELEASE-1} + +# post-release version +if [ "hf" = "$(echo "$RELEASE" | cut -c -2)" ]; then + RPM_RELEASE="${RPM_RELEASE}.${RELEASE}" +# pre-release version (-b or -rc) +elif [[ $RELEASE ]]; then + RPM_RELEASE="0.${RPM_RELEASE}.${RELEASE}" +fi + +export RPM_RELEASE + +if [[ $RPM_PATCH ]]; then + RPM_PATCH=".${RPM_PATCH}" + export RPM_PATCH +fi + +cd rippled +if [[ -n $(git status --porcelain) ]]; then + git status + error "Unstaged changes in this repo - please commit first" +fi +git archive --format tar.gz --prefix rippled/ -o ../rpmbuild/SOURCES/rippled.tar.gz HEAD +cd .. +tar -zc --exclude-vcs -f ./rpmbuild/SOURCES/validator-keys.tar.gz validator-keys-tool/ + +source /opt/rh/devtoolset-7/enable + +rpmbuild --define "_topdir ${PWD}/rpmbuild" -ba rippled.spec +rc=$?; if [[ $rc != 0 ]]; then + error "error building rpm" +fi + +# Make a tar of the rpm and source rpm +RPM_VERSION_RELEASE=$(rpm -qp --qf='%{NAME}-%{VERSION}-%{RELEASE}' ./rpmbuild/RPMS/x86_64/rippled-[0-9]*.rpm) +tar_file=$RPM_VERSION_RELEASE.tar.gz + +cp ./rpmbuild/RPMS/x86_64/* ${PKG_OUTDIR} +cp ./rpmbuild/SRPMS/* ${PKG_OUTDIR} + +RPM_MD5SUM=$(rpm -q --queryformat '%{SIGMD5}\n' -p ./rpmbuild/RPMS/x86_64/rippled-[0-9]*.rpm 2>/dev/null) +DBG_MD5SUM=$(rpm -q --queryformat '%{SIGMD5}\n' -p ./rpmbuild/RPMS/x86_64/rippled-debuginfo*.rpm 2>/dev/null) +DEV_MD5SUM=$(rpm -q --queryformat '%{SIGMD5}\n' -p ./rpmbuild/RPMS/x86_64/rippled-devel*.rpm 2>/dev/null) +SRC_MD5SUM=$(rpm -q --queryformat '%{SIGMD5}\n' -p ./rpmbuild/SRPMS/*.rpm 2>/dev/null) + +RPM_SHA256="$(sha256sum ./rpmbuild/RPMS/x86_64/rippled-[0-9]*.rpm | awk '{ print $1}')" +DBG_SHA256="$(sha256sum ./rpmbuild/RPMS/x86_64/rippled-debuginfo*.rpm | awk '{ print $1}')" +DEV_SHA256="$(sha256sum ./rpmbuild/RPMS/x86_64/rippled-devel*.rpm | awk '{ print $1}')" +SRC_SHA256="$(sha256sum ./rpmbuild/SRPMS/*.rpm | awk '{ print $1}')" + +echo "rpm_md5sum=$RPM_MD5SUM" > ${PKG_OUTDIR}/build_vars +echo "dbg_md5sum=$DBG_MD5SUM" >> ${PKG_OUTDIR}/build_vars +echo "dev_md5sum=$DEV_MD5SUM" >> ${PKG_OUTDIR}/build_vars +echo "src_md5sum=$SRC_MD5SUM" >> ${PKG_OUTDIR}/build_vars +echo "rpm_sha256=$RPM_SHA256" >> ${PKG_OUTDIR}/build_vars +echo "dbg_sha256=$DBG_SHA256" >> ${PKG_OUTDIR}/build_vars +echo "dev_sha256=$DEV_SHA256" >> ${PKG_OUTDIR}/build_vars +echo "src_sha256=$SRC_SHA256" >> ${PKG_OUTDIR}/build_vars +echo "rippled_version=$RIPPLED_VERSION" >> ${PKG_OUTDIR}/build_vars +echo "rpm_version=$RIPPLED_RPM_VERSION" >> ${PKG_OUTDIR}/build_vars +echo "rpm_file_name=$tar_file" >> ${PKG_OUTDIR}/build_vars +echo "rpm_version_release=$RPM_VERSION_RELEASE" >> ${PKG_OUTDIR}/build_vars + diff --git a/Builds/containers/packaging/rpm/rippled.spec b/Builds/containers/packaging/rpm/rippled.spec new file mode 100644 index 0000000000..cf9b144e10 --- /dev/null +++ b/Builds/containers/packaging/rpm/rippled.spec @@ -0,0 +1,108 @@ +%define rippled_version %(echo $RIPPLED_RPM_VERSION) +%define rpm_release %(echo $RPM_RELEASE) +%define rpm_patch %(echo $RPM_PATCH) +%define _prefix /opt/ripple +Name: rippled +# Dashes in Version extensions must be converted to underscores +Version: %{rippled_version} +Release: %{rpm_release}%{?dist}%{rpm_patch} +Summary: rippled daemon + +License: MIT +URL: http://ripple.com/ +Source0: rippled.tar.gz +Source1: validator-keys.tar.gz + +BuildRequires: protobuf-static openssl-static cmake zlib-static ninja-build + +%description +rippled + +%package devel +Summary: Files for development of applications using xrpl core library +Group: Development/Libraries +Requires: openssl-static, zlib-static + +%description devel +core library for development of standalone applications that sign transactions. + +%prep +%setup -c -n rippled -a 1 + +%build +cd rippled +mkdir -p bld.release +cd bld.release +cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_BUILD_TYPE=Release -Dstatic=true -DCMAKE_VERBOSE_MAKEFILE=ON -Dlocal_protobuf=ON +rm -rf $RPM_BUILD_ROOT +DESTDIR=$RPM_BUILD_ROOT cmake --build . --parallel --target install -- -v + +cd ../../validator-keys-tool +mkdir -p bld.release +cd bld.release +cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$RPM_BUILD_ROOT%{_prefix}/ -Dstatic=true -DCMAKE_VERBOSE_MAKEFILE=ON +cmake --build . --parallel -- -v + +%pre +test -e /etc/pki/tls || { mkdir -p /etc/pki; ln -s /usr/lib/ssl /etc/pki/tls; } + +%install +DESTDIR=$RPM_BUILD_ROOT cmake --build rippled/bld.release --target install -- -v +install -d ${RPM_BUILD_ROOT}/etc/opt/ripple +install -d ${RPM_BUILD_ROOT}/usr/local/bin +ln -s %{_prefix}/etc/rippled.cfg ${RPM_BUILD_ROOT}/etc/opt/ripple/rippled.cfg +ln -s %{_prefix}/etc/validators.txt ${RPM_BUILD_ROOT}/etc/opt/ripple/validators.txt +ln -s %{_prefix}/bin/rippled ${RPM_BUILD_ROOT}/usr/local/bin/rippled +install -D validator-keys-tool/bld.release/validator-keys ${RPM_BUILD_ROOT}%{_bindir}/validator-keys +install -D ./rippled/Builds/containers/shared/rippled.service ${RPM_BUILD_ROOT}/usr/lib/systemd/system/rippled.service +install -D ./rippled/Builds/containers/packaging/rpm/50-rippled.preset ${RPM_BUILD_ROOT}/usr/lib/systemd/system-preset/50-rippled.preset +install -D ./rippled/Builds/containers/shared/update-rippled.sh ${RPM_BUILD_ROOT}%{_bindir}/update-rippled.sh +install -D ./rippled/Builds/containers/shared/update-rippled-cron ${RPM_BUILD_ROOT}%{_prefix}/etc/update-rippled-cron +install -d $RPM_BUILD_ROOT/var/log/rippled +install -d $RPM_BUILD_ROOT/var/lib/rippled + +%post +USER_NAME=rippled +GROUP_NAME=rippled + +getent passwd $USER_NAME &>/dev/null || useradd $USER_NAME +getent group $GROUP_NAME &>/dev/null || groupadd $GROUP_NAME + +chown -R $USER_NAME:$GROUP_NAME /var/log/rippled/ +chown -R $USER_NAME:$GROUP_NAME /var/lib/rippled/ +chown -R $USER_NAME:$GROUP_NAME %{_prefix}/ + +chmod 755 /var/log/rippled/ +chmod 755 /var/lib/rippled/ + +chmod 644 %{_prefix}/etc/update-rippled-cron +chown -R root:$GROUP_NAME %{_prefix}/etc/update-rippled-cron + +%files +%doc rippled/README.md rippled/LICENSE +%{_bindir}/rippled +/usr/local/bin/rippled +%{_bindir}/update-rippled.sh +%{_prefix}/etc/update-rippled-cron +%{_bindir}/validator-keys +%config(noreplace) %{_prefix}/etc/rippled.cfg +%config(noreplace) /etc/opt/ripple/rippled.cfg +%config(noreplace) %{_prefix}/etc/validators.txt +%config(noreplace) /etc/opt/ripple/validators.txt +%config(noreplace) /usr/lib/systemd/system/rippled.service +%config(noreplace) /usr/lib/systemd/system-preset/50-rippled.preset +%dir /var/log/rippled/ +%dir /var/lib/rippled/ + +%files devel +%{_prefix}/include +%{_prefix}/lib/*.a +%{_prefix}/lib/cmake/ripple + +%changelog +* Wed Aug 01 2018 Mike Ellery +- add devel package for signing library + +* Thu Jun 02 2016 Brandon Wilson +- Install validators.txt + diff --git a/Builds/containers/shared/build_deps.sh b/Builds/containers/shared/build_deps.sh new file mode 100755 index 0000000000..04b324a7a6 --- /dev/null +++ b/Builds/containers/shared/build_deps.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +set -ex + +function build_boost() +{ + local boost_ver=$1 + local do_link=$2 + local boost_path=$(echo "${boost_ver}" | sed -e 's!\.!_!g') + cd /tmp + wget https://dl.bintray.com/boostorg/release/${boost_ver}/source/boost_${boost_path}.tar.bz2 + mkdir -p /opt/local + cd /opt/local + tar xf /tmp/boost_${boost_path}.tar.bz2 + if [ "$do_link" = true ] ; then + ln -s ./boost_${boost_path} boost + fi + cd boost_${boost_path} + ./bootstrap.sh + ./b2 -j$(nproc) + ./b2 stage + cd .. + rm -f /tmp/boost_${boost_path}.tar.bz2 +} + +build_boost "1.67.0" true +build_boost "1.68.0" false + +# installed in opt, so won't be used +# unless specified by OPENSSL_ROOT_DIR +cd /tmp +OPENSSL_VER=1.1.1 +wget https://www.openssl.org/source/openssl-${OPENSSL_VER}.tar.gz +tar xf openssl-${OPENSSL_VER}.tar.gz +cd openssl-${OPENSSL_VER} +# NOTE: add -g to the end of the following line if we want debug symbols for openssl +./config -fPIC --prefix=/opt/local/openssl --openssldir=/opt/local/openssl zlib shared +make -j$(nproc) +make install +cd .. +rm -f openssl-${OPENSSL_VER}.tar.gz +rm -rf openssl-${OPENSSL_VER} +LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/local/openssl/lib /opt/local/openssl/bin/openssl version -a + +cd /tmp +wget https://github.com/doxygen/doxygen/archive/Release_1_8_14.tar.gz +tar xf Release_1_8_14.tar.gz +cd doxygen-Release_1_8_14 +mkdir build +cd build +cmake -G "Unix Makefiles" .. +make -j$(nproc) +make install +cd ../.. +rm -f Release_1_8_14.tar.gz +rm -rf doxygen-Release_1_8_14 + +mkdir -p /opt/plantuml +wget -O /opt/plantuml/plantuml.jar https://downloads.sourceforge.net/project/plantuml/plantuml.jar + +cd /tmp +wget https://github.com/linux-test-project/lcov/releases/download/v1.13/lcov-1.13.tar.gz +tar xfz lcov-1.13.tar.gz +cd lcov-1.13 +make install PREFIX=/usr/local +cd .. +rm -r lcov-1.13 lcov-1.13.tar.gz + +pip install requests +pip install https://github.com/codecov/codecov-python/archive/master.zip + +set +e +mkdir -p /opt/local/nih_cache +mkdir -p /opt/jenkins +set -e + + diff --git a/Builds/containers/shared/install_cmake.sh b/Builds/containers/shared/install_cmake.sh new file mode 100755 index 0000000000..749f0fb9ac --- /dev/null +++ b/Builds/containers/shared/install_cmake.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -ex + +cd /tmp +CM_INSTALLER=cmake-3.13.2-Linux-x86_64.sh +CM_VER_DIR=/opt/local/cmake-3.13 +wget https://cmake.org/files/v3.13/$CM_INSTALLER +chmod a+x $CM_INSTALLER +mkdir -p $CM_VER_DIR +ln -s $CM_VER_DIR /opt/local/cmake +./$CM_INSTALLER --prefix=$CM_VER_DIR --exclude-subdir +rm -f /tmp/$CM_INSTALLER + +export PATH="/opt/local/cmake/bin:${PATH}" + + diff --git a/Builds/containers/shared/rippled.service b/Builds/containers/shared/rippled.service new file mode 100644 index 0000000000..4514edb0d1 --- /dev/null +++ b/Builds/containers/shared/rippled.service @@ -0,0 +1,15 @@ +[Unit] +Description=Ripple Daemon + +[Service] +Type=simple +ExecStart=/opt/ripple/bin/rippled --net --silent --conf /etc/opt/ripple/rippled.cfg +# Default KillSignal can be used if/when rippled handles SIGTERM +KillSignal=SIGINT +Restart=no +User=rippled +Group=rippled +LimitNOFILE=65536 + +[Install] +WantedBy=multi-user.target diff --git a/Builds/containers/shared/update-rippled-cron b/Builds/containers/shared/update-rippled-cron new file mode 100644 index 0000000000..c7744219f9 --- /dev/null +++ b/Builds/containers/shared/update-rippled-cron @@ -0,0 +1,10 @@ +# For automatic updates, symlink this file to /etc/cron.d/ +# Do not remove the newline at the end of this cron script + +# bash required for use of RANDOM below. +SHELL=/bin/bash +PATH=/sbin;/bin;/usr/sbin;/usr/bin + +# invoke check/update script with random delay up to 59 mins +0 * * * * root sleep $((RANDOM*3540/32768)) && /opt/ripple/bin/update-rippled.sh + diff --git a/Builds/containers/shared/update-rippled.sh b/Builds/containers/shared/update-rippled.sh new file mode 100755 index 0000000000..a0e28d23ff --- /dev/null +++ b/Builds/containers/shared/update-rippled.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# auto-update script for rippled daemon + +LOCKDIR=/tmp/rippleupdate.lock +UPDATELOG=/var/log/rippled/update.log + +function cleanup { + # If this directory isn't removed, future updates will fail. + rmdir $LOCKDIR +} + +# Use mkdir to check if process is already running. mkdir is atomic, as against file create. +if ! mkdir $LOCKDIR 2>/dev/null; then + echo $(date -u) "lockdir exists - won't proceed." >> $UPDATELOG + exit 1 +fi +trap cleanup EXIT + +source /etc/os-release +can_update=false + +if [[ "$ID" == "ubuntu" || "$ID" == "debian" ]] ; then + # Silent update + apt-get update -qq + + # The next line is an "awk"ward way to check if the package needs to be updated. + RIPPLE=$(apt-get install -s --only-upgrade rippled | awk '/^Inst/ { print $2 }') + test "$RIPPLE" == "rippled" && can_update=true + + function apply_update { + apt-get install rippled -qq + } +elif [[ "$ID" == "fedora" || "$ID" == "centos" || "$ID" == "rhel" || "$ID" == "scientific" ]] ; then + RIPPLE_REPO=${RIPPLE_REPO-stable} + # Update ripple.repo file + rpm -Uvh --replacepkgs https://mirrors.ripple.com/ripple-repo-el7.rpm + yum --disablerepo=* --enablerepo=ripple-$RIPPLE_REPO clean expire-cache + + yum check-update -q --enablerepo=ripple-$RIPPLE_REPO rippled || can_update=true + + function apply_update { + yum update -y --enablerepo=ripple-$RIPPLE_REPO rippled + } +else + echo "unrecognized distro!" + exit 1 +fi + +# Do the actual update and restart the service after reloading systemctl daemon. +if [ "$can_update" = true ] ; then + exec 3>&1 1>>${UPDATELOG} 2>&1 + set -e + apply_update + systemctl daemon-reload + systemctl restart rippled.service + echo $(date -u) "rippled daemon updated." +else + echo $(date -u) "no updates available" >> $UPDATELOG +fi + diff --git a/Builds/containers/shared/update_sources.sh b/Builds/containers/shared/update_sources.sh new file mode 100755 index 0000000000..83b1168093 --- /dev/null +++ b/Builds/containers/shared/update_sources.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +function error { + echo $1 + exit 1 +} + +cd /opt/rippled_bld/pkg/rippled +export RIPPLED_VERSION=$(egrep -i -o "\b(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9a-z\-]+(\.[0-9a-z\-]+)*)?(\+[0-9a-z\-]+(\.[0-9a-z\-]+)*)?\b" src/ripple/protocol/impl/BuildInfo.cpp) + +cd .. +git clone https://github.com/ripple/validator-keys-tool.git +cd validator-keys-tool +git checkout origin/master +git submodule update --init --recursive +cd .. + +: ${PKG_OUTDIR:=/opt/rippled_bld/pkg/out} +export PKG_OUTDIR +if [ ! -d ${PKG_OUTDIR} ]; then + error "${PKG_OUTDIR} is not mounted" +fi + +if [ -x ${OPENSSL_ROOT}/bin/openssl ]; then + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${OPENSSL_ROOT}/lib ${OPENSSL_ROOT}/bin/openssl version -a +fi + diff --git a/Builds/containers/ubuntu-builder/Dockerfile b/Builds/containers/ubuntu-builder/Dockerfile new file mode 100644 index 0000000000..08aac7aa45 --- /dev/null +++ b/Builds/containers/ubuntu-builder/Dockerfile @@ -0,0 +1,32 @@ +ARG DIST_TAG=16.04 +ARG GIT_COMMIT=unknown + +FROM ubuntu:$DIST_TAG +LABEL git-commit=$GIT_COMMIT + +# install/setup prerequisites: +COPY ubuntu-builder/ubuntu_setup.sh /tmp/ +COPY shared/build_deps.sh /tmp/ +COPY shared/install_cmake.sh /tmp/ +RUN chmod +x /tmp/ubuntu_setup.sh && \ + chmod +x /tmp/build_deps.sh && \ + chmod +x /tmp/install_cmake.sh +RUN /tmp/ubuntu_setup.sh +RUN /tmp/install_cmake.sh +ENV PATH="/opt/local/cmake/bin:$PATH" +RUN /tmp/build_deps.sh +ENV PLANTUML_JAR="/opt/plantuml/plantuml.jar" +ENV BOOST_ROOT="/opt/local/boost" +ENV OPENSSL_ROOT="/opt/local/openssl" + +# prep files for package building +RUN mkdir -m 777 -p /opt/rippled_bld/pkg +WORKDIR /opt/rippled_bld/pkg + +COPY packaging/dpkg/debian /opt/rippled_bld/pkg/debian/ +COPY shared/update_sources.sh ./ +COPY shared/rippled.service /opt/rippled_bld/pkg/debian/ + +COPY packaging/dpkg/build_dpkg.sh ./ +CMD ./build_dpkg.sh + diff --git a/Builds/containers/ubuntu-builder/ubuntu_setup.sh b/Builds/containers/ubuntu-builder/ubuntu_setup.sh new file mode 100755 index 0000000000..cc56b4bdde --- /dev/null +++ b/Builds/containers/ubuntu-builder/ubuntu_setup.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash +set -ex + +source /etc/os-release + +if [[ ${VERSION_ID} =~ ^18\. || ${VERSION_ID} =~ ^16\. ]] ; then + echo "setup for ${PRETTY_NAME}" +else + echo "${VERSION} not supported" + exit 1 +fi + +export DEBIAN_FRONTEND="noninteractive" +echo "Acquire::Retries 3;" > /etc/apt/apt.conf.d/80-retries +echo "Acquire::http::Pipeline-Depth 0;" >> /etc/apt/apt.conf.d/80-retries +echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/80-retries +echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/80-retries +apt-get update -o Acquire::CompressionTypes::Order::=gz + +apt-get -y update +apt-get -y install apt-utils +apt-get -y install software-properties-common wget +apt-get -y upgrade +if [[ ${VERSION_ID} =~ ^18\. ]] ; then + apt-add-repository -y multiverse + apt-add-repository -y universe +elif [[ ${VERSION_ID} =~ ^16\. ]] ; then + add-apt-repository -y ppa:ubuntu-toolchain-r/test +fi +apt-get -y clean +apt-get -y update + +apt-get -y --fix-missing install \ + make cmake ninja-build ccache \ + protobuf-compiler libprotobuf-dev libssl-dev libzstd-dev \ + libjemalloc-dev \ + python-pip \ + gdb gdbserver \ + libstdc++6 \ + flex bison \ + libicu-dev texinfo \ + java-common javacc \ + gcc-7 g++-7 \ + gcc-8 g++-8 \ + dpkg-dev debhelper devscripts fakeroot \ + debmake git-buildpackage dh-make gitpkg debsums gnupg \ + dh-buildinfo dh-make dh-systemd + +update-alternatives --install \ + /usr/bin/gcc gcc /usr/bin/gcc-7 40 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-7 \ + --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-7 \ + --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-7 \ + --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-7 \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-7 \ + --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-dump-7 \ + --slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-tool-7 +update-alternatives --install \ + /usr/bin/gcc gcc /usr/bin/gcc-8 20 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-8 \ + --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-8 \ + --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-8 \ + --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-8 \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-8 \ + --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-dump-8 \ + --slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-tool-8 +update-alternatives --auto gcc + +update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-7 40 +update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-8 20 +update-alternatives --auto cpp + +if [[ ${VERSION_ID} =~ ^18\. ]] ; then + apt-get -y install binutils +elif [[ ${VERSION_ID} =~ ^16\. ]] ; then + apt-get -y install python-software-properties binutils-gold +fi + +wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - +if [[ ${VERSION_ID} =~ ^18\. ]] ; then + cat << EOF > /etc/apt/sources.list.d/llvm.list +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main +EOF +elif [[ ${VERSION_ID} =~ ^16\. ]] ; then + cat << EOF > /etc/apt/sources.list.d/llvm.list +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main +EOF +fi +apt-get -y update + +apt-get -y install \ + clang-7 libclang-common-7-dev libclang-7-dev libllvm7 lldb-7 llvm-7 \ + llvm-7-dev llvm-7-runtime clang-format-7 python-clang-7 python-lldb-7 \ + liblldb-7-dev lld-7 libfuzzer-7-dev libc++-7-dev +update-alternatives --install \ + /usr/bin/clang clang /usr/bin/clang-7 40 \ + --slave /usr/bin/clang++ clang++ /usr/bin/clang++-7 \ + --slave /usr/bin/llvm-profdata llvm-profdata /usr/bin/llvm-profdata-7 \ + --slave /usr/bin/asan-symbolize asan-symbolize /usr/bin/asan_symbolize-7 \ + --slave /usr/bin/clang-format clang-format /usr/bin/clang-format-7 \ + --slave /usr/bin/lldb lldb /usr/bin/lldb-7 \ + --slave /usr/bin/lldb-server lldb-server /usr/bin/lldb-server-7 \ + --slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-7 \ + --slave /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-7 \ + --slave /usr/bin/llvm-nm llvm-nm /usr/bin/llvm-nm-7 +update-alternatives --auto clang + +apt-get -y autoremove + diff --git a/CMakeLists.txt b/CMakeLists.txt index bc618dc186..1e1ddd2092 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,10 +46,11 @@ if (NOT is_multiconfig) endif () endif () -if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) - set (is_root_project ON) -else () +get_directory_property(has_parent PARENT_DIRECTORY) +if (has_parent) set (is_root_project OFF) +else () + set (is_root_project ON) endif () if ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang") # both Clang and AppleClang @@ -175,6 +176,16 @@ if (san) message (FATAL_ERROR "${san} sanitizer does not seem to be supported by your compiler") endif () endif () +set (container_label "" CACHE STRING "tag to use for package building containers") +option (packages_only + "ONLY generate package building targets. This is special use-case and almost \ + certainly not what you want. Use with caution as you won't be able to build \ + any compiled targets locally." OFF) +option (have_package_container + "Sometimes you already have the tagged container you want to use for package \ + building and you don't want docker to rebuild it. This flag will detach the \ + dependency of the package build from the container build. It's an advanced \ + use case and most likely you should not be touching this flag." OFF) # the remaining options are obscure and rarely used option (beast_no_unit_test_inline @@ -204,6 +215,189 @@ if (coverage) set (CMAKE_BUILD_TYPE Debug CACHE STRING "build type" FORCE) endif () +#[===================================================================[ + NIH prefix path..this is where we will download + and build any ExternalProjects, and they will hopefully + survive across build directory deletion (manual cleans) +#]===================================================================] + +string (REGEX REPLACE "[ \\/%]+" "_" gen_for_path ${CMAKE_GENERATOR}) +string (TOLOWER ${gen_for_path} gen_for_path) +# HACK: trying to shorten paths for windows CI (which hits 260 MAXPATH easily) +# @see: https://issues.jenkins-ci.org/browse/JENKINS-38706?focusedCommentId=339847 +string (REPLACE "visual_studio" "vs" gen_for_path ${gen_for_path}) +if (NOT DEFINED NIH_CACHE_ROOT) + if (DEFINED ENV{NIH_CACHE_ROOT}) + set (NIH_CACHE_ROOT $ENV{NIH_CACHE_ROOT}) + else () + set (NIH_CACHE_ROOT "${CMAKE_SOURCE_DIR}/.nih_c") + endif () +endif () +set (nih_cache_path + "${NIH_CACHE_ROOT}/${gen_for_path}/${CMAKE_CXX_COMPILER_ID}_${CMAKE_CXX_COMPILER_VERSION}") +if (NOT is_multiconfig) + set (nih_cache_path "${nih_cache_path}/${CMAKE_BUILD_TYPE}") +endif () +file(TO_CMAKE_PATH "${nih_cache_path}" nih_cache_path) +message (STATUS "NIH-EP cache path: ${nih_cache_path}") +## two convenience variables: +set (ep_lib_prefix ${CMAKE_STATIC_LIBRARY_PREFIX}) +set (ep_lib_suffix ${CMAKE_STATIC_LIBRARY_SUFFIX}) + +# this is a setting for FetchContent and needs to be +# a cache variable +# https://cmake.org/cmake/help/latest/module/FetchContent.html#populating-the-content +set (FETCHCONTENT_BASE_DIR ${nih_cache_path} CACHE STRING "" FORCE) + +#[===================================================================[ + package/container targets - (optional) +#]===================================================================] + +if (is_root_project) + if (NOT DOCKER) + find_program (DOCKER docker) + endif () + + if (DOCKER) + # if no container label is provided, use current git hash + git_hash (commit_hash) + if (NOT container_label) + set (container_label ${commit_hash}) + endif () + message (STATUS "using [${container_label}] as build container tag...") + + file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/packages) + file (MAKE_DIRECTORY ${NIH_CACHE_ROOT}/pkgbuild) + if (UNIX) + execute_process (COMMAND id -u + OUTPUT_VARIABLE DOCKER_USER_ID + OUTPUT_STRIP_TRAILING_WHITESPACE) + message (STATUS "docker local user id: ${DOCKER_USER_ID}") + execute_process (COMMAND id -g + OUTPUT_VARIABLE DOCKER_GROUP_ID + OUTPUT_STRIP_TRAILING_WHITESPACE) + message (STATUS "docker local group id: ${DOCKER_GROUP_ID}") + endif () + if (DOCKER_USER_ID AND DOCKER_GROUP_ID) + set(map_user TRUE) + endif () + #[===================================================================[ + rpm + #]===================================================================] + add_custom_target (rpm_container + docker build + --pull + --build-arg GIT_COMMIT=${commit_hash} + -t rippled-rpm-builder:${container_label} + $<$:--cache-from=${rpm_cache_from}> + -f centos-builder/Dockerfile . + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Builds/containers + VERBATIM + USES_TERMINAL + COMMAND_EXPAND_LISTS + SOURCES + Builds/containers/centos-builder/Dockerfile + Builds/containers/centos-builder/centos_setup.sh + Builds/containers/centos-builder/extras.sh + Builds/containers/shared/build_deps.sh + Builds/containers/shared/rippled.service + Builds/containers/shared/update_sources.sh + Builds/containers/shared/update-rippled.sh + Builds/containers/packaging/rpm/rippled.spec + Builds/containers/packaging/rpm/build_rpm.sh + ) + exclude_from_default (rpm_container) + add_custom_target (rpm + docker run + -e NIH_CACHE_ROOT=/opt/rippled_bld/pkg/.nih_c + -v ${NIH_CACHE_ROOT}/pkgbuild:/opt/rippled_bld/pkg/.nih_c + -v ${CMAKE_SOURCE_DIR}:/opt/rippled_bld/pkg/rippled + -v ${CMAKE_CURRENT_BINARY_DIR}/packages:/opt/rippled_bld/pkg/out + "$<$:--volume=/etc/passwd:/etc/passwd;--volume=/etc/group:/etc/group;--user=${DOCKER_USER_ID}:${DOCKER_GROUP_ID}>" + -t rippled-rpm-builder:${container_label} + VERBATIM + USES_TERMINAL + COMMAND_EXPAND_LISTS + SOURCES + Builds/containers/packaging/rpm/rippled.spec + ) + exclude_from_default (rpm) + if (NOT have_package_container) + add_dependencies(rpm rpm_container) + endif () + #[===================================================================[ + dpkg + #]===================================================================] + # currently use ubuntu 16.04 as a base b/c it has one of + # the lower versions of libc among ubuntu and debian releases. + # we could change this in the future and build with some other deb + # based system. + add_custom_target (dpkg_container + docker build + --pull + --build-arg DIST_TAG=16.04 + --build-arg GIT_COMMIT=${commit_hash} + -t rippled-dpkg-builder:${container_label} + $<$:--cache-from=${dpkg_cache_from}> + -f ubuntu-builder/Dockerfile . + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Builds/containers + VERBATIM + USES_TERMINAL + COMMAND_EXPAND_LISTS + SOURCES + Builds/containers/ubuntu-builder/Dockerfile + Builds/containers/ubuntu-builder/ubuntu_setup.sh + Builds/containers/shared/build_deps.sh + Builds/containers/shared/rippled.service + Builds/containers/shared/update_sources.sh + Builds/containers/shared/update-rippled.sh + Builds/containers/packaging/dpkg/build_dpkg.sh + Builds/containers/packaging/dpkg/debian/README.Debian + Builds/containers/packaging/dpkg/debian/conffiles + Builds/containers/packaging/dpkg/debian/control + Builds/containers/packaging/dpkg/debian/copyright + Builds/containers/packaging/dpkg/debian/dirs + Builds/containers/packaging/dpkg/debian/docs + Builds/containers/packaging/dpkg/debian/rippled-dev.install + Builds/containers/packaging/dpkg/debian/rippled.install + Builds/containers/packaging/dpkg/debian/rippled.links + Builds/containers/packaging/dpkg/debian/rippled.postinst + Builds/containers/packaging/dpkg/debian/rippled.postrm + Builds/containers/packaging/dpkg/debian/rippled.preinst + Builds/containers/packaging/dpkg/debian/rippled.prerm + Builds/containers/packaging/dpkg/debian/rules + ) + exclude_from_default (dpkg_container) + add_custom_target (dpkg + docker run + -e NIH_CACHE_ROOT=/opt/rippled_bld/pkg/.nih_c + -v ${NIH_CACHE_ROOT}/pkgbuild:/opt/rippled_bld/pkg/.nih_c + -v ${CMAKE_SOURCE_DIR}:/opt/rippled_bld/pkg/rippled + -v ${CMAKE_CURRENT_BINARY_DIR}/packages:/opt/rippled_bld/pkg/out + "$<$:--volume=/etc/passwd:/etc/passwd;--volume=/etc/group:/etc/group;--user=${DOCKER_USER_ID}:${DOCKER_GROUP_ID}>" + -t rippled-dpkg-builder:${container_label} + VERBATIM + USES_TERMINAL + COMMAND_EXPAND_LISTS + SOURCES + Builds/containers/packaging/dpkg/debian/control + ) + exclude_from_default (dpkg) + if (NOT have_package_container) + add_dependencies(dpkg dpkg_container) + endif () + else () + message (STATUS "docker NOT found -- won't be able to build containers for packaging") + endif () +endif () + +if (packages_only) + if (NOT TARGET rpm) + message (FATAL_ERROR "packages_only requested, but targets were not created - is docker installed?") + endif() + return () +endif () + #[===================================================================[ setup project-wide compiler settings #]===================================================================] @@ -222,7 +416,7 @@ target_compile_features (common INTERFACE cxx_std_14) target_compile_definitions (common INTERFACE $<$:DEBUG _DEBUG> - $<$,$>>:NDEBUG>) + $<$,$>>:NDEBUG>) # ^^^^ NOTE: CMAKE release builds already have NDEBUG # defined, so no need to add it explicitly except for # this special case of (profile ON) and (assert OFF) @@ -305,7 +499,7 @@ else () > $<$>:-fno-strict-aliasing> # tweak gcc optimization for debug - $<$,$>:-O0> + $<$,$>:-O0> # Add debug symbols to release config $<$:-g>) target_link_libraries (common @@ -466,40 +660,6 @@ add_library (ripple_libs INTERFACE) add_library (Ripple::libs ALIAS ripple_libs) target_link_libraries (ripple_libs INTERFACE Ripple::syslibs) -#[===================================================================[ - NIH prefix path..this is where we will download - and build any ExternalProjects, and they will hopefully - survive across build directory deletion (manual cleans) -#]===================================================================] - -string (REGEX REPLACE "[ \\/%]+" "_" gen_for_path ${CMAKE_GENERATOR}) -string (TOLOWER ${gen_for_path} gen_for_path) -# HACK: trying to shorten paths for windows CI (which hits 260 MAXPATH easily) -# @see: https://issues.jenkins-ci.org/browse/JENKINS-38706?focusedCommentId=339847 -string (REPLACE "visual_studio" "vs" gen_for_path ${gen_for_path}) -if (NOT DEFINED NIH_CACHE_ROOT) - if (DEFINED ENV{NIH_CACHE_ROOT}) - set (NIH_CACHE_ROOT $ENV{NIH_CACHE_ROOT}) - else () - set (NIH_CACHE_ROOT ${CMAKE_SOURCE_DIR}) - endif () -endif () -set (nih_cache_path - "${NIH_CACHE_ROOT}/.nih_c/${gen_for_path}/${CMAKE_CXX_COMPILER_ID}_${CMAKE_CXX_COMPILER_VERSION}") -if (NOT is_multiconfig) - set (nih_cache_path "${nih_cache_path}/${CMAKE_BUILD_TYPE}") -endif () -file(TO_CMAKE_PATH "${nih_cache_path}" nih_cache_path) -message (STATUS "NIH-EP cache path: ${nih_cache_path}") -## two convenience variables: -set (ep_lib_prefix ${CMAKE_STATIC_LIBRARY_PREFIX}) -set (ep_lib_suffix ${CMAKE_STATIC_LIBRARY_SUFFIX}) - -# this is a setting for FetchContent and needs to be -# a cache variable -# https://cmake.org/cmake/help/latest/module/FetchContent.html#populating-the-content -set (FETCHCONTENT_BASE_DIR ${nih_cache_path} CACHE STRING "" FORCE) - #[===================================================================[ NIH dep: boost #]===================================================================] @@ -1231,43 +1391,45 @@ exclude_if_included (rocksdb_lib) proper targets and export/install #]===================================================================] -add_library (nudb INTERFACE) -if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.11) - FetchContent_Declare( - nudb_src - GIT_REPOSITORY https://github.com/vinniefalco/NuDB.git - GIT_TAG 1.0.0 - ) - FetchContent_GetProperties(nudb_src) - if(NOT nudb_src_POPULATED) - message (STATUS "Pausing to download NuDB...") - FetchContent_Populate(nudb_src) - endif() -else () - ExternalProject_Add (nudb_src - PREFIX ${nih_cache_path} - GIT_REPOSITORY https://github.com/vinniefalco/NuDB.git - GIT_TAG 1.0.0 - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - TEST_COMMAND "" - INSTALL_COMMAND "" - ) - ExternalProject_Get_Property (nudb_src SOURCE_DIR) - set (nudb_src_SOURCE_DIR "${SOURCE_DIR}") - file (MAKE_DIRECTORY ${nudb_src_SOURCE_DIR}/include) - add_dependencies (nudb nudb_src) -endif () +if (is_root_project) # NuDB not needed in the case of xrpl_core inclusion build + add_library (nudb INTERFACE) + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.11) + FetchContent_Declare( + nudb_src + GIT_REPOSITORY https://github.com/vinniefalco/NuDB.git + GIT_TAG 1.0.0 + ) + FetchContent_GetProperties(nudb_src) + if(NOT nudb_src_POPULATED) + message (STATUS "Pausing to download NuDB...") + FetchContent_Populate(nudb_src) + endif() + else () + ExternalProject_Add (nudb_src + PREFIX ${nih_cache_path} + GIT_REPOSITORY https://github.com/vinniefalco/NuDB.git + GIT_TAG 1.0.0 + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + TEST_COMMAND "" + INSTALL_COMMAND "" + ) + ExternalProject_Get_Property (nudb_src SOURCE_DIR) + set (nudb_src_SOURCE_DIR "${SOURCE_DIR}") + file (MAKE_DIRECTORY ${nudb_src_SOURCE_DIR}/include) + add_dependencies (nudb nudb_src) + endif () -file(TO_CMAKE_PATH "${nudb_src_SOURCE_DIR}" nudb_src_SOURCE_DIR) + file(TO_CMAKE_PATH "${nudb_src_SOURCE_DIR}" nudb_src_SOURCE_DIR) # specify as system includes so as to avoid warnings -target_include_directories (nudb SYSTEM INTERFACE ${nudb_src_SOURCE_DIR}/include) -target_link_libraries (nudb - INTERFACE - Boost::thread - Boost::system) -add_library (NIH::nudb ALIAS nudb) -target_link_libraries (ripple_libs INTERFACE NIH::nudb) + target_include_directories (nudb SYSTEM INTERFACE ${nudb_src_SOURCE_DIR}/include) + target_link_libraries (nudb + INTERFACE + Boost::thread + Boost::system) + add_library (NIH::nudb ALIAS nudb) + target_link_libraries (ripple_libs INTERFACE NIH::nudb) +endif () #[===================================================================[ import protobuf (lib and compiler) and create a lib diff --git a/Jenkinsfile b/Jenkinsfile index 8c6c295e42..3d3acb9b1c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -192,7 +192,7 @@ try { echo "BUILD_TYPE: ${config}" echo "USE_CC: ${ucc}" env_vars.addAll([ - "NIH_CACHE_ROOT=${cdir}"]) + "NIH_CACHE_ROOT=${cdir}/.nih_c"]) if (compiler == 'msvc') { env_vars.addAll([ 'BOOST_ROOT=c:\\lib\\boost_1_67',