about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/tu/tup/setup-hook.sh
blob: a9fbf35c32f86ddaa5114959ee19cbe4cb356732 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh

tupConfigure() {
    echo -n CONFIG_TUP_ARCH= >> tup.config
    case "$system" in
    "i686-*")      echo i386 >> tup.config;;
    "x86_64-*")    echo x86_64 >> tup.config;;
    "powerpc-*")   echo powerpc >> tup.config;;
    "powerpc64-*") echo powerpc64 >> tup.config;;
    "ia64-*")      echo ia64 >> tup.config;;
    "alpha-*")     echo alpha >> tup.config;;
    "sparc-*")     echo sparc >> tup.config;;
    "aarch64-*")   echo arm64 >> tup.config;;
    "arm*")        echo arm >> tup.config;;
    esac

    echo "${tupConfig-}" >> tup.config

    tup init
    tup generate --verbose tupBuild.sh
}

tupConfigurePhase() {
    runHook preConfigure
    tupConfigure
    runHook postConfigure
}

if [ -z "${dontUseTupConfigure-}" -a -z "${configurePhase-}" ]; then
    configurePhase=tupConfigurePhase
fi

tupBuild() {
    pushd .
    ./tupBuild.sh
    popd
}

tupBuildPhase() {
    runHook preBuild
    tupBuild
    runHook postBuild
}

if [ -z "${dontUseTupBuild-}" -a -z "${buildPhase-}" ]; then
    buildPhase=tupBuildPhase
fi