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> <listitem>
<para> <para>
Overrides the configure, build, and install phases. This will run the Overrides the configure, build, and install phases. This will run the
"waf" script used by many projects. If waf doesnt exist, it will copy "waf" script used by many projects. If wafPath (default ./waf) doesnt
the version of waf available in Nixpkgs wafFlags can be used to pass exist, it will copy the version of waf available in Nixpkgs. wafFlags can
flags to the waf script. be used to pass flags to the waf script.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

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

View File

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

View File

@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
export SWORD_HOME=${sword}; export SWORD_HOME=${sword};
''; '';
configureFlags= [ "--enable-webkit2" ]; wafConfigureFlags = [ "--enable-webkit2" ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A GTK Bible study tool"; 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 sed -i '/target[ ]*= "ttl2c"/ ilib=["boost_system"],' tools/wscript_build
''; '';
configureFlags = [ wafConfigureFlags = [
"--boost-includes=${boost.dev}/include" "--boost-includes=${boost.dev}/include"
"--boost-libs=${boost.out}/lib" "--boost-libs=${boost.out}/lib"
]; ];

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{ stdenv, fetchurl, python, pkgconfig, readline, libxslt { stdenv, fetchurl, python, pkgconfig, readline, libxslt
, docbook_xsl, docbook_xml_dtd_42, fixDarwinDylibNames , docbook_xsl, docbook_xml_dtd_42, fixDarwinDylibNames
, buildPackages , wafHook
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -11,23 +11,22 @@ stdenv.mkDerivation rec {
sha256 = "1kk76dyav41ip7ddbbf04yfydb4jvywzi2ps0z2vla56aqkn11di"; sha256 = "1kk76dyav41ip7ddbbf04yfydb4jvywzi2ps0z2vla56aqkn11di";
}; };
nativeBuildInputs = [ pkgconfig fixDarwinDylibNames python nativeBuildInputs = [ pkgconfig fixDarwinDylibNames python wafHook
docbook_xsl docbook_xml_dtd_42 ]; docbook_xsl docbook_xml_dtd_42 ];
buildInputs = [ readline libxslt ]; buildInputs = [ readline libxslt ];
prePatch = '' wafPath = "buildtools/bin/waf";
patchShebangs buildtools/bin/waf
'';
configureFlags = [ wafConfigureFlags = [
"--enable-talloc-compat1" "--enable-talloc-compat1"
"--bundled-libraries=NONE" "--bundled-libraries=NONE"
"--builtin-libraries=replace" "--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 = '' postInstall = ''
${stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc_[0-9]*.o ${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 { stdenv, fetchurl, wafHook, pkgconfig, readline, libxslt
, docbook_xsl, docbook_xml_dtd_42, buildPackages , docbook_xsl, docbook_xml_dtd_42
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -10,23 +10,17 @@ stdenv.mkDerivation rec {
sha256 = "1ibcz466xwk1x6xvzlgzd5va4lyrjzm3rnjak29kkwk7cmhw4gva"; sha256 = "1ibcz466xwk1x6xvzlgzd5va4lyrjzm3rnjak29kkwk7cmhw4gva";
}; };
nativeBuildInputs = [ pkgconfig python2 ]; nativeBuildInputs = [ pkgconfig wafHook ];
buildInputs = [ buildInputs = [
readline libxslt docbook_xsl docbook_xml_dtd_42 readline libxslt docbook_xsl docbook_xml_dtd_42
]; ];
preConfigure = '' wafPath = "buildtools/bin/waf";
patchShebangs buildtools/bin/waf
'';
configureFlags = [ wafConfigureFlags = [
"--bundled-libraries=NONE" "--bundled-libraries=NONE"
"--builtin-libraries=replace" "--builtin-libraries=replace"
] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"--cross-compile"
"--cross-execute=${stdenv.hostPlatform.emulator buildPackages}"
]; ];
configurePlatforms = [ ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "The trivial database"; description = "The trivial database";

View File

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

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation {
export CXXFLAGS="-I${libX11.dev}/include/X11 -DLIBDIR=\\\"${mupen64plus}/lib/\\\"" export CXXFLAGS="-I${libX11.dev}/include/X11 -DLIBDIR=\\\"${mupen64plus}/lib/\\\""
export LDFLAGS="-lwx_gtk2u_adv-2.9" 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"; NIX_CFLAGS_COMPILE = "-fpermissive";

View File

@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE" export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE"
''; '';
configureFlags = [ wafConfigureFlags = [
"--classic" "--classic"
"--autostart=${if (optDbus != null) then "dbus" else "classic"}" "--autostart=${if (optDbus != null) then "dbus" else "classic"}"
] ++ optional (optDbus != null) "--dbus" ] ++ 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 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; { meta = with stdenv.lib; {
description = "OpenGL (ES) 2.0 benchmark"; description = "OpenGL (ES) 2.0 benchmark";

View File

@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
postPatch = '' postPatch = ''
substituteInPlace src/GNUmakefile \ substituteInPlace src/GNUmakefile \
--replace /bin/echo ${coreutils}/bin/echo --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; buildInputs = [ talloc ] ++ stdenv.lib.optional enablePython python;

View File

@ -6463,7 +6463,11 @@ in
waf = callPackage ../development/tools/build-managers/waf { python = python3; }; waf = callPackage ../development/tools/build-managers/waf { python = python3; };
wafHook = makeSetupHook { wafHook = makeSetupHook {
deps = [ python ]; 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; } ../development/tools/build-managers/waf/setup-hook.sh;
wakelan = callPackage ../tools/networking/wakelan { }; wakelan = callPackage ../tools/networking/wakelan { };