1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
https://github.com/raboof/nethogs/pull/285
[Formatting patch 3/3 dropped.]
From 049fff5623720fcd0b4fdc92501b586addbb6b48 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 25 Jan 2025 16:03:12 +0000
Subject: [PATCH 1/3] meson: cleanup version detection
Tell Meson what version the project is, so that we set the right versioning
on libnethogs.
---
meson.build | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meson.build b/meson.build
index 81d7b59..16e61b4 100644
--- a/meson.build
+++ b/meson.build
@@ -5,11 +5,11 @@
project('nethogs',
['c', 'cpp'],
default_options : ['warning_level=3',
- 'cpp_std=c++14']
+ 'cpp_std=c++14'],
+ version : run_command('./determineVersion.sh').stdout().strip(),
)
cc = meson.get_compiler('cpp')
-version = run_command('./determineVersion.sh', check: true).stdout().strip()
#######################################
## Dependencies and flags definition ##
@@ -19,7 +19,7 @@ projectinc = [include_directories('.', 'src')]
# flags
c_args = [
- '-DVERSION="' + version + '"'
+ '-DVERSION="' + meson.project_version() + '"'
]
# dependencies
@@ -42,5 +42,5 @@ pkgconfig = import('pkgconfig')
pkgconfig_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
pkgconfig.generate(libnethogs,
requires: ['libpcap'],
- version: version
+ version: meson.project_version()
)
From 5afce747f142f6df6a264ab368c99f47050d9984 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 25 Jan 2025 16:05:20 +0000
Subject: [PATCH 2/3] meson: fix build with libnethogs disabled
Fix `meson.build:43:19: ERROR: Unknown variable "libnethogs".`.
While src/ has this correct, the top-level meson.build wasn't right.
---
meson.build | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index 16e61b4..8537718 100644
--- a/meson.build
+++ b/meson.build
@@ -38,9 +38,11 @@ subdir('src')
#############################
## Pkgconfig definition ##
#############################
-pkgconfig = import('pkgconfig')
-pkgconfig_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
-pkgconfig.generate(libnethogs,
- requires: ['libpcap'],
- version: meson.project_version()
- )
+if get_option('enable-libnethogs').enabled()
+ pkgconfig = import('pkgconfig')
+ pkgconfig_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
+ pkgconfig.generate(libnethogs,
+ requires: ['libpcap'],
+ version: meson.project_version()
+ )
+endif
|