Skip to contentSkip to conversation

static libnftables by now?

PATCH Superseded Pablo Neira Ayuso 3 participants 6 messages Nov 24, 2017 – Dec 4, 2017

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

Hi Phil,

Until the library API is stable, before 0.9.0 release, I think it would be good if we make it static by now.

This would also allow me to make more frequent 0.8.x releases including fixes and such.

What do you think? Would you have a look into it?

Thanks.

reviewer
#1 lore raw

PATCH 1/1 Make libnftables a local static library

This changes Makefiles so that libnftables is built into a static library which is not installed. This allows for incompatible changes while still providing a library to link to for testing purposes.

---
 Makefile.am     |  3 ---
 src/Makefile.am | 14 ++++++--------
 2 files changed, 6 insertions(+), 11 deletions(-)
Makefile.am +0 -3
index 9af25ded836b8..10aa40f14127f 100644
@@ -6,6 +6,3 @@ SUBDIRS = 	src	\
 		files
 
 EXTRA_DIST =	tests
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libnftables.pc
src/Makefile.am +6 -8
index 9f7a4bfbb90a4..07ddfd590dd8f 100644
@@ -27,9 +27,9 @@ parser_bison.o scanner.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-decl
 
 BUILT_SOURCES = parser_bison.h
 
-lib_LTLIBRARIES = libnftables.la
+noinst_LIBRARIES = libnftables.a
 
-libnftables_la_SOURCES =			\
+libnftables_a_SOURCES =				\
 		rule.c				\
 		statement.c			\
 		datatype.c			\
@@ -64,14 +64,14 @@ libnftables_la_SOURCES =			\
 if BUILD_MINIGMP
 mini-gmp.o: AM_CFLAGS += -Wno-sign-compare
 
-libnftables_la_SOURCES += mini-gmp.c
+libnftables_a_SOURCES += mini-gmp.c
 endif
 
-libnftables_la_LIBADD = ${LIBMNL_LIBS} ${LIBNFTNL_LIBS}
+nft_LDADD = libnftables.a ${LIBMNL_LIBS} ${LIBNFTNL_LIBS}
 
 if BUILD_XTABLES
-libnftables_la_SOURCES += xt.c
-libnftables_la_LIBADD += ${XTABLES_LIBS}
+libnftables_a_SOURCES += xt.c
+nft_LDADD += ${XTABLES_LIBS}
 endif
 
 nft_SOURCES = main.c
@@ -79,5 +79,3 @@ nft_SOURCES = main.c
 if BUILD_CLI
 nft_SOURCES += cli.c
 endif
-
-nft_LDADD = libnftables.la
Signature · 1 line
2.13.1
#2 lore raw

Re: [nft PATCH] Make libnftables a local static library

Quoted 12 lines · Phil Sutter

This changes Makefiles so that libnftables is built into a static library which is not installed. This allows for incompatible changes while still providing a library to link to for testing purposes.

src/Makefile.am +0 -0
index 9f7a4bfbb90a4..07ddfd590dd8f 100644
@@ -27,9 +27,9 @@ parser_bison.o scanner.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-decl
 

BUILT_SOURCES = parser_bison.h

src/Makefile.am parser_bison.o scanner.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-decl · line 30

Quoted 2 lines
src/Makefile.am +1 -1
-lib_LTLIBRARIES = libnftables.la
+noinst_LIBRARIES = libnftables.a

Making it a noinst_LTLIBRARIES would have the benefit that its dependencies are at least recorded.

reviewer
#3 lore raw

Re: [nft PATCH] Make libnftables a local static library

Quoted 13 lines · Jan Engelhardt
Quoted 10 lines · Phil Sutter

This changes Makefiles so that libnftables is built into a static library which is not installed. This allows for incompatible changes while still providing a library to link to for testing purposes.

src/Makefile.am +0 -0
index 9f7a4bfbb90a4..07ddfd590dd8f 100644
@@ -27,9 +27,9 @@ parser_bison.o scanner.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-decl
 
Quoted 7 lines

src/Makefile.am parser_bison.o scanner.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-decl · line 30

Quoted 4 lines

BUILT_SOURCES = parser_bison.h

src/Makefile.am +1 -1
-lib_LTLIBRARIES = libnftables.la
+noinst_LIBRARIES = libnftables.a

Making it a noinst_LTLIBRARIES would have the benefit that its dependencies are at least recorded.

Oh, thanks for the hint! I wasn't aware this is supported at all. In fact, doing so shrinks my patch to a one-liner. :)

Thanks, Phil

reviewer
#4 lore raw

PATCH v2 1/1 Make libnftables a local static library

This changes Makefiles so that libnftables is built into a static library which is not installed. This allows for incompatible changes while still providing a library to link to for testing purposes.

---
Changes since v1:
- Keep it a libtool library.
- Update src/.gitignore.

---
 src/.gitignore  | 1 +
 src/Makefile.am | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
src/.gitignore +1 -0
index 36d6acd1e4d01..e27d4f8431eec 100644
@@ -1,3 +1,4 @@
+libnftables.a
 libnftables.la
 parser.c
 parser.h
src/Makefile.am +1 -1
index 9f7a4bfbb90a4..7581ec2090092 100644
@@ -27,7 +27,7 @@ parser_bison.o scanner.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-decl
 
 BUILT_SOURCES = parser_bison.h
 
-lib_LTLIBRARIES = libnftables.la
+noinst_LTLIBRARIES = libnftables.la
 
 libnftables_la_SOURCES =			\
 		rule.c				\
Signature · 1 line
2.13.1
author maintainer Applied
#5 lore raw

Re: [nft PATCH v2] Make libnftables a local static library

Quoted 3 lines · Phil Sutter

This changes Makefiles so that libnftables is built into a static library which is not installed. This allows for incompatible changes while still providing a library to link to for testing purposes.

Applied, thanks Phil.