samba: resurrect cross compilation patch

+64
+1
pkgs/servers/samba/4.x.nix
··· 78 ./patch-source3__libads__kerberos_keytab.c.patch 79 ./4.x-no-persistent-install-dynconfig.patch 80 ./4.x-fix-makeflags-parsing.patch 81 (fetchpatch { 82 # workaround for https://github.com/NixOS/nixpkgs/issues/303436 83 name = "samba-reproducible-builds.patch";
··· 78 ./patch-source3__libads__kerberos_keytab.c.patch 79 ./4.x-no-persistent-install-dynconfig.patch 80 ./4.x-fix-makeflags-parsing.patch 81 + ./build-find-pre-built-heimdal-build-tools-in-case-of-.patch 82 (fetchpatch { 83 # workaround for https://github.com/NixOS/nixpkgs/issues/303436 84 name = "samba-reproducible-builds.patch";
+63
pkgs/servers/samba/build-find-pre-built-heimdal-build-tools-in-case-of-.patch
···
··· 1 + From 48f7e6d66e2850088b8922024641173776222242 Mon Sep 17 00:00:00 2001 2 + From: Nick Cao <nickcao@nichi.co> 3 + Date: Thu, 21 Nov 2024 15:30:00 -0500 4 + Subject: [PATCH] build: find pre-built heimdal build tools in case of embedded 5 + heimdal 6 + 7 + This patch fixes the case of finding asn1_compile and compile_et for 8 + building embedded heimdal, by setting 9 + --bundled-libraries='!asn1_compile,!compile_et' as configure flags. 10 + 11 + The Heimdal build tools compile_et and asn1_compile are needed *only* 12 + if we use the embedded heimdal (otherwise we don't build heimdal and 13 + use headers that have been generated by those tools elsewhere). 14 + 15 + For cross-compilation with embedded heimdal, it is vital to use host build 16 + tools, and so asn1_compile and compile_et must be supplied and not 17 + built. One way of doing this would be to set the COMPILE_ET and 18 + ASN1_COMPILE env vars to the location of supplied binaries. Another way, 19 + which is more commonly used, is to exclude asn1_compile and compile_et 20 + from bundled packages via the switch 21 + -bundled-libraries='!asn1_compile,!compile_et'. When this is done, 22 + the build script searches the path for those tools and sets the 23 + ASN1_COMPILE and COMPILE_ET vars accordingly. (this is admittedly 24 + kind of a round-about way of doing things but this has become the 25 + de-facto standard amongst embedded distro builders). 26 + 27 + In commit 8061983d4882f3ba3f12da71443b035d7b672eec, this process of 28 + finding the binaris has been moved to be carried out only in the 29 + system heimdal case. As explained above, we only need these tools, 30 + and hence the check, in bundled mode. 31 + 32 + BUG: https://bugzilla.samba.org/show_bug.cgi?id=14164 33 + 34 + Signed-off-by: Uri Simchoni <uri@samba.org> 35 + Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> 36 + [Bachp: rebased for version 4.15.0] 37 + [Mats: rebased for version 4.18.5] 38 + --- 39 + wscript_configure_embedded_heimdal | 11 +++++++++++ 40 + 1 file changed, 11 insertions(+) 41 + 42 + diff --git a/wscript_configure_embedded_heimdal b/wscript_configure_embedded_heimdal 43 + index 45f47721de..6c5a4bcf01 100644 44 + --- a/wscript_configure_embedded_heimdal 45 + +++ b/wscript_configure_embedded_heimdal 46 + @@ -13,3 +13,14 @@ conf.RECURSE('third_party/heimdal_build') 47 + # when this will be available also in 48 + # system libraries... 49 + conf.define('HAVE_CLIENT_GSS_C_CHANNEL_BOUND_FLAG', 1) 50 + + 51 + +def check_system_heimdal_binary(name): 52 + + if conf.LIB_MAY_BE_BUNDLED(name): 53 + + return False 54 + + if not conf.find_program(name, var=name.upper()): 55 + + return False 56 + + conf.define('USING_SYSTEM_%s' % name.upper(), 1) 57 + + return True 58 + + 59 + +check_system_heimdal_binary("compile_et") 60 + +check_system_heimdal_binary("asn1_compile") 61 + -- 62 + 2.47.0 63 +