sys-fs/bcachefs-tools: add support out-of-tree module compile
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
This commit is contained in:
parent
45a554f6f6
commit
cfbb3c69fc
@ -1,4 +1,4 @@
|
|||||||
masters = gentoo
|
masters = guru gentoo
|
||||||
thin-manifests = true
|
thin-manifests = true
|
||||||
sign-manifests = false
|
sign-manifests = false
|
||||||
# Needed for profiles parent with repo syntax
|
# Needed for profiles parent with repo syntax
|
||||||
|
|||||||
@ -86,15 +86,14 @@ CRATES="
|
|||||||
zeroize@1.8.1
|
zeroize@1.8.1
|
||||||
zeroize_derive@1.4.2
|
zeroize_derive@1.4.2
|
||||||
"
|
"
|
||||||
|
MODULES_OPTIONAL_IUSE="modules"
|
||||||
|
MODULE_S="module/src/${PN%-*}-${PV}"
|
||||||
LLVM_COMPAT=( {17..20} )
|
LLVM_COMPAT=( {17..20} )
|
||||||
PYTHON_COMPAT=( python3_{11..14} )
|
PYTHON_COMPAT=( python3_{11..14} )
|
||||||
RUST_MIN_VER="1.77.0"
|
RUST_MIN_VER="1.77.0"
|
||||||
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kentoverstreet.asc
|
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kentoverstreet.asc
|
||||||
|
|
||||||
MODULES_OPTIONAL_IUSE="modules"
|
inherit cargo flag-o-matic linux-mod-r1 llvm-r1 python-any-r1 shell-completion toolchain-funcs unpacker verify-sig
|
||||||
|
|
||||||
inherit cargo flag-o-matic llvm-r1 python-any-r1 shell-completion toolchain-funcs unpacker verify-sig linux-mod-r1
|
|
||||||
|
|
||||||
DESCRIPTION="Tools for bcachefs"
|
DESCRIPTION="Tools for bcachefs"
|
||||||
HOMEPAGE="https://bcachefs.org/"
|
HOMEPAGE="https://bcachefs.org/"
|
||||||
@ -114,7 +113,7 @@ LICENSE="GPL-2"
|
|||||||
# Dependent crate licenses
|
# Dependent crate licenses
|
||||||
LICENSE+=" Apache-2.0 BSD ISC MIT Unicode-DFS-2016"
|
LICENSE+=" Apache-2.0 BSD ISC MIT Unicode-DFS-2016"
|
||||||
SLOT="0"
|
SLOT="0"
|
||||||
IUSE="fuse verify-sig module-src"
|
IUSE="fuse verify-sig"
|
||||||
RESTRICT="test"
|
RESTRICT="test"
|
||||||
|
|
||||||
DEPEND="
|
DEPEND="
|
||||||
@ -157,10 +156,7 @@ pkg_setup() {
|
|||||||
rust_pkg_setup
|
rust_pkg_setup
|
||||||
llvm-r1_pkg_setup
|
llvm-r1_pkg_setup
|
||||||
python-any-r1_pkg_setup
|
python-any-r1_pkg_setup
|
||||||
|
use modules && linux-mod-r1_pkg_setup
|
||||||
if use modules; then
|
|
||||||
linux-mod-r1_pkg_setup
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
src_unpack() {
|
src_unpack() {
|
||||||
@ -192,6 +188,9 @@ src_prepare() {
|
|||||||
-e '/^CFLAGS/s:-g::' \
|
-e '/^CFLAGS/s:-g::' \
|
||||||
-i Makefile || die
|
-i Makefile || die
|
||||||
append-lfs-flags
|
append-lfs-flags
|
||||||
|
|
||||||
|
use modules && emake DESTDIR="${WORKDIR}" PREFIX="/module" install_dkms && \
|
||||||
|
sed -i 's/^ /\t/g' "${WORKDIR}/${MODULE_S}/Makefile" || die
|
||||||
}
|
}
|
||||||
|
|
||||||
src_compile() {
|
src_compile() {
|
||||||
@ -211,20 +210,11 @@ src_compile() {
|
|||||||
./bcachefs completions ${shell} > ${shell}.completion || die
|
./bcachefs completions ${shell} > ${shell}.completion || die
|
||||||
done
|
done
|
||||||
|
|
||||||
local modlist=( "bcachefs=:libbcachefs::bcachefs.ko" )
|
local modlist=( "bcachefs=:../${MODULE_S}::default" )
|
||||||
linux-mod-r1_src_compile
|
use modules && linux-mod-r1_src_compile
|
||||||
|
|
||||||
local modlist=( bcachefs=kernel/drivers/fs:libbcachefs::module )
|
|
||||||
local modargs=(
|
|
||||||
KERNELDIR=${KV_OUT_DIR}
|
|
||||||
)
|
|
||||||
use modules && linux-mod-r1_src_compile
|
|
||||||
}
|
}
|
||||||
|
|
||||||
src_install() {
|
src_install() {
|
||||||
use modules && linux-mod-r1_src_install
|
|
||||||
use module-src && emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install_dkms
|
|
||||||
|
|
||||||
into /
|
into /
|
||||||
dosbin bcachefs
|
dosbin bcachefs
|
||||||
|
|
||||||
@ -238,6 +228,8 @@ src_install() {
|
|||||||
dosym bcachefs /sbin/mount.fuse.bcachefs
|
dosym bcachefs /sbin/mount.fuse.bcachefs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
use modules && linux-mod-r1_src_install
|
||||||
|
|
||||||
newbashcomp bash.completion bcachefs
|
newbashcomp bash.completion bcachefs
|
||||||
newfishcomp fish.completion bcachefs.fish
|
newfishcomp fish.completion bcachefs.fish
|
||||||
newzshcomp zsh.completion _bcachefs
|
newzshcomp zsh.completion _bcachefs
|
||||||
@ -252,43 +244,5 @@ pkg_postinst() {
|
|||||||
ewarn "You have been warned."
|
ewarn "You have been warned."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if use module-src && ! use module; then
|
use modules && linux-mod-r1_pkg_postinst
|
||||||
einfo
|
|
||||||
einfo "You have enabled the module-src USE flag without the module USE"
|
|
||||||
einfo "flag. This means that sources are installed to"
|
|
||||||
einfo "${ROOT}/usr/src/bcachefs-${PV} instead of having the"
|
|
||||||
einfo "kernel module compiled. You will need to compile the module"
|
|
||||||
einfo "yourself or use dkms. Most likely, you don't want this USE flag, and should"
|
|
||||||
einfo "rather use USE=module"
|
|
||||||
einfo
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use modules; then
|
|
||||||
linux-mod-r1_pkg_postinst
|
|
||||||
local old new
|
|
||||||
if [[ $(uname -r) != "${KV_FULL}" ]]; then
|
|
||||||
ewarn
|
|
||||||
ewarn "You have just built bcachefs for kernel ${KV_FULL}, yet the currently running"
|
|
||||||
ewarn "kernel is $(uname -r). If you intend to use this bcachefs module on the currently"
|
|
||||||
ewarn "running machine, you will first need to reboot it into the kernel ${KV_FULL}, for"
|
|
||||||
ewarn "which this module was built."
|
|
||||||
ewarn
|
|
||||||
elif [[ -f /sys/module/bcachefs/version ]] && \
|
|
||||||
old="$(< /sys/module/bcachefs/version)" && \
|
|
||||||
new="$(modinfo -F version "${ROOT}/lib/modules/${KV_FULL}/net/bcachefs.ko" 2>/dev/null)" && \
|
|
||||||
[[ $old != "$new" ]]; then
|
|
||||||
ewarn
|
|
||||||
ewarn "You appear to have just upgraded bcachefs from version v$old to v$new."
|
|
||||||
ewarn "However, the old version is still running on your system. In order to use the"
|
|
||||||
ewarn "new version, you will need to remove the old module and load the new one. As"
|
|
||||||
ewarn "root, you can accomplish this with the following commands:"
|
|
||||||
ewarn
|
|
||||||
ewarn " # rmmod bcachefs"
|
|
||||||
ewarn " # modprobe bcachefs"
|
|
||||||
ewarn
|
|
||||||
ewarn "Do note that doing this will remove currently mounted bcachefs filesystems, so you may want"
|
|
||||||
ewarn "to gracefully remove them yourself prior."
|
|
||||||
ewarn
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user