···11+From 9287fcfc36ed9f2bb936ec2253244f60df80711f Mon Sep 17 00:00:00 2001
22+From: Pascal Bach <pascal.bach@nextrem.ch>
33+Date: Wed, 22 Sep 2021 09:42:42 +0200
44+Subject: [PATCH] build: find pre-built heimdal build tools in case of embedded
55+ heimdal
66+77+This patch fixes the case of finding asn1_compile and compile_et for
88+building embedded heimdal, by setting
99+--bundled-libraries='!asn1_compile,!compile_et' as configure flags.
1010+1111+The Heimdal build tools compile_et and asn1_compile are needed *only*
1212+if we use the embedded heimdal (otherwise we don't build heimdal and
1313+use headers that have been generated by those tools elsewhere).
1414+1515+For cross-compilation with embedded heimdal, it is vital to use host build
1616+tools, and so asn1_compile and compile_et must be supplied and not
1717+built. One way of doing this would be to set the COMPILE_ET and
1818+ASN1_COMPILE env vars to the location of supplied binaries. Another way,
1919+which is more commonly used, is to exclude asn1_compile and compile_et
2020+from bundled packages via the switch
2121+-bundled-libraries='!asn1_compile,!compile_et'. When this is done,
2222+the build script searches the path for those tools and sets the
2323+ASN1_COMPILE and COMPILE_ET vars accordingly. (this is admittedly
2424+kind of a round-about way of doing things but this has become the
2525+de-facto standard amongst embedded distro builders).
2626+2727+In commit 8061983d4882f3ba3f12da71443b035d7b672eec, this process of
2828+finding the binaris has been moved to be carried out only in the
2929+system heimdal case. As explained above, we only need these tools,
3030+and hence the check, in bundled mode.
3131+3232+BUG: https://bugzilla.samba.org/show_bug.cgi?id=14164
3333+3434+Signed-off-by: Uri Simchoni <uri@samba.org>
3535+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
3636+[Bachp: rebased for version 4.15.0]
3737+3838+# Conflicts:
3939+# wscript_configure_system_heimdal
4040+---
4141+ wscript_configure_embedded_heimdal | 11 +++++++++++
4242+ wscript_configure_system_heimdal | 11 -----------
4343+ 2 files changed, 11 insertions(+), 11 deletions(-)
4444+4545+diff --git a/wscript_configure_embedded_heimdal b/wscript_configure_embedded_heimdal
4646+index 6066f2b39d7..e92cabad65f 100644
4747+--- a/wscript_configure_embedded_heimdal
4848++++ b/wscript_configure_embedded_heimdal
4949+@@ -6,3 +6,14 @@ if not conf.env['BISON']:
5050+5151+ conf.define('USING_EMBEDDED_HEIMDAL', 1)
5252+ conf.RECURSE('third_party/heimdal_build')
5353++
5454++def check_system_heimdal_binary(name):
5555++ if conf.LIB_MAY_BE_BUNDLED(name):
5656++ return False
5757++ if not conf.find_program(name, var=name.upper()):
5858++ return False
5959++ conf.define('USING_SYSTEM_%s' % name.upper(), 1)
6060++ return True
6161++
6262++check_system_heimdal_binary("compile_et")
6363++check_system_heimdal_binary("asn1_compile")
6464+diff --git a/wscript_configure_system_heimdal b/wscript_configure_system_heimdal
6565+index 6033dad08dc..c0a9bb95e87 100644
6666+--- a/wscript_configure_system_heimdal
6767++++ b/wscript_configure_system_heimdal
6868+@@ -37,14 +37,6 @@ def check_system_heimdal_lib(name, functions='', headers='', onlyif=None):
6969+ conf.define('USING_SYSTEM_%s' % name.upper(), 1)
7070+ return True
7171+7272+-def check_system_heimdal_binary(name):
7373+- if conf.LIB_MAY_BE_BUNDLED(name):
7474+- return False
7575+- if not conf.find_program(name, var=name.upper()):
7676+- return False
7777+- conf.define('USING_SYSTEM_%s' % name.upper(), 1)
7878+- return True
7979+-
8080+ check_system_heimdal_lib("com_err", "com_right_r com_err", "com_err.h")
8181+8282+ if check_system_heimdal_lib("roken", "rk_socket_set_reuseaddr", "roken.h"):
8383+@@ -86,9 +78,6 @@ finally:
8484+ #if conf.CHECK_BUNDLED_SYSTEM('tommath', checkfunctions='mp_init', headers='tommath.h'):
8585+ # conf.define('USING_SYSTEM_TOMMATH', 1)
8686+8787+-check_system_heimdal_binary("compile_et")
8888+-check_system_heimdal_binary("asn1_compile")
8989+-
9090+ conf.env.KRB5_VENDOR = 'heimdal'
9191+ conf.define('USING_SYSTEM_KRB5', 1)
9292+ conf.define('USING_SYSTEM_HEIMDAL', 1)
9393+--
9494+2.37.3
9595+