NixOS/nixpkgs — pull request #3204 by aherrmann (2014-07-07 13:14:57+00:00)
Title: cmake: Remove bash-ism in setup-hook.sh

Note: This will trigger quite a number of rebuilds, as CMake is a fairly central package. I have tested it with `gtest`, and `openimageio`.

This commit fixes the following error message:

...cmake.../nix-support/setup-hook: line 50: [: -v: unary operator expected

This error appears when using cmake in a `myEnvFun` package that is sourced into an existing shell session.

---

We only want to set `configurePhase` if it hasn't been set before. A user could
wish to specify an empty configure phase by setting `configurePhase=""`. So, a
test for _empty_ is insufficient.

Bash offers `[[ -v` for that purpose. However, this only works in the double
brackets `[[`, and it only works in bash.

In the classic bourne shell we can use parameter substitutions for this
purpose. `${parameter=default}` will assign `default` to the variable
`parameter` if and only if `parameter` has not been set before.