[Nix-dev] Why is unpackPhase special?

Marc Weber marco-oweber at gmx.de
Mon Aug 13 06:59:06 CEST 2007


unpackPhase is special because you can't omit it.


If Setup.hs exists I'm using my own build comands cabalBuildInstall
else the default configure make stuff is called.

if test -f [Ss]etup.*hs; then
  # [Ss]etup.[l]hs  found, use cabal
  echo "using cabal"
  phases="$additionalPhases cabalBuildInstall";
else
  # no cabal file - try traditional configure make 
  echo "no *etup.*hs - trying configure make"
  phases="$additionalPhases configurePhase buildPhase";
fi

Now there is a package not having any cabal file. So I want to use the
patch phase to add it.

thus:
  unpackPhase
  cd $sourceRoot
  set phases depending on directory content
  genericBuild

But genericBuild will unpack the source again !

So what about changing:

    *unpackPhase*
    cd $sourceRoot
    if test -z "$phases"; then
        phases="patchPhase configurePhase buildPhase checkPhase \

to

    if test -z "$phases"; then
        phases="*unpackPhase* patchPhase configurePhase buildPhase checkPhase \

and adding cd $sourceRoot to unpackPhase?

This would mean adding unpackPhase to many packages.. 

So what about adding a 

    if test -z $donUnpack; then
      unpackPhase
      cd $sourceRoot
    fi
check?

Any comments?

I've copied the relenvant lines from the builder now so it works.

Perhaps you can give your comment on what would be the best nix style to
do this..

Marc Weber

=============  =======================================================
source genericBuild:

genericBuild() {
    header "building $out"

    if test -n "$buildCommand"; then
        eval "$buildCommand"
        return
    fi

    unpackPhase
    cd $sourceRoot

    if test -z "$phases"; then
        phases="patchPhase configurePhase buildPhase checkPhase \
            installPhase fixupPhase distPhase";
    fi

    for i in $phases; do
        dumpVars
        eval "$i"
    done
    
    stopNest
}



More information about the nix-dev mailing list