# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 src_prepare() { default sed -i \ -e '/--enable-static is not supported by kmod/s:as_fn_error:echo:' \ configure || die "Failed to re-enable static support" # List of symbols which are clashing with (e)udev cat <<-EOF >> kmod.syms mkdir_p _kmod_mkdir_p mkdir_parents _kmod_mkdir_parents path_is_absolute _kmod_path_is_absolute path_make_absolute_cwd _kmod_path_make_absolute_cwd EOF } src_configure() { local myconf=( --enable-static --disable-manpages --disable-python --enable-tools --with-xz --with-zlib --with-zstd --without-openssl ) gkconf "${myconf[@]}" } src_install() { default # remove hardcoded $BROOT sed -i \ -e 's/-L\/[^ ]*/-L${libdir}/g' \ "${D}"/usr/lib*/pkgconfig/*.pc \ || die # rename internal symbols to avoid clashing with (e)udev $(tc-getOBJCOPY) \ --redefine-syms=kmod.syms \ "${D}"/usr/lib*/libkmod.a \ || die rm -rf \ "${D}"/usr/share/ "${STRIP}" --strip-all "${D}"/usr/bin/kmod \ || die "Failed to strip '${D}/usr/bin/kmod'!" mkdir "${D}"/bin || die "Failed to create '${D}/bin'!" mkdir "${D}"/sbin || die "Failed to create '${D}/sbin'!" # We need to install these links where busybox would create them local symlink_targets=() symlink_targets+=( /sbin/depmod ) symlink_targets+=( /sbin/insmod ) symlink_targets+=( /sbin/lsmod ) symlink_targets+=( /sbin/modinfo ) symlink_targets+=( /sbin/modprobe ) symlink_targets+=( /sbin/rmmod ) local symlink_target= for symlink_target in "${symlink_targets[@]}" do ln -s ../usr/bin/kmod "${D}${symlink_target}" \ || die "Failed to create symlink '${D}${symlink_target}' to '${D}/usr/bin/kmod'!" done }