···55# Posix utilities, the GNU C compiler, and so on. On other systems,
66# we use the native C library.
7788-99-# stdenvType exists to support multiple kinds of stdenvs on the same
1010-# system, e.g., cygwin and mingw builds on i686-cygwin. Most people
1111-# can ignore it.
1212-1313-{ system, stdenvType ? system, allPackages ? import ../.., platform, config }:
1414-1515-assert system != "i686-cygwin" -> system == stdenvType;
88+{ system, allPackages ? import ../.., platform, config }:
16917101811rec {
···4538 stdenvLinux = (import ./linux { inherit system allPackages platform config;}).stdenvLinux;
463947404848- # MinGW/MSYS standard environment.
4949- stdenvMinGW = import ./mingw {
5050- inherit system;
5151- };
5252-5353-5441 # Select the appropriate stdenv for the platform `system'.
5542 stdenv =
5656- if stdenvType == "i686-linux" then stdenvLinux else
5757- if stdenvType == "x86_64-linux" then stdenvLinux else
5858- if stdenvType == "armv5tel-linux" then stdenvLinux else
5959- if stdenvType == "armv6l-linux" then stdenvLinux else
6060- if stdenvType == "armv7l-linux" then stdenvLinux else
6161- if stdenvType == "mips64el-linux" then stdenvLinux else
6262- if stdenvType == "powerpc-linux" then /* stdenvLinux */ stdenvNative else
6363- if stdenvType == "i686-mingw" then stdenvMinGW else
6464- if stdenvType == "x86_64-darwin" then stdenvNix else
6565- if stdenvType == "x86_64-solaris" then stdenvNix else
4343+ if system == "i686-linux" then stdenvLinux else
4444+ if system == "x86_64-linux" then stdenvLinux else
4545+ if system == "armv5tel-linux" then stdenvLinux else
4646+ if system == "armv6l-linux" then stdenvLinux else
4747+ if system == "armv7l-linux" then stdenvLinux else
4848+ if system == "mips64el-linux" then stdenvLinux else
4949+ if system == "powerpc-linux" then /* stdenvLinux */ stdenvNative else
5050+ if system == "x86_64-darwin" then stdenvNix else
5151+ if system == "x86_64-solaris" then stdenvNix else
6652 stdenvNative;
6753}
-18
pkgs/stdenv/mingw/builder.sh
···11-# the other stdenv could change the SHELL variable,
22-# so we have to remember its value.
33-origShell=$SHELL
44-origGcc=$GCC
55-66-source $STDENV/setup
77-88-mkdir $OUT
99-1010-SHELL=$origShell
1111-GCC=$origGcc
1212-1313-export NIX_BUILD_TOP=$(pwd)
1414-1515-substitute "$SETUP" "$OUT/setup" \
1616- --subst-var INITIALPATH \
1717- --subst-var GCC \
1818- --subst-var SHELL
···11-source $stdenv/setup
22-33-mkdir $out
44-cd $out
55-tar zxvf $src
66-77-# Make the Nix store available to MSYS.
88-# Hack: we are assuming that the stdenv is based on Cygwin.
99-1010-nixdir="$(cygpath --windows /nix)"
1111-mkdir $out/nix
1212-cat > $out/etc/fstab <<EOF
1313-#Win32_Path Mount_Point
1414-$nixdir /nix
1515-EOF
···11-# Run the named hook, either by calling the function with that name or
22-# by evaluating the variable with that name. This allows convenient
33-# setting of hooks both from Nix expressions (as attributes /
44-# environment variables) and from shell scripts (as functions).
55-runHook() {
66- local hookName="$1"
77- if test "$(type -t $hookName)" = function; then
88- $hookName
99- else
1010- eval "${!hookName}"
1111- fi
1212-}
1313-1414-1515-exitHandler() {
1616- exitCode=$?
1717- set +e
1818-1919- closeNest
2020-2121- if test -n "$showBuildStats"; then
2222- times > "$NIX_BUILD_TOP/.times"
2323- local -a times=($(cat "$NIX_BUILD_TOP/.times"))
2424- # Print the following statistics:
2525- # - user time for the shell
2626- # - system time for the shell
2727- # - user time for all child processes
2828- # - system time for all child processes
2929- echo "build time elapsed: " ${times[*]}
3030- fi
3131-3232- if test $exitCode != 0; then
3333- runHook failureHook
3434-3535- # If the builder had a non-zero exit code and
3636- # $succeedOnFailure is set, create the file
3737- # `$out/nix-support/failed' to signal failure, and exit
3838- # normally. Otherwise, return the original exit code.
3939- if test -n "$succeedOnFailure"; then
4040- echo "build failed with exit code $exitCode (ignored)"
4141- mkdir -p "$out/nix-support"
4242- echo -n $exitCode > "$out/nix-support/failed"
4343- exit 0
4444- fi
4545-4646- else
4747- runHook exitHook
4848- fi
4949-5050- exit $exitCode
5151-}
5252-5353-trap "exitHandler" EXIT
5454-5555-5656-######################################################################
5757-# Helper functions that might be useful in setup hooks.
5858-5959-6060-addToSearchPathWithCustomDelimiter() {
6161- local delimiter=$1
6262- local varName=$2
6363- local dir=$3
6464- if [ -d "$dir" ]; then
6565- eval export ${varName}=${!varName}${!varName:+$delimiter}${dir}
6666- fi
6767-}
6868-6969-PATH_DELIMITER=':'
7070-7171-addToSearchPath() {
7272- addToSearchPathWithCustomDelimiter "${PATH_DELIMITER}" "$@"
7373-}
7474-7575-7676-######################################################################
7777-# Initialisation.
7878-7979-set -e
8080-8181-test -z $NIX_GCC && NIX_GCC=@GCC@
8282-8383-8484-# Wildcard expansions that don't match should expand to an empty list.
8585-# This ensures that, for instance, "for i in *; do ...; done" does the
8686-# right thing.
8787-shopt -s nullglob
8888-8989-9090-# Set up the initial path.
9191-PATH=
9292-for i in $NIX_GCC @INITIALPATH@; do
9393- if test "$i" = /; then i=; fi
9494- addToSearchPath PATH $i/bin
9595-done
9696-9797-# Hack: the /tmp of Cygwin is different from the /tmp in MSYS
9898-if test -d $NIX_BUILD_TOP; then
9999- echo "Nix build top already exists. Strange."
100100-else
101101- mkdir $NIX_BUILD_TOP
102102- cd $NIX_BUILD_TOP
103103-fi
104104-105105-if test "$NIX_DEBUG" = "1"; then
106106- echo "initial path: $PATH"
107107-fi
108108-109109-110110-# Execute the pre-hook.
111111-export SHELL=@SHELL@
112112-if test -z "$shell"; then
113113- export shell=@SHELL@
114114-fi
115115-116116-# Check that the pre-hook initialised SHELL.
117117-if test -z "$SHELL"; then echo "SHELL not set"; exit 1; fi
118118-119119-120120-# Hack: run gcc's setup hook.
121121-envHooks=()
122122-if test -f $NIX_GCC/nix-support/setup-hook; then
123123- source $NIX_GCC/nix-support/setup-hook
124124-fi
125125-126126-127127-# Ensure that the given directories exists.
128128-ensureDir() {
129129- local dir
130130- for dir in "$@"; do
131131- if ! test -x "$dir"; then mkdir -p "$dir"; fi
132132- done
133133-}
134134-135135-installBin() {
136136- mkdir -p $out/bin
137137- cp "$@" $out/bin
138138-}
139139-140140-141141-# Allow the caller to augment buildInputs (it's not always possible to
142142-# do this before the call to setup.sh, since the PATH is empty at that
143143-# point; here we have a basic Unix environment).
144144-runHook addInputsHook
145145-146146-147147-# Recursively find all build inputs.
148148-findInputs() {
149149- local pkg=$1
150150-151151- case $pkgs in
152152- *\ $pkg\ *)
153153- return 0
154154- ;;
155155- esac
156156-157157- pkgs="$pkgs $pkg "
158158-159159- if test -f $pkg/nix-support/setup-hook; then
160160- source $pkg/nix-support/setup-hook
161161- fi
162162-163163- if test -f $pkg/nix-support/propagated-build-inputs; then
164164- for i in $(cat $pkg/nix-support/propagated-build-inputs); do
165165- findInputs $i
166166- done
167167- fi
168168-}
169169-170170-pkgs=""
171171-for i in $buildInputs $propagatedBuildInputs; do
172172- findInputs $i
173173-done
174174-175175-176176-# Set the relevant environment variables to point to the build inputs
177177-# found above.
178178-addToEnv() {
179179- local pkg=$1
180180-181181- if test -d $1/bin; then
182182- addToSearchPath _PATH $1/bin
183183- fi
184184-185185- # Run the package-specific hooks set by the setup-hook scripts.
186186- for i in "${envHooks[@]}"; do
187187- $i $pkg
188188- done
189189-}
190190-191191-for i in $pkgs; do
192192- addToEnv $i
193193-done
194194-195195-196196-# Add the output as an rpath.
197197-if test "$NIX_NO_SELF_RPATH" != "1"; then
198198- export NIX_LDFLAGS="-rpath $out/lib $NIX_LDFLAGS"
199199- if test -n "$NIX_LIB64_IN_SELF_RPATH"; then
200200- export NIX_LDFLAGS="-rpath $out/lib64 $NIX_LDFLAGS"
201201- fi
202202-fi
203203-204204-205205-# Set the TZ (timezone) environment variable, otherwise commands like
206206-# `date' will complain (e.g., `Tue Mar 9 10:01:47 Local time zone must
207207-# be set--see zic manual page 2004').
208208-export TZ=UTC
209209-210210-211211-# Set the prefix. This is generally $out, but it can be overriden,
212212-# for instance if we just want to perform a test build/install to a
213213-# temporary location and write a build report to $out.
214214-if test -z "$prefix"; then
215215- prefix="$out";
216216-fi
217217-218218-if test "$useTempPrefix" = "1"; then
219219- prefix="$NIX_BUILD_TOP/tmp_prefix";
220220-fi
221221-222222-223223-PATH=$_PATH${_PATH:+:}$PATH
224224-if test "$NIX_DEBUG" = "1"; then
225225- echo "final path: $PATH"
226226-fi
227227-228228-229229-# Make GNU Make produce nested output.
230230-export NIX_INDENT_MAKE=1
231231-232232-233233-######################################################################
234234-# Misc. helper functions.
235235-236236-237237-stripDirs() {
238238- local dirs="$1"
239239- local stripFlags="$2"
240240- local dirsNew=
241241-242242- for d in ${dirs}; do
243243- if test -d "$prefix/$d"; then
244244- dirsNew="${dirsNew} $prefix/$d "
245245- fi
246246- done
247247- dirs=${dirsNew}
248248-249249- if test -n "${dirs}"; then
250250- header "stripping (with flags $stripFlags) in $dirs"
251251- find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} strip $stripFlags || true
252252- stopNest
253253- fi
254254-}
255255-256256-257257-######################################################################
258258-# Textual substitution functions.
259259-260260-261261-substitute() {
262262- local input="$1"
263263- local output="$2"
264264-265265- local -a params=("$@")
266266- local -a args=()
267267-268268- local n p pattern replacement varName
269269-270270- for ((n = 2; n < ${#params[*]}; n += 1)); do
271271- p=${params[$n]}
272272-273273- if test "$p" = "--replace"; then
274274- pattern="${params[$((n + 1))]}"
275275- replacement="${params[$((n + 2))]}"
276276- n=$((n + 2))
277277- fi
278278-279279- if test "$p" = "--subst-var"; then
280280- varName="${params[$((n + 1))]}"
281281- pattern="@$varName@"
282282- replacement="${!varName}"
283283- n=$((n + 1))
284284- fi
285285-286286- if test "$p" = "--subst-var-by"; then
287287- pattern="@${params[$((n + 1))]}@"
288288- replacement="${params[$((n + 2))]}"
289289- n=$((n + 2))
290290- fi
291291-292292- if test ${#args[@]} != 0; then
293293- args[${#args[@]}]="-a"
294294- fi
295295- args[${#args[@]}]="$pattern"
296296- args[${#args[@]}]="$replacement"
297297- done
298298-299299- replace-literal -e -s -- "${args[@]}" < "$input" > "$output".tmp
300300- if test -x "$output"; then
301301- chmod +x "$output".tmp
302302- fi
303303- mv -f "$output".tmp "$output"
304304-}
305305-306306-307307-substituteInPlace() {
308308- local fileName="$1"
309309- shift
310310- substitute "$fileName" "$fileName" "$@"
311311-}
312312-313313-314314-substituteAll() {
315315- local input="$1"
316316- local output="$2"
317317-318318- # Select all environment variables that start with a lowercase character.
319319- for envVar in $(env | sed "s/^[^a-z].*//" | sed "s/^\([^=]*\)=.*/\1/"); do
320320- if test "$NIX_DEBUG" = "1"; then
321321- echo "$envVar -> ${!envVar}"
322322- fi
323323- args="$args --subst-var $envVar"
324324- done
325325-326326- substitute "$input" "$output" $args
327327-}
328328-329329-330330-######################################################################
331331-# What follows is the generic builder.
332332-333333-334334-nestingLevel=0
335335-336336-startNest() {
337337- nestingLevel=$(($nestingLevel + 1))
338338- echo -en "\e[$1p"
339339-}
340340-341341-stopNest() {
342342- nestingLevel=$(($nestingLevel - 1))
343343- echo -en "\e[q"
344344-}
345345-346346-header() {
347347- startNest "$2"
348348- echo "$1"
349349-}
350350-351351-# Make sure that even when we exit abnormally, the original nesting
352352-# level is properly restored.
353353-closeNest() {
354354- while test $nestingLevel -gt 0; do
355355- stopNest
356356- done
357357-}
358358-359359-360360-# This function is useful for debugging broken Nix builds. It dumps
361361-# all environment variables to a file `env-vars' in the build
362362-# directory. If the build fails and the `-K' option is used, you can
363363-# then go to the build directory and source in `env-vars' to reproduce
364364-# the environment used for building.
365365-dumpVars() {
366366- echo "Dumping env-vars to $NIX_BUILD_TOP/env-vars"
367367- if test "$noDumpEnvVars" != "1"; then
368368- export > "$NIX_BUILD_TOP/env-vars"
369369- fi
370370-}
371371-372372-373373-# Utility function: return the base name of the given path, with the
374374-# prefix `HASH-' removed, if present.
375375-stripHash() {
376376- strippedName=$(basename $1);
377377- if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then
378378- strippedName=$(echo "$strippedName" | cut -c34-)
379379- fi
380380-}
381381-382382-383383-unpackFile() {
384384- curSrc="$1"
385385- local cmd
386386-387387- header "unpacking source archive $curSrc" 3
388388-389389- case "$curSrc" in
390390- *.tar)
391391- tar xvf $curSrc
392392- ;;
393393- *.tar.gz | *.tgz | *.tar.Z)
394394- gzip -d < $curSrc | tar xvf -
395395- ;;
396396- *.tar.bz2 | *.tbz2)
397397- bzip2 -d < $curSrc | tar xvf -
398398- ;;
399399- *.zip)
400400- unzip $curSrc
401401- ;;
402402- *)
403403- if test -d "$curSrc"; then
404404- stripHash $curSrc
405405- cp -prvd $curSrc $strippedName
406406- else
407407- if test -z "$unpackCmd"; then
408408- echo "source archive $curSrc has unknown type"
409409- exit 1
410410- fi
411411- runHook unpackCmd
412412- fi
413413- ;;
414414- esac
415415-416416- stopNest
417417-}
418418-419419-420420-unpackPhase() {
421421- runHook preUnpack
422422-423423- if test -z "$srcs"; then
424424- if test -z "$src"; then
425425- echo 'variable $src or $srcs should point to the source'
426426- exit 1
427427- fi
428428- srcs="$src"
429429- fi
430430-431431- # To determine the source directory created by unpacking the
432432- # source archives, we record the contents of the current
433433- # directory, then look below which directory got added. Yeah,
434434- # it's rather hacky.
435435- local dirsBefore=""
436436- for i in *; do
437437- if test -d "$i"; then
438438- dirsBefore="$dirsBefore $i "
439439- fi
440440- done
441441-442442- # Unpack all source archives.
443443- for i in $srcs; do
444444- unpackFile $i
445445- done
446446-447447- # Find the source directory.
448448- if test -n "$setSourceRoot"; then
449449- runHook setSourceRoot
450450- elif test -z "$sourceRoot"; then
451451- sourceRoot=
452452- for i in *; do
453453- if test -d "$i"; then
454454- case $dirsBefore in
455455- *\ $i\ *)
456456- ;;
457457- *)
458458- if test -n "$sourceRoot"; then
459459- echo "unpacker produced multiple directories"
460460- exit 1
461461- fi
462462- sourceRoot="$i"
463463- ;;
464464- esac
465465- fi
466466- done
467467- fi
468468-469469- if test -z "$sourceRoot"; then
470470- echo "unpacker appears to have produced no directories"
471471- exit 1
472472- fi
473473-474474- echo "source root is $sourceRoot"
475475-476476- # By default, add write permission to the sources. This is often
477477- # necessary when sources have been copied from other store
478478- # locations.
479479- if test "$dontMakeSourcesWritable" != 1; then
480480- chmod -R u+w "$sourceRoot"
481481- fi
482482-483483- runHook postUnpack
484484-}
485485-486486-487487-patchPhase() {
488488- runHook prePatch
489489-490490- for i in $patches; do
491491- header "applying patch $i" 3
492492- local uncompress=cat
493493- case $i in
494494- *.gz)
495495- uncompress="gzip -d"
496496- ;;
497497- *.bz2)
498498- uncompress="bzip2 -d"
499499- ;;
500500- esac
501501- $uncompress < $i | patch ${patchFlags:--p1}
502502- stopNest
503503- done
504504-505505- runHook postPatch
506506-}
507507-508508-509509-configurePhase() {
510510- runHook preConfigure
511511-512512- if test -z "$configureScript"; then
513513- configureScript=./configure
514514- if ! test -x $configureScript; then
515515- echo "no configure script, doing nothing"
516516- return
517517- fi
518518- fi
519519-520520- if test -z "$dontAddPrefix"; then
521521- configureFlags="${prefixKey:---prefix=}$prefix $configureFlags"
522522- fi
523523-524524- # Add --disable-dependency-tracking to speed up some builds.
525525- if test -z "$dontAddDisableDepTrack"; then
526526- if grep -q dependency-tracking $configureScript; then
527527- configureFlags="--disable-dependency-tracking $configureFlags"
528528- fi
529529- fi
530530-531531- # By default, disable static builds.
532532- if test -z "$dontDisableStatic"; then
533533- if grep -q enable-static $configureScript; then
534534- configureFlags="--disable-static $configureFlags"
535535- fi
536536- fi
537537-538538- echo "configure flags: $configureFlags ${configureFlagsArray[@]}"
539539- $configureScript $configureFlags "${configureFlagsArray[@]}"
540540-541541- runHook postConfigure
542542-}
543543-544544-545545-buildPhase() {
546546- runHook preBuild
547547-548548- if test -z "$makeFlags" && ! test -n "$makefile" -o -e "Makefile" -o -e "makefile" -o -e "GNUmakefile"; then
549549- echo "no Makefile, doing nothing"
550550- return
551551- fi
552552-553553- echo "make flags: $makeFlags ${makeFlagsArray[@]} $buildFlags ${buildFlagsArray[@]}"
554554- make ${makefile:+-f $makefile} \
555555- $makeFlags "${makeFlagsArray[@]}" \
556556- $buildFlags "${buildFlagsArray[@]}"
557557-558558- runHook postBuild
559559-}
560560-561561-562562-checkPhase() {
563563- runHook preCheck
564564-565565- echo "check flags: $makeFlags ${makeFlagsArray[@]} $checkFlags ${checkFlagsArray[@]}"
566566- make ${makefile:+-f $makefile} \
567567- $makeFlags "${makeFlagsArray[@]}" \
568568- $checkFlags "${checkFlagsArray[@]}" ${checkTarget:-check}
569569-570570- runHook postCheck
571571-}
572572-573573-574574-patchELF() {
575575- # Patch all ELF executables and shared libraries.
576576- header "patching ELF executables and libraries"
577577- if test -e "$prefix"; then
578578- find "$prefix" \( \
579579- \( -type f -a -name "*.so*" \) -o \
580580- \( -type f -a -perm +0100 \) \
581581- \) -print -exec patchelf --shrink-rpath {} \;
582582- fi
583583- stopNest
584584-}
585585-586586-587587-patchShebangs() {
588588- # Rewrite all script interpreter file names (`#! /path') under the
589589- # specified directory tree to paths found in $PATH. E.g.,
590590- # /bin/sh will be rewritten to /nix/store/<hash>-some-bash/bin/sh.
591591- # Interpreters that are already in the store are left untouched.
592592- header "patching script interpreter paths"
593593- local dir="$1"
594594- local f
595595- for f in $(find "$dir" -type f -perm +0100); do
596596- local oldPath=$(sed -ne '1 s,^#![ ]*\([^ ]*\).*$,\1,p' "$f")
597597- if test -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE"; then
598598- local newPath=$(type -P $(basename $oldPath) || true)
599599- if test -n "$newPath" -a "$newPath" != "$oldPath"; then
600600- echo "$f: interpreter changed from $oldPath to $newPath"
601601- sed -i -e "1 s,$oldPath,$newPath," "$f"
602602- fi
603603- fi
604604- done
605605- stopNest
606606-}
607607-608608-609609-installPhase() {
610610- runHook preInstall
611611-612612- mkdir -p "$prefix"
613613-614614- installTargets=${installTargets:-install}
615615- echo "install flags: $installTargets $makeFlags ${makeFlagsArray[@]} $installFlags ${installFlagsArray[@]}"
616616- make ${makefile:+-f $makefile} $installTargets \
617617- $makeFlags "${makeFlagsArray[@]}" \
618618- $installFlags "${installFlagsArray[@]}"
619619-620620- runHook postInstall
621621-}
622622-623623-624624-# The fixup phase performs generic, package-independent, Nix-related
625625-# stuff, like running patchelf and setting the
626626-# propagated-build-inputs. It should rarely be overriden.
627627-fixupPhase() {
628628- runHook preFixup
629629-630630- # Put man/doc/info under $out/share.
631631- forceShare=${forceShare:=man doc info}
632632- if test -n "$forceShare"; then
633633- for d in $forceShare; do
634634- if test -d "$prefix/$d"; then
635635- if test -d "$prefix/share/$d"; then
636636- echo "both $d/ and share/$d/ exists!"
637637- else
638638- echo "fixing location of $d/ subdirectory"
639639- mkdir -p $prefix/share
640640- if test -w $prefix/share; then
641641- mv -v $prefix/$d $prefix/share
642642- ln -sv $prefix/share/$d $prefix/$d
643643- fi
644644- fi
645645- fi
646646- done;
647647- fi
648648-649649- # TODO: strip _only_ ELF executables, and return || fail here...
650650- if test -z "$dontStrip"; then
651651- stripDebugList=${stripDebugList:-lib lib64 libexec bin sbin}
652652- if test -n "$stripDebugList"; then
653653- stripDirs "$stripDebugList" "${stripDebugFlags:--S}"
654654- fi
655655-656656- stripAllList=${stripAllList:-}
657657- if test -n "$stripAllList"; then
658658- stripDirs "$stripAllList" "${stripAllFlags:--s}"
659659- fi
660660- fi
661661-662662- if test "$havePatchELF" = 1 -a -z "$dontPatchELF"; then
663663- patchELF "$prefix"
664664- fi
665665-666666- if test -z "$dontPatchShebangs"; then
667667- patchShebangs "$prefix"
668668- fi
669669-670670- if test -n "$propagatedBuildInputs"; then
671671- mkdir -p "$out/nix-support"
672672- echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs"
673673- fi
674674-675675- if test -n "$setupHook"; then
676676- mkdir -p "$out/nix-support"
677677- substituteAll "$setupHook" "$out/nix-support/setup-hook"
678678- fi
679679-680680- runHook postFixup
681681-}
682682-683683-684684-distPhase() {
685685- runHook preDist
686686-687687- echo "dist flags: $distFlags ${distFlagsArray[@]}"
688688- make ${makefile:+-f $makefile} $distFlags "${distFlagsArray[@]}" ${distTarget:-dist}
689689-690690- if test "$dontCopyDist" != 1; then
691691- mkdir -p "$out/tarballs"
692692-693693- # Note: don't quote $tarballs, since we explicitly permit
694694- # wildcards in there.
695695- cp -pvd ${tarballs:-*.tar.gz} $out/tarballs
696696- fi
697697-698698- runHook postDist
699699-}
700700-701701-702702-showPhaseHeader() {
703703- local phase="$1"
704704- case $phase in
705705- unpackPhase) header "unpacking sources";;
706706- patchPhase) header "patching sources";;
707707- configurePhase) header "configuring";;
708708- buildPhase) header "building";;
709709- checkPhase) header "running tests";;
710710- installPhase) header "installing";;
711711- fixupPhase) header "post-installation fixup";;
712712- *) header "$phase";;
713713- esac
714714-}
715715-716716-717717-genericBuild() {
718718- header "building $out"
719719-720720- if test -n "$buildCommand"; then
721721- eval "$buildCommand"
722722- return
723723- fi
724724-725725- if test -z "$phases"; then
726726- phases="$prePhases unpackPhase patchPhase $preConfigurePhases \
727727- configurePhase $preBuildPhases buildPhase checkPhase \
728728- $preInstallPhases installPhase $preFixupPhases fixupPhase \
729729- $preDistPhases distPhase $postPhases";
730730- fi
731731-732732- for curPhase in $phases; do
733733- if test "$curPhase" = buildPhase -a -n "$dontBuild"; then continue; fi
734734- if test "$curPhase" = checkPhase -a -z "$doCheck"; then continue; fi
735735- if test "$curPhase" = installPhase -a -n "$dontInstall"; then continue; fi
736736- if test "$curPhase" = fixupPhase -a -n "$dontFixup"; then continue; fi
737737- if test "$curPhase" = distPhase -a -z "$doDist"; then continue; fi
738738-739739- showPhaseHeader "$curPhase"
740740- dumpVars
741741-742742- # Evaluate the variable named $curPhase if it exists, otherwise the
743743- # function named $curPhase.
744744- eval "${!curPhase:-$curPhase}"
745745-746746- if test "$curPhase" = unpackPhase; then
747747- cd "${sourceRoot:-.}"
748748- fi
749749-750750- stopNest
751751- done
752752-753753- stopNest
754754-}
755755-756756-757757-758758-759759-dumpVars
-80
pkgs/stdenv/mingw/simple-stdenv/builder.sh
···11-if test -z "$out"; then
22- out="$OUT"
33- initialPath="$INITIALPATH"
44- shell="$SHELL"
55-fi
66-77-setupPath=
88-for i in $initialPath; do
99- setupPath=$setupPath${setupPath:+:}$i
1010-done
1111-1212-PATH=$setupPath
1313-export PATH
1414-1515-mkdir $out
1616-1717-cat > $out/setup <<EOF
1818-PATH=$setupPath
1919-export PATH
2020-2121-SHELL=$shell
2222-export SHELL
2323-2424-# make fetchurl usable
2525-header() {
2626- echo "\$1"
2727-}
2828-2929-stopNest() {
3030- echo "Nothing to do"
3131-}
3232-3333-# !!! Awful copy&paste.
3434-substitute() {
3535- local input="\$1"
3636- local output="\$2"
3737-3838- local -a params=("\$@")
3939-4040- local sedScript=\$NIX_BUILD_TOP/.sedargs
4141- rm -f \$sedScript
4242- touch \$sedScript
4343-4444- local n p pattern replacement varName
4545-4646- for ((n = 2; n < \${#params[*]}; n += 1)); do
4747- p=\${params[\$n]}
4848-4949- if test "\$p" = "--replace"; then
5050- pattern=\${params[\$((n + 1))]}
5151- replacement=\${params[\$((n + 2))]}
5252- n=\$((n + 2))
5353- echo "s^\$pattern^\$replacement^g" >> \$sedScript
5454- sedArgs=("\${sedArgs[@]}" "-e" )
5555- fi
5656-5757- if test "\$p" = "--subst-var"; then
5858- varName=\${params[\$((n + 1))]}
5959- n=\$((n + 1))
6060- echo "s^@\${varName}@^\${!varName}^g" >> \$sedScript
6161- fi
6262-6363- if test "\$p" = "--subst-var-by"; then
6464- varName=\${params[\$((n + 1))]}
6565- replacement=\${params[\$((n + 2))]}
6666- n=\$((n + 2))
6767- echo "s^@\${varName}@^\$replacement^g" >> \$sedScript
6868- fi
6969-7070- done
7171-7272- sed -f \$sedScript < "\$input" > "\$output".tmp
7373- if test -x "\$output"; then
7474- chmod +x "\$output".tmp
7575- fi
7676- mv -f "\$output".tmp "\$output"
7777-}
7878-EOF
7979-8080-chmod +x $out/setup
···88{ # The system (e.g., `i686-linux') for which to build the packages.
99 system ? builtins.currentSystem
10101111- # Usually, the system type uniquely determines the stdenv and thus
1212- # how to build the packages. But on some platforms we have
1313- # different stdenvs, leading to different ways to build the
1414- # packages. For instance, on Windows we support both Cygwin and
1515- # Mingw builds. In both cases, `system' is `i686-cygwin'. The
1616- # attribute `stdenvType' is used to select the specific kind of
1717- # stdenv to use, e.g., `i686-mingw'.
1818-, stdenvType ? system
1919-2011, # The standard environment to use. Only used for bootstrapping. If
2112 # null, the default standard environment is used.
2213 bootStdenv ? null
···137128 self_ = with self; helperFunctions // {
138129139130 # Make some arguments passed to all-packages.nix available
140140- inherit system stdenvType platform;
131131+ inherit system platform;
141132142133 # Allow callPackage to fill in the pkgs argument
143134 inherit pkgs;
···213204214205215206 allStdenvs = import ../stdenv {
216216- inherit system stdenvType platform config;
207207+ inherit system platform config;
217208 allPackages = args: import ./all-packages.nix ({ inherit config system; } // args);
218209 };
219210