summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/build.sh182
-rwxr-xr-xscripts/kernel-doc (renamed from doc/kernel-doc)0
-rwxr-xr-x[-rw-r--r--]scripts/kernel-doc-check (renamed from doc/kernel-doc-check)0
-rwxr-xr-xscripts/list-man-pages.sh (renamed from doc/list-man-pages.sh)0
-rwxr-xr-xscripts/list-pre-compiled.sh (renamed from doc/list-pre-compiled.sh)0
-rwxr-xr-xscripts/meson-vcs-tag.sh (renamed from meson-vcs-tag.sh)0
-rwxr-xr-xscripts/release.sh (renamed from release.sh)69
-rwxr-xr-xscripts/update-docs.sh49
8 files changed, 286 insertions, 14 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100755
index 0000000..82d271b
--- /dev/null
+++ b/scripts/build.sh
@@ -0,0 +1,182 @@
+#!/bin/bash
+
+usage() {
+ echo "Usage: build.sh [-b [release|debug]] "
+ echo " [-c [gcc|clang]]"
+ echo " [-m [meson|muon]"
+ echo " [config]"
+ echo ""
+ echo "CI build script."
+ echo ""
+ echo " -b [release]|debug build type"
+ echo " -c [gcc]|clang compiler to use"
+ echo " -m [meson]|muon use meson or muon"
+ echo " -t [armhf]|ppc64le|s390x cross compile target"
+ echo ""
+ echo "configs with meson:"
+ echo " [default] default settings"
+ echo " libdbus build with libdbus"
+ echo " fallback download all dependencies"
+ echo " and build them as shared libaries"
+ echo " cross use cross toolchain to build"
+ echo ""
+ echo "configs with muon:"
+ echo " [default] minimal static build"
+}
+
+BUILDTOOL=meson
+MESON=meson
+BUILDTYPE=release
+CROSS_TARGET=armhf
+CC=${CC:-"gcc"}
+
+while getopts "b:c:m:t:" o; do
+ case "${o}" in
+ b)
+ BUILDTYPE="${OPTARG}"
+ ;;
+ c)
+ CC="${OPTARG}"
+ ;;
+ m)
+ BUILDTOOL="${OPTARG}"
+ ;;
+ t)
+ CROSS_TARGET="${OPTARG}"
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+CONFIG=${1:-"default"}
+
+cd "$(git rev-parse --show-toplevel)" || exit 1
+
+BUILDDIR="$(pwd)/.build-ci"
+
+config_meson_default() {
+ CC="${CC}" "${MESON}" setup \
+ --werror \
+ --buildtype="${BUILDTYPE}" \
+ "${BUILDDIR}"
+}
+
+config_meson_libdbus() {
+ CC="${CC}" "${MESON}" setup \
+ --werror \
+ --buildtype="${BUILDTYPE}" \
+ -Dlibdbus=enabled \
+ --prefix=/ \
+ "${BUILDDIR}"
+}
+
+config_meson_fallback() {
+ CC="${CC}" "${MESON}" setup \
+ --werror \
+ --buildtype="${BUILDTYPE}" \
+ --wrap-mode=forcefallback \
+ -Dlibdbus=enabled \
+ -Ddbus:werror=false \
+ -Dopenssl:werror=false \
+ "${BUILDDIR}"
+}
+
+config_meson_cross() {
+ CC="${CC}" "${MESON}" setup \
+ --werror \
+ --buildtype="${BUILDTYPE}" \
+ --cross-file=.github/cross/ubuntu-cross-"${CROSS_TARGET}".txt \
+ -Dpython=disabled \
+ -Dopenssl=disabled \
+ "${BUILDDIR}"
+}
+
+build_meson() {
+ "${MESON}" compile \
+ -C "${BUILDDIR}"
+}
+
+test_meson() {
+ "${MESON}" test \
+ -C "${BUILDDIR}"
+}
+
+tools_build_samurai() {
+ mkdir -p "${BUILDDIR}"/build-tools
+ git clone --depth 1 https://github.com/michaelforney/samurai.git \
+ "${BUILDDIR}/build-tools/samurai"
+ pushd "${BUILDDIR}/build-tools/samurai" || exit 1
+
+ CC="${CC}" make
+ SAMU="${BUILDDIR}/build-tools/samurai/samu"
+
+ popd || exit 1
+}
+
+tools_build_muon() {
+ mkdir -p "${BUILDDIR}"/build-tools
+ git clone --depth 1 https://git.sr.ht/~lattis/muon \
+ "${BUILDDIR}/build-tools/muon"
+ pushd "${BUILDDIR}/build-tools/muon" || exit 1
+
+ CC="${CC}" ninja="${SAMU}" ./bootstrap.sh stage1
+
+ CC="${CC}" ninja="${SAMU}" stage1/muon setup \
+ -Dprefix="${BUILDDIR}/build-tools" \
+ -Dlibcurl=enabled \
+ -Dlibarchive=enabled \
+ -Dlibpkgconf=enabled \
+ -Ddocs=disabled \
+ -Dsamurai=disabled \
+ "${BUILDDIR}/build-tools/.build-muon"
+ "${SAMU}" -C "${BUILDDIR}/build-tools/.build-muon"
+ MUON="${BUILDDIR}/build-tools/.build-muon/muon"
+
+ # "${MUON}" -C "${BUILDDIR}/build-tools/.build-muon" test
+
+ popd || exit 1
+}
+
+config_muon_default() {
+ CC="${CC}" CFLAGS="${CFLAGS} -static" \
+ ninja="${SAMU}" "${MUON}" setup \
+ -Ddefault_library=static \
+ -Djson-c=disabled \
+ -Dopenssl=disabled \
+ -Dkeyutils=disabled \
+ -Dpython=disabled \
+ -Dpython=disabled \
+ "${BUILDDIR}"
+}
+
+build_muon() {
+ "${SAMU}" -C "${BUILDDIR}"
+}
+
+test_muon() {
+ ninja="${SAMU}" "${MUON}" -C "${BUILDDIR}" test
+}
+
+rm -rf "${BUILDDIR}"
+
+if [[ "${BUILDTOOL}" == "muon" ]]; then
+ if ! which samu ; then
+ tools_build_samurai
+ else
+ SAMU="$(which samu)"
+ fi
+
+ if ! which muon ; then
+ tools_build_muon
+ else
+ MUON="$(which muon)"
+ fi
+fi
+
+config_"${BUILDTOOL}"_"${CONFIG}"
+build_"${BUILDTOOL}"
+test_"${BUILDTOOL}"
diff --git a/doc/kernel-doc b/scripts/kernel-doc
index 4900c3a..4900c3a 100755
--- a/doc/kernel-doc
+++ b/scripts/kernel-doc
diff --git a/doc/kernel-doc-check b/scripts/kernel-doc-check
index 23887d0..23887d0 100644..100755
--- a/doc/kernel-doc-check
+++ b/scripts/kernel-doc-check
diff --git a/doc/list-man-pages.sh b/scripts/list-man-pages.sh
index 3acdf7a..3acdf7a 100755
--- a/doc/list-man-pages.sh
+++ b/scripts/list-man-pages.sh
diff --git a/doc/list-pre-compiled.sh b/scripts/list-pre-compiled.sh
index c31caf9..c31caf9 100755
--- a/doc/list-pre-compiled.sh
+++ b/scripts/list-pre-compiled.sh
diff --git a/meson-vcs-tag.sh b/scripts/meson-vcs-tag.sh
index 8ce6924..8ce6924 100755
--- a/meson-vcs-tag.sh
+++ b/scripts/meson-vcs-tag.sh
diff --git a/release.sh b/scripts/release.sh
index 320da46..dad3f25 100755
--- a/release.sh
+++ b/scripts/release.sh
@@ -6,6 +6,7 @@ usage() {
echo "The script does all necessary steps to create a new release."
echo ""
echo " -d: no documentation update"
+ echo " -n: dry run"
echo ""
echo "Note: The version number needs to be exactly"
echo " '^v[\d]+.[\d]+(.[\d\]+(-rc[0-9]+)?$'"
@@ -16,12 +17,16 @@ usage() {
}
build_doc=true
+dry_run=false
-while getopts "d" o; do
+while getopts "dn" o; do
case "${o}" in
d)
build_doc=false
;;
+ n)
+ dry_run=true
+ ;;
*)
usage
;;
@@ -36,21 +41,45 @@ if [ -z "$VERSION" ] ; then
exit 1
fi
-ver=""
-
+# expected version regex
re='^v([0-9]+\.[0-9]+(\.[0-9]+)?)(-rc[0-9]+)?$'
-if [[ "$VERSION" =~ $re ]]; then
- echo "Valid version $VERSION string"
+
+# use the version string provided from the command line
+if [[ "$VERSION" =~ ${re} ]]; then
+ echo "valid version $VERSION string"
+
# remove the leading 'v'
- ver=${VERSION#v}
+ ver="${VERSION#v}"
else
- echo "Invalid version string $VERSION"
+ echo "invalid version string $VERSION"
exit 1
fi
+cd "$(git rev-parse --show-toplevel)" || exit 1
+
+if [[ -f subprojects/libnvme.wrap ]]; then
+ git -C subprojects/libnvme fetch --all
+
+ # extract the vesion string from libnvme by using the ref
+ # defined in libnvme.wrap.
+ libnvme_ref=$(sed -n "s/revision = \([0-9a-z]\+\)/\1/p" subprojects/libnvme.wrap)
+ libnvme_VERSION=$(git -C subprojects/libnvme describe "${libnvme_ref}")
+ if [[ "${libnvme_VERSION}" =~ ${re} ]]; then
+ echo "libnvme: valid version ${libnvme_VERSION} string"
+
+ # remove the leading 'v'
+ libnvme_ver="${libnvme_VERSION#v}"
+ else
+ echo "libnvme: invalid version string ${libnvme_VERSION}"
+ exit 1
+ fi
+fi
+
if [[ -n $(git status -s) ]]; then
- echo "tree is dirty. abort."
- exit 1
+ echo "tree is dirty."
+ if [[ "${dry_run}" = false ]]; then
+ exit 1
+ fi
fi
if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ] ; then
@@ -71,14 +100,26 @@ fi
# update meson.build
sed -i -e "0,/[ \t]version: /s/\([ \t]version: \).*/\1\'$ver\',/" meson.build
-git add meson.build
-git commit -s -m "build: Update version to $VERSION"
+if [[ -f subprojects/libnvme.wrap ]]; then
+ sed -i -e "s/\(dependency('libnvme', version: '>=\)\([\.1-9]\+\)/\1$libnvme_ver/" meson.build
+fi
+
+if [[ "${dry_run}" = false ]]; then
+ git add meson.build
+ git commit -s -m "build: Update version to $VERSION"
+fi
if [ "$build_doc" = true ]; then
# update documentation
- ./$doc_dir/update-docs.sh
- git add $doc_dir
- git commit -s -m "doc: Regenerate all docs for $VERSION"
+ ./scripts/update-docs.sh
+ if [[ "${dry_run}" = false ]]; then
+ git add $doc_dir
+ git commit -s -m "doc: Regenerate all docs for $VERSION"
+ fi
+fi
+
+if [[ "${dry_run}" = true ]]; then
+ exit 0
fi
git tag -s -m "Release $VERSION" "$VERSION"
diff --git a/scripts/update-docs.sh b/scripts/update-docs.sh
new file mode 100755
index 0000000..34d181e
--- /dev/null
+++ b/scripts/update-docs.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+cd "$(git rev-parse --show-toplevel)" || exit 1
+
+# build man docs
+BUILDDIR="$(mktemp -d)"
+echo "${BUILDDIR}"
+trap 'rm -rf -- ${BUILDDIR}' EXIT
+
+meson setup \
+ -Ddocs=man \
+ -Ddocs-build=true \
+ "${BUILDDIR}"
+meson compile \
+ -C "${BUILDDIR}"
+
+rm -rf doc/man
+mkdir doc/man
+
+find "${BUILDDIR}/doc" -maxdepth 1 -name '*.2' -exec cp {} doc/man \;
+
+# build ReST docs
+rm -rf -- "${BUILDDIR}"
+BUILDDIR="$(mktemp -d)"
+echo "${BUILDDIR}"
+trap 'rm -rf -- ${BUILDDIR}' EXIT
+
+meson setup \
+ -Ddocs=rst \
+ -Ddocs-build=true \
+ "${BUILDDIR}"
+meson compile \
+ -C "${BUILDDIR}"
+
+rm -rf doc/rst/*.rst
+mkdir -p doc/rst
+
+find "${BUILDDIR}/doc/rst" -maxdepth 1 -name '*.rst' -exec cp {} doc/rst \;
+
+cp "${BUILDDIR}/doc/conf.py" doc
+cp "${BUILDDIR}/doc/index.rst" doc
+cp "${BUILDDIR}/doc/config-schema.json" doc
+
+# build html docs
+# The HTML doc is not ready yet
+# rm -rf $DESTDIR/doc/html
+# cp -R $BUILDDIR/doc/html $DESTDIR/doc/
+