diff --git a/.drone.jsonnet b/.drone.jsonnet index 86cf6a0..f6d372b 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -1,63 +1,45 @@ -local debian_pipeline(name, image, arch='amd64', deps='g++ libsodium-dev libzmq3-dev', cmake_extra='', build_type='Release', extra_cmds=[], allow_fail=false) = { +local distro = "fedora-34"; +local distro_name = 'Fedora 34'; +local distro_docker = 'fedora:34'; + +local submodules = { + name: 'submodules', + image: 'drone/git', + commands: ['git fetch --tags', 'git submodule update --init --recursive'] +}; + +local dnf(arch) = 'dnf -y --setopt install_weak_deps=False --setopt cachedir=/cache/'+distro+'/'+arch+'/${DRONE_STAGE_MACHINE} '; + +local rpm_pipeline(image, buildarch='amd64', rpmarch='x86_64', jobs=6) = { kind: 'pipeline', type: 'docker', - name: name, - platform: { arch: arch }, - environment: { CLICOLOR_FORCE: '1' }, // Lets color through ninja (1.9+) + name: distro_name + ' (' + rpmarch + ')', + platform: { arch: buildarch }, steps: [ + submodules, { name: 'build', image: image, - [if allow_fail then "failure"]: "ignore", + environment: { + SSH_KEY: { from_secret: "SSH_KEY" }, + RPM_BUILD_NCPUS: jobs + }, commands: [ - 'apt-get update', - 'apt-get install -y eatmydata', - 'eatmydata apt-get dist-upgrade -y', - 'eatmydata apt-get install -y cmake git ninja-build pkg-config ccache ' + deps, - 'git submodule update --init --recursive', - 'mkdir build', - 'cd build', - 'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE='+build_type+' -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ' + cmake_extra, - 'ninja -v', - './tests/tests --use-colour yes' - ] + extra_cmds, + 'echo "Building on ${DRONE_STAGE_MACHINE}"', + dnf(rpmarch) + 'distro-sync', + dnf(rpmarch) + 'install rpm-build git-archive-all dnf-plugins-core ccache', + 'pkg_src_base="$(rpm -q --queryformat=\'%{NAME}-%{VERSION}\n\' --specfile SPECS/oxenmq.spec | head -n 1)"', + 'git-archive-all --prefix $pkg_src_base/ SOURCES/$pkg_src_base.src.tar.gz', + dnf(rpmarch) + 'builddep --spec SPECS/oxenmq.spec', + 'if [ -n "$CCACHE_DIR" ]; then mkdir -pv ~/.cache; ln -sv "$CCACHE_DIR" ~/.cache/ccache; fi', + 'rpmbuild --define "_topdir $(pwd)" -bb SPECS/oxenmq.spec', + './SPECS/ci-upload.sh ' + distro + ' ' + rpmarch, + ], } ] }; [ - debian_pipeline("Ubuntu focal (amd64)", "ubuntu:focal"), - debian_pipeline("Ubuntu bionic (amd64)", "ubuntu:bionic", deps='libsodium-dev g++-8', - cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8'), - debian_pipeline("Debian sid (amd64)", "debian:sid"), - debian_pipeline("Debian sid/Debug (amd64)", "debian:sid", build_type='Debug'), - debian_pipeline("Debian sid/clang-11 (amd64)", "debian:sid", deps='clang-11 lld-11 libsodium-dev libzmq3-dev', - cmake_extra='-DCMAKE_C_COMPILER=clang-11 -DCMAKE_CXX_COMPILER=clang++-11 ' + std.join(' ', [ - '-DCMAKE_'+type+'_LINKER_FLAGS=-fuse-ld=lld-11' for type in ['EXE','MODULE','SHARED','STATIC']])), - debian_pipeline("Debian buster (amd64)", "debian:buster"), - debian_pipeline("Debian buster (i386)", "i386/debian:buster"), - debian_pipeline("Ubuntu bionic (ARM64)", "ubuntu:bionic", arch="arm64", deps='libsodium-dev g++-8', - cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8'), - debian_pipeline("Debian sid (ARM64)", "debian:sid", arch="arm64"), - debian_pipeline("Debian buster (armhf)", "arm32v7/debian:buster", arch="arm64"), - { - kind: 'pipeline', - type: 'exec', - name: 'macOS (Catalina w/macports)', - platform: { os: 'darwin', arch: 'amd64' }, - environment: { CLICOLOR_FORCE: '1' }, // Lets color through ninja (1.9+) - steps: [ - { - name: 'build', - commands: [ - 'git submodule update --init --recursive', - 'mkdir build', - 'cd build', - 'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fcolor-diagnostics -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache', - 'ninja -v', - './tests/tests --use-colour yes' - ], - } - ] - }, + rpm_pipeline(distro_docker), + rpm_pipeline("arm64v8/" + distro_docker, buildarch='arm64', rpmarch="aarch64", jobs=4) ] diff --git a/.gitignore b/.gitignore index cfb8544..8d31c62 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ /build* +/BUILD +/RPMS +/SOURCES/*.tar.gz /compile_commands.json /obj-*-linux-gnu/ diff --git a/SOURCES/fully-version-library.patch b/SOURCES/fully-version-library.patch new file mode 100644 index 0000000..edabb22 --- /dev/null +++ b/SOURCES/fully-version-library.patch @@ -0,0 +1,21 @@ +From: Jason Rhinelander +Date: Sat, 28 Mar 2020 12:22:07 -0300 +Subject: Fully version library + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 68926f8..51f5fc2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -24,7 +24,7 @@ include(GNUInstallDirs) + + message(STATUS "oxenmq v${PROJECT_VERSION}") + +-set(OXENMQ_LIBVERSION 0) ++set(OXENMQ_LIBVERSION ${PROJECT_VERSION}) + + + if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) diff --git a/SPECS/ci-upload.sh b/SPECS/ci-upload.sh new file mode 100755 index 0000000..dec261c --- /dev/null +++ b/SPECS/ci-upload.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Script used with Drone CI to upload build artifacts (because specifying all this in +# .drone.jsonnet is too painful). + + + +set -o errexit + +if [ -z "$SSH_KEY" ]; then + echo -e "\n\n\n\e[31;1mUnable to upload artifact: SSH_KEY not set\e[0m" + # Just warn but don't fail, so that this doesn't trigger a build failure for untrusted builds + exit 0 +fi + +echo "$SSH_KEY" >ssh_key + +set -o xtrace # Don't start tracing until *after* we write the ssh key + +chmod 600 ssh_key + +distro="${1:-unknown}" +rpmarch="${2:-x86_64}" + +base="rpm-$distro-$(date --date=@$DRONE_BUILD_CREATED +%Y%m%dT%H%M%SZ)-${DRONE_COMMIT:0:9}" + +br="${DRONE_BRANCH// /_}" +br="${br//\//-}" +upload_to="builds.lokinet.dev/${DRONE_REPO// /_}/$br/$base" + +put= +for rpm in RPMS/${rpmarch}/*.rpm; do + put+=$'\n'"put $rpm $upload_to" + + echo -e "\n\n\e[35;1m$rpm contents:\e[0m" + rpm --query --list $rpm +done + +# sftp doesn't have any equivalent to mkdir -p, so we have to split the above up into a chain of +# -mkdir a/, -mkdir a/b/, -mkdir a/b/c/, ... commands. The leading `-` allows the command to fail +# without error. +upload_dirs=(${upload_to//\// }) +mkdirs= +dir_tmp="" +for p in "${upload_dirs[@]}"; do + dir_tmp="$dir_tmp$p/" + mkdirs="$mkdirs +-mkdir $dir_tmp" +done + +sftp -i ssh_key -b - -o StrictHostKeyChecking=off drone@builds.lokinet.dev < - 1.2.6-2 +- Split oxenmq into lib and devel package +- Versioned the library, as we do for debs +- Updated various package descriptions and build commands + +* Thu Jul 22 2021 Technical Tumbleweed (necro_nemesis@hotmail.com) oxenmq +-First oxenmq RPM +-Second build update to v1.2.6