commit:     a39e1b86cf935e9015b67af6b4ebef3ae68e40c8
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 12 18:05:29 2024 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue Nov 12 18:21:47 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a39e1b86

sys-kernel/dracut: use cargo.eclass

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 sys-kernel/dracut/dracut-9999.ebuild | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/sys-kernel/dracut/dracut-9999.ebuild 
b/sys-kernel/dracut/dracut-9999.ebuild
index 81b6b6982597..40da9319cb51 100644
--- a/sys-kernel/dracut/dracut-9999.ebuild
+++ b/sys-kernel/dracut/dracut-9999.ebuild
@@ -2,9 +2,9 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
-RUST_OPTIONAL=1
+CARGO_OPTIONAL=1
 
-inherit flag-o-matic bash-completion-r1 edo optfeature rust systemd 
toolchain-funcs
+inherit cargo flag-o-matic bash-completion-r1 edo optfeature systemd 
toolchain-funcs
 
 if [[ ${PV} == 9999 ]] ; then
        inherit git-r3
@@ -51,7 +51,6 @@ RDEPEND="
 "
 DEPEND="
        >=sys-apps/kmod-23
-       dracut-cpio? ( ${RUST_DEPEND} )
        elibc_musl? ( sys-libs/fts-standalone )
 "
 
@@ -61,6 +60,7 @@ BDEPEND="
        >=app-text/docbook-xsl-stylesheets-1.75.2
        >=dev-libs/libxslt-1.1.26
        virtual/pkgconfig
+       dracut-cpio? ( ${RUST_DEPEND} )
        test? (
                net-nds/rpcbind
                net-fs/nfs-utils
@@ -113,7 +113,7 @@ src_configure() {
                --sysconfdir="${EPREFIX}/etc"
                --bashcompletiondir="$(get_bashcompdir)"
                --systemdsystemunitdir="$(systemd_get_systemunitdir)"
-               $(use_enable dracut-cpio)
+               --disable-dracut-cpio
        )
 
        # this emulates what the build system would be doing without us
@@ -122,6 +122,19 @@ src_configure() {
        tc-export CC PKG_CONFIG
 
        edo ./configure "${myconf[@]}"
+       if use dracut-cpio; then
+               cargo_gen_config
+               cargo_src_configure
+       fi
+}
+
+src_compile() {
+       default
+       if use dracut-cpio; then
+               pushd src/dracut-cpio >/dev/null || die
+               cargo_src_compile
+               popd >/dev/null || die
+       fi
 }
 
 src_test() {
@@ -149,6 +162,10 @@ src_install() {
                README.md
        )
        default
+       if use dracut-cpio; then
+               exeinto /usr/lib/dracut
+               doexe "src/dracut-cpio/$(cargo_target_dir)/dracut-cpio"
+       fi
 }
 
 pkg_preinst() {

Reply via email to