Merge pull request #58504 from symphorien/static-proot

Static proot, wafHook cross compilation
This commit is contained in:
Dmitry Kalinkin 2019-04-13 12:04:32 -04:00 committed by GitHub
commit 59c81160e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 44 additions and 42 deletions

View File

@ -2754,9 +2754,9 @@ addEnvHooks "$hostOffset" myBashFunction
<listitem>
<para>
Overrides the configure, build, and install phases. This will run the
"waf" script used by many projects. If waf doesnt exist, it will copy
the version of waf available in Nixpkgs wafFlags can be used to pass
flags to the waf script.
"waf" script used by many projects. If wafPath (default ./waf) doesnt
exist, it will copy the version of waf available in Nixpkgs. wafFlags can
be used to pass flags to the waf script.
</para>
</listitem>
</varlistentry>

View File

@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
patchShebangs ./tools/
'';
configureFlags = [
wafConfigureFlags = [
"--optimize"
"--docs"
"--with-backends=jack,alsa,dummy"

View File

@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
zita-resampler curl
];
configureFlags = [
wafConfigureFlags = [
"--shared-lib"
"--no-desktop-update"
"--enable-nls"

View File

@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
export SWORD_HOME=${sword};
'';
configureFlags= [ "--enable-webkit2" ];
wafConfigureFlags = [ "--enable-webkit2" ];
meta = with stdenv.lib; {
description = "A GTK Bible study tool";

View File

@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
sed -i '/target[ ]*= "ttl2c"/ ilib=["boost_system"],' tools/wscript_build
'';
configureFlags = [
wafConfigureFlags = [
"--boost-includes=${boost.dev}/include"
"--boost-libs=${boost.out}/lib"
];

View File

@ -13,7 +13,7 @@ stdenv.mkDerivation {
};
nativeBuildInputs = [ pkgconfig wafHook ];
buildInputs = [ openssl doxygen boost sqlite python pythonPackages.sphinx];
configureFlags = [
wafConfigureFlags = [
"--with-openssl=${openssl.dev}"
"--boost-includes=${boost.dev}/include"
"--boost-libs=${boost.out}/lib"

View File

@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
patchShebangs doc/ns3_html_theme/get_version.sh
'';
configureFlags = with stdenv.lib; [
wafConfigureFlags = with stdenv.lib; [
"--enable-modules=${stdenv.lib.concatStringsSep "," modules}"
"--with-python=${pythonEnv.interpreter}"
]

View File

@ -1,6 +1,6 @@
{ stdenv, fetchurl, python, pkgconfig, readline, libxslt
, docbook_xsl, docbook_xml_dtd_42, fixDarwinDylibNames
, buildPackages
, wafHook
}:
stdenv.mkDerivation rec {
@ -11,23 +11,22 @@ stdenv.mkDerivation rec {
sha256 = "1kk76dyav41ip7ddbbf04yfydb4jvywzi2ps0z2vla56aqkn11di";
};
nativeBuildInputs = [ pkgconfig fixDarwinDylibNames python
nativeBuildInputs = [ pkgconfig fixDarwinDylibNames python wafHook
docbook_xsl docbook_xml_dtd_42 ];
buildInputs = [ readline libxslt ];
prePatch = ''
patchShebangs buildtools/bin/waf
'';
wafPath = "buildtools/bin/waf";
configureFlags = [
wafConfigureFlags = [
"--enable-talloc-compat1"
"--bundled-libraries=NONE"
"--builtin-libraries=replace"
] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"--cross-compile"
"--cross-execute=${stdenv.hostPlatform.emulator buildPackages}"
];
configurePlatforms = [];
# this must not be exported before the ConfigurePhase otherwise waf whines
preBuild = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
export NIX_CFLAGS_LINK="-no-pie -shared";
'';
postInstall = ''
${stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc_[0-9]*.o

View File

@ -1,5 +1,5 @@
{ stdenv, fetchurl, python2, pkgconfig, readline, libxslt
, docbook_xsl, docbook_xml_dtd_42, buildPackages
{ stdenv, fetchurl, wafHook, pkgconfig, readline, libxslt
, docbook_xsl, docbook_xml_dtd_42
}:
stdenv.mkDerivation rec {
@ -10,23 +10,17 @@ stdenv.mkDerivation rec {
sha256 = "1ibcz466xwk1x6xvzlgzd5va4lyrjzm3rnjak29kkwk7cmhw4gva";
};
nativeBuildInputs = [ pkgconfig python2 ];
nativeBuildInputs = [ pkgconfig wafHook ];
buildInputs = [
readline libxslt docbook_xsl docbook_xml_dtd_42
];
preConfigure = ''
patchShebangs buildtools/bin/waf
'';
wafPath = "buildtools/bin/waf";
configureFlags = [
wafConfigureFlags = [
"--bundled-libraries=NONE"
"--builtin-libraries=replace"
] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"--cross-compile"
"--cross-execute=${stdenv.hostPlatform.emulator buildPackages}"
];
configurePlatforms = [ ];
meta = with stdenv.lib; {
description = "The trivial database";

View File

@ -1,20 +1,23 @@
wafConfigurePhase() {
runHook preConfigure
if ! [ -f ./waf ]; then
cp @waf@ waf
if ! [ -f "${wafPath:=./waf}" ]; then
echo "copying waf to $wafPath..."
cp @waf@ "$wafPath"
fi
if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then
configureFlags="${prefixKey:---prefix=}$prefix $configureFlags"
if [ -z "${dontAddPrefix:-}" ] && [ -n "$prefix" ]; then
wafConfigureFlags="${prefixKey:---prefix=}$prefix $wafConfigureFlags"
fi
local flagsArray=(
$configureFlags ${configureFlagsArray[@]}
@crossFlags@
"${flagsArray[@]}"
$wafConfigureFlags "${wafConfigureFlagsArray[@]}"
${configureTargets:-configure}
)
echoCmd 'configure flags' "${flagsArray[@]}"
python waf "${flagsArray[@]}"
python "$wafPath" "${flagsArray[@]}"
runHook postConfigure
}
@ -33,7 +36,7 @@ wafBuildPhase () {
)
echoCmd 'build flags' "${flagsArray[@]}"
python waf "${flagsArray[@]}"
python "$wafPath" "${flagsArray[@]}"
runHook postBuild
}
@ -52,7 +55,7 @@ wafInstallPhase() {
)
echoCmd 'install flags' "${flagsArray[@]}"
python waf "${flagsArray[@]}"
python "$wafPath" "${flagsArray[@]}"
runHook postInstall
}

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation {
export CXXFLAGS="-I${libX11.dev}/include/X11 -DLIBDIR=\\\"${mupen64plus}/lib/\\\""
export LDFLAGS="-lwx_gtk2u_adv-2.9"
configureFlagsArray+=("--mupenapi=$APIDIR" "--wxconfig=`type -P wx-config`")
wafConfigureFlagsArray+=("--mupenapi=$APIDIR" "--wxconfig=`type -P wx-config`")
'';
NIX_CFLAGS_COMPILE = "-fpermissive";

View File

@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE"
'';
configureFlags = [
wafConfigureFlags = [
"--classic"
"--autostart=${if (optDbus != null) then "dbus" else "classic"}"
] ++ optional (optDbus != null) "--dbus"

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
libjpeg libpng xorg.libxcb libX11 libGL libdrm python27 wayland udev mesa_noglu
];
configureFlags = ["--with-flavors=x11-gl,x11-glesv2,drm-gl,drm-glesv2,wayland-gl,wayland-glesv2"];
wafConfigureFlags = ["--with-flavors=x11-gl,x11-glesv2,drm-gl,drm-glesv2,wayland-gl,wayland-glesv2"];
meta = with stdenv.lib; {
description = "OpenGL (ES) 2.0 benchmark";

View File

@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
postPatch = ''
substituteInPlace src/GNUmakefile \
--replace /bin/echo ${coreutils}/bin/echo
# our cross machinery defines $CC and co just right
sed -i /CROSS_COMPILE/d src/GNUmakefile
'';
buildInputs = [ talloc ] ++ stdenv.lib.optional enablePython python;

View File

@ -6463,7 +6463,11 @@ in
waf = callPackage ../development/tools/build-managers/waf { python = python3; };
wafHook = makeSetupHook {
deps = [ python ];
substitutions = { inherit waf; };
substitutions = {
inherit waf;
crossFlags = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform)
''--cross-compile "--cross-execute=${stdenv.targetPlatform.emulator pkgs}"'';
};
} ../development/tools/build-managers/waf/setup-hook.sh;
wakelan = callPackage ../tools/networking/wakelan { };