0001-build-systems-make-example-build-optional.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From 40a4871b171293d98acb40cf54be9ee9b78a3244 Mon Sep 17 00:00:00 2001
  2. From: Samuel Martin <s.martin49@gmail.com>
  3. Date: Wed, 6 Jun 2012 00:49:25 +0200
  4. Subject: [PATCH 1/1] build systems: make example build optional
  5. This patch makes example build optional for both cmake and autotools build
  6. systems.
  7. In order to keep the former behavior, example build is enabled by default.
  8. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  9. diff -Nurp a/CMakeLists.txt b/CMakeLists.txt
  10. --- a/CMakeLists.txt 2013-12-08 18:51:01.000000000 +0000
  11. +++ b/CMakeLists.txt 2014-01-08 12:51:42.435096403 +0000
  12. @@ -39,6 +39,7 @@ IF(LIBNFC_ENVVARS)
  13. ADD_DEFINITIONS(-DENVVARS)
  14. ENDIF(LIBNFC_ENVVARS)
  15. +SET(BUILD_EXAMPLES ON CACHE BOOL "Build examples")
  16. SET(LIBNFC_DEBUG_MODE OFF CACHE BOOL "Debug mode")
  17. IF(LIBNFC_DEBUG_MODE)
  18. ADD_DEFINITIONS(-DDEBUG)
  19. @@ -155,7 +156,10 @@ ENDIF(WIN32)
  20. ADD_SUBDIRECTORY(libnfc)
  21. ADD_SUBDIRECTORY(include)
  22. ADD_SUBDIRECTORY(utils)
  23. -ADD_SUBDIRECTORY(examples)
  24. +
  25. +IF(BUILD_EXAMPLES)
  26. + ADD_SUBDIRECTORY(examples)
  27. +ENDIF(BUILD_EXAMPLES)
  28. # Binary Package
  29. IF(WIN32)
  30. diff -Nurp a/Makefile.am b/Makefile.am
  31. --- a/Makefile.am 2013-12-08 18:51:01.000000000 +0000
  32. +++ b/Makefile.am 2014-01-08 12:52:12.807018593 +0000
  33. @@ -2,7 +2,13 @@ ACLOCAL_AMFLAGS = -I m4
  34. AM_CFLAGS = $(LIBNFC_CFLAGS)
  35. -SUBDIRS = libnfc utils examples include contrib cmake test
  36. +SUBDIRS = libnfc utils
  37. +
  38. +if EXAMPLE_ENABLED
  39. +SUBDIRS += examples
  40. +endif
  41. +
  42. +SUBDIRS += include contrib cmake test
  43. pkgconfigdir = $(libdir)/pkgconfig
  44. pkgconfig_DATA = libnfc.pc
  45. diff -Nurp a/configure.ac b/configure.ac
  46. --- a/configure.ac 2013-12-08 18:51:01.000000000 +0000
  47. +++ b/configure.ac 2014-01-08 12:53:02.054872564 +0000
  48. @@ -142,6 +142,14 @@ then
  49. fi
  50. AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes])
  51. +# Example build (default: yes)
  52. +AC_ARG_ENABLE([example],AS_HELP_STRING([--enable-example],[Enable example build.]),[enable_example=$enableval],[enable_example="yes"])
  53. +
  54. +AC_MSG_CHECKING(for example build)
  55. +AC_MSG_RESULT($enable_example)
  56. +
  57. +AM_CONDITIONAL(EXAMPLE_ENABLED, [test x"$enable_example" = xyes])
  58. +
  59. # Dependencies
  60. PKG_CONFIG_REQUIRES=""
  61. @@ -160,7 +168,10 @@ if test x$ac_cv_with_cutter = xyes -a x$
  62. fi
  63. AM_CONDITIONAL([WITH_CUTTER], [test "$ac_cv_use_cutter" != "no"])
  64. +if test x"$enable_example" = "xyes"
  65. +then
  66. AC_CHECK_READLINE
  67. +fi
  68. # Help us to write great code ;-)
  69. CFLAGS="$CFLAGS -Wall -pedantic -Wextra"