aboutsummaryrefslogtreecommitdiff
path: root/net/kadnode
diff options
context:
space:
mode:
authorMoritz Warning <moritzwarning@web.de>2018-05-02 20:05:25 +0200
committerMoritz Warning <moritzwarning@web.de>2018-05-02 20:21:50 +0200
commit32242f6f6e1c85e5e4201c8ee482c5d8747acd98 (patch)
treef4e596cfc5322e2ef78e918c7163b570ad15e945 /net/kadnode
parente72341e52abd478848814454623db7ff46253019 (diff)
kadnode: smaller binary
Decreases size of package by 3% Signed-off-by: Moritz Warning <moritzwarning@web.de>
Diffstat (limited to 'net/kadnode')
-rw-r--r--net/kadnode/Makefile4
-rw-r--r--net/kadnode/patches/0001-LFLAGS-LDFLAGS.patch67
2 files changed, 71 insertions, 0 deletions
diff --git a/net/kadnode/Makefile b/net/kadnode/Makefile
index d4b22ce12..5db3247e8 100644
--- a/net/kadnode/Makefile
+++ b/net/kadnode/Makefile
@@ -76,6 +76,10 @@ endif
MAKE_FLAGS += FEATURES="$(FEATURES)"
+# Make binary smaller
+TARGET_CFLAGS += -ffunction-sections -fdata-sections
+TARGET_LDFLAGS += -Wl,--gc-sections
+
define Package/kadnode/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/build/kadnode $(1)/usr/bin/
diff --git a/net/kadnode/patches/0001-LFLAGS-LDFLAGS.patch b/net/kadnode/patches/0001-LFLAGS-LDFLAGS.patch
new file mode 100644
index 000000000..0e6de8e16
--- /dev/null
+++ b/net/kadnode/patches/0001-LFLAGS-LDFLAGS.patch
@@ -0,0 +1,67 @@
+From 12f6ca15b1b80f7fedb3ae3cf9067a8045a9a8fd Mon Sep 17 00:00:00 2001
+From: Moritz Warning <moritzwarning@web.de>
+Date: Wed, 2 May 2018 19:54:37 +0200
+Subject: [PATCH] LFLAGS => LDFLAGS
+
+---
+ Makefile | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 62be30a..ae994fc 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,7 +2,7 @@
+ CC ?= gcc
+ CFLAGS ?= -Os -Wall -Wwrite-strings -pedantic
+ CFLAGS += -std=gnu99 -I/usr/local/include
+-LFLAGS += -L/usr/local/lib -lc
++LDFLAGS += -L/usr/local/lib -lc
+ FEATURES ?= dns lpd tls bob cmd debug nss #natpmp upnp
+
+ OBJS = build/searches.o build/kad.o build/log.o \
+@@ -30,7 +30,7 @@ endif
+ ifeq ($(findstring bob,$(FEATURES)),bob)
+ OBJS += build/ext-bob.o
+ CFLAGS += -DBOB
+- LFLAGS += -lmbedtls -lmbedx509 -lmbedcrypto
++ LDFLAGS += -lmbedtls -lmbedx509 -lmbedcrypto
+ endif
+
+ ifeq ($(findstring cmd,$(FEATURES)),cmd)
+@@ -56,20 +56,20 @@ endif
+ ifeq ($(findstring tls,$(FEATURES)),tls)
+ OBJS += build/ext-tls-client.o build/ext-tls-server.o
+ CFLAGS += -DTLS
+- LFLAGS += -lmbedtls -lmbedx509 -lmbedcrypto
++ LDFLAGS += -lmbedtls -lmbedx509 -lmbedcrypto
+ endif
+
+ ifeq ($(findstring upnp,$(FEATURES)),upnp)
+ OBJS += build/upnp.o
+ CFLAGS += -DFWD_UPNP
+- LFLAGS += -Wl,-Bdynamic -lminiupnpc
++ LDFLAGS += -Wl,-Bdynamic -lminiupnpc
+ ENABLE_FORWARDING = 1
+ endif
+
+ ifeq ($(findstring natpmp,$(FEATURES)),natpmp)
+ OBJS += build/natpmp.o
+ CFLAGS += -DFWD_NATPMP
+- LFLAGS += -Wl,-Bdynamic -lnatpmp
++ LDFLAGS += -Wl,-Bdynamic -lnatpmp
+ ENABLE_FORWARDING = 1
+ endif
+
+@@ -94,7 +94,7 @@ libkadnode.so: build/libkadnode.o $(OBJS)
+ $(CC) -shared $(OBJS) build/libkadnode.o -o build/libkadnode.so
+
+ kadnode: build/main.o $(OBJS) $(EXTRA)
+- $(CC) build/main.o $(OBJS) -o build/kadnode $(LFLAGS)
++ $(CC) build/main.o $(OBJS) -o build/kadnode $(LDFLAGS)
+ ln -s kadnode build/kadnode-ctl 2> /dev/null || true
+
+ clean:
+--
+2.17.0
+