Skip to contentSkip to conversation

tools: allow better build system configuration

PATCH In review Marc-Antoine Perennou 2 participants 6 messages Nov 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: allow better build system configuration

---
 src/tools/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
src/tools/Makefile +5 -3
index fc0c0f3..92e0528 100644
@@ -4,6 +4,8 @@ BINDIR ?= $(PREFIX)/bin
 LIBDIR ?= $(PREFIX)/lib
 MANDIR ?= $(PREFIX)/share/man
 RUNSTATEDIR ?= /var/run
+PKG_CONFIG ?= pkg-config
+INSTALL_STRIP_OPT ?= -s
 
 CFLAGS ?= -O3
 CFLAGS += -std=gnu11
@@ -12,8 +14,8 @@ CFLAGS += -MMD -MP
 CFLAGS += -DRUNSTATEDIR="\"$(RUNSTATEDIR)\""
 LDLIBS += -lresolv
 ifeq ($(shell uname -s),Linux)
-LIBMNL_CFLAGS := $(shell pkg-config --cflags libmnl 2>/dev/null)
-LIBMNL_LDLIBS := $(shell pkg-config --libs libmnl 2>/dev/null || echo -lmnl)
+LIBMNL_CFLAGS := $(shell $(PKG_CONFIG) --cflags libmnl 2>/dev/null)
+LIBMNL_LDLIBS := $(shell $(PKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)
 CFLAGS += $(LIBMNL_CFLAGS)
 LDLIBS += $(LIBMNL_LDLIBS)
 endif
@@ -24,7 +26,7 @@ clean:
 	rm -f wg *.o *.d
 
 install: wg
-	install -v -d "$(DESTDIR)$(BINDIR)" && install -s -m 0755 -v wg "$(DESTDIR)$(BINDIR)/wg"
+	install -v -d "$(DESTDIR)$(BINDIR)" && install $(INSTALL_STRIP_OPT) -m 0755 -v wg "$(DESTDIR)$(BINDIR)/wg"
 	install -v -d "$(DESTDIR)$(MANDIR)/man8" && install -m 0644 -v wg.8 "$(DESTDIR)$(MANDIR)/man8/wg.8"
 
 check: clean
Signature · 1 line
2.10.1
#1 lore raw

Hi Marc,

What is the motivation for making -s overrideable? Do different install versions use different options? Or do you simply want the ability to not strip?

Jason

#2 lore raw

Hi,

Quoted 7 lines · Jason A. Donenfeld

Hi Marc,

What is the motivation for making -s overrideable? Do different install versions use different options? Or do you simply want the ability to not strip?

Jason

My patch is missing a little background indeed.
Some build environments do not allow the build system to do the stripping, and want
to do it after the uild system has finished, so it's the latter. I can split and/or rework that part if needed.

Marc-Antoine

#3 lore raw

Okay, I thought that might be the case. That's the situation on Gentoo too.

Secondly, why the pkg-config abstraction? When is it not called pkg-config and when is it not in PATH?

#4 lore raw
Quoted 4 lines · Jason A. Donenfeld

Okay, I thought that might be the case. That's the situation on Gentoo too.

Secondly, why the pkg-config abstraction? When is it not called pkg-config and when is it not in PATH?

On exherbo, everything (including the main arch) is cross compiled, so unprefixed
toolchain is blacklisted, we use e.g. x86_64-pc-linux-gnu-pkg-config Supporting PKG_CONFIG env var seems like something quite common, as that(s how the pkg-config autotools integration works, for example.

#5 lore raw
Quoted 3 lines · Marc-Antoine Perennou

On exherbo, everything (including the main arch) is cross compiled, so unprefixed
toolchain is blacklisted, we use e.g. x86_64-pc-linux-gnu-pkg-config

Oh yea, I remember that. That's really awesome.

Okay, I committed something that does what you want in these two commits:

https://git.zx2c4.com/WireGuard/commit/?id=1ed544bd195b02ca59bab8e325e19e1e0567aa7c
https://git.zx2c4.com/WireGuard/commit/?id=adc0bf883c10c46ccea9cd934904c54faaf11a0d