Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add depmod -M option to replace kmod.pc #127

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES)
libkmod_libkmod_internal_la_LIBADD = $(libkmod_libkmod_la_LIBADD)

pkgconfig_DATA = libkmod/libkmod.pc
noarch_pkgconfig_DATA = tools/kmod.pc

bashcompletiondir=@bashcompletiondir@
dist_bashcompletion_DATA = \
Expand Down
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ AC_CONFIG_FILES([
libkmod/docs/Makefile
libkmod/docs/version.xml
libkmod/libkmod.pc
tools/kmod.pc
])


Expand Down
5 changes: 5 additions & 0 deletions libkmod/libkmod.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
sysconfdir=@sysconfdir@
distconfdir=@distconfdir@
module_directory=@module_directory@
module_signatures=@module_signatures@
module_compressions=@module_compressions@

Name: libkmod
Description: Library to deal with kernel modules
Expand Down
6 changes: 6 additions & 0 deletions man/depmod.8.scd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ depmod - Generate modules.dep and map files.
*depmod* [*-e*] [*-E* _Module.symvers_] [*-F* _System.map_] [*-n*] [*-v*] [*-P* _prefix_]
\ \ \ \ \ \ \ \[*-w*] [_version_] [_filename_...]

*depmod* *-M*

# DESCRIPTION

Linux kernel modules can provide services (called "symbols") for other modules
Expand Down Expand Up @@ -80,6 +82,10 @@ rather than the current kernel version (as returned by *uname -r*).
_/tmp/build/kernel-modules/$(uname -r)_ and generates index files under
that same directory.

*-M*
*--moduledir-defualt*
Print the moduledir prefix @MODULE_DIRECTORY@ set at compile time.

*-o* _outdir_
*--outdir* _outdir_
Set the output directory where *depmod* will store any generated file.
Expand Down
34 changes: 14 additions & 20 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,25 @@ libkmod = shared_library(
install : true,
)

_libkmod_variables = [
'sysconfdir=' + sysconfdir,
'distconfdir=' + distconfdir,
'module_directory=' + moduledir,
'module_signatures=' + module_signatures,
]

# XXX: Support for empty variables was added in meson v1.4.0.
# pkgconf behaves identically on missing and empty variable.
if module_compressions != ''
_libkmod_variables += ['module_compressions=' + module_compressions]
endif

pkg.generate(
name : 'libkmod',
description : 'Library to deal with kernel modules',
libraries : libkmod,
requires_private : libkmod_deps,
variables: _libkmod_variables
)

libkmod_internal = static_library(
Expand Down Expand Up @@ -400,26 +414,6 @@ kmod = executable(
install : get_option('tools'),
)

_kmod_variables = [
'sysconfdir=' + sysconfdir,
'distconfdir=' + distconfdir,
'module_directory=' + moduledir,
'module_signatures=' + module_signatures,
]

# XXX: Support for empty variables was added in meson v1.4.0.
# pkgconf behaves identically on missing and empty variable.
if module_compressions != ''
_kmod_variables += ['module_compressions=' + module_compressions]
endif

pkg.generate(
name : 'kmod',
description : 'Tools to deal with kernel modules',
install_dir : join_paths(get_option('datadir'), 'pkgconfig'),
variables : _kmod_variables,
)

_tools = [
'depmod',
'insmod',
Expand Down
7 changes: 6 additions & 1 deletion tools/depmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ static const char *const default_cfg_paths[] = {
// clang-format on
};

static const char cmdopts_s[] = "aAb:m:o:C:E:F:evnP:wVh";
static const char cmdopts_s[] = "aAb:m:Mo:C:E:F:evnP:wVh";
static const struct option cmdopts[] = {
{ "all", no_argument, 0, 'a' },
{ "quick", no_argument, 0, 'A' },
{ "basedir", required_argument, 0, 'b' },
{ "moduledir", required_argument, 0, 'm' },
{ "moduledir-default", no_argument, 0, 'M' },
{ "outdir", required_argument, 0, 'o' },
{ "config", required_argument, 0, 'C' },
{ "symvers", required_argument, 0, 'E' },
Expand Down Expand Up @@ -96,6 +97,7 @@ static void help(void)
"\t-b, --basedir=DIR Root path (default: /).\n"
"\t-m, --moduledir=DIR Module directory (default: " MODULE_DIRECTORY
").\n"
"\t-M, --moduledir-default Print MODULE_DIRECTORY default value.\n"
"\t-o, --outdir=DIR Output root path (default: same as <basedir>).\n"
"\t-F, --filesyms=FILE Use the file instead of the\n"
"\t current kernel symbols.\n"
Expand Down Expand Up @@ -2932,6 +2934,9 @@ static int do_depmod(int argc, char *argv[])
case 'm':
module_directory = optarg;
break;
case 'M':
puts(MODULE_DIRECTORY);
return EXIT_SUCCESS;
case 'o':
free(out_root);
out_root = path_make_absolute_cwd(optarg);
Expand Down
10 changes: 0 additions & 10 deletions tools/kmod.pc.in

This file was deleted.