[Nix-dev] Re: [PATCHES] Patch sequence adding Nix expressions for Ur/Web

Yury G. Kudryashov urkud+nix at ya.ru
Tue Aug 24 01:14:24 CEST 2010


Karn Kallio wrote:

> Double patches ( 0002 0003 ) and ( 0005 0006 ) should be applied in order.
> Apologies for the doubles, they are a result of fixing errors ... any
> pointers as to how to collapse this commit - fix commit pair pattern into
> a single patch in git welcome.
git rebase -i and "squash"

> 0001-Add-package-mlton-an-optimizing-compiler-for-Standar.patch
>  +  configurePhase = ''
>  +    # Fix paths in the source.
>  +    for f in $(find $(pwd) -type f ) ; do
>  +      substituteInPlace $f --replace '/usr/bin/env bash' $(type -p bash)
>  +    done
Look at patchShebangs bash function in setup.sh (if this /usr/bin/env is in 
#! lines).
>  +
>  +    substituteInPlace $(pwd)/Makefile --replace '/bin/cp' $(type -p cp)
>  +
>  +    # Fix paths in the binary distribution.
>  +    BIN_DIST_DIR="$(pwd)/../usr"
>  +    for f in "bin/mlton" "lib/mlton/platform" "lib/mlton/static-library"
>  +      substituteInPlace "$BIN_DIST_DIR/$f" --replace '/usr/bin/env
>  bash' $(type -p bash) +    done
The same (try patchShebangs .; patchShebangs ../usr).
>  +
>  +    substituteInPlace $(pwd)/../usr/bin/mlton --replace '/usr/lib/mlton'
>  $(pwd)/../usr/lib/mlton +  '';
This will be done by patchShebangs as well if you'll move "preBuild" before 
"configurePhase"
>  +  doCheck = true;
>  +
>  +  installTargets = [ "install-no-docs" ];
>  +
>  +  postInstall = ''
>  +    # Fix path to mlton libraries.
>  +    substituteInPlace $(pwd)/install/usr/bin/mlton --replace
>  '/usr/lib/mlton' $out/lib/mlton +
>  +    # Path to libgmp.
>  +    substituteInPlace $(pwd)/install/usr/bin/mlton --replace "-link-opt
>  '-lm -lgmp'" "-link-opt '-lm -lgmp -L${gmp}/lib'" +
>  +    # Path to gmp.h.
>  +    substituteInPlace $(pwd)/install/usr/bin/mlton --replace "-cc-opt
>  '-O1 -fno-common'" "-cc-opt '-O1 -fno-common -I${gmp}/include'" +
>  +    # Path to the same gcc used in the build; needed at runtime.
>  +    substituteInPlace $(pwd)/install/usr/bin/mlton --replace "gcc='gcc'"
>  "gcc='"$(type -p gcc)"'" +
>  +    # Copy files to final positions.
>  +    cp -r $(pwd)/install/usr/bin $out
>  +    cp -r $(pwd)/install/usr/lib $out
>  +    cp -r $(pwd)/install/usr/man $out
>  +  '';
It would be nice to develop a proper patch to the mlton sources 
(buildsystem), and try push it into the next mlton release. Then it will be 
much easier to package it next time.
>  +Debian Bug report #473204
Could you please ping upstream about this patch as well (I hope that Debian 
guys already done it, but it would be nice to check whether upstream 
accepted/rejected/fixed in another way)?

P.S.: I haven't tested whether it builds/runs.




More information about the nix-dev mailing list