1From e002d2ef2688d5433d2bd03aa4d77a0ec5ac4e63 Mon Sep 17 00:00:00 2001
2From: Uri Simchoni <uri@samba.org>
3Date: Sun, 20 Oct 2019 00:03:14 +0300
4Subject: [PATCH] build: find pre-built heimdal build tools in case of embedded
5 heimdal
6
7This patch fixes the case of finding asn1_compile and compile_et for
8building embedded heimdal, by setting
9--bundled-libraries='!asn1_compile,!compile_et' as configure flags.
10
11The Heimdal build tools compile_et and asn1_compile are needed *only*
12if we use the embedded heimdal (otherwise we don't build heimdal and
13use headers that have been generated by those tools elsewhere).
14
15For cross-compilation with embedded heimdal, it is vital to use host build
16tools, and so asn1_compile and compile_et must be supplied and not
17built. One way of doing this would be to set the COMPILE_ET and
18ASN1_COMPILE env vars to the location of supplied binaries. Another way,
19which is more commonly used, is to exclude asn1_compile and compile_et
20from bundled packages via the switch
21-bundled-libraries='!asn1_compile,!compile_et'. When this is done,
22the build script searches the path for those tools and sets the
23ASN1_COMPILE and COMPILE_ET vars accordingly. (this is admittedly
24kind of a round-about way of doing things but this has become the
25de-facto standard amongst embedded distro builders).
26
27In commit 8061983d4882f3ba3f12da71443b035d7b672eec, this process of
28finding the binaris has been moved to be carried out only in the
29system heimdal case. As explained above, we only need these tools,
30and hence the check, in bundled mode.
31
32BUG: https://bugzilla.samba.org/show_bug.cgi?id=14164
33
34Signed-off-by: Uri Simchoni <uri@samba.org>
35Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
36[Bernd: rebased for version 4.11.13]
37---
38 wscript_configure_embedded_heimdal | 11 +++++++++++
39 wscript_configure_system_heimdal   | 11 -----------
40 2 files changed, 11 insertions(+), 11 deletions(-)
41
42diff --git a/wscript_configure_embedded_heimdal b/wscript_configure_embedded_heimdal
43index 8c55ae2a938..4fdae8062c5 100644
44--- a/wscript_configure_embedded_heimdal
45+++ b/wscript_configure_embedded_heimdal
46@@ -1 +1,12 @@
47 conf.RECURSE('source4/heimdal_build')
48+
49+def check_system_heimdal_binary(name):
50+    if conf.LIB_MAY_BE_BUNDLED(name):
51+        return False
52+    if not conf.find_program(name, var=name.upper()):
53+        return False
54+    conf.define('USING_SYSTEM_%s' % name.upper(), 1)
55+    return True
56+
57+check_system_heimdal_binary("compile_et")
58+check_system_heimdal_binary("asn1_compile")
59diff --git a/wscript_configure_system_heimdal b/wscript_configure_system_heimdal
60index 0ff6dad2f55..f77c177442f 100644
61--- a/wscript_configure_system_heimdal
62+++ b/wscript_configure_system_heimdal
63@@ -37,14 +37,6 @@ def check_system_heimdal_lib(name, functions='', headers='', onlyif=None):
64     conf.define('USING_SYSTEM_%s' % name.upper(), 1)
65     return True
66
67-def check_system_heimdal_binary(name):
68-    if conf.LIB_MAY_BE_BUNDLED(name):
69-        return False
70-    if not conf.find_program(name, var=name.upper()):
71-        return False
72-    conf.define('USING_SYSTEM_%s' % name.upper(), 1)
73-    return True
74-
75 check_system_heimdal_lib("com_err", "com_right_r com_err", "com_err.h")
76
77 if check_system_heimdal_lib("roken", "rk_socket_set_reuseaddr", "roken.h"):
78@@ -96,7 +96,4 @@
79 #if conf.CHECK_BUNDLED_SYSTEM('tommath', checkfunctions='mp_init', headers='tommath.h'):
80 #    conf.define('USING_SYSTEM_TOMMATH', 1)
81
82-check_system_heimdal_binary("compile_et")
83-check_system_heimdal_binary("asn1_compile")
84-
85 conf.define('USING_SYSTEM_KRB5', 1)
86--
872.20.1
88