summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Kang <kai.kang@windriver.com>2016-07-19 15:39:20 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-26 08:56:27 +0100
commitb6aa976756e24994a2c60086e5b8c9455c16bbb1 (patch)
tree01b50682f62e1d35049975ddc89f792953e6361d
parentb7a2688ac86056c1128876beb0d70be68849371b (diff)
downloadpoky-b6aa976756e24994a2c60086e5b8c9455c16bbb1.tar.gz
quota: make compile pass when disable rpc
When 'rpc' is not in PACKAGECONFIG, option '--disable-rpc' is passed to configure and then compile fails. Backport patches to make quota build successfully. Update fcntl.patch that part of the patches are added by 0002-Allow-building-on-systems-that-do-not-have-rpc-heade.patch. (From OE-Core rev: aff36f4c4d241707744fe13b6310fb894610a0f3) Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/quota/quota/0001-Use-NGROUPS_MAX-instead-of-NGROUPS.patch83
-rw-r--r--meta/recipes-extended/quota/quota/0002-Allow-building-on-systems-that-do-not-have-rpc-heade.patch153
-rw-r--r--meta/recipes-extended/quota/quota/0003-Don-t-build-rpc.rquotad-when-disable-rpc-was-request.patch62
-rw-r--r--meta/recipes-extended/quota/quota/0004-Fix-warnings-due-to-missing-stdlib.h.patch46
-rw-r--r--meta/recipes-extended/quota/quota/fcntl.patch28
-rw-r--r--meta/recipes-extended/quota/quota_4.03.bb8
6 files changed, 350 insertions, 30 deletions
diff --git a/meta/recipes-extended/quota/quota/0001-Use-NGROUPS_MAX-instead-of-NGROUPS.patch b/meta/recipes-extended/quota/quota/0001-Use-NGROUPS_MAX-instead-of-NGROUPS.patch
new file mode 100644
index 0000000000..6fb2daf532
--- /dev/null
+++ b/meta/recipes-extended/quota/quota/0001-Use-NGROUPS_MAX-instead-of-NGROUPS.patch
@@ -0,0 +1,83 @@
1Upstream-Status: Backport
2
3Signed-off-by: Kai Kang <kai.kang@windriver.com>
4---
5From feca6d2e55d992bbe176ee8faa734c105eb1b2e1 Mon Sep 17 00:00:00 2001
6From: Theodore Ts'o <tytso@mit.edu>
7Date: Tue, 29 Mar 2016 20:48:05 -0400
8Subject: [PATCH] Use NGROUPS_MAX instead of NGROUPS
9
10NGRROUPS_MAX is what is defined by SuSv3; NGROUPS is not guaranteed by
11any standard, but is just an ancient BSD'ism. Since Android's bionic
12libc has the former but not the latter, let's use NGROUPS_MAX instead.
13
14Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15Signed-off-by: Jan Kara <jack@suse.cz>
16---
17 quota.c | 5 +++--
18 quotaops.c | 5 +++--
19 2 files changed, 6 insertions(+), 4 deletions(-)
20
21diff --git a/quota.c b/quota.c
22index 049dac4..e195ead 100644
23--- a/quota.c
24+++ b/quota.c
25@@ -48,6 +48,7 @@
26 #include <errno.h>
27 #include <string.h>
28 #include <unistd.h>
29+#include <limits.h>
30 #ifdef RPC
31 #include <rpc/rpc.h>
32 #include "rquota.h"
33@@ -296,7 +297,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt)
34 int main(int argc, char **argv)
35 {
36 int ngroups;
37- gid_t gidset[NGROUPS], *gidsetp;
38+ gid_t gidset[NGROUPS_MAX], *gidsetp;
39 int i, ret;
40 struct option long_opts[] = {
41 { "help", 0, NULL, 'h' },
42@@ -405,7 +406,7 @@ int main(int argc, char **argv)
43 ret |= showquotas(USRQUOTA, getuid(), argc, argv);
44 if (flags & FL_GROUP) {
45 ngroups = sysconf(_SC_NGROUPS_MAX);
46- if (ngroups > NGROUPS) {
47+ if (ngroups > NGROUPS_MAX) {
48 gidsetp = malloc(ngroups * sizeof(gid_t));
49 if (!gidsetp)
50 die(1, _("Gid set allocation (%d): %s\n"), ngroups, strerror(errno));
51diff --git a/quotaops.c b/quotaops.c
52index 136aec3..590dc1b 100644
53--- a/quotaops.c
54+++ b/quotaops.c
55@@ -51,6 +51,7 @@
56 #include <unistd.h>
57 #include <time.h>
58 #include <ctype.h>
59+#include <limits.h>
60
61 #if defined(RPC)
62 #include "rquota.h"
63@@ -97,7 +98,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
64 #if defined(BSD_BEHAVIOUR)
65 int j, ngroups;
66 uid_t euid;
67- gid_t gidset[NGROUPS], *gidsetp;
68+ gid_t gidset[NGROUPS_MAX], *gidsetp;
69 #endif
70
71 for (i = 0; handles[i]; i++) {
72@@ -115,7 +116,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
73 if (geteuid() == 0)
74 break;
75 ngroups = sysconf(_SC_NGROUPS_MAX);
76- if (ngroups > NGROUPS) {
77+ if (ngroups > NGROUPS_MAX) {
78 gidsetp = malloc(ngroups * sizeof(gid_t));
79 if (!gidsetp) {
80 gid2group(id, name);
81--
822.6.1
83
diff --git a/meta/recipes-extended/quota/quota/0002-Allow-building-on-systems-that-do-not-have-rpc-heade.patch b/meta/recipes-extended/quota/quota/0002-Allow-building-on-systems-that-do-not-have-rpc-heade.patch
new file mode 100644
index 0000000000..6cea548edc
--- /dev/null
+++ b/meta/recipes-extended/quota/quota/0002-Allow-building-on-systems-that-do-not-have-rpc-heade.patch
@@ -0,0 +1,153 @@
1Upstream-Status: Backport
2
3Signed-off-by: Kai Kang <kai.kang@windriver.com>
4---
5From f30e1ada8326463cc0af048afa058bc2f1dc9370 Mon Sep 17 00:00:00 2001
6From: Theodore Ts'o <tytso@mit.edu>
7Date: Tue, 29 Mar 2016 20:48:04 -0400
8Subject: [PATCH] Allow building on systems that do not have rpc header files
9
10Android's bionic C library doesn't have Sun RPC support.
11
12Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13Signed-off-by: Jan Kara <jack@suse.cz>
14---
15 Makefile.am | 30 ++++++++++++++++--------------
16 quotaops.c | 2 ++
17 setquota.c | 2 ++
18 3 files changed, 20 insertions(+), 14 deletions(-)
19
20diff --git a/Makefile.am b/Makefile.am
21index 6d7ea0e..82db99f 100644
22--- a/Makefile.am
23+++ b/Makefile.am
24@@ -1,7 +1,5 @@
25 ACLOCAL_AMFLAGS = -I m4
26
27-BUILT_SOURCES = rquota.h rquota.c rquota_clnt.c
28-
29 docdir = $(datadir)/doc/@PACKAGE@
30 doc_DATA = \
31 README.mailserver \
32@@ -12,11 +10,6 @@ doc_DATA = \
33 doc/quotas.preformated \
34 doc/quotas-1.eps
35
36-rpcsvcdir = $(includedir)/rpcsvc
37-rpcsvc_DATA = \
38- rquota.h \
39- rquota.x
40-
41 sysconf_DATA = \
42 warnquota.conf \
43 quotatab \
44@@ -35,15 +28,12 @@ man_MANS = \
45 quota.1 \
46 quot.8 \
47 repquota.8 \
48- rpc.rquotad.8 \
49 rquota.3 \
50 setquota.8 \
51 warnquota.conf.5 \
52 warnquota.8 \
53 xqmstats.8
54
55-CLEANFILES = rquota.c rquota.h rquota_clnt.c
56-
57 SUBDIRS = po
58
59 EXTRA_DIST = \
60@@ -55,9 +45,15 @@ EXTRA_DIST = \
61 Changelog \
62 ldap-scripts
63
64-noinst_LIBRARIES = \
65- libquota.a \
66- librpcclient.a
67+noinst_LIBRARIES = libquota.a
68+
69+if WITH_RPC
70+rpcsvcdir = $(includedir)/rpcsvc
71+rpcsvc_DATA = \
72+ rquota.h \
73+ rquota.x
74+
75+noinst_LIBRARIES += librpcclient.a
76
77 librpcclient_a_SOURCES = \
78 rquota.c \
79@@ -67,8 +63,10 @@ librpcclient_a_SOURCES = \
80 rquota_clnt.c
81 librpcclient_a_CFLAGS = -Wno-unused
82
83-if WITH_RPC
84 RPCLIBS = librpcclient.a
85+BUILT_SOURCES = rquota.h rquota.c rquota_clnt.c
86+CLEANFILES = rquota.c rquota.h rquota_clnt.c
87+man_MANS += rpc.rquotad.8
88 endif
89
90 libquota_a_SOURCES = \
91@@ -217,6 +215,7 @@ convertquota_LDADD = \
92 libquota.a \
93 $(RPCLIBS)
94
95+if WITH_RPC
96 rpc_rquotad_SOURCES = \
97 rquota_server.c \
98 rquota_svc.c \
99@@ -225,6 +224,7 @@ rpc_rquotad_LDADD = \
100 libquota.a \
101 $(WRAP_LIBS) \
102 $(RPCLIBS)
103+endif
104
105 quota_nld_SOURCES = quota_nld.c
106 quota_nld_CFLAGS = \
107@@ -236,6 +236,7 @@ quota_nld_LDADD = \
108 $(DBUS_LIBS) \
109 $(LIBNL3_LIBS)
110
111+if WITH_RPC
112 # ------------------
113 # Rpcgen conversions
114 # ------------------
115@@ -250,6 +251,7 @@ quota_nld_LDADD = \
116 rquota_clnt.c: rquota.x
117 @rm -f $@
118 @$(RPCGEN) -l -o $@ $<
119+endif
120
121 # --------
122 # Quotaoff
123diff --git a/quotaops.c b/quotaops.c
124index 47ef9a7..136aec3 100644
125--- a/quotaops.c
126+++ b/quotaops.c
127@@ -34,7 +34,9 @@
128
129 #include "config.h"
130
131+#if defined(RPC)
132 #include <rpc/rpc.h>
133+#endif
134 #include <sys/types.h>
135 #include <sys/stat.h>
136 #include <sys/file.h>
137diff --git a/setquota.c b/setquota.c
138index 51d7b3c..8ecd9c3 100644
139--- a/setquota.c
140+++ b/setquota.c
141@@ -7,7 +7,9 @@
142
143 #include "config.h"
144
145+#if defined(RPC)
146 #include <rpc/rpc.h>
147+#endif
148 #include <sys/types.h>
149 #include <errno.h>
150 #include <stdio.h>
151--
1522.6.1
153
diff --git a/meta/recipes-extended/quota/quota/0003-Don-t-build-rpc.rquotad-when-disable-rpc-was-request.patch b/meta/recipes-extended/quota/quota/0003-Don-t-build-rpc.rquotad-when-disable-rpc-was-request.patch
new file mode 100644
index 0000000000..1455384129
--- /dev/null
+++ b/meta/recipes-extended/quota/quota/0003-Don-t-build-rpc.rquotad-when-disable-rpc-was-request.patch
@@ -0,0 +1,62 @@
1Upstream-Status: Backport
2
3Signed-off-by: Kai Kang <kai.kang@windriver.com>
4---
5From c7a76237e7a51a69d0236ebfc191e462f805cf4e Mon Sep 17 00:00:00 2001
6From: Lars Wendler <polynomial-c@gentoo.org>
7Date: Mon, 15 Feb 2016 14:42:14 +0100
8Subject: [PATCH] Don't build rpc.rquotad when --disable-rpc was requested.
9
10This fixes a buch of undefined references:
11
12x86_64-pc-linux-gnu-gcc -march=native -mtune=native -O2 -pipe -D_GNU_SOURCE -Wa
13ll -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -pie -Wl,-O1 -Wl,--hash-st
14yle=gnu -Wl,--sort-common -Wl,--as-needed -o rpc.rquotad rquota_server.o rquota_
15svc.o svc_socket.o libquota.a
16rquota_svc.o: In function `rquotaprog_2':
17rquota_svc.c:(.text+0x1d3): undefined reference to `xdr_setquota_rslt'
18rquota_svc.c:(.text+0x1da): undefined reference to `xdr_ext_setquota_args'
19rquota_svc.c:(.text+0x2b2): undefined reference to `xdr_setquota_rslt'
20rquota_svc.c:(.text+0x2b9): undefined reference to `xdr_ext_setquota_args'
21rquota_svc.c:(.text+0x2ff): undefined reference to `xdr_getquota_rslt'
22rquota_svc.c:(.text+0x306): undefined reference to `xdr_ext_getquota_args'
23rquota_svc.c:(.text+0x31a): undefined reference to `xdr_getquota_rslt'
24rquota_svc.c:(.text+0x321): undefined reference to `xdr_ext_getquota_args'
25rquota_svc.o: In function `rquotaprog_1':
26rquota_svc.c:(.text+0x3f3): undefined reference to `xdr_setquota_rslt'
27rquota_svc.c:(.text+0x3fa): undefined reference to `xdr_setquota_args'
28rquota_svc.c:(.text+0x4d2): undefined reference to `xdr_setquota_rslt'
29rquota_svc.c:(.text+0x4d9): undefined reference to `xdr_setquota_args'
30rquota_svc.c:(.text+0x51f): undefined reference to `xdr_getquota_rslt'
31rquota_svc.c:(.text+0x526): undefined reference to `xdr_getquota_args'
32rquota_svc.c:(.text+0x53a): undefined reference to `xdr_getquota_rslt'
33rquota_svc.c:(.text+0x541): undefined reference to `xdr_getquota_args'
34collect2: error: ld returned 1 exit status
35Makefile:901: recipe for target 'rpc.rquotad' failed
36
37Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
38Signed-off-by: Jan Kara <jack@suse.cz>
39---
40 Makefile.am | 5 ++++-
41 1 file changed, 4 insertions(+), 1 deletion(-)
42
43diff --git a/Makefile.am b/Makefile.am
44index 77f8400..6d7ea0e 100644
45--- a/Makefile.am
46+++ b/Makefile.am
47@@ -116,8 +116,11 @@ sbin_PROGRAMS = \
48 xqmstats \
49 edquota \
50 setquota \
51- convertquota \
52+ convertquota
53+if WITH_RPC
54+sbin_PROGRAMS += \
55 rpc.rquotad
56+endif
57 if WITH_NETLINK
58 sbin_PROGRAMS += \
59 quota_nld
60--
612.6.1
62
diff --git a/meta/recipes-extended/quota/quota/0004-Fix-warnings-due-to-missing-stdlib.h.patch b/meta/recipes-extended/quota/quota/0004-Fix-warnings-due-to-missing-stdlib.h.patch
new file mode 100644
index 0000000000..bdb4ceaadd
--- /dev/null
+++ b/meta/recipes-extended/quota/quota/0004-Fix-warnings-due-to-missing-stdlib.h.patch
@@ -0,0 +1,46 @@
1Upstream-Status: Backport
2
3Signed-off-by: Kai Kang <kai.kang@windriver.com>
4---
5From c4b56ee58b9b76d2598535cf6109a27b22e60abe Mon Sep 17 00:00:00 2001
6From: Jan Kara <jack@suse.cz>
7Date: Wed, 30 Mar 2016 10:21:13 +0200
8Subject: [PATCH] Fix warnings due to missing stdlib.h
9
10When compiling without RPC, we do not get stdlib.h automatically
11included via other includes and thus miss some function definitions.
12Include stdlib.h explicitely.
13
14Signed-off-by: Jan Kara <jack@suse.cz>
15---
16 quotaops.c | 1 +
17 setquota.c | 1 +
18 2 files changed, 2 insertions(+)
19
20diff --git a/quotaops.c b/quotaops.c
21index 590dc1b..56cf622 100644
22--- a/quotaops.c
23+++ b/quotaops.c
24@@ -52,6 +52,7 @@
25 #include <time.h>
26 #include <ctype.h>
27 #include <limits.h>
28+#include <stdlib.h>
29
30 #if defined(RPC)
31 #include "rquota.h"
32diff --git a/setquota.c b/setquota.c
33index 8ecd9c3..421631e 100644
34--- a/setquota.c
35+++ b/setquota.c
36@@ -17,6 +17,7 @@
37 #include <getopt.h>
38 #include <time.h>
39 #include <ctype.h>
40+#include <stdlib.h>
41
42 #if defined(RPC)
43 #include "rquota.h"
44--
452.6.1
46
diff --git a/meta/recipes-extended/quota/quota/fcntl.patch b/meta/recipes-extended/quota/quota/fcntl.patch
index 27e60fd07d..2d37971321 100644
--- a/meta/recipes-extended/quota/quota/fcntl.patch
+++ b/meta/recipes-extended/quota/quota/fcntl.patch
@@ -59,20 +59,6 @@ Index: quota-tools/dqblk_v2.h
59 #include <sys/types.h> 59 #include <sys/types.h>
60 #include "quota_tree.h" 60 #include "quota_tree.h"
61 61
62Index: quota-tools/quotaops.c
63===================================================================
64--- quota-tools.orig/quotaops.c
65+++ quota-tools/quotaops.c
66@@ -34,7 +34,9 @@
67
68 #include "config.h"
69
70+#if defined(RPC)
71 #include <rpc/rpc.h>
72+#endif
73 #include <sys/types.h>
74 #include <sys/stat.h>
75 #include <sys/file.h>
76Index: quota-tools/rquota_client.c 62Index: quota-tools/rquota_client.c
77=================================================================== 63===================================================================
78--- quota-tools.orig/rquota_client.c 64--- quota-tools.orig/rquota_client.c
@@ -97,17 +83,3 @@ Index: quota-tools/rquota_client.c
97 #include "common.h" 83 #include "common.h"
98 #include "quotaio.h" 84 #include "quotaio.h"
99 #include "quotasys.h" 85 #include "quotasys.h"
100Index: quota-tools/setquota.c
101===================================================================
102--- quota-tools.orig/setquota.c
103+++ quota-tools/setquota.c
104@@ -7,7 +7,9 @@
105
106 #include "config.h"
107
108+#if defined(RPC)
109 #include <rpc/rpc.h>
110+#endif
111 #include <sys/types.h>
112 #include <errno.h>
113 #include <stdio.h>
diff --git a/meta/recipes-extended/quota/quota_4.03.bb b/meta/recipes-extended/quota/quota_4.03.bb
index 4a980464b1..22aab4147b 100644
--- a/meta/recipes-extended/quota/quota_4.03.bb
+++ b/meta/recipes-extended/quota/quota_4.03.bb
@@ -12,6 +12,10 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/project/linuxquota/quota-tools/${PV}/quota-${PV
12 file://0001-Do-not-accidentaly-override-commandline-passed-CFLAG.patch \ 12 file://0001-Do-not-accidentaly-override-commandline-passed-CFLAG.patch \
13 file://fcntl.patch \ 13 file://fcntl.patch \
14 file://remove_non_posix_types.patch \ 14 file://remove_non_posix_types.patch \
15 file://0001-Use-NGROUPS_MAX-instead-of-NGROUPS.patch \
16 file://0002-Allow-building-on-systems-that-do-not-have-rpc-heade.patch \
17 file://0003-Don-t-build-rpc.rquotad-when-disable-rpc-was-request.patch \
18 file://0004-Fix-warnings-due-to-missing-stdlib.h.patch \
15 " 19 "
16SRC_URI_append_libc-musl = " file://replace_getrpcbynumber_r.patch" 20SRC_URI_append_libc-musl = " file://replace_getrpcbynumber_r.patch"
17 21
@@ -25,8 +29,8 @@ DEPENDS = "gettext-native e2fsprogs libnl dbus"
25 29
26inherit autotools-brokensep gettext pkgconfig 30inherit autotools-brokensep gettext pkgconfig
27 31
28CFLAGS += "-I${STAGING_INCDIR}/tirpc" 32CFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'rpc', '-I${STAGING_INCDIR}/tirpc', '', d)}"
29LDFLAGS += "-ltirpc" 33LDFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'rpc', '-ltirpc', '', d)}"
30ASNEEDED = "" 34ASNEEDED = ""
31 35
32PACKAGECONFIG ??= "tcp-wrappers rpc bsd" 36PACKAGECONFIG ??= "tcp-wrappers rpc bsd"