Skip to content

Commit 67abaaa

Browse files
committed
build: separate builds of libnvme and nvme-cli
Build and install libnvme separately from libnvme. This should catch any attempts to include private headers from the library. Also this is what distro usually do, so we should test this as well. Signed-off-by: Daniel Wagner <dwagner@suse.de>
1 parent a300938 commit 67abaaa

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.github/workflows/build.yml

+12
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jobs:
8989
- name: build
9090
run: |
9191
scripts/build.sh -m muon
92+
9293
build-make-static:
9394
name: make static
9495
runs-on: ubuntu-latest
@@ -99,3 +100,14 @@ jobs:
99100
- name: build
100101
run: |
101102
make static
103+
104+
build-distro:
105+
name: build libnvme and nvme-cli separately
106+
runs-on: ubuntu-latest
107+
container:
108+
image: ghcr.io/igaw/linux-nvme/debian:latest
109+
steps:
110+
- uses: actions/checkout@v4
111+
- name: build
112+
run: |
113+
scripts/build.sh distro

scripts/build.sh

+46
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ usage() {
2121
echo " cross use cross toolchain to build"
2222
echo " coverage build coverage report"
2323
echo " appimage build AppImage target"
24+
echo " distro build libnvme and nvme-cli separately"
2425
echo ""
2526
echo "configs with muon:"
2627
echo " [default] minimal static build"
@@ -205,6 +206,51 @@ test_muon() {
205206
ldd "${BUILDDIR}/nvme" 2>&1 | grep 'not a dynamic executable' || exit 1
206207
}
207208

209+
_install_libnvme() {
210+
local libnvme_ref=$(sed -n "s/revision = \([0-9a-z]\+\)/\1/p" subprojects/libnvme.wrap)
211+
local LBUILDDIR="${BUILDDIR}/.build-libnvme"
212+
213+
mkdir -p "${BUILDDIR}/libnvme"
214+
215+
pushd "${BUILDDIR}/libnvme"
216+
git init
217+
git remote add origin https://github.com/linux-nvme/libnvme.git
218+
git fetch origin ${libnvme_ref}
219+
git reset --hard FETCH_HEAD
220+
221+
CC="${CC}" "${MESON}" setup \
222+
--prefix="${BUILDDIR}/usr" \
223+
--buildtype="${BUILDTYPE}" \
224+
"${LBUILDDIR}"
225+
226+
"${MESON}" compile \
227+
-C "${LBUILDDIR}"
228+
229+
"${MESON}" install \
230+
-C "${LBUILDDIR}"
231+
232+
popd || exit 1
233+
}
234+
235+
config_meson_distro() {
236+
_install_libnvme
237+
238+
PKG_CONFIG_PATH="${BUILDDIR}/usr/lib64/pkgconfig" \
239+
CC="${CC}" ${MESON} setup \
240+
--prefix="${BUILDDIR}/usr" \
241+
--werror \
242+
--buildtype="${BUILDTYPE}" \
243+
"${BUILDDIR}"
244+
}
245+
246+
build_meson_distro() {
247+
build_meson
248+
}
249+
250+
test_meson_distro() {
251+
test_meson
252+
}
253+
208254
if [[ "${BUILDTOOL}" == "muon" ]]; then
209255
SAMU="$(which samu 2> /dev/null)" || true
210256
if [[ -z "${SAMU}" ]]; then

0 commit comments

Comments
 (0)