summaryrefslogtreecommitdiff
path: root/source3/modules/wscript_build
diff options
context:
space:
mode:
authorAliaksei Karaliou <akaraliou@panasas.com>2019-01-28 03:17:07 -0500
committerAndrew Bartlett <abartlet@samba.org>2019-02-11 07:43:31 +0100
commit193bb824e2c4d40a88ce226814162357765c0c52 (patch)
tree5736bf36b4b2a3a2e5a8db01fdd5024d43e68c4d /source3/modules/wscript_build
parentd21fc7d8b86b0cddc619ffe528d9cd93eeedbb0b (diff)
downloadsamba-193bb824e2c4d40a88ce226814162357765c0c52.tar.gz
s3:modules: Fix compilation of nfs41acl_xdr.c when building outside src
If the Samba build directory is outside its source directory, generation of nfs41acl_xdr.c by rpcgen leads to improper include paths to nfs41acl.h. This happens because rpcgen is designed to produce its generated file in the same directory as the input template. If the build directory is not located under the source directory, this relative path will be invalid and the header will not be found. Example: src dir is ~/samba-src bld dir is ~/samba-bld rpcgen will use path ../../samba-src/source3/modules/nfs41acl.x running from ~/samba-bld/default and nfs41acl_xdr.c will contain: #include "../../samba-src/source3/modules/nfs41acl.h" This behaviour is fixed through an intermediate copy of the input file to the build directory so that rpcgen receives the path as if located in src. Also now we avoid generation of nfs41acl_xdr.c when HAVE_RPC_XDR_H is not defined because it will not be used as part of the vfs_nfs4acl_xattr module. Signed-off-by: Aliaksei Karaliou <akaraliou@panasas.com> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/modules/wscript_build')
-rw-r--r--source3/modules/wscript_build24
1 files changed, 17 insertions, 7 deletions
diff --git a/source3/modules/wscript_build b/source3/modules/wscript_build
index c666aa07a2c..30347e0fc6d 100644
--- a/source3/modules/wscript_build
+++ b/source3/modules/wscript_build
@@ -242,13 +242,6 @@ bld.SAMBA3_MODULE('vfs_zfsacl',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_zfsacl'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_zfsacl'))
-xdr_buf_hack = 'sed -e "s@^\([ \t]*register int32_t \*buf\);@\\1 = buf;@"'
-
-bld.SAMBA_GENERATOR('nfs41acl-xdr-c',
- source='nfs41acl.x',
- target='nfs41acl_xdr.c',
- rule='rpcgen -c ${SRC} | ' + xdr_buf_hack + ' > ${TGT}')
-
bld.SAMBA_GENERATOR('nfs41acl-h',
source='nfs41acl.x',
target='nfs41acl.h',
@@ -261,6 +254,23 @@ vfs_nfs4acl_xattr_source = '''
'''
if bld.CONFIG_SET("HAVE_RPC_XDR_H"):
+ xdr_buf_hack = 'sed -e "s@^\([ \t]*register int32_t \*buf\);@\\1 = buf;@"'
+
+ # By default rpcgen assumes that the input file, generated header and
+ # source file are located in the same directory, which is extracted from
+ # the provided path to the input file.
+ # However if the build directory is not under the source tree, ${SRC} will
+ # be a long relative path through a common parent directory, resulting
+ # in an invalid path used in #include for the header.
+ # In order to fix that, the input file is first copied to the output build
+ # directory and then rpcgen is called with the proper path.
+ bld.SAMBA_GENERATOR('nfs41acl-xdr-c',
+ source='nfs41acl.x',
+ target='nfs41acl_xdr.c',
+ rule='cp -f ${SRC} ${TGT[0].parent} && rpcgen -c ' \
+ '${TGT[0].path_from(tsk.get_cwd())[:-len(tsk.outputs[0].name)] + tsk.inputs[0].name} | ' + \
+ xdr_buf_hack + ' > ${TGT}')
+
vfs_nfs4acl_xattr_source += ' nfs41acl_xdr.c'
bld.SAMBA3_MODULE('vfs_nfs4acl_xattr',