2014-12-02 12:47:37

by David Härdeman

[permalink] [raw]
Subject: [PATCH 0/3] nfs-utils build fixes

The following series fixes some of the snafus I encountered when
trying to build nfs-utils for OpenELEC (meaning: lots of static
libraries, cross compile, separate source and build dirs).

Only the first patch is a real patch, the other two are more
a basis for discussion since I'm not sure about the best approach...

---

David Härdeman (3):
nfs-utils: fix gssd build flags
[RFC] nfs-utils: change internal rpcgen to support separate builddir
[RFC] nfs-utils: include headers from srcdir


configure.ac | 3 +++
tools/rpcgen/rpc_main.c | 7 ++++---
utils/gssd/Makefile.am | 4 ++--
3 files changed, 9 insertions(+), 5 deletions(-)

--
David Härdeman


2014-12-02 12:47:37

by David Härdeman

[permalink] [raw]
Subject: [PATCH 1/3] nfs-utils: fix gssd build flags

The tirpc variable is another library to add, not additional flags.
I'm guessing the reason this hasn't caused problems is that it only
shows up with static libraries.

Signed-off-by: David Härdeman <[email protected]>
---
utils/gssd/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/gssd/Makefile.am b/utils/gssd/Makefile.am
index 9835117..e12a480 100644
--- a/utils/gssd/Makefile.am
+++ b/utils/gssd/Makefile.am
@@ -46,8 +46,8 @@ gssd_SOURCES = \
write_bytes.h

gssd_LDADD = ../../support/nfs/libnfs.a \
- $(RPCSECGSS_LIBS) $(KRBLIBS) $(GSSAPI_LIBS)
-gssd_LDFLAGS = $(KRBLDFLAGS) $(LIBTIRPC)
+ $(RPCSECGSS_LIBS) $(KRBLIBS) $(GSSAPI_LIBS) $(LIBTIRPC)
+gssd_LDFLAGS = $(KRBLDFLAGS)

gssd_CFLAGS = $(AM_CFLAGS) $(CFLAGS) \
$(RPCSECGSS_CFLAGS) $(KRBCFLAGS) $(GSSAPI_CFLAGS)


2014-12-08 17:33:24

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH 1/3] nfs-utils: fix gssd build flags



On 12/02/2014 07:39 AM, David Härdeman wrote:
> The tirpc variable is another library to add, not additional flags.
> I'm guessing the reason this hasn't caused problems is that it only
> shows up with static libraries.
>
> Signed-off-by: David Härdeman <[email protected]>
Committed...

steved.
> ---
> utils/gssd/Makefile.am | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/utils/gssd/Makefile.am b/utils/gssd/Makefile.am
> index 9835117..e12a480 100644
> --- a/utils/gssd/Makefile.am
> +++ b/utils/gssd/Makefile.am
> @@ -46,8 +46,8 @@ gssd_SOURCES = \
> write_bytes.h
>
> gssd_LDADD = ../../support/nfs/libnfs.a \
> - $(RPCSECGSS_LIBS) $(KRBLIBS) $(GSSAPI_LIBS)
> -gssd_LDFLAGS = $(KRBLDFLAGS) $(LIBTIRPC)
> + $(RPCSECGSS_LIBS) $(KRBLIBS) $(GSSAPI_LIBS) $(LIBTIRPC)
> +gssd_LDFLAGS = $(KRBLDFLAGS)
>
> gssd_CFLAGS = $(AM_CFLAGS) $(CFLAGS) \
> $(RPCSECGSS_CFLAGS) $(KRBCFLAGS) $(GSSAPI_CFLAGS)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2014-12-02 12:47:37

by David Härdeman

[permalink] [raw]
Subject: [PATCH 2/3] [RFC] nfs-utils: change internal rpcgen to support separate builddir

rpcgen uses absolute paths (based on the input) when generating the
output files, thus breaking builds using a separate build directory.
I'm not sure this is the best (or even an acceptable) approach, but
it works for me...consider it an RFC :)
---
tools/rpcgen/rpc_main.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/rpcgen/rpc_main.c b/tools/rpcgen/rpc_main.c
index 28aa60c..f81da47 100644
--- a/tools/rpcgen/rpc_main.c
+++ b/tools/rpcgen/rpc_main.c
@@ -44,6 +44,7 @@ static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
+#include <libgen.h>
#include "rpc_parse.h"
#include "rpc_util.h"
#include "rpc_scan.h"
@@ -389,7 +390,7 @@ c_output(char *infile, char *define, int extend, char *outfile)
open_output(infile, outfilename);
add_warning();
if (infile && (include = extendfile(infile, ".h"))) {
- f_print(fout, "#include \"%s\"\n", include);
+ f_print(fout, "#include \"%s\"\n", basename(include));
free(include);
/* .h file already contains rpc/rpc.h */
} else
@@ -523,7 +524,7 @@ s_output(int argc, char **argv, char *infile, char *define, int extend,
open_output(infile, outfilename);
add_warning();
if (infile && (include = extendfile(infile, ".h"))) {
- f_print(fout, "#include \"%s\"\n", include);
+ f_print(fout, "#include \"%s\"\n", basename(include));
free(include);
} else
f_print(fout, "#include <rpc/rpc.h>\n");
@@ -630,7 +631,7 @@ l_output(char *infile, char *define, int extend, char *outfile)
if (Cflag)
f_print (fout, "#include <memory.h> /* for memset */\n");
if (infile && (include = extendfile(infile, ".h"))) {
- f_print(fout, "#include \"%s\"\n", include);
+ f_print(fout, "#include \"%s\"\n", basename(include));
free(include);
} else
f_print(fout, "#include <rpc/rpc.h>\n");


2014-12-08 17:36:19

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH 2/3] [RFC] nfs-utils: change internal rpcgen to support separate builddir



On 12/02/2014 07:39 AM, David Härdeman wrote:
> rpcgen uses absolute paths (based on the input) when generating the
> output files, thus breaking builds using a separate build directory.
> I'm not sure this is the best (or even an acceptable) approach, but
> it works for me...consider it an RFC :)
I went ahead committed this as well... I didn't realized the internal
rpcgen was being used... So if makes life easier for you... so be it! :-)

steved.

> ---
> tools/rpcgen/rpc_main.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tools/rpcgen/rpc_main.c b/tools/rpcgen/rpc_main.c
> index 28aa60c..f81da47 100644
> --- a/tools/rpcgen/rpc_main.c
> +++ b/tools/rpcgen/rpc_main.c
> @@ -44,6 +44,7 @@ static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
> #include <unistd.h>
> #include <ctype.h>
> #include <errno.h>
> +#include <libgen.h>
> #include "rpc_parse.h"
> #include "rpc_util.h"
> #include "rpc_scan.h"
> @@ -389,7 +390,7 @@ c_output(char *infile, char *define, int extend, char *outfile)
> open_output(infile, outfilename);
> add_warning();
> if (infile && (include = extendfile(infile, ".h"))) {
> - f_print(fout, "#include \"%s\"\n", include);
> + f_print(fout, "#include \"%s\"\n", basename(include));
> free(include);
> /* .h file already contains rpc/rpc.h */
> } else
> @@ -523,7 +524,7 @@ s_output(int argc, char **argv, char *infile, char *define, int extend,
> open_output(infile, outfilename);
> add_warning();
> if (infile && (include = extendfile(infile, ".h"))) {
> - f_print(fout, "#include \"%s\"\n", include);
> + f_print(fout, "#include \"%s\"\n", basename(include));
> free(include);
> } else
> f_print(fout, "#include <rpc/rpc.h>\n");
> @@ -630,7 +631,7 @@ l_output(char *infile, char *define, int extend, char *outfile)
> if (Cflag)
> f_print (fout, "#include <memory.h> /* for memset */\n");
> if (infile && (include = extendfile(infile, ".h"))) {
> - f_print(fout, "#include \"%s\"\n", include);
> + f_print(fout, "#include \"%s\"\n", basename(include));
> free(include);
> } else
> f_print(fout, "#include <rpc/rpc.h>\n");
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2014-12-02 12:47:37

by David Härdeman

[permalink] [raw]
Subject: [PATCH 3/3] [RFC] nfs-utils: include headers from srcdir

Some of the headers in ./support/include get generated as part of the
build process (and end up in the build dir hierarchy) and some are
not (so they stay in the srcdir hierarchy).

That means the build breaks when using a separate build dir. I'm not sure
what the best way to make sure that -I$(top_srcdir)/support/include is
defined everywhere is. Consider this a basis for discussion rather than
a real patch. Someone with more autoconf-fu can surely come up with a better
solution.
---
configure.ac | 3 +++
1 file changed, 3 insertions(+)

diff --git a/configure.ac b/configure.ac
index e3af723..5d0ab2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -479,6 +479,9 @@ my_am_cflags="-Wall -Wextra -Wstrict-prototypes $ARCHFLAGS -pipe"

AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])

+AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_srcdir)/support/include"
+AC_SUBST([AM_CPPFLAGS])
+
# Make sure that $ACLOCAL_FLAGS are used during a rebuild
AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])



2014-12-08 18:04:34

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH 3/3] [RFC] nfs-utils: include headers from srcdir



On 12/02/2014 07:40 AM, David Härdeman wrote:
> Some of the headers in ./support/include get generated as part of the
> build process (and end up in the build dir hierarchy) and some are
> not (so they stay in the srcdir hierarchy).
>
> That means the build breaks when using a separate build dir. I'm not sure
> what the best way to make sure that -I$(top_srcdir)/support/include is
> defined everywhere is. Consider this a basis for discussion rather than
> a real patch. Someone with more autoconf-fu can surely come up with a better
> solution.
This one I didn't commit because it caused -I../../support/include to
defined twice. That path gets define ing Makefile.in file in the
DEFAULT_INCLUDES macro.

steved.

> ---
> configure.ac | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index e3af723..5d0ab2b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -479,6 +479,9 @@ my_am_cflags="-Wall -Wextra -Wstrict-prototypes $ARCHFLAGS -pipe"
>
> AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
>
> +AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_srcdir)/support/include"
> +AC_SUBST([AM_CPPFLAGS])
> +
> # Make sure that $ACLOCAL_FLAGS are used during a rebuild
> AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2014-12-08 20:45:34

by David Härdeman

[permalink] [raw]
Subject: Re: [PATCH 3/3] [RFC] nfs-utils: include headers from srcdir

On Mon, Dec 08, 2014 at 01:04:28PM -0500, Steve Dickson wrote:
>On 12/02/2014 07:40 AM, David H?rdeman wrote:
>> Some of the headers in ./support/include get generated as part of the
>> build process (and end up in the build dir hierarchy) and some are
>> not (so they stay in the srcdir hierarchy).
>>
>> That means the build breaks when using a separate build dir. I'm not sure
>> what the best way to make sure that -I$(top_srcdir)/support/include is
>> defined everywhere is. Consider this a basis for discussion rather than
>> a real patch. Someone with more autoconf-fu can surely come up with a better
>> solution.
>
>This one I didn't commit because it caused -I../../support/include to
>defined twice. That path gets define ing Makefile.in file in the
>DEFAULT_INCLUDES macro.

But only if $(top_srcdir) == $(top_builddir)

So, for example, if you do:

cd nfs-utils
mkdir tmp
cd tmp
../configure
make

Then you'd have -I../../support/include and -I../../../support/include?

I think this is in line with:
http://www.gnu.org/software/automake/manual/html_node/Program-Variables.html

See the section on AM_CPPFLAGS...

An example from Gutenprint2:
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS)

Though a more "complete" fix might be to either have a common include
file, or a non-recursive make :)

--
David H?rdeman