blob: acca59004730b666fc28acbc72c4b4006e4c7d56 (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# shellcheck shell=bash disable=SC2086,SC2154,SC2206
addMakeFlags() {
export prefix="$out"
export MANDIR="${!outputMan}/share/man"
export MANTARGET=man
export BINOWN=
export STRIP_FLAG=
}
bmakeBuildPhase() {
runHook preBuild
local flagsArray=(
${enableParallelBuilding:+-j${NIX_BUILD_CORES}}
SHELL="$SHELL"
)
concatTo flagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray
nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}"
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
runHook postBuild
}
bmakeCheckPhase() {
runHook preCheck
if [ -z "${checkTarget:-}" ]; then
#TODO(@oxij): should flagsArray influence make -n?
if bmake -n ${makefile:+-f $makefile} check >/dev/null 2>&1; then
checkTarget="check"
elif bmake -n ${makefile:+-f $makefile} test >/dev/null 2>&1; then
checkTarget="test"
fi
fi
if [ -z "${checkTarget:-}" ]; then
nixInfoLog "${FUNCNAME[0]}: no test target found in bmake, doing nothing"
else
local flagsArray=(
${enableParallelChecking:+-j${NIX_BUILD_CORES}}
SHELL="$SHELL"
)
concatTo flagsArray makeFlags makeFlagsArray checkFlags=VERBOSE=y checkFlagsArray checkTarget
nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}"
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
fi
runHook postCheck
}
bmakeInstallPhase() {
runHook preInstall
if [ -n "$prefix" ]; then
mkdir -p "$prefix"
fi
local flagsArray=(
${enableParallelInstalling:+-j${NIX_BUILD_CORES}}
SHELL="$SHELL"
)
concatTo flagsArray makeFlags makeFlagsArray installFlags installFlagsArray installTargets=install
nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}"
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
runHook postInstall
}
bmakeDistPhase() {
runHook preDist
if [ -n "$prefix" ]; then
mkdir -p "$prefix"
fi
local flagsArray=()
concatTo flagsArray distFlags distFlagsArray distTarget=dist
nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}"
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
if [ "${dontCopyDist:-0}" != 1 ]; then
mkdir -p "$out/tarballs"
# Note: don't quote $tarballs, since we explicitly permit
# wildcards in there.
cp -pvd ${tarballs:-*.tar.gz} "$out/tarballs"
fi
runHook postDist
}
preConfigureHooks+=(addMakeFlags)
if [ -z "${dontUseBmakeBuild-}" ] && [ -z "${buildPhase-}" ]; then
buildPhase=bmakeBuildPhase
nixInfoLog "${FUNCNAME[0]}: set buildPhase to bmakeBuildPhase"
fi
if [ -z "${dontUseBmakeCheck-}" ] && [ -z "${checkPhase-}" ]; then
checkPhase=bmakeCheckPhase
nixInfoLog "${FUNCNAME[0]}: set checkPhase to bmakeCheckPhase"
fi
if [ -z "${dontUseBmakeInstall-}" ] && [ -z "${installPhase-}" ]; then
installPhase=bmakeInstallPhase
nixInfoLog "${FUNCNAME[0]}: set installPhase to bmakeInstallPhase"
fi
if [ -z "${dontUseBmakeDist-}" ] && [ -z "${distPhase-}" ]; then
distPhase=bmakeDistPhase
nixInfoLog "${FUNCNAME[0]}: set distPhase to bmakeDistPhase"
fi
|