at master 117 lines 3.2 kB view raw
1# shellcheck shell=bash disable=SC2086,SC2154,SC2206 2 3addMakeFlags() { 4 export prefix="$out" 5 export MANDIR="${!outputMan}/share/man" 6 export MANTARGET=man 7 export BINOWN= 8 export STRIP_FLAG= 9} 10 11bmakeBuildPhase() { 12 runHook preBuild 13 14 local flagsArray=( 15 ${enableParallelBuilding:+-j${NIX_BUILD_CORES}} 16 SHELL="$SHELL" 17 ) 18 concatTo flagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray 19 20 nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}" 21 bmake ${makefile:+-f $makefile} "${flagsArray[@]}" 22 23 runHook postBuild 24} 25 26bmakeCheckPhase() { 27 runHook preCheck 28 29 if [ -z "${checkTarget:-}" ]; then 30 #TODO(@oxij): should flagsArray influence make -n? 31 if bmake -n ${makefile:+-f $makefile} check >/dev/null 2>&1; then 32 checkTarget="check" 33 elif bmake -n ${makefile:+-f $makefile} test >/dev/null 2>&1; then 34 checkTarget="test" 35 fi 36 fi 37 38 if [ -z "${checkTarget:-}" ]; then 39 nixInfoLog "${FUNCNAME[0]}: no test target found in bmake, doing nothing" 40 else 41 local flagsArray=( 42 ${enableParallelChecking:+-j${NIX_BUILD_CORES}} 43 SHELL="$SHELL" 44 ) 45 concatTo flagsArray makeFlags makeFlagsArray checkFlags=VERBOSE=y checkFlagsArray checkTarget 46 47 nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}" 48 bmake ${makefile:+-f $makefile} "${flagsArray[@]}" 49 fi 50 51 runHook postCheck 52} 53 54bmakeInstallPhase() { 55 runHook preInstall 56 57 if [ -n "$prefix" ]; then 58 mkdir -p "$prefix" 59 fi 60 61 local flagsArray=( 62 ${enableParallelInstalling:+-j${NIX_BUILD_CORES}} 63 SHELL="$SHELL" 64 ) 65 concatTo flagsArray makeFlags makeFlagsArray installFlags installFlagsArray installTargets=install 66 67 nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}" 68 bmake ${makefile:+-f $makefile} "${flagsArray[@]}" 69 70 runHook postInstall 71} 72 73bmakeDistPhase() { 74 runHook preDist 75 76 if [ -n "$prefix" ]; then 77 mkdir -p "$prefix" 78 fi 79 80 local flagsArray=() 81 concatTo flagsArray distFlags distFlagsArray distTarget=dist 82 83 nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}" 84 bmake ${makefile:+-f $makefile} "${flagsArray[@]}" 85 86 if [ "${dontCopyDist:-0}" != 1 ]; then 87 mkdir -p "$out/tarballs" 88 89 # Note: don't quote $tarballs, since we explicitly permit 90 # wildcards in there. 91 cp -pvd ${tarballs:-*.tar.gz} "$out/tarballs" 92 fi 93 94 runHook postDist 95} 96 97preConfigureHooks+=(addMakeFlags) 98 99if [ -z "${dontUseBmakeBuild-}" ] && [ -z "${buildPhase-}" ]; then 100 buildPhase=bmakeBuildPhase 101 nixInfoLog "${FUNCNAME[0]}: set buildPhase to bmakeBuildPhase" 102fi 103 104if [ -z "${dontUseBmakeCheck-}" ] && [ -z "${checkPhase-}" ]; then 105 checkPhase=bmakeCheckPhase 106 nixInfoLog "${FUNCNAME[0]}: set checkPhase to bmakeCheckPhase" 107fi 108 109if [ -z "${dontUseBmakeInstall-}" ] && [ -z "${installPhase-}" ]; then 110 installPhase=bmakeInstallPhase 111 nixInfoLog "${FUNCNAME[0]}: set installPhase to bmakeInstallPhase" 112fi 113 114if [ -z "${dontUseBmakeDist-}" ] && [ -z "${distPhase-}" ]; then 115 distPhase=bmakeDistPhase 116 nixInfoLog "${FUNCNAME[0]}: set distPhase to bmakeDistPhase" 117fi