diff options
Diffstat (limited to '')
-rwxr-xr-x | scripts/build.sh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index 470f39a..a88336f 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -21,6 +21,9 @@ usage() { echo " cross use cross toolchain to build" echo " coverage build coverage report" echo " appimage build AppImage target" + echo " distro build libnvme and nvme-cli separately" + echo " docs build documentation" + echo " static build a static binary" echo "" echo "configs with muon:" echo " [default] minimal static build" @@ -115,6 +118,25 @@ config_meson_appimage() { "${BUILDDIR}" } +config_meson_docs() { + CC="${CC}" "${MESON}" setup \ + -Ddocs=all \ + -Ddocs-build=true \ + --force-fallback-for=libnvme \ + -Dlibnvme:werror=false \ + "${BUILDDIR}" +} + +config_meson_static() { + CC="${CC}" "${MESON}" setup \ + --buildtype=release \ + --default-library=static \ + --wrap-mode=forcefallback \ + -Dc_link_args="-static" \ + -Dlibnvme:keyutils=disabled \ + "${BUILDDIR}" +} + build_meson() { "${MESON}" compile \ -C "${BUILDDIR}" @@ -205,6 +227,51 @@ test_muon() { ldd "${BUILDDIR}/nvme" 2>&1 | grep 'not a dynamic executable' || exit 1 } +_install_libnvme() { + local libnvme_ref=$(sed -n "s/revision = \([0-9a-z]\+\)/\1/p" subprojects/libnvme.wrap) + local LBUILDDIR="${BUILDDIR}/.build-libnvme" + + mkdir -p "${BUILDDIR}/libnvme" + + pushd "${BUILDDIR}/libnvme" + git init + git remote add origin https://github.com/linux-nvme/libnvme.git + git fetch origin ${libnvme_ref} + git reset --hard FETCH_HEAD + + CC="${CC}" "${MESON}" setup \ + --prefix="${BUILDDIR}/usr" \ + --buildtype="${BUILDTYPE}" \ + "${LBUILDDIR}" + + "${MESON}" compile \ + -C "${LBUILDDIR}" + + "${MESON}" install \ + -C "${LBUILDDIR}" + + popd || exit 1 +} + +config_meson_distro() { + _install_libnvme + + PKG_CONFIG_PATH="${BUILDDIR}/usr/lib64/pkgconfig" \ + CC="${CC}" ${MESON} setup \ + --prefix="${BUILDDIR}/usr" \ + --werror \ + --buildtype="${BUILDTYPE}" \ + "${BUILDDIR}" +} + +build_meson_distro() { + build_meson +} + +test_meson_distro() { + test_meson +} + if [[ "${BUILDTOOL}" == "muon" ]]; then SAMU="$(which samu 2> /dev/null)" || true if [[ -z "${SAMU}" ]]; then |