[Nix-dev] Re: [Nix-commits] SVN commit: nix - 18534 - viric - in nixpkgs/branches/stdenv-updates/pkgs: build-support/gcc-cross-wrapper development/compilers/gcc-4.3 development/interpreters/guile development/libraries/glibc-2.9 development/libraries/physfs dev

Nicolas Pierron nicolas.b.pierron at gmail.com
Mon Nov 23 12:16:43 CET 2009


On Sun, Nov 22, 2009 at 20:51, Llus Batlle <viriketo at gmail.com> wrote:
> - Fixed the generic stdenv expression, which did a big mess on buildInputs and
>  buildNativeInputs. Now it distinguishes when there is a stdenvCross or not.
>  Maybe we should have a single stdenv and forget about the stdenvCross
>  adapter - this could end in a stdenv a bit complex, but simpler than the
>  generic stdenv + adapter.

Yes & No.  The generic stdenv should handle gccHost and libcHost (not
gccCross & glibcCross).  But you still need an adapter to change
between the stdenv and to give the abstraction of the hostDrv &
buildDrv.  As you mention stdenv give you one derivation which is a
sane design.

Yes, you need an stdenv which handles cross-compilation attributes.
No, you need an adapter to introduce stdenv changes to either build
the buildDrv or the hostDrv.

>
> Changes:
>
> Modified: nixpkgs/branches/stdenv-updates/pkgs/development/tools/misc/pkgconfig/setup-hook.sh
> ===================================================================
> --- nixpkgs/branches/stdenv-updates/pkgs/development/tools/misc/pkgconfig/setup-hook.sh 2009-11-22 19:28:56 UTC (rev 18533)
> +++ nixpkgs/branches/stdenv-updates/pkgs/development/tools/misc/pkgconfig/setup-hook.sh 2009-11-22 19:51:45 UTC (rev 18534)
> @@ -3,4 +3,8 @@
>     addToSearchPath PKG_CONFIG_PATH $1/share/pkgconfig
>  }
>
> -envHooks=(${envHooks[@]} addPkgConfigPath)
> +if test -n "$crossConfig"; then
> +    crossEnvHooks=(${crossEnvHooks[@]} addPkgConfigPath)
> +else
> +    envHooks=(${envHooks[@]} addPkgConfigPath)
> +fi
>

You are using this pattern multiple times and I am not sure to get it right.
1/ Don't you need to escape the $ because ${ is used to escape to Nix.
2/ You should always use "crossEnvHooks" because it is either a
build-time dependency or a run-rime dependency.


> Modified: nixpkgs/branches/stdenv-updates/pkgs/servers/x11/xorg/overrides.nix
> ===================================================================
> --- nixpkgs/branches/stdenv-updates/pkgs/servers/x11/xorg/overrides.nix 2009-11-22 19:28:56 UTC (rev 18533)
> +++ nixpkgs/branches/stdenv-updates/pkgs/servers/x11/xorg/overrides.nix 2009-11-22 19:51:45 UTC (rev 18534)
> @@ -30,6 +30,7 @@
>   libxcb = attrs : attrs // {
>     # I only remove python from the original, and add xproto. I don't know how
>     # to achieve that referring to attrs.buildInputs.
> +    # I should use: builtins.unsafeDiscardStringContext

I don't understand why you need "unsafeDiscardStringContext" here.

>     buildInputs = [args.pkgconfig args.libxslt xorg.libpthreadstubs /*xorg.python*/
>         xorg.libXau xorg.xcbproto xorg.libXdmcp ] ++ [ xorg.xproto ];
>     buildNativeInputs = [ args.python ];
>
> Modified: nixpkgs/branches/stdenv-updates/pkgs/top-level/all-packages.nix
> ===================================================================
> --- nixpkgs/branches/stdenv-updates/pkgs/top-level/all-packages.nix     2009-11-22 19:28:56 UTC (rev 18533)
> +++ nixpkgs/branches/stdenv-updates/pkgs/top-level/all-packages.nix     2009-11-22 19:51:45 UTC (rev 18534)
> @@ -183,6 +183,8 @@
>         }
>       else stdenvCross;
>
> +  forceBuildDrv = drv : drv // { hostDrv = drv.buildDrv; };
> +

You cannot convert all Nixpkgs and unfortunately some programs might
want to propagate pkg-config like the Stratego compiler which locates
its libraries with it.

May be we should think of another way which is entirely backward
compatible.  For example, as previous system do not support
cross-compilation, you can duplicate all buildInputs into the
buildNativeInputs if the build system is the same as the host system.

Then you won't have such problem because all cross-compilable package
should handles these dependencies in a clean way, without this
hackery.

>   # A stdenv capable of building 32-bit binaries.  On x86_64-linux,
>   # it uses GCC compiled with multilib support; on i686-linux, it's
>   # just the plain stdenv.
> @@ -2885,7 +2886,7 @@
>      cross_renaming: we should make all programs use pkgconfig as
>      buildNativeInput after the renaming.
>      */
> -  pkgconfig = pkgconfigReal // { hostDrv = pkgconfigReal.buildDrv; };
> +  pkgconfig = forceBuildDrv pkgconfigReal;
>
>   radare = import ../development/tools/analysis/radare {
>     inherit stdenv fetchurl pkgconfig libusb readline gtkdialog python



-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/
Donald Knuth - I can't go to a restaurant because I keep looking at
the fonts on the menu.



More information about the nix-dev mailing list