forked from mirrors/nixpkgs
Merge pull request #113263 from lopsided98/samba-cross
samba: fix cross-compilation
This commit is contained in:
commit
fe273ea648
|
@ -81,6 +81,9 @@ stdenv.mkDerivation rec {
|
|||
# asn1 compilers, move them to $dev
|
||||
mv $out/libexec/heimdal/heimdal/* $dev/bin
|
||||
rmdir $out/libexec/heimdal/heimdal
|
||||
|
||||
# compile_et is needed for cross-compiling this package and samba
|
||||
mv lib/com_err/.libs/compile_et $dev/bin
|
||||
'';
|
||||
|
||||
# Issues with hydra
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
, wafHook
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "talloc";
|
||||
version = "2.3.2";
|
||||
|
||||
|
@ -42,6 +42,11 @@ stdenv.mkDerivation (rec {
|
|||
"--builtin-libraries=replace"
|
||||
];
|
||||
|
||||
# python-config from build Python gives incorrect values when cross-compiling.
|
||||
# If python-config is not found, the build falls back to using the sysconfig
|
||||
# module, which works correctly in all cases.
|
||||
PYTHON_CONFIG = "/invalid";
|
||||
|
||||
# this must not be exported before the ConfigurePhase otherwise waf whines
|
||||
preBuild = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
export NIX_CFLAGS_LINK="-no-pie -shared";
|
||||
|
@ -57,9 +62,4 @@ stdenv.mkDerivation (rec {
|
|||
license = licenses.gpl3;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
} // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
|
||||
# python-config from build Python gives incorrect values when cross-compiling.
|
||||
# If python-config is not found, the build falls back to using the sysconfig
|
||||
# module, which works correctly when cross-compiling.
|
||||
PYTHON_CONFIG = "/invalid";
|
||||
})
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ stdenv.mkDerivation rec {
|
|||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3
|
||||
pkg-config
|
||||
wafHook
|
||||
libxslt
|
||||
|
@ -38,6 +39,11 @@ stdenv.mkDerivation rec {
|
|||
"--builtin-libraries=replace"
|
||||
];
|
||||
|
||||
# python-config from build Python gives incorrect values when cross-compiling.
|
||||
# If python-config is not found, the build falls back to using the sysconfig
|
||||
# module, which works correctly in all cases.
|
||||
PYTHON_CONFIG = "/invalid";
|
||||
|
||||
meta = with lib; {
|
||||
description = "The trivial database";
|
||||
longDescription = ''
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
{ lib, stdenv
|
||||
, buildPackages
|
||||
, fetchurl
|
||||
, python
|
||||
, python3
|
||||
, wafHook
|
||||
, pkg-config
|
||||
, bison
|
||||
, flex
|
||||
, perl
|
||||
, libxslt
|
||||
, heimdal
|
||||
, docbook_xsl
|
||||
, rpcgen
|
||||
, fixDarwinDylibNames
|
||||
, docbook_xml_dtd_45
|
||||
, readline
|
||||
|
@ -17,7 +19,6 @@
|
|||
, libarchive
|
||||
, zlib
|
||||
, liburing
|
||||
, fam
|
||||
, gnutls
|
||||
, libunwind
|
||||
, systemd
|
||||
|
@ -59,26 +60,30 @@ stdenv.mkDerivation rec {
|
|||
./patch-source3__libads__kerberos_keytab.c.patch
|
||||
./4.x-no-persistent-install-dynconfig.patch
|
||||
./4.x-fix-makeflags-parsing.patch
|
||||
./build-find-pre-built-heimdal-build-tools-in-case-of-.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3
|
||||
wafHook
|
||||
pkg-config
|
||||
bison
|
||||
flex
|
||||
perl
|
||||
perl.pkgs.ParseYapp
|
||||
libxslt
|
||||
buildPackages.stdenv.cc
|
||||
heimdal
|
||||
docbook_xsl
|
||||
docbook_xml_dtd_45
|
||||
cmocka
|
||||
rpcsvc-proto
|
||||
] ++ optionals stdenv.isDarwin [
|
||||
rpcgen
|
||||
fixDarwinDylibNames
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
python
|
||||
python3
|
||||
readline
|
||||
popt
|
||||
dbus
|
||||
|
@ -86,7 +91,6 @@ stdenv.mkDerivation rec {
|
|||
libbsd
|
||||
libarchive
|
||||
zlib
|
||||
fam
|
||||
libunwind
|
||||
gnutls
|
||||
libtasn1
|
||||
|
@ -102,6 +106,8 @@ stdenv.mkDerivation rec {
|
|||
++ optional enableAcl acl
|
||||
++ optional enablePam pam;
|
||||
|
||||
wafPath = "buildtools/bin/waf";
|
||||
|
||||
postPatch = ''
|
||||
# Removes absolute paths in scripts
|
||||
sed -i 's,/sbin/,,g' ctdb/config/functions
|
||||
|
@ -112,7 +118,11 @@ stdenv.mkDerivation rec {
|
|||
patchShebangs ./buildtools/bin
|
||||
'';
|
||||
|
||||
configureFlags = [
|
||||
preConfigure = ''
|
||||
export PKGCONFIG="$PKG_CONFIG"
|
||||
'';
|
||||
|
||||
wafConfigureFlags = [
|
||||
"--with-static-modules=NONE"
|
||||
"--with-shared-modules=ALL"
|
||||
"--enable-fhs"
|
||||
|
@ -126,7 +136,15 @@ stdenv.mkDerivation rec {
|
|||
"--without-ads"
|
||||
] ++ optional enableProfiling "--with-profiling-data"
|
||||
++ optional (!enableAcl) "--without-acl-support"
|
||||
++ optional (!enablePam) "--without-pam";
|
||||
++ optional (!enablePam) "--without-pam"
|
||||
++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"--bundled-libraries=!asn1_compile,!compile_et"
|
||||
];
|
||||
|
||||
# python-config from build Python gives incorrect values when cross-compiling.
|
||||
# If python-config is not found, the build falls back to using the sysconfig
|
||||
# module, which works correctly in all cases.
|
||||
PYTHON_CONFIG = "/invalid";
|
||||
|
||||
preBuild = ''
|
||||
export MAKEFLAGS="-j $NIX_BUILD_CORES"
|
||||
|
@ -146,6 +164,10 @@ stdenv.mkDerivation rec {
|
|||
patchelf --shrink-rpath "\$BIN";
|
||||
EOF
|
||||
find $out -type f -name \*.so -exec $SHELL -c "$SCRIPT" \;
|
||||
|
||||
# Samba does its own shebang patching, but uses build Python
|
||||
find "$out/bin" -type f -executable -exec \
|
||||
sed -i '1 s^#!${python3.pythonForBuild}/bin/python.*^#!${python3.interpreter}^' {} \;
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
From e002d2ef2688d5433d2bd03aa4d77a0ec5ac4e63 Mon Sep 17 00:00:00 2001
|
||||
From: Uri Simchoni <uri@samba.org>
|
||||
Date: Sun, 20 Oct 2019 00:03:14 +0300
|
||||
Subject: [PATCH] build: find pre-built heimdal build tools in case of embedded
|
||||
heimdal
|
||||
|
||||
This patch fixes the case of finding asn1_compile and compile_et for
|
||||
building embedded heimdal, by setting
|
||||
--bundled-libraries='!asn1_compile,!compile_et' as configure flags.
|
||||
|
||||
The Heimdal build tools compile_et and asn1_compile are needed *only*
|
||||
if we use the embedded heimdal (otherwise we don't build heimdal and
|
||||
use headers that have been generated by those tools elsewhere).
|
||||
|
||||
For cross-compilation with embedded heimdal, it is vital to use host build
|
||||
tools, and so asn1_compile and compile_et must be supplied and not
|
||||
built. One way of doing this would be to set the COMPILE_ET and
|
||||
ASN1_COMPILE env vars to the location of supplied binaries. Another way,
|
||||
which is more commonly used, is to exclude asn1_compile and compile_et
|
||||
from bundled packages via the switch
|
||||
-bundled-libraries='!asn1_compile,!compile_et'. When this is done,
|
||||
the build script searches the path for those tools and sets the
|
||||
ASN1_COMPILE and COMPILE_ET vars accordingly. (this is admittedly
|
||||
kind of a round-about way of doing things but this has become the
|
||||
de-facto standard amongst embedded distro builders).
|
||||
|
||||
In commit 8061983d4882f3ba3f12da71443b035d7b672eec, this process of
|
||||
finding the binaris has been moved to be carried out only in the
|
||||
system heimdal case. As explained above, we only need these tools,
|
||||
and hence the check, in bundled mode.
|
||||
|
||||
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14164
|
||||
|
||||
Signed-off-by: Uri Simchoni <uri@samba.org>
|
||||
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
|
||||
[Bernd: rebased for version 4.11.13]
|
||||
---
|
||||
wscript_configure_embedded_heimdal | 11 +++++++++++
|
||||
wscript_configure_system_heimdal | 11 -----------
|
||||
2 files changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/wscript_configure_embedded_heimdal b/wscript_configure_embedded_heimdal
|
||||
index 8c55ae2a938..4fdae8062c5 100644
|
||||
--- a/wscript_configure_embedded_heimdal
|
||||
+++ b/wscript_configure_embedded_heimdal
|
||||
@@ -1 +1,12 @@
|
||||
conf.RECURSE('source4/heimdal_build')
|
||||
+
|
||||
+def check_system_heimdal_binary(name):
|
||||
+ if conf.LIB_MAY_BE_BUNDLED(name):
|
||||
+ return False
|
||||
+ if not conf.find_program(name, var=name.upper()):
|
||||
+ return False
|
||||
+ conf.define('USING_SYSTEM_%s' % name.upper(), 1)
|
||||
+ return True
|
||||
+
|
||||
+check_system_heimdal_binary("compile_et")
|
||||
+check_system_heimdal_binary("asn1_compile")
|
||||
diff --git a/wscript_configure_system_heimdal b/wscript_configure_system_heimdal
|
||||
index 0ff6dad2f55..f77c177442f 100644
|
||||
--- a/wscript_configure_system_heimdal
|
||||
+++ b/wscript_configure_system_heimdal
|
||||
@@ -37,14 +37,6 @@ def check_system_heimdal_lib(name, functions='', headers='', onlyif=None):
|
||||
conf.define('USING_SYSTEM_%s' % name.upper(), 1)
|
||||
return True
|
||||
|
||||
-def check_system_heimdal_binary(name):
|
||||
- if conf.LIB_MAY_BE_BUNDLED(name):
|
||||
- return False
|
||||
- if not conf.find_program(name, var=name.upper()):
|
||||
- return False
|
||||
- conf.define('USING_SYSTEM_%s' % name.upper(), 1)
|
||||
- return True
|
||||
-
|
||||
check_system_heimdal_lib("com_err", "com_right_r com_err", "com_err.h")
|
||||
|
||||
if check_system_heimdal_lib("roken", "rk_socket_set_reuseaddr", "roken.h"):
|
||||
@@ -96,7 +96,4 @@
|
||||
#if conf.CHECK_BUNDLED_SYSTEM('tommath', checkfunctions='mp_init', headers='tommath.h'):
|
||||
# conf.define('USING_SYSTEM_TOMMATH', 1)
|
||||
|
||||
-check_system_heimdal_binary("compile_et")
|
||||
-check_system_heimdal_binary("asn1_compile")
|
||||
-
|
||||
conf.define('USING_SYSTEM_KRB5', 1)
|
||||
--
|
||||
2.20.1
|
|
@ -20293,10 +20293,7 @@ in
|
|||
|
||||
deadpixi-sam-unstable = callPackage ../applications/editors/deadpixi-sam { };
|
||||
|
||||
samba4 = callPackage ../servers/samba/4.x.nix {
|
||||
rpcgen = netbsd.rpcgen;
|
||||
python = python3;
|
||||
};
|
||||
samba4 = callPackage ../servers/samba/4.x.nix { };
|
||||
|
||||
samba = samba4;
|
||||
|
||||
|
|
Loading…
Reference in a new issue