diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b1251704d..78ae0cad70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,6 +89,7 @@ jobs: - name: build run: | scripts/build.sh -m muon + build-make-static: name: make static runs-on: ubuntu-latest @@ -99,3 +100,14 @@ jobs: - name: build run: | make static + + build-distro: + name: build libnvme and nvme-cli separately + runs-on: ubuntu-latest + container: + image: ghcr.io/igaw/linux-nvme/debian:latest + steps: + - uses: actions/checkout@v4 + - name: build + run: | + scripts/build.sh distro diff --git a/scripts/build.sh b/scripts/build.sh index 470f39a885..be907a5af7 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -21,6 +21,7 @@ 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 "" echo "configs with muon:" echo " [default] minimal static build" @@ -205,6 +206,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