Merge ~sergiodj/ubuntu/+source/libpcap:bug1865501-pkg-config into ubuntu/+source/libpcap:ubuntu/bionic-devel

Proposed by Sergio Durigan Junior
Status: Merged
Approved by: Christian Ehrhardt 
Approved revision: 3828dfedb504b17c1d3747004eeb031b08c4c927
Merged at revision: 3828dfedb504b17c1d3747004eeb031b08c4c927
Proposed branch: ~sergiodj/ubuntu/+source/libpcap:bug1865501-pkg-config
Merge into: ubuntu/+source/libpcap:ubuntu/bionic-devel
Diff against target: 388 lines (+345/-0)
6 files modified
debian/changelog (+17/-0)
debian/libpcap0.8-dev.install (+1/-0)
debian/patches/install-pkg-config-file.patch (+137/-0)
debian/patches/series (+3/-0)
debian/patches/set-package-name-with-ac-init.patch (+160/-0)
debian/patches/use-m4-macro-to-get-version.patch (+27/-0)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Approve
Canonical Server Pending
Review via email: mp+386535@code.launchpad.net

Description of the change

Users of libpcap cannot make use of its pkg-config file in order to automate the building process of applications that use the library, because the file is not being installed on Ubuntu bionic.

To reproduce the problem, one can do:

$ lxc launch ubuntu-daily:bionic libpcap-bug1865501
$ lxc shell libpcap-bug1865501
# apt update
# apt install libpcap-dev pkg-config -y
# pkg-config libpcap --libs

You will see an error like this:

Package libpcap was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpcap.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpcap' found

The fix for this problem seems simple at the beginning: just install the .pc file and be done with it. However, bionic's version of the package doesn't have the .pc file, so I needed to backport the upstream patch that created the file. Then, I noticed that some variables (like PACKAGE_NAME) were not being expanded in the libpcap.pc.in template, so I had to chase and backport the upstream patches that correctly set these variables in the configure.ac. All in all, I had to backport 3 relatively simple upstream patches.

Then, the actual fix came from the Debian package:

https://salsa.debian.org/rfrancoise/libpcap/-/commit/580102f990009a7cb74cf94a5538b41c90ee0f3e
https://salsa.debian.org/rfrancoise/libpcap/-/commit/a0f1ea6e96c692ce69fab0fb2ee3a1fcbab3d258

The first commit didn't need to be cherry-picked because it was already applied; only the second commit was necessary.

There is a PPA with the proposed fix here:

https://launchpad.net/~sergiodj/+archive/ubuntu/libpcap-bug1865501

There are no dep8 tests. To test, I cloned and built the package mentioned by the reporter, which uses libpcap. You can do this inside the lxd container you set up above:

# git clone https://github.com/nhorman/dropwatch
# cd dropwatch
# ./autogen.sh && ./configure && make

To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks for identifying the configure/make changes needed to get this working Sergio.
The changelog looks well.
The build log has a few warnings, but not related to your change.
The PPA works as intended and shows no other impact.

I double checked the backported patches for potential side-effects but found none \o/.
Never the less the config changes make this way more noisy and intrusive than I'd have hoped :-/

In the review I learned that libpcap had another - non standard - way to provide this data already.
=> /usr/bin/pcap-config
This was retained going forward for compatibility:
Focal:
$ $ pcap-config --static --additional-libs --libs --cflags
-I/usr/include -lpcap
Bionic:
root@b:~# pcap-config --static --libs --cflags --additional-libs
-I/usr/include -lpcap
Bionic + PPA:
root@b:~# pcap-config --static --libs --cflags --additional-libs
-I/usr/include -lpcap

+1 for the review on this.

Let us see what the SRU Team thinks of "more intrusive than we hoped" + "there is a (non standard) alternative". Both arguments against the SRU, but no clear show stoppers.

review: Approve
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Tuesday, June 30 2020, Christian Ehrhardt  wrote:

> Thanks for identifying the configure/make changes needed to get this working Sergio.
> The changelog looks well.
> The build log has a few warnings, but not related to your change.
> The PPA works as intended and shows no other impact.
>
> I double checked the backported patches for potential side-effects but found none \o/.
> Never the less the config changes make this way more noisy and intrusive than I'd have hoped :-/

Thanks for the review, Christian!

Indeed, I was also negatively surprised when I noticed that I'd need to
backport more than the trivial libpcap.pc.in change in order to make
this work.

> In the review I learned that libpcap had another - non standard - way to provide this data already.
> => /usr/bin/pcap-config
> This was retained going forward for compatibility:
> Focal:
> $ $ pcap-config --static --additional-libs --libs --cflags
> -I/usr/include -lpcap
> Bionic:
> root@b:~# pcap-config --static --libs --cflags --additional-libs
> -I/usr/include -lpcap
> Bionic + PPA:
> root@b:~# pcap-config --static --libs --cflags --additional-libs
> -I/usr/include -lpcap

Ah, that's correct, thanks for pointing it out! As you can see, part of
the changes I backported even patched the pcap-config script.

> +1 for the review on this.
>
> Let us see what the SRU Team thinks of "more intrusive than we hoped" + "there is a (non standard) alternative". Both arguments against the SRU, but no clear show stoppers.

Yep, fingers crossed.

As you said, pcap-config is non-standard, and, as far I have seen, not
really well documented, which explains why this bug was filed. Let's
hope the SRU team considers this justification sufficient :-).

Thanks again!

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Yeah so it is a valid change but maybe a bit too much for SRU - let's see what the SRU Team thinks.
Sponsored

To ssh://git.launchpad.net/ubuntu/+source/libpcap
 * [new tag] upload/1.8.1-6ubuntu1.18.04.2 -> upload/1.8.1-6ubuntu1.18.04.2

Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading libpcap_1.8.1-6ubuntu1.18.04.2.dsc: done.
  Uploading libpcap_1.8.1-6ubuntu1.18.04.2.debian.tar.xz: done.
  Uploading libpcap_1.8.1-6ubuntu1.18.04.2_source.buildinfo: done.
  Uploading libpcap_1.8.1-6ubuntu1.18.04.2_source.changes: done.
Successfully uploaded packages.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

@Sergio - Do you know what happened here?

It is not in Bionic unapproved
https://launchpad.net/ubuntu/bionic/+queue?queue_state=1&queue_text=

Nor is it in proposed/released:
 libpcap | 1.8.1-6ubuntu1 | bionic | source
 libpcap | 1.8.1-6ubuntu1.18.04.1 | bionic-security | source
 libpcap | 1.8.1-6ubuntu1.18.04.1 | bionic-updates | source

Nor is there a denial by the SRU team on the bug.

I have copied my uploads log here which looked good 25 days ago - I'm puzzled.

Re-trying:
 ! [rejected] upload/1.8.1-6ubuntu1.18.04.2 -> upload/1.8.1-6ubuntu1.18.04.2 (already exists)
(as expected)

Again uploaded:
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading libpcap_1.8.1-6ubuntu1.18.04.2.dsc: done.
  Uploading libpcap_1.8.1-6ubuntu1.18.04.2.debian.tar.xz: done.
  Uploading libpcap_1.8.1-6ubuntu1.18.04.2_source.buildinfo: done.
  Uploading libpcap_1.8.1-6ubuntu1.18.04.2_source.changes: done.
Successfully uploaded packages.

Need to check the feedback mail to that upload later ...

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I see it in bionic-unapproved now, if you happen to know what this was please enlight me ...

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Tuesday, July 28 2020, Christian Ehrhardt  wrote:

> I see it in bionic-unapproved now, if you happen to know what this was please enlight me ...

Thanks for looking into this, Christian. I have no idea what happened;
I assumed the upload was waiting to be reviewed by the SRU team (it was
one of the uploads I mentioned yesterday during the call). I apologize
for not checking bionic-unapproved; I guess I didn't know about it.

Anyway, thanks for making sure this is in the right state to be reviewed
by the SRU team.

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 6d2d86d..87bdeac 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,20 @@
6+libpcap (1.8.1-6ubuntu1.18.04.2) bionic; urgency=medium
7+
8+ * Install pkg-config file for libpcap (LP: #1865501).
9+ - d/p/set-package-name-with-ac-init.patch: Set the PACKAGE_NAME
10+ variable using autoconf's AC_INIT macro, so that we can use it
11+ in the libpcap.pc.in file.
12+ - d/p/use-m4-macro-to-get-version.patch: Use an M4 macro to
13+ execute a "cat" command and obtain the version from the VERSION
14+ file.
15+ - d/p/install-pkg-config-file.patch: New patch from upstream,
16+ which creates a libpcap.pc.in file and adjusts the Makefile to
17+ install it.
18+ - d/libpcap0.8-dev.install: Install libpcap.pc pkg-config file.
19+ Thanks to Luca Boccassi for the Debian patch (Closes #922219).
20+
21+ -- Sergio Durigan Junior <sergio.durigan@canonical.com> Mon, 29 Jun 2020 17:49:04 -0400
22+
23 libpcap (1.8.1-6ubuntu1.18.04.1) bionic-security; urgency=medium
24
25 * SECURITY UPDATE: pcapng reading buffer over-read.
26diff --git a/debian/libpcap0.8-dev.install b/debian/libpcap0.8-dev.install
27index 09f7c61..d4bd144 100644
28--- a/debian/libpcap0.8-dev.install
29+++ b/debian/libpcap0.8-dev.install
30@@ -2,4 +2,5 @@ usr/bin
31 usr/include/pcap*
32 usr/lib/*/libpcap.a
33 usr/lib/*/libpcap.so
34+usr/lib/*/pkgconfig/libpcap.pc
35 usr/share/man
36diff --git a/debian/patches/install-pkg-config-file.patch b/debian/patches/install-pkg-config-file.patch
37new file mode 100644
38index 0000000..b774ba6
39--- /dev/null
40+++ b/debian/patches/install-pkg-config-file.patch
41@@ -0,0 +1,137 @@
42+From: Guy Harris <guy@alum.mit.edu>
43+Date: Wed, 25 Apr 2018 17:22:45 -0700
44+Subject: Add a pkg-config .pc file for libpcap.
45+
46+Addresses GitHub issue #374.
47+
48+Author: Guy Harris <guy@alum.mit.edu>
49+Origin: backport, https://github.com/the-tcpdump-group/libpcap/commit/a7deb6a241f8c71ca261adc45ac07c8427074792
50+Bug: https://github.com/the-tcpdump-group/libpcap/issues/374
51+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libpcap/+bug/1865501
52+Reviewed-By: Sergio Durigan Junior <sergio.durigan@canonical.com>
53+Last-Update: 2020-06-29
54+---
55+ Makefile.in | 28 +++++++++++++++++++++-------
56+ libpcap.pc.in | 18 ++++++++++++++++++
57+ 2 files changed, 39 insertions(+), 7 deletions(-)
58+ create mode 100644 libpcap.pc.in
59+
60+diff --git a/Makefile.in b/Makefile.in
61+index d8562f1..44b9274 100644
62+--- a/Makefile.in
63++++ b/Makefile.in
64+@@ -171,7 +171,7 @@ TAGFILES = \
65+
66+ CLEANFILES = $(OBJ) libpcap.* $(TESTS) \
67+ $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
68+- lex.yy.c pcap-config $(OBJ_PIC)
69++ lex.yy.c pcap-config libpcap.pc $(OBJ_PIC)
70+
71+ MAN1 = pcap-config.1
72+
73+@@ -300,6 +300,7 @@ EXTRA_DIST = \
74+ lbl/os-solaris2.h \
75+ lbl/os-sunos4.h \
76+ lbl/os-ultrix4.h \
77++ libpcap.pc.in \
78+ missing/getopt.c \
79+ missing/getopt.h \
80+ missing/snprintf.c \
81+@@ -372,7 +373,7 @@ EXTRA_DIST = \
82+ Win32/Prj/wpcap.vcxproj \
83+ Win32/Prj/wpcap.vcxproj.filters
84+
85+-all: libpcap.a shared pcap-config
86++all: libpcap.a shared libpcap.pc pcap-config
87+
88+ libpcap.a: $(OBJ)
89+ @rm -f $@
90+@@ -536,7 +537,7 @@ bpf_filter_pic.o: bpf_filter.c
91+ $(CC) -fPIC $(FULL_CFLAGS) -c bpf_filter.c -o $@
92+
93+ #
94+-# Generate the pcap-config script.
95++# Generate the libpcap.pc file.
96+ #
97+ # Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<";
98+ # for example, the Solaris 9 make man page says
99+@@ -547,7 +548,16 @@ bpf_filter_pic.o: bpf_filter.c
100+ #
101+ # and this is an explicit target entry.
102+ #
103+-# Therefore, instead of using $<, we explicitly put in $(srcdir)/pcap-config.in.
104++# Therefore, instead of using $<, we explicitly put in $(srcdir)/libpcap.pc.in.
105++#
106++libpcap.pc: $(srcdir)/libpcap.pc.in ./config.status
107++ @rm -f $@ $@.tmp
108++ ./config.status --file=$@.tmp:$(srcdir)/libpcap.pc.in
109++ mv $@.tmp $@
110++ chmod a+x $@
111++
112++#
113++# Generate the pcap-config script. See above.
114+ #
115+ pcap-config: $(srcdir)/pcap-config.in ./config.status
116+ @rm -f $@ $@.tmp
117+@@ -584,7 +594,7 @@ selpolltest: tests/selpolltest.c libpcap.a
118+ valgrindtest: tests/valgrindtest.c libpcap.a
119+ $(CC) $(FULL_CFLAGS) -I. -L. -o valgrindtest $(srcdir)/tests/valgrindtest.c libpcap.a $(LIBS)
120+
121+-install: install-shared install-archive pcap-config
122++install: install-shared install-archive libpcap.pc pcap-config
123+ [ -d $(DESTDIR)$(libdir) ] || \
124+ (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
125+ [ -d $(DESTDIR)$(includedir) ] || \
126+@@ -605,6 +615,9 @@ install: install-shared install-archive pcap-config
127+ [ -d $(DESTDIR)$(bindir) ] || \
128+ (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
129+ $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
130++ [ -d $(DESTDIR)$(libdir)/pkgconfig ] || \
131++ (mkdir -p $(DESTDIR)$(libdir)/pkgconfig; chmod 755 $(DESTDIR)$(libdir)/pkgconfig)
132++ $(INSTALL_DATA) libpcap.pc $(DESTDIR)$(libdir)/pkgconfig/libpcap.pc
133+ for i in $(MAN1); do \
134+ $(INSTALL_DATA) $(srcdir)/$$i \
135+ $(DESTDIR)$(mandir)/man1/$$i; done
136+@@ -708,6 +721,7 @@ uninstall: uninstall-shared
137+ for i in $(PUBHDR); do \
138+ rm -f $(DESTDIR)$(includedir)/$$i; done
139+ -rmdir $(DESTDIR)$(includedir)/pcap
140++ rm -f $(DESTDIR)/$(libdir)/pkgconfig/libpcap.pc
141+ rm -f $(DESTDIR)/$(bindir)/pcap-config
142+ for i in $(MAN1); do \
143+ rm -f $(DESTDIR)$(mandir)/man1/$$i; done
144+@@ -760,8 +774,8 @@ clean:
145+
146+ distclean: clean
147+ rm -f Makefile config.cache config.log config.status \
148+- config.h gnuc.h net os-proto.h bpf_filter.c pcap-config \
149+- stamp-h stamp-h.in
150++ config.h gnuc.h net os-proto.h bpf_filter.c libpcap.pc \
151++ pcap-config stamp-h stamp-h.in
152+ rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
153+ rm -rf autom4te.cache
154+
155+diff --git a/libpcap.pc.in b/libpcap.pc.in
156+new file mode 100644
157+index 0000000..d74cbc5
158+--- /dev/null
159++++ b/libpcap.pc.in
160+@@ -0,0 +1,18 @@
161++#
162++# pkg-config file for libpcap.
163++#
164++# These variables come from the configure script, so includedir and
165++# libdir may be defined in terms of prefix and exec_prefix, so the
166++# latter must be defined as well.
167++#
168++prefix="@prefix@"
169++exec_prefix="@exec_prefix@"
170++includedir="@includedir@"
171++libdir="@libdir@"
172++
173++Name: libpcap
174++Description: Platform-independent network traffic capture library
175++Version: @PACKAGE_VERSION@
176++Libs: -L${libdir} -l@PACKAGE_NAME@
177++Libs.private: @LIBS@
178++Cflags: -I${includedir}
179diff --git a/debian/patches/series b/debian/patches/series
180index 6f38ebf..c09da53 100644
181--- a/debian/patches/series
182+++ b/debian/patches/series
183@@ -11,3 +11,6 @@ pcap-config.diff
184 0001-Revert-Add-file-capture-length-sanity-check-for-pcap.patch
185 CVE-2019-15165-1.patch
186 CVE-2019-15165-2.patch
187+set-package-name-with-ac-init.patch
188+use-m4-macro-to-get-version.patch
189+install-pkg-config-file.patch
190diff --git a/debian/patches/set-package-name-with-ac-init.patch b/debian/patches/set-package-name-with-ac-init.patch
191new file mode 100644
192index 0000000..f1578fc
193--- /dev/null
194+++ b/debian/patches/set-package-name-with-ac-init.patch
195@@ -0,0 +1,160 @@
196+From: Sergio Durigan Junior <sergio.durigan@canonical.com>
197+Date: Mon, 29 Jun 2020 17:39:01 -0400
198+Subject: Don't wire the library name into pcap-config.
199+
200+With autotools, set the package name with AC_INIT(), which now takes the
201+package name and version as arguments, rather than the name of a file in
202+the source directory. That sets PACKAGE_NAME.
203+
204+With CMake, set PACKAGE_NAME to ${LIBRARY_NAME}.
205+
206+In pcap-config.in, use "-l@PACKAGE_NAME@", rather than -lpcap, as the
207+library name.
208+
209+That means that pcap-config will use -lwpcap, rather than -lpcap, on
210+Windows, where the library's name is wpcap rather than just pcap.
211+
212+Author: Guy Harris <guy@alum.mit.edu>
213+Origin: backport, https://github.com/the-tcpdump-group/libpcap/commit/c2e151358d7bc7c77dddb4ca00770034872cd081
214+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libpcap/+bug/1865501
215+Reviewed-By: Sergio Durigan Junior <sergio.durigan@canonical.com>
216+Last-Update: 2020-06-29
217+---
218+ configure | 31 ++++++++++++++++---------------
219+ configure.ac | 3 ++-
220+ pcap-config.in | 5 +++--
221+ 3 files changed, 21 insertions(+), 18 deletions(-)
222+
223+diff --git a/configure b/configure
224+index 4c64875..fd14f5f 100755
225+--- a/configure
226++++ b/configure
227+@@ -1,6 +1,6 @@
228+ #! /bin/sh
229+ # Guess values for system-dependent variables and create Makefiles.
230+-# Generated by GNU Autoconf 2.69.
231++# Generated by GNU Autoconf 2.69 for pcap 1.8.1.
232+ #
233+ #
234+ # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
235+@@ -575,14 +575,13 @@ MFLAGS=
236+ MAKEFLAGS=
237+
238+ # Identity of this package.
239+-PACKAGE_NAME=
240+-PACKAGE_TARNAME=
241+-PACKAGE_VERSION=
242+-PACKAGE_STRING=
243+-PACKAGE_BUGREPORT=
244+-PACKAGE_URL=
245+-
246+-ac_unique_file="pcap.c"
247++PACKAGE_NAME='pcap'
248++PACKAGE_TARNAME='pcap'
249++PACKAGE_VERSION='1.8.1'
250++PACKAGE_STRING='pcap 1.8.1'
251++PACKAGE_BUGREPORT=''
252++PACKAGE_URL=''
253++
254+ # Factoring default headers for most tests.
255+ ac_includes_default="\
256+ #include <stdio.h>
257+@@ -803,7 +802,7 @@ sharedstatedir='${prefix}/com'
258+ localstatedir='${prefix}/var'
259+ includedir='${prefix}/include'
260+ oldincludedir='/usr/include'
261+-docdir='${datarootdir}/doc/${PACKAGE}'
262++docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
263+ infodir='${datarootdir}/info'
264+ htmldir='${docdir}'
265+ dvidir='${docdir}'
266+@@ -1303,7 +1302,7 @@ if test "$ac_init_help" = "long"; then
267+ # Omit some internal or obsolete options to make the list less imposing.
268+ # This message is too long to be a string in the A/UX 3.1 sh.
269+ cat <<_ACEOF
270+-\`configure' configures this package to adapt to many kinds of systems.
271++\`configure' configures pcap 1.8.1 to adapt to many kinds of systems.
272+
273+ Usage: $0 [OPTION]... [VAR=VALUE]...
274+
275+@@ -1351,7 +1350,7 @@ Fine tuning of the installation directories:
276+ --infodir=DIR info documentation [DATAROOTDIR/info]
277+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
278+ --mandir=DIR man documentation [DATAROOTDIR/man]
279+- --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
280++ --docdir=DIR documentation root [DATAROOTDIR/doc/pcap]
281+ --htmldir=DIR html documentation [DOCDIR]
282+ --dvidir=DIR dvi documentation [DOCDIR]
283+ --pdfdir=DIR pdf documentation [DOCDIR]
284+@@ -1368,7 +1367,9 @@ _ACEOF
285+ fi
286+
287+ if test -n "$ac_init_help"; then
288+-
289++ case $ac_init_help in
290++ short | recursive ) echo "Configuration of pcap 1.8.1:";;
291++ esac
292+ cat <<\_ACEOF
293+
294+ Optional Features:
295+@@ -1500,7 +1501,7 @@ fi
296+ test -n "$ac_init_help" && exit $ac_status
297+ if $ac_init_version; then
298+ cat <<\_ACEOF
299+-configure
300++pcap configure 1.8.1
301+ generated by GNU Autoconf 2.69
302+
303+ Copyright (C) 2012 Free Software Foundation, Inc.
304+@@ -1965,7 +1966,7 @@ cat >config.log <<_ACEOF
305+ This file contains any messages produced by compilers while
306+ running configure, to aid debugging if configure makes a mistake.
307+
308+-It was created by $as_me, which was
309++It was created by pcap $as_me 1.8.1, which was
310+ generated by GNU Autoconf 2.69. Invocation command line was
311+
312+ $ $0 $@
313+diff --git a/configure.ac b/configure.ac
314+index 46bbd67..9952e04 100644
315+--- a/configure.ac
316++++ b/configure.ac
317+@@ -15,7 +15,8 @@ dnl
318+ #
319+
320+ AC_PREREQ(2.61)
321+-AC_INIT(pcap.c)
322++AC_INIT(pcap, 1.8.1)
323++AC_SUBST(PACKAGE_NAME)
324+
325+ AC_CANONICAL_SYSTEM
326+
327+diff --git a/pcap-config.in b/pcap-config.in
328+index 16522dd..945c52d 100644
329+--- a/pcap-config.in
330++++ b/pcap-config.in
331+@@ -8,6 +8,7 @@ prefix="@prefix@"
332+ exec_prefix="@exec_prefix@"
333+ includedir="@includedir@"
334+ LIBS="@LIBS@"
335++PACKAGE_NAME="@PACKAGE_NAME@"
336+
337+ static=0
338+ show_cflags=0
339+@@ -63,7 +64,7 @@ else
340+ #
341+ if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
342+ then
343+- echo "-I$includedir -lpcap"
344++ echo "-I$includedir -l$PACKAGE_NAME"
345+ elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
346+ then
347+ echo "-I$includedir"
348+@@ -72,6 +73,6 @@ else
349+ echo "-I$includedir"
350+ elif [ "$show_libs" = 1 ]
351+ then
352+- echo "-lpcap"
353++ echo "-l$PACKAGE_NAME"
354+ fi
355+ fi
356diff --git a/debian/patches/use-m4-macro-to-get-version.patch b/debian/patches/use-m4-macro-to-get-version.patch
357new file mode 100644
358index 0000000..8bb9b46
359--- /dev/null
360+++ b/debian/patches/use-m4-macro-to-get-version.patch
361@@ -0,0 +1,27 @@
362+From: Ali Abdulkadir <autostart.ini@gmail.com>
363+Date: Wed, 4 Oct 2017 04:08:18 +0300
364+Subject: Use a m4 macro to get version string from file
365+
366+Author: Ali Abdulkadir <autostart.ini@gmail.com>
367+Origin: backport, https://github.com/the-tcpdump-group/libpcap/commit/263e6ca61e072cd8abe82b58e6b3f6539c2cdaaa
368+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libpcap/+bug/1865501
369+Reviewed-By: Sergio Durigan Junior <sergio.durigan@canonical.com>
370+Last-Update: 2020-06-29
371+---
372+ configure.ac | 3 ++-
373+ 1 file changed, 2 insertions(+), 1 deletion(-)
374+
375+diff --git a/configure.ac b/configure.ac
376+index 9952e04..febdb69 100644
377+--- a/configure.ac
378++++ b/configure.ac
379+@@ -15,7 +15,8 @@ dnl
380+ #
381+
382+ AC_PREREQ(2.61)
383+-AC_INIT(pcap, 1.8.1)
384++
385++AC_INIT(pcap, m4_esyscmd_s([cat VERSION]))
386+ AC_SUBST(PACKAGE_NAME)
387+
388+ AC_CANONICAL_SYSTEM

Subscribers

People subscribed via source and target branches