lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #201093 from lopsided98/samba-cross

samba: fix cross-compilation

authored by

ajs124 and committed by
GitHub
ae332579 86018bc8

+114 -4
+19 -4
pkgs/servers/samba/4.x.nix
··· 1 1 { lib, stdenv 2 2 , buildPackages 3 3 , fetchurl 4 + , wafHook 4 5 , pkg-config 5 6 , bison 6 7 , flex 7 8 , perl 8 9 , libxslt 9 - , heimdal 10 10 , docbook_xsl 11 11 , fixDarwinDylibNames 12 12 , docbook_xml_dtd_45 ··· 20 20 , gnutls 21 21 , libunwind 22 22 , systemd 23 + , samba 23 24 , jansson 24 25 , libtasn1 25 26 , tdb 27 + , libxcrypt 26 28 , cmocka 27 29 , rpcsvc-proto 28 30 , bash ··· 59 61 ./patch-source3__libads__kerberos_keytab.c.patch 60 62 ./4.x-no-persistent-install-dynconfig.patch 61 63 ./4.x-fix-makeflags-parsing.patch 64 + ./build-find-pre-built-heimdal-build-tools-in-case-of-.patch 62 65 ]; 63 66 64 67 nativeBuildInputs = [ 65 68 python3Packages.python 69 + wafHook 66 70 pkg-config 67 71 bison 68 72 flex ··· 71 75 perl.pkgs.JSON 72 76 libxslt 73 77 buildPackages.stdenv.cc 74 - heimdal 75 78 docbook_xsl 76 79 docbook_xml_dtd_45 77 80 cmocka 78 81 rpcsvc-proto 79 - ] ++ optionals stdenv.isDarwin [ 82 + ] ++ optional (stdenv.buildPlatform != stdenv.hostPlatform) samba # asn1_compile/compile_et 83 + ++ optionals stdenv.isDarwin [ 80 84 fixDarwinDylibNames 81 85 ]; 86 + 87 + wafPath = "buildtools/bin/waf"; 82 88 83 89 buildInputs = [ 84 90 bash ··· 95 101 gnutls 96 102 libtasn1 97 103 tdb 104 + libxcrypt 98 105 ] ++ optionals stdenv.isLinux [ liburing systemd ] 99 106 ++ optionals enableLDAP [ openldap.dev python3Packages.markdown ] 100 107 ++ optional (enablePrinting && stdenv.isLinux) cups ··· 118 125 119 126 preConfigure = '' 120 127 export PKGCONFIG="$PKG_CONFIG" 128 + export PYTHONHASHSEED=1 121 129 ''; 122 130 123 - configureFlags = [ 131 + wafConfigureFlags = [ 124 132 "--with-static-modules=NONE" 125 133 "--with-shared-modules=ALL" 126 134 "--enable-fhs" ··· 151 159 152 160 preBuild = '' 153 161 export MAKEFLAGS="-j $NIX_BUILD_CORES" 162 + ''; 163 + 164 + # Save asn1_compile and compile_et so they are available to run on the build 165 + # platform when cross-compiling 166 + postInstall = optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' 167 + mkdir -p "$dev/bin" 168 + cp bin/asn1_compile bin/compile_et "$dev/bin" 154 169 ''; 155 170 156 171 # Some libraries don't have /lib/samba in RPATH but need it.
+95
pkgs/servers/samba/build-find-pre-built-heimdal-build-tools-in-case-of-.patch
··· 1 + From 9287fcfc36ed9f2bb936ec2253244f60df80711f Mon Sep 17 00:00:00 2001 2 + From: Pascal Bach <pascal.bach@nextrem.ch> 3 + Date: Wed, 22 Sep 2021 09:42:42 +0200 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 + 38 + # Conflicts: 39 + # wscript_configure_system_heimdal 40 + --- 41 + wscript_configure_embedded_heimdal | 11 +++++++++++ 42 + wscript_configure_system_heimdal | 11 ----------- 43 + 2 files changed, 11 insertions(+), 11 deletions(-) 44 + 45 + diff --git a/wscript_configure_embedded_heimdal b/wscript_configure_embedded_heimdal 46 + index 6066f2b39d7..e92cabad65f 100644 47 + --- a/wscript_configure_embedded_heimdal 48 + +++ b/wscript_configure_embedded_heimdal 49 + @@ -6,3 +6,14 @@ if not conf.env['BISON']: 50 + 51 + conf.define('USING_EMBEDDED_HEIMDAL', 1) 52 + conf.RECURSE('third_party/heimdal_build') 53 + + 54 + +def check_system_heimdal_binary(name): 55 + + if conf.LIB_MAY_BE_BUNDLED(name): 56 + + return False 57 + + if not conf.find_program(name, var=name.upper()): 58 + + return False 59 + + conf.define('USING_SYSTEM_%s' % name.upper(), 1) 60 + + return True 61 + + 62 + +check_system_heimdal_binary("compile_et") 63 + +check_system_heimdal_binary("asn1_compile") 64 + diff --git a/wscript_configure_system_heimdal b/wscript_configure_system_heimdal 65 + index 6033dad08dc..c0a9bb95e87 100644 66 + --- a/wscript_configure_system_heimdal 67 + +++ b/wscript_configure_system_heimdal 68 + @@ -37,14 +37,6 @@ def check_system_heimdal_lib(name, functions='', headers='', onlyif=None): 69 + conf.define('USING_SYSTEM_%s' % name.upper(), 1) 70 + return True 71 + 72 + -def check_system_heimdal_binary(name): 73 + - if conf.LIB_MAY_BE_BUNDLED(name): 74 + - return False 75 + - if not conf.find_program(name, var=name.upper()): 76 + - return False 77 + - conf.define('USING_SYSTEM_%s' % name.upper(), 1) 78 + - return True 79 + - 80 + check_system_heimdal_lib("com_err", "com_right_r com_err", "com_err.h") 81 + 82 + if check_system_heimdal_lib("roken", "rk_socket_set_reuseaddr", "roken.h"): 83 + @@ -86,9 +78,6 @@ finally: 84 + #if conf.CHECK_BUNDLED_SYSTEM('tommath', checkfunctions='mp_init', headers='tommath.h'): 85 + # conf.define('USING_SYSTEM_TOMMATH', 1) 86 + 87 + -check_system_heimdal_binary("compile_et") 88 + -check_system_heimdal_binary("asn1_compile") 89 + - 90 + conf.env.KRB5_VENDOR = 'heimdal' 91 + conf.define('USING_SYSTEM_KRB5', 1) 92 + conf.define('USING_SYSTEM_HEIMDAL', 1) 93 + -- 94 + 2.37.3 95 +