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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
run: |
dnf config-manager --set-enabled crb
dnf install -y epel-release
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
name: bsl-rpm
- name: Install
Expand Down
9 changes: 5 additions & 4 deletions bsl.spec
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ from the API with Doxygen.
%prep
%setup -q

./build.sh deps

%build
# non-package dependencies into ./testroot
DESTDIR=${PWD}/testroot ./build.sh deps

%cmake -DCMAKE_PREFIX_PATH=${PWD}/testroot/usr \
-DPROJECT_VERSION=%{version} \
-DBUILD_UNITTEST=YES -DTEST_MEMCHECK=NO -DBUILD_COVERAGE=NO \
-DBUILD_DOCS_MAN=YES %{?with_apidoc:-DBUILD_DOCS_API=YES}
-DBUILD_DOCS_MAN=YES -DBUILD_DOCS_API=%{?with_apidoc:YES}%{!?with_apidoc:NO}


%build
%cmake_build
%cmake_build --target docs-man
%if %{with apidoc}
Expand Down
31 changes: 15 additions & 16 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
set -e
set -o pipefail

source setenv.sh
export SELFDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))

source ${SELFDIR}/setenv.sh
BUILDDIR=${SELFDIR}/build/default

function usage {
Expand All @@ -51,15 +52,15 @@ function usage {
}

function cmd_check_format {
./resources/check_format.sh
exec ./resources/check_format.sh
}

function cmd_apply_format {
./resources/apply_format.sh
exec ./resources/apply_format.sh
}

function cmd_apply_license {
./resources/apply_license.sh
exec ./resources/apply_license.sh
}

function cmd_check {
Expand Down Expand Up @@ -90,7 +91,7 @@ function cmd_coverage_summary {
}

function cmd_deps {
./resources/deps.sh
exec ./resources/deps.sh
}

function cmd_docs {
Expand All @@ -108,13 +109,20 @@ function cmd_lint {

function cmd_prep {
shift
./resources/prep.sh "$@"
exec ./resources/prep.sh "$@"
}

function cmd_rpm_build {
if ! git describe 2>/dev/null >/dev/null
then
git config --global --add safe.directory ${PWD}
for NAME in ${PWD}/deps/*
do
if [[ -d ${NAME} ]]
then
git config --global --add safe.directory ${NAME}
fi
done
fi
tito build -o build/default/pkg --test --srpm
tito build -o build/default/pkg --test --rpm
Expand Down Expand Up @@ -157,17 +165,8 @@ function cmd_rpm_container {
}

function cmd_run {
# testroot installed files
DESTDIR=${DESTDIR:-${SELFDIR}/testroot}
PREFIX=${PREFIX:-/usr}

if [ -n "${DESTDIR}" -o -n "${PREFIX}" ]
then
export LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib:${DESTDIR}${PREFIX}/lib64
export PATH=${PATH}:${DESTDIR}${PREFIX}/bin
fi

shift
# Environment is already set by setenv.sh
exec $@
}

Expand Down
21 changes: 11 additions & 10 deletions pkg/rpmbuild.Containerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM quay.io/centos/centos:stream9

RUN dnf config-manager --set-enabled crb
RUN --mount=type=cache,target=/var/cache/yum dnf install -y epel-release
# Dependencies for library, test executables, bsl-mock-bpa, and apidoc HTML
RUN --mount=type=cache,target=/var/cache/yum dnf install -y \
rsync cmake git ninja-build gcc ruby \
openssl-devel jansson-devel \
doxygen graphviz plantuml texlive-bibtex \
asciidoctor \
rpm-build rpmlint
RUN --mount=type=cache,target=/var/cache/yum \
dnf install -y epel-release
# Dependencies for general RPM building
RUN --mount=type=cache,target=/var/cache/yum \
dnf install -y git rsync tito rpm-build rpmlint

RUN mkdir -p /usr/local/src/bsl
COPY bsl.spec /usr/local/src/bsl/
WORKDIR /usr/local/src/bsl
CMD ["sh", "-c", "./build.sh rpm-prep && ./build.sh rpm-build && ./build.sh rpm-check"]
RUN --mount=type=cache,target=/var/cache/yum \
dnf builddep -y bsl.spec

# Container will mount to /usr/local/src/bsl
CMD ["sh", "-c", "./build.sh rpm-build && ./build.sh rpm-check"]
7 changes: 2 additions & 5 deletions resources/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ then
fi
cd $SELFDIR

# SELFDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
source ${SELFDIR}/setenv.sh

DEPSDIR=${DEPSDIR:-${SELFDIR}/deps}
BUILDDIR=${BUILDDIR:-${SELFDIR}/deps/build}
echo "Building in ${BUILDDIR}"
Expand All @@ -52,7 +49,7 @@ then
cmake -S . -B ${BUILDDIR}/QCBOR \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=${DESTDIR}${PREFIX}
-DCMAKE_INSTALL_PREFIX=${PREFIX}
cmake --build ${BUILDDIR}/QCBOR
cmake --install ${BUILDDIR}/QCBOR
rm -rf ${BUILDDIR}/QCBOR
Expand Down Expand Up @@ -83,7 +80,7 @@ then
cmake -S . -B ${BUILDDIR}/unity \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_INSTALL_PREFIX=${DESTDIR}${PREFIX}
-DCMAKE_INSTALL_PREFIX=${PREFIX}
cmake --build ${BUILDDIR}/unity
cmake --install ${BUILDDIR}/unity
rm -rf ${BUILDDIR}/unity
Expand Down
4 changes: 1 addition & 3 deletions resources/prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ then
echo "SELFDIR not defined"
exit 1
fi

cd $SELFDIR
source ${SELFDIR}/setenv.sh

cmake -S . -B ${SELFDIR}/build/default \
-DCMAKE_PREFIX_PATH=${DESTDIR}${PREFIX} \
-DCMAKE_INSTALL_PREFIX=${DESTDIR}${PREFIX} \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_BUILD_TYPE=Debug \
-G Ninja \
"$@"
17 changes: 13 additions & 4 deletions setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,20 @@
##

SELFDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
DESTDIR=${DESTDIR:-${SELFDIR}/testroot}
PREFIX=${PREFIX:-/usr}

if [ -n "${DESTDIR}" -o -n "${PREFIX}" ]
export DESTDIR=${DESTDIR:-${SELFDIR}/testroot}
export PREFIX=${PREFIX:-/usr}

if [[ -n "${DESTDIR}" || -n "${PREFIX}" ]]
then
export LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib
if which dpkg-architecture >/dev/null 2>/dev/null
then
# Debian or Ubuntu
LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib:${DESTDIR}${PREFIX}/lib/$(dpkg-architecture -q DEB_BUILD_MULTIARCH)
else
# Fedora or RHEL
LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib:${DESTDIR}${PREFIX}/lib64
fi
export LD_LIBRARY_PATH
export PATH=${PATH}:${DESTDIR}${PREFIX}/bin
fi
Loading