HomePhabricator

net: Add libnatpmp support

Description

net: Add libnatpmp support

Summary:
https://github.com/bitcoin/bitcoin/pull/18077/commits/a8d9f275d0ca64797cc89627f8003b48b3efef63 (main commit)

net: Add libnatpmp support

https://github.com/bitcoin/bitcoin/pull/18077/commits/ae749d12ddbaf592fbdb65d98ca35a0ff5566992

doc: Add libnatpmp stuff

Note: I excluded the changes in tor.md, as the documentation added in that file is not yet applicable until core#18077 is fully backported. I suggest we should backport this tohether with the release notes.


core#21320:

build: fix libnatpmp macos cross compile

Currently, our cross-compile of libnatpmp for macOS doesn't work at all.
The wrong archiver is used, which produces an archive the linker doesn't like.

Fix this by using the right ar (we do the same for upnp).

While we're at it, we fixe the build so that we are using our c/ppflags.
This means building with -O2 rather than -Os.


core#21209:

build: compile libnatpmp with -DNATPMP_STATICLIB on Windows

This fixes linking issues and mirrors what we do with miniupnpc.

build: use newer source for libnatpmp

The source we are currently using is from 2015. The upstream repo has
received a small number of bug fixes and improvements since then.
Including one that fixes an issue for Windows users:
miniupnp/libnatpmp#13.

The source we are currently using is the most recent "official" release,
however I don't think it's worth waiting for a new one. The maintainer
was prompted to do so in Oct 2020, then again in Jan of this year, and
no release has eventuated. Given libnatpmp is a new inclusion into our
repository, I think we should be using this newer source.

This also cleans up a few warnings we currently see in depends builds


core#25917:

depends: libnatpmp 07004b97cf691774efebe70404cf22201e4d330d

This pulls in two changes I've upstreamed:
Support for pkg-config: miniupnp/libnatpmp#19
Suppressing a deprecation warning: miniupnp/libnatpmp#28


This is a backport of core#18077 [7 & 12/13], core#21320, core#21209 and core#25917

Depends on D12094

Test Plan:

cmake .. -GNinja
ninja

@bot build-win64 build-osx

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12075

Details

Provenance
Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>Authored on Feb 22 2020, 23:34
PiRKCommitted on Sep 29 2022, 18:34
PiRKPushed on Sep 29 2022, 18:34
Reviewer
Restricted Project
Differential Revision
D12075: net: Add libnatpmp support
Parents
rABC9045d36906ec: [Chronik] Add `ChronikBridge` to access the node from Rust
Branches
Unknown
Tags
Unknown