package: add libnetfilter-log.

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>

SVN-Revision: 42921
owl
John Crispin 2014-10-14 19:01:16 +00:00
parent ddb9bf4bac
commit 607b3cac36
7 changed files with 297 additions and 0 deletions

View File

@ -0,0 +1,73 @@
#
# Copyright (C) 2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libnetfilter_log
PKG_VERSION:=1.0.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \
http://www.netfilter.org/projects/libnetfilter_log/files/ \
ftp://ftp.netfilter.org/pub/libnetfilter_log/
PKG_MD5SUM:=2a4bb0654ae675a52d2e8d1c06090b94
PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libnetfilter-log
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libnfnetlink +kmod-nfnetlink-log +libmnl
TITLE:=API to receive to-be-logged packets from the kernel nfnetlink_log subsystem
URL:=http://www.netfilter.org/projects/libnetfilter_log/
endef
define Package/libnetfilter-log/description
libnetfilter_log is a userspace library providing interface to packets that
have been logged by the kernel packet filter. It is is part of a system that
deprecates the old syslog/dmesg based packet logging. This library has been
previously known as libnfnetlink_log.
endef
TARGET_CFLAGS += $(FPIC)
CONFIGURE_ARGS += \
--enable-static \
--enable-shared \
--without-ipulog \
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/libnetfilter_log
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/libnetfilter_log/*.h \
$(1)/usr/include/libnetfilter_log/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libnetfilter_log.{so*,a,la} \
$(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnetfilter_log.pc \
$(1)/usr/lib/pkgconfig/
endef
define Package/libnetfilter-log/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libnetfilter_log.so.* \
$(1)/usr/lib/
endef
$(eval $(call BuildPackage,libnetfilter-log))

View File

@ -0,0 +1,25 @@
From 8858b8eacd1385f99796ead78b3a7157c5e93121 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Sun, 24 Jun 2012 14:57:14 +0200
Subject: [PATCH 1/6] build: remove unnecessary pkgconfig->config.status
dependency
The flags obtained from pkgconfig are in essence preprocessor ones.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
Make_global.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Make_global.am b/Make_global.am
index b7dab7b..a4e9bd9 100644
--- a/Make_global.am
+++ b/Make_global.am
@@ -1,2 +1,2 @@
-AM_CPPFLAGS = -I${top_srcdir}/include
-AM_CFLAGS = -Wall ${LIBNFNETLINK_CFLAGS}
+AM_CPPFLAGS = -I${top_srcdir}/include ${LIBNFNETLINK_CFLAGS}
+AM_CFLAGS = -Wall
--
1.7.10.4

View File

@ -0,0 +1,24 @@
From fee63b81ee432d0b3e03ffcf9f54cda99476f267 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Sun, 24 Jun 2012 14:57:48 +0200
Subject: [PATCH 2/6] build: remove unused lines in Makefile.am
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
Makefile.am | 2 --
1 file changed, 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index b758e56..9a1cbcb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,4 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include
SUBDIRS = include src utils
-LINKOPTS = -lnfnetlink
ACLOCAL_AMFLAGS = -I m4
--
1.7.10.4

View File

@ -0,0 +1,29 @@
From 1aa23946431ac593568ccac0e0b6925e7dfd7bd3 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Mon, 8 Oct 2012 15:15:07 +0200
Subject: [PATCH 3/6] build: resolve automake-1.12 warnings
am/ltlibrary.am: warning: 'libnetfilter_log.la': linking libtool
libraries using a non-POSIX archiver requires 'AM_PROG_AR' in
'configure.ac'
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index fe6e75f..e6e1317 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,6 +7,7 @@ AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects
tar-pax no-dist-gzip dist-bzip2 1.6])
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
dnl kernel style compile messages
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
--
1.7.10.4

View File

@ -0,0 +1,24 @@
From 7529487f70e244cd31ef84b037b1c32749c134a7 Mon Sep 17 00:00:00 2001
From: Eric Leblond <eric@regit.org>
Date: Sun, 4 Nov 2012 09:29:44 +0100
Subject: [PATCH 4/6] Add include needed for integer type definition.
---
include/libnetfilter_log/libnetfilter_log.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/libnetfilter_log/libnetfilter_log.h b/include/libnetfilter_log/libnetfilter_log.h
index 6b0d3b0..a1331de 100644
--- a/include/libnetfilter_log/libnetfilter_log.h
+++ b/include/libnetfilter_log/libnetfilter_log.h
@@ -9,6 +9,7 @@
#ifndef __LIBNETFILTER_LOG_H
#define __LIBNETFILTER_LOG_H
+#include <sys/types.h>
#include <libnetfilter_log/linux_nfnetlink_log.h>
struct nflog_handle;
--
1.7.10.4

View File

@ -0,0 +1,27 @@
From 2f22d3c4453135c27873b9014e9dc5b5712804df Mon Sep 17 00:00:00 2001
From: Gustavo Zacarias <gustavo@zacarias.com.ar>
Date: Tue, 10 Sep 2013 16:23:31 -0300
Subject: [PATCH 5/6] configure: uclinux is also linux
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index e6e1317..189a753 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@ AC_PROG_INSTALL
AC_PROG_LN_S
case "$host" in
-*-*-linux*) ;;
+*-*-linux* | *-*-uclinux*) ;;
*) AC_MSG_ERROR([Linux only, dude!]);;
esac
--
1.7.10.4

View File

@ -0,0 +1,95 @@
From a1b392b4156db984ab2b695a4a70d113f70cb9b8 Mon Sep 17 00:00:00 2001
From: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
Date: Wed, 5 Feb 2014 14:18:57 +0100
Subject: [PATCH 6/6] configure: add --without-ipulog option to disable
libipulog build
This is a compat library used for netfilter ULOG target.
ULOG only works with IPv4. NFLOG has replaced ULOG.
Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
configure.ac | 5 +++++
include/libnetfilter_log/Makefile.am | 5 ++++-
src/Makefile.am | 6 +++++-
utils/Makefile.am | 7 +++++--
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 189a753..88ff7ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,11 @@ case "$host" in
*) AC_MSG_ERROR([Linux only, dude!]);;
esac
+AC_ARG_WITH([ipulog],
+ AC_HELP_STRING([--without-ipulog], [don't build libipulog compat library]),
+ [ipulog_skip=1], [ipulog_skip=0])
+AM_CONDITIONAL([BUILD_IPULOG], [test $ipulog_skip = 0])
+
dnl Dependencies
PKG_CHECK_MODULES([LIBNFNETLINK], [libnfnetlink >= 0.0.41])
diff --git a/include/libnetfilter_log/Makefile.am b/include/libnetfilter_log/Makefile.am
index fe934f1..fde1d60 100644
--- a/include/libnetfilter_log/Makefile.am
+++ b/include/libnetfilter_log/Makefile.am
@@ -1,3 +1,6 @@
-pkginclude_HEADERS = libnetfilter_log.h libipulog.h linux_nfnetlink_log.h
+pkginclude_HEADERS = libnetfilter_log.h linux_nfnetlink_log.h
+if BUILD_IPULOG
+pkginclude_HEADERS += libipulog.h
+endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 10a66e2..33933a4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,14 +22,18 @@ LIBVERSION=2:0:1
include ${top_srcdir}/Make_global.am
-lib_LTLIBRARIES = libnetfilter_log.la libnetfilter_log_libipulog.la
+lib_LTLIBRARIES = libnetfilter_log.la
libnetfilter_log_la_LDFLAGS = -Wc,-nostartfiles -lnfnetlink \
-version-info $(LIBVERSION)
libnetfilter_log_la_SOURCES = libnetfilter_log.c
libnetfilter_log_la_LIBADD = ${LIBNFNETLINK_LIBS}
+if BUILD_IPULOG
+lib_LTLIBRARIES += libnetfilter_log_libipulog.la
+
libnetfilter_log_libipulog_la_LDFLAGS = -Wc,-nostartfiles \
-version-info 1:0:0
libnetfilter_log_libipulog_la_LIBADD = libnetfilter_log.la
libnetfilter_log_libipulog_la_SOURCES = libipulog_compat.c
+endif
diff --git a/utils/Makefile.am b/utils/Makefile.am
index ae64c90..f961b6c 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,12 +1,15 @@
include ${top_srcdir}/Make_global.am
-check_PROGRAMS = nfulnl_test ulog_test
+check_PROGRAMS = nfulnl_test
nfulnl_test_SOURCES = nfulnl_test.c
nfulnl_test_LDADD = ../src/libnetfilter_log.la
nfulnl_test_LDFLAGS = -dynamic
+if BUILD_IPULOG
+check_PROGRAMS += ulog_test
+
ulog_test_SOURCES = ulog_test.c
ulog_test_LDADD = ../src/libnetfilter_log_libipulog.la ../src/libnetfilter_log.la
ulog_test_LDFLAGS = -dynamic
-
+endif
--
1.7.10.4