diff mbox

[1/1] libnfc: make example build optional

Message ID 1338741337-12019-1-git-send-email-s.martin49@gmail.com
State Superseded
Headers show

Commit Message

Samuel Martin June 3, 2012, 4:35 p.m. UTC
This patch converts libnfc to CMAKETARGET and makes example build
optional.

Fixes http://autobuild.buildroot.org/results/a963924b15e185d0144809a98feac52dec0d1cc3

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
 package/libnfc/Config.in                           |    5 +++++
 package/libnfc/libnfc-make-examples-optional.patch |   22 ++++++++++++++++++++
 package/libnfc/libnfc.mk                           |   16 ++++++++++++--
 3 files changed, 41 insertions(+), 2 deletions(-)
 create mode 100644 package/libnfc/libnfc-make-examples-optional.patch

Comments

Peter Korsgaard June 5, 2012, 9:25 p.m. UTC | #1
>>>>> "Samuel" == Samuel Martin <s.martin49@gmail.com> writes:

 Samuel> This patch converts libnfc to CMAKETARGET and makes example build
 Samuel> optional.

What's the reason for using cmake instead of autotools? Is upstream
moving away from autotools or is it just because you prefer cmake?


 Samuel> Fixes http://autobuild.buildroot.org/results/a963924b15e185d0144809a98feac52dec0d1cc3
 Samuel> Signed-off-by: Samuel Martin <s.martin49@gmail.com>

 Samuel> diff --git a/package/libnfc/libnfc-make-examples-optional.patch b/package/libnfc/libnfc-make-examples-optional.patch
 Samuel> new file mode 100644
 Samuel> index 0000000..da8bc3f
 Samuel> --- /dev/null
 Samuel> +++ b/package/libnfc/libnfc-make-examples-optional.patch

Please add a git-style header with description and your signed-off-by to
this patch. Have you submitted it upstream? If not, please consider
doing so.


 Samuel> @@ -0,0 +1,22 @@
 Samuel> +--- libnfc-1.5.1.orig/CMakeLists.txt	2012-06-03 17:57:20.308085744 +0200
 Samuel> ++++ libnfc-1.5.1/CMakeLists.txt	2012-06-03 18:13:37.502570332 +0200
 Samuel> +@@ -27,6 +27,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOUR
 Samuel> + SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
 Samuel> + 
 Samuel> + # Options
 Samuel> ++SET(BUILD_EXAMPLES OFF CACHE BOOL "Build examples")
 Samuel> + SET(LIBNFC_DEBUG_OUTPUT OFF CACHE BOOL "Debug output of communication with the NFC chip")
 Samuel> + IF(LIBNFC_DEBUG_OUTPUT)
 Samuel> +   ADD_DEFINITIONS(-DDEBUG -g3)
 Samuel> +@@ -101,7 +102,10 @@ ENDIF(LIBUSB_INCLUDE_DIRS)
 Samuel> + ADD_SUBDIRECTORY(libnfc)
 Samuel> + ADD_SUBDIRECTORY(include)
 Samuel> + ADD_SUBDIRECTORY(utils)
 Samuel> +-ADD_SUBDIRECTORY(examples)
 Samuel> ++
 Samuel> ++IF(BUILD_EXAMPLES)
 Samuel> ++  ADD_SUBDIRECTORY(examples)
 Samuel> ++ENDIF(BUILD_EXAMPLES)
 Samuel> + 
 Samuel> + # Binary Package
 Samuel> + IF(WIN32)
Samuel Martin June 5, 2012, 11:37 p.m. UTC | #2
Hi Peter,

2012/6/5 Peter Korsgaard <jacmet@uclibc.org>:
>>>>>> "Samuel" == Samuel Martin <s.martin49@gmail.com> writes:
>
>  Samuel> This patch converts libnfc to CMAKETARGET and makes example build
>  Samuel> optional.
>
> What's the reason for using cmake instead of autotools? Is upstream
> moving away from autotools or is it just because you prefer cmake?
Upstream seems provide both build system and, IMHO, it is easier to
hack cmake than autotools.
So, I move to cmake.
BTW, I don't know how to do what i did in 4 lines of cmake using
autotools... I'll look at that then repost.

>
>
>  Samuel> Fixes http://autobuild.buildroot.org/results/a963924b15e185d0144809a98feac52dec0d1cc3
>  Samuel> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>
>  Samuel> diff --git a/package/libnfc/libnfc-make-examples-optional.patch b/package/libnfc/libnfc-make-examples-optional.patch
>  Samuel> new file mode 100644
>  Samuel> index 0000000..da8bc3f
>  Samuel> --- /dev/null
>  Samuel> +++ b/package/libnfc/libnfc-make-examples-optional.patch
>
> Please add a git-style header with description and your signed-off-by to
> this patch. Have you submitted it upstream? If not, please consider
> doing so.
Will do.

Cheers,
diff mbox

Patch

diff --git a/package/libnfc/Config.in b/package/libnfc/Config.in
index 42418e0..3d67d58 100644
--- a/package/libnfc/Config.in
+++ b/package/libnfc/Config.in
@@ -6,3 +6,8 @@  config BR2_PACKAGE_LIBNFC
 	  Public platform independent Near Field Communication (NFC) library.
 
 	  http://www.libnfc.org/
+
+config BR2_PACKAGE_LIBNFC_EXAMPLES
+	bool "build libnfc examples"
+	depends on BR2_PACKAGE_LIBNFC
+	select BR2_PACKAGE_READLINE
diff --git a/package/libnfc/libnfc-make-examples-optional.patch b/package/libnfc/libnfc-make-examples-optional.patch
new file mode 100644
index 0000000..da8bc3f
--- /dev/null
+++ b/package/libnfc/libnfc-make-examples-optional.patch
@@ -0,0 +1,22 @@ 
+--- libnfc-1.5.1.orig/CMakeLists.txt	2012-06-03 17:57:20.308085744 +0200
++++ libnfc-1.5.1/CMakeLists.txt	2012-06-03 18:13:37.502570332 +0200
+@@ -27,6 +27,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOUR
+ SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
+ 
+ # Options
++SET(BUILD_EXAMPLES OFF CACHE BOOL "Build examples")
+ SET(LIBNFC_DEBUG_OUTPUT OFF CACHE BOOL "Debug output of communication with the NFC chip")
+ IF(LIBNFC_DEBUG_OUTPUT)
+   ADD_DEFINITIONS(-DDEBUG -g3)
+@@ -101,7 +102,10 @@ ENDIF(LIBUSB_INCLUDE_DIRS)
+ ADD_SUBDIRECTORY(libnfc)
+ ADD_SUBDIRECTORY(include)
+ ADD_SUBDIRECTORY(utils)
+-ADD_SUBDIRECTORY(examples)
++
++IF(BUILD_EXAMPLES)
++  ADD_SUBDIRECTORY(examples)
++ENDIF(BUILD_EXAMPLES)
+ 
+ # Binary Package
+ IF(WIN32)
diff --git a/package/libnfc/libnfc.mk b/package/libnfc/libnfc.mk
index f1028b1..54cc5f9 100644
--- a/package/libnfc/libnfc.mk
+++ b/package/libnfc/libnfc.mk
@@ -11,6 +11,18 @@  LIBNFC_INSTALL_STAGING = YES
 LIBNFC_DEPENDENCIES = host-pkg-config libusb libusb-compat
 
 # N.B. The acr122 driver requires pcsc-lite.
-LIBNFC_CONF_OPT = --with-drivers=arygon,pn53x_usb
+LIBNFC_CONF_OPT += \
+	-DLIBNFC_DRIVER_ACR122=OFF \
+	-DLIBNFC_DRIVER_ARYGON=ON \
+	-DLIBNFC_DRIVER_PN532_UART=OFF \
+	-DLIBNFC_DRIVER_PN532_USB=ON \
+	-DLIBNFC_SERIAL_AUTOPROBE_ENABLED=OFF
 
-$(eval $(call AUTOTARGETS))
+ifeq ($(BR2_PACKAGE_LIBNFC_EXAMPLES),y)
+LIBNFC_CONF_OPT += -DBUILD_EXAMPLES=ON
+LIBNFC_DEPENDENCIES += readline
+else
+LIBNFC_CONF_OPT += -DBUILD_EXAMPLES=OFF
+endif
+
+$(eval $(call CMAKETARGETS))