diff mbox

[v3] helper: convert to a library

Message ID 1436294868-6473-1-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes July 7, 2015, 6:47 p.m. UTC
Remove the need to build helper source files into the linux-generic
library by converting helpers to be their own library.

This removes the need for all other platforms to also build in the
helpers which are optional just to run the tests.

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
v3
move helper includes

├── bin
├── include
│   └── odp
│       ├── api
│       ├── helper   <----- moved it to here
│       └── plat
├── lib
│   └── pkgconfig
└── share
    └── opendataplane

checkpacth then forces some other clean up

 .gitignore                               |  2 +-
 Makefile.am                              |  3 ++-
 configure.ac                             |  1 +
 debian/libodphelper-dev.dirs             |  2 ++
 debian/libodphelper-dev.install          |  4 ++++
 debian/libodphelper.dirs                 |  1 +
 debian/libodphelper.install              |  1 +
 example/Makefile.inc                     |  4 ++--
 helper/Makefile.am                       | 30 +++++++++++++++++++++++++++++-
 helper/{include => }/odp/helper/chksum.h |  1 -
 helper/{include => }/odp/helper/eth.h    |  2 --
 helper/{include => }/odp/helper/icmp.h   |  1 -
 helper/{include => }/odp/helper/ip.h     |  1 -
 helper/{include => }/odp/helper/ipsec.h  |  1 -
 helper/{include => }/odp/helper/linux.h  | 12 +++---------
 helper/{include => }/odp/helper/ring.h   |  0
 helper/{include => }/odp/helper/tcp.h    |  0
 helper/{include => }/odp/helper/udp.h    |  0
 helper/test/Makefile.am                  |  2 ++
 pkgconfig/libodphelper.pc.in             | 11 +++++++++++
 platform/linux-generic/Makefile.am       | 18 +-----------------
 test/Makefile.inc                        |  4 ++--
 test/validation/Makefile.inc             |  2 +-
 23 files changed, 63 insertions(+), 40 deletions(-)
 create mode 100644 debian/libodphelper-dev.dirs
 create mode 100644 debian/libodphelper-dev.install
 create mode 100644 debian/libodphelper.dirs
 create mode 100644 debian/libodphelper.install
 rename helper/{include => }/odp/helper/chksum.h (99%)
 rename helper/{include => }/odp/helper/eth.h (99%)
 rename helper/{include => }/odp/helper/icmp.h (99%)
 rename helper/{include => }/odp/helper/ip.h (99%)
 rename helper/{include => }/odp/helper/ipsec.h (99%)
 rename helper/{include => }/odp/helper/linux.h (95%)
 rename helper/{include => }/odp/helper/ring.h (100%)
 rename helper/{include => }/odp/helper/tcp.h (100%)
 rename helper/{include => }/odp/helper/udp.h (100%)
 create mode 100644 pkgconfig/libodphelper.pc.in
diff mbox

Patch

diff --git a/.gitignore b/.gitignore
index 6222fd9..4dbf28e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,7 +24,7 @@  missing
 config.log
 config.status
 libtool
-pkgconfig/libodp.pc
+pkgconfig/libodp*.pc
 .deps/
 cscope.out
 tags
diff --git a/Makefile.am b/Makefile.am
index 2c8a9d6..7ce3a3c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,9 +3,10 @@  AUTOMAKE_OPTIONS = foreign
 
 #@with_platform@ works alone in subdir but not as part of a path???
 SUBDIRS = @platform_with_platform@ \
+	  helper \
 	  test \
 	  @platform_with_platform_test@ \
-	  helper \
+	  helper/test \
 	  doc \
 	  example \
 	  scripts
diff --git a/configure.ac b/configure.ac
index 28dad3b..29fcb18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -296,6 +296,7 @@  AC_CONFIG_FILES([Makefile
 		 helper/Makefile
 		 helper/test/Makefile
 		 pkgconfig/libodp.pc
+		 pkgconfig/libodphelper.pc
 		 platform/linux-generic/Makefile
 		 platform/linux-generic/test/pktio/Makefile
 		 scripts/Makefile
diff --git a/debian/libodphelper-dev.dirs b/debian/libodphelper-dev.dirs
new file mode 100644
index 0000000..4418816
--- /dev/null
+++ b/debian/libodphelper-dev.dirs
@@ -0,0 +1,2 @@ 
+usr/lib
+usr/include
diff --git a/debian/libodphelper-dev.install b/debian/libodphelper-dev.install
new file mode 100644
index 0000000..b973af4
--- /dev/null
+++ b/debian/libodphelper-dev.install
@@ -0,0 +1,4 @@ 
+usr/include/*
+usr/lib/*/lib*.so
+usr/lib/*/lib*.a
+usr/lib/*/pkgconfig/*
diff --git a/debian/libodphelper.dirs b/debian/libodphelper.dirs
new file mode 100644
index 0000000..6845771
--- /dev/null
+++ b/debian/libodphelper.dirs
@@ -0,0 +1 @@ 
+usr/lib
diff --git a/debian/libodphelper.install b/debian/libodphelper.install
new file mode 100644
index 0000000..3ddde58
--- /dev/null
+++ b/debian/libodphelper.install
@@ -0,0 +1 @@ 
+usr/lib/*/lib*.so.*
diff --git a/example/Makefile.inc b/example/Makefile.inc
index b3a9706..0911ea9 100644
--- a/example/Makefile.inc
+++ b/example/Makefile.inc
@@ -1,13 +1,13 @@ 
 include $(top_srcdir)/Makefile.inc
 include $(top_srcdir)/platform/@with_platform@/Makefile.inc
 LIB   = $(top_builddir)/lib
-LDADD = $(LIB)/libodp.la
+LDADD = $(LIB)/libodp.la $(LIB)/libodphelper.la
 AM_CFLAGS += \
 	-I$(srcdir) \
 	-I$(top_srcdir)/example \
 	-I$(top_srcdir)/platform/@with_platform@/include \
 	-I$(top_srcdir)/platform/linux-generic/include \
 	-I$(top_srcdir)/include/ \
-	-I$(top_srcdir)/helper/include
+	-I$(top_srcdir)/helper
 
 AM_LDFLAGS += -L$(LIB)
diff --git a/helper/Makefile.am b/helper/Makefile.am
index 02af5b3..0feca9f 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -1 +1,29 @@ 
-SUBDIRS = test
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = $(top_builddir)/pkgconfig/libodphelper.pc
+
+LIB   = $(top_builddir)/lib
+AM_CFLAGS  = -I$(srcdir)/include
+AM_CFLAGS += -I$(top_srcdir)/platform/@with_platform@/include
+AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include
+AM_CFLAGS += -I$(top_srcdir)/include
+
+nobase_include_HEADERS = \
+		  $(srcdir)/odp/helper/ring.h \
+		  $(srcdir)/odp/helper/linux.h \
+		  $(srcdir)/odp/helper/chksum.h\
+		  $(srcdir)/odp/helper/eth.h\
+		  $(srcdir)/odp/helper/icmp.h\
+		  $(srcdir)/odp/helper/ip.h\
+		  $(srcdir)/odp/helper/ipsec.h\
+		  $(srcdir)/odp/helper/tcp.h\
+		  $(srcdir)/odp/helper/udp.h
+
+noinst_HEADERS = \
+		 $(srcdir)/odph_debug.h \
+		 $(srcdir)/odph_pause.h
+
+__LIB__libodphelper_la_SOURCES = \
+					linux.c \
+					ring.c
+
+lib_LTLIBRARIES = $(LIB)/libodphelper.la
diff --git a/helper/include/odp/helper/chksum.h b/helper/odp/helper/chksum.h
similarity index 99%
rename from helper/include/odp/helper/chksum.h
rename to helper/odp/helper/chksum.h
index edb1c98..3c07271 100644
--- a/helper/include/odp/helper/chksum.h
+++ b/helper/odp/helper/chksum.h
@@ -4,7 +4,6 @@ 
  * SPDX-License-Identifier:     BSD-3-Clause
  */
 
-
 /**
  * @file
  *
diff --git a/helper/include/odp/helper/eth.h b/helper/odp/helper/eth.h
similarity index 99%
rename from helper/include/odp/helper/eth.h
rename to helper/odp/helper/eth.h
index f1c164d..5e69cf9 100644
--- a/helper/include/odp/helper/eth.h
+++ b/helper/odp/helper/eth.h
@@ -4,7 +4,6 @@ 
  * SPDX-License-Identifier:     BSD-3-Clause
  */
 
-
 /**
  * @file
  *
@@ -70,7 +69,6 @@  typedef struct ODP_PACKED {
 /** @internal Compile time assert */
 _ODP_STATIC_ASSERT(sizeof(odph_vlanhdr_t) == ODPH_VLANHDR_LEN, "ODPH_VLANHDR_T__SIZE_ERROR");
 
-
 /* Ethernet header Ether Type ('type') values, a selected few */
 #define ODPH_ETHTYPE_IPV4       0x0800 /**< Internet Protocol version 4 */
 #define ODPH_ETHTYPE_ARP        0x0806 /**< Address Resolution Protocol */
diff --git a/helper/include/odp/helper/icmp.h b/helper/odp/helper/icmp.h
similarity index 99%
rename from helper/include/odp/helper/icmp.h
rename to helper/odp/helper/icmp.h
index abcf818..19cb41d 100644
--- a/helper/include/odp/helper/icmp.h
+++ b/helper/odp/helper/icmp.h
@@ -4,7 +4,6 @@ 
  * SPDX-License-Identifier:		 BSD-3-Clause
  */
 
-
 /**
  * @file
  *
diff --git a/helper/include/odp/helper/ip.h b/helper/odp/helper/ip.h
similarity index 99%
rename from helper/include/odp/helper/ip.h
rename to helper/odp/helper/ip.h
index 41408a3..4010461 100644
--- a/helper/include/odp/helper/ip.h
+++ b/helper/odp/helper/ip.h
@@ -4,7 +4,6 @@ 
  * SPDX-License-Identifier:     BSD-3-Clause
  */
 
-
 /**
  * @file
  *
diff --git a/helper/include/odp/helper/ipsec.h b/helper/odp/helper/ipsec.h
similarity index 99%
rename from helper/include/odp/helper/ipsec.h
rename to helper/odp/helper/ipsec.h
index 2565f74..fcbdfda 100644
--- a/helper/include/odp/helper/ipsec.h
+++ b/helper/odp/helper/ipsec.h
@@ -4,7 +4,6 @@ 
  * SPDX-License-Identifier:     BSD-3-Clause
  */
 
-
 /**
  * @file
  *
diff --git a/helper/include/odp/helper/linux.h b/helper/odp/helper/linux.h
similarity index 95%
rename from helper/include/odp/helper/linux.h
rename to helper/odp/helper/linux.h
index 44ee787..eb80020 100644
--- a/helper/include/odp/helper/linux.h
+++ b/helper/odp/helper/linux.h
@@ -4,7 +4,6 @@ 
  * SPDX-License-Identifier:     BSD-3-Clause
  */
 
-
 /**
  * @file
  *
@@ -29,7 +28,7 @@  extern "C" {
 
 /** The thread starting arguments */
 typedef struct {
-	void *(*start_routine) (void *); /**< The function to run */
+	void *(*start_routine)(void *); /**< The function to run */
 	void *arg; /**< The functions arguemnts */
 } odp_start_args_t;
 
@@ -42,7 +41,6 @@  typedef struct {
 	odp_start_args_t *start_args;
 } odph_linux_pthread_t;
 
-
 /** Linux process state information */
 typedef struct {
 	pid_t pid;      /**< Process ID */
@@ -74,8 +72,8 @@  int odph_linux_cpumask_default(odp_cpumask_t *mask, int num);
  * @return Number of threads created
  */
 int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
-			       const odp_cpumask_t *mask,
-			       void *(*start_routine) (void *), void *arg);
+			      const odp_cpumask_t *mask,
+			      void *(*start_routine)(void *), void *arg);
 
 /**
  * Waits pthreads to exit
@@ -88,7 +86,6 @@  int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
  */
 void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num);
 
-
 /**
  * Fork a process
  *
@@ -102,7 +99,6 @@  void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num);
  */
 int odph_linux_process_fork(odph_linux_process_t *proc, int cpu);
 
-
 /**
  * Fork a number of processes
  *
@@ -117,7 +113,6 @@  int odph_linux_process_fork(odph_linux_process_t *proc, int cpu);
 int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl,
 			      const odp_cpumask_t *mask);
 
-
 /**
  * Wait for a number of processes
  *
@@ -131,7 +126,6 @@  int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl,
  */
 int odph_linux_process_wait_n(odph_linux_process_t *proc_tbl, int num);
 
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/helper/include/odp/helper/ring.h b/helper/odp/helper/ring.h
similarity index 100%
rename from helper/include/odp/helper/ring.h
rename to helper/odp/helper/ring.h
diff --git a/helper/include/odp/helper/tcp.h b/helper/odp/helper/tcp.h
similarity index 100%
rename from helper/include/odp/helper/tcp.h
rename to helper/odp/helper/tcp.h
diff --git a/helper/include/odp/helper/udp.h b/helper/odp/helper/udp.h
similarity index 100%
rename from helper/include/odp/helper/udp.h
rename to helper/odp/helper/udp.h
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index 9ac82eb..aed97cc 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -24,4 +24,6 @@  bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
 
 dist_odp_chksum_SOURCES = odp_chksum.c
 dist_odp_thread_SOURCES = odp_thread.c
+odp_thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
 dist_odp_process_SOURCES = odp_process.c
+odp_process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
diff --git a/pkgconfig/libodphelper.pc.in b/pkgconfig/libodphelper.pc.in
new file mode 100644
index 0000000..2993d71
--- /dev/null
+++ b/pkgconfig/libodphelper.pc.in
@@ -0,0 +1,11 @@ 
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libodphelper
+Description: Helper for the ODP packet processing engine
+Version: @VERSION@
+Libs: -L${libdir} -lodphelper
+Libs.private:
+Cflags: -I${includedir}
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 4f2063f..895f74c 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -3,7 +3,7 @@  include $(top_srcdir)/platform/Makefile.inc
 
 AM_CFLAGS +=  -I$(srcdir)/include
 AM_CFLAGS +=  -I$(top_srcdir)/include
-AM_CFLAGS +=  -I$(top_srcdir)/helper/include
+AM_CFLAGS +=  -I$(top_srcdir)/helper
 
 include_HEADERS = \
 		  $(top_srcdir)/include/odp.h
@@ -127,20 +127,6 @@  noinst_HEADERS = \
 		  ${top_srcdir}/platform/linux-generic/include/odp_timer_internal.h \
 		  ${top_srcdir}/platform/linux-generic/Makefile.inc
 
-subdirheadersdir = $(includedir)/odp/helper
-subdirheaders_HEADERS = \
-			$(top_srcdir)/helper/include/odp/helper/chksum.h \
-			$(top_srcdir)/helper/include/odp/helper/eth.h \
-			$(top_srcdir)/helper/include/odp/helper/icmp.h \
-			$(top_srcdir)/helper/include/odp/helper/ip.h \
-			$(top_srcdir)/helper/include/odp/helper/ipsec.h \
-			$(top_srcdir)/helper/include/odp/helper/linux.h \
-			$(top_srcdir)/helper/include/odp/helper/ring.h \
-			$(top_srcdir)/helper/include/odp/helper/tcp.h \
-			$(top_srcdir)/helper/include/odp/helper/udp.h \
-			$(top_srcdir)/helper/odph_debug.h \
-			$(top_srcdir)/helper/odph_pause.h
-
 __LIB__libodp_la_SOURCES = \
 			   odp_barrier.c \
 			   odp_buffer.c \
@@ -151,14 +137,12 @@  __LIB__libodp_la_SOURCES = \
 			   odp_event.c \
 			   odp_init.c \
 			   odp_impl.c \
-			   ../../helper/linux.c \
 			   odp_packet.c \
 			   odp_packet_flags.c \
 			   odp_packet_io.c \
 			   odp_packet_socket.c \
 			   odp_pool.c \
 			   odp_queue.c \
-			   ../../helper/ring.c \
 			   odp_rwlock.c \
 			   odp_schedule.c \
 			   odp_shared_memory.c \
diff --git a/test/Makefile.inc b/test/Makefile.inc
index 1eb6ed5..4a82d5c 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -5,14 +5,14 @@  LIB   = $(top_builddir)/lib
 #in the following line, the libs using the symbols should come before
 #the libs containing them! The includer is given a chance to add things
 #before libodp by setting PRE_LDADD before the inclusion.
-LDADD = $(PRE_LDADD) $(LIB)/libodp.la
+LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp.la
 
 INCFLAGS = -I$(srcdir) \
 	-I$(top_srcdir)/test \
 	-I$(top_srcdir)/platform/@with_platform@/include \
 	-I$(top_srcdir)/platform/linux-generic/include \
 	-I$(top_srcdir)/include \
-	-I$(top_srcdir)/helper/include
+	-I$(top_srcdir)/helper
 AM_CFLAGS += $(INCFLAGS)
 AM_CXXFLAGS = $(INCFLAGS)
 
diff --git a/test/validation/Makefile.inc b/test/validation/Makefile.inc
index 3cdc6a7..31729b8 100644
--- a/test/validation/Makefile.inc
+++ b/test/validation/Makefile.inc
@@ -4,4 +4,4 @@  AM_CFLAGS += -I$(top_srcdir)/test/validation/common
 AM_LDFLAGS += -static
 
 LIBCUNIT_COMMON = $(top_builddir)/test/validation/common/libcunit_common.a
-LIBODP = $(LIB)/libodp.la
+LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp.la