summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/rng-tools
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2016-02-15 20:07:26 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-16 11:15:49 +0000
commit11359e9d5db948cf981228abe0020ce20087eb26 (patch)
treea952b8dd95ae2cc1795cb3bd410db11ccc28fee4 /meta/recipes-support/rng-tools
parenta25858982ae313a13be95692496e4983c7bd4251 (diff)
downloadpoky-11359e9d5db948cf981228abe0020ce20087eb26.tar.gz
rng-tools: fix the build with musl
musl doesn't provide argp, so we need argp-standalone, as we do for uclibc. Rather than passing in -largp via the recipe, patch the configure script to provide an argument for the libargp usage and check for it when needed, and use PACKAGECONFIG. The initial patch to check for libargp and use it if available came from Gentoo. The patches are kept separate despite the second modifying what the first does, in order to keep the history/origin clear. (From OE-Core rev: 94ecc846f9b33fcec039936643c49728eedfefb7) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support/rng-tools')
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/0001-If-the-libc-is-lacking-argp-use-libargp.patch60
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/0002-Add-argument-to-control-the-libargp-dependency.patch92
-rw-r--r--meta/recipes-support/rng-tools/rng-tools_5.bb8
3 files changed, 159 insertions, 1 deletions
diff --git a/meta/recipes-support/rng-tools/rng-tools/0001-If-the-libc-is-lacking-argp-use-libargp.patch b/meta/recipes-support/rng-tools/rng-tools/0001-If-the-libc-is-lacking-argp-use-libargp.patch
new file mode 100644
index 0000000000..4bd9d31c0e
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools/0001-If-the-libc-is-lacking-argp-use-libargp.patch
@@ -0,0 +1,60 @@
1From 99679fda405e535a282f04a4decc2381154a749f Mon Sep 17 00:00:00 2001
2From: Christopher Larson <chris_larson@mentor.com>
3Date: Mon, 15 Feb 2016 15:59:58 -0700
4Subject: [PATCH 1/2] If the libc is lacking argp, use libargp
5
6Patch pulled from Gentoo:
7
8 On glibc systems, argp is provided by libc. However, on
9 uclibc and other systems which lack argp in their C library,
10 argp might be provided by a stand alone library, libargp.
11 This patch adds tests to the build system to find who provides
12 argp.
13
14 X-Gentoo-Bug: 292191
15 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=292191
16 Reported-by: Ed Wildgoose <gentoo@wildgooses.com>
17 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
18
19Upstream-Status: Pending
20Signed-off-by: Christopher Larson <chris_larson@mentor.com>
21---
22 configure.ac | 22 ++++++++++++++++++++++
23 1 file changed, 22 insertions(+)
24
25diff --git a/configure.ac b/configure.ac
26index 27a2dba..04fcd25 100644
27--- a/configure.ac
28+++ b/configure.ac
29@@ -82,6 +82,28 @@ AS_IF(
30 ]
31 )
32
33+dnl First check if we have argp available from libc
34+AC_LINK_IFELSE(
35+ [AC_LANG_PROGRAM(
36+ [#include <argp.h>],
37+ [int argc=1; char *argv[]={"test"}; argp_parse(0,argc,argv,0,0,0); return 0;]
38+ )],
39+ [libc_has_argp="true"],
40+ [libc_has_argp="false"]
41+)
42+
43+dnl If libc doesn't provide argp, then test for libargp
44+if test "$libc_has_argp" = "false" ; then
45+ AC_MSG_WARN("libc does not have argp")
46+ AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])
47+
48+ if test "$have_argp" = "false"; then
49+ AC_MSG_ERROR("no libargp found")
50+ else
51+ LIBS+=" -largp"
52+ fi
53+fi
54+
55 dnl -----------------
56 dnl Configure options
57 dnl -----------------
58--
592.2.1
60
diff --git a/meta/recipes-support/rng-tools/rng-tools/0002-Add-argument-to-control-the-libargp-dependency.patch b/meta/recipes-support/rng-tools/rng-tools/0002-Add-argument-to-control-the-libargp-dependency.patch
new file mode 100644
index 0000000000..1c8a79ce0b
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools/0002-Add-argument-to-control-the-libargp-dependency.patch
@@ -0,0 +1,92 @@
1From afc8712a9e6c72fbd03c36f84ecf8703e5d22a8c Mon Sep 17 00:00:00 2001
2From: Christopher Larson <chris_larson@mentor.com>
3Date: Mon, 15 Feb 2016 16:11:32 -0700
4Subject: [PATCH 2/2] Add argument to control the libargp dependency
5
6This ensures that the builds are always deterministic. If the argument isn't
7passed, the default behavior is to use libargp if the libc doesn't have argp.
8
9Upstream-Status: Pending
10Signed-off-by: Christopher Larson <chris_larson@mentor.com>
11---
12 configure.ac | 55 ++++++++++++++++++++++++++++++++++++-------------------
13 1 file changed, 36 insertions(+), 19 deletions(-)
14
15diff --git a/configure.ac b/configure.ac
16index 04fcd25..11a5321 100644
17--- a/configure.ac
18+++ b/configure.ac
19@@ -32,6 +32,13 @@ AC_ARG_WITH([libgcrypt],
20 [with_libgcrypt=check]
21 )
22
23+AC_ARG_WITH([libargp],
24+ AS_HELP_STRING([--without-libargp],
25+ [Disable libargp support. Systems whose libc lacks argp can use libargp instead. (Default: check if libc lacks argp)]),
26+ [with_libargp=$withval],
27+ [with_libargp=check]
28+)
29+
30 dnl Make sure anyone changing configure.ac/Makefile.am has a clue
31 AM_MAINTAINER_MODE
32
33@@ -82,27 +89,37 @@ AS_IF(
34 ]
35 )
36
37-dnl First check if we have argp available from libc
38-AC_LINK_IFELSE(
39- [AC_LANG_PROGRAM(
40- [#include <argp.h>],
41- [int argc=1; char *argv[]={"test"}; argp_parse(0,argc,argv,0,0,0); return 0;]
42- )],
43- [libc_has_argp="true"],
44- [libc_has_argp="false"]
45+dnl Determine if we need libargp: either user requested, or libc has no argp
46+AS_IF(
47+ [test "x$with_libargp" != "xyes"],
48+ [
49+ AC_LINK_IFELSE(
50+ [AC_LANG_PROGRAM(
51+ [#include <argp.h>],
52+ [int argc=1; char *argv[]={"test"}; argp_parse(0,argc,argv,0,0,0); return 0;]
53+ )],
54+ [need_libargp=no],
55+ [need_libargp=yes
56+ if test "x$with_libargp" = "xno"; then
57+ AC_MSG_FAILURE([libargp disabled and libc does not have argp])
58+ fi]
59+ )
60+ ],
61+ [need_libargp=yes],
62 )
63
64-dnl If libc doesn't provide argp, then test for libargp
65-if test "$libc_has_argp" = "false" ; then
66- AC_MSG_WARN("libc does not have argp")
67- AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])
68-
69- if test "$have_argp" = "false"; then
70- AC_MSG_ERROR("no libargp found")
71- else
72- LIBS+=" -largp"
73- fi
74-fi
75+dnl Check for libargp
76+AS_IF(
77+ [test "x$need_libargp" = "xyes"],
78+ [
79+ AC_CHECK_LIB(
80+ [argp],
81+ [argp_parse],
82+ [LIBS="$LIBS -largp"],
83+ [AC_MSG_FAILURE([libargp not found])]
84+ )
85+ ]
86+)
87
88 dnl -----------------
89 dnl Configure options
90--
912.2.1
92
diff --git a/meta/recipes-support/rng-tools/rng-tools_5.bb b/meta/recipes-support/rng-tools/rng-tools_5.bb
index 67f53f2998..9a19d1cb42 100644
--- a/meta/recipes-support/rng-tools/rng-tools_5.bb
+++ b/meta/recipes-support/rng-tools/rng-tools_5.bb
@@ -1,9 +1,10 @@
1SUMMARY = "Random number generator daemon" 1SUMMARY = "Random number generator daemon"
2LICENSE = "GPLv2" 2LICENSE = "GPLv2"
3LIC_FILES_CHKSUM = "file://COPYING;md5=0b6f033afe6db235e559456585dc8cdc" 3LIC_FILES_CHKSUM = "file://COPYING;md5=0b6f033afe6db235e559456585dc8cdc"
4DEPENDS_append_libc-uclibc = " argp-standalone"
5 4
6SRC_URI = "http://heanet.dl.sourceforge.net/sourceforge/gkernel/${BP}.tar.gz \ 5SRC_URI = "http://heanet.dl.sourceforge.net/sourceforge/gkernel/${BP}.tar.gz \
6 file://0001-If-the-libc-is-lacking-argp-use-libargp.patch \
7 file://0002-Add-argument-to-control-the-libargp-dependency.patch \
7 file://init \ 8 file://init \
8 file://default" 9 file://default"
9 10
@@ -19,6 +20,11 @@ python () {
19 20
20inherit autotools update-rc.d 21inherit autotools update-rc.d
21 22
23PACKAGECONFIG = ""
24PACKAGECONFIG_libc-musl = "libargp"
25PACKAGECONFIG_libc-uclibc = "libargp"
26PACKAGECONFIG[libargp] = "--with-libargp,--without-libargp,argp-standalone,"
27
22RDEPENDS_${PN} = "libgcrypt" 28RDEPENDS_${PN} = "libgcrypt"
23 29
24do_install_append() { 30do_install_append() {