Fixup fromcvs/togit conversion
[pkgsrcv2.git] / bootstrap / bootstrap
1 #! /bin/sh
2
3 # $NetBSD: bootstrap,v 1.179 2012/07/24 13:18:00 jperkin Exp $
4 #
5 # Copyright (c) 2001-2011 Alistair Crooks <agc@NetBSD.org>
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 # 1. Redistributions of source code must retain the above copyright
12 #    notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 #    notice, this list of conditions and the following disclaimer in the
15 #    documentation and/or other materials provided with the distribution.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #
28 #set -x
29
30 # the following environment variables are honored:
31 # compiler/linker flags: CFLAGS, CPPFLAGS, LDFLAGS, LIBS
32 # tools: CP, GREP, ID, MKDIR, SH, TEST, TOUCH, XARGS
33
34
35 BOOTSTRAP_VERSION=20060721
36
37 # Don't let the bootstrap program get confused by a pre-existing mk.conf
38 # file.
39 MAKECONF=/dev/null
40 export MAKECONF
41
42 # No vulnerability checks since there might be an incompatible checker installed
43 NO_PKGTOOLS_REQD_CHECK=yes
44 export NO_PKGTOOLS_REQD_CHECK
45
46 unprivileged=no
47
48 preserve_path=no
49
50 # where the building takes place
51 bootstrapdir=`dirname "$0"`
52 bootstrapdir=`cd "${bootstrapdir}" && pwd`
53 pkgsrcdir=`dirname "${bootstrapdir}"`
54 wrkdir="`pwd`/work"
55
56 usage="Usage: $0 "'
57     [ --abi [32|64] ]
58     [ --binary-kit <tarball> ]
59     [ --binary-macpkg <pkg> ]
60     [ --compiler <compiler> ]
61     [ --full ]
62     [ --gzip-binary-kit <tarball> ]
63     [ --help ]
64     [ --mk-fragment <mk.conf> ]
65     [ --pkgdbdir <pkgdbdir> ]
66     [ --pkgmandir <pkgmandir> ]
67     [ --prefer-pkgsrc <list|yes|no> ]
68     [ --prefix <prefix> ]
69     [ --preserve-path ]
70     [ --quiet ]
71     [ --sysconfdir <sysconfdir> ]
72     [ --unprivileged | --ignore-user-check ]
73     [ --varbase <varbase> ]
74     [ --workdir <workdir> ]
75 '
76
77 # this replicates some of the logic in bsd.prefs.mk. until
78 # bootstrap-pkgsrc is merged into pkgsrc, we need to determine the
79 # right value for OPSYS and MACHINE_ARCH.
80
81 # strip / for BSD/OS, strip - for HP-UX
82 opsys=`uname -s | tr -d /-`
83
84 mkbinarykit_macpkg()
85 {
86         local macdestdir
87         macdestdir=${wrkdir}/macpkg-destdir
88         rm -rf ${macdestdir} || die "cleanup destdir"
89
90         mkdir -p ${macdestdir}${prefix} || die "mkdir destprefix"
91         rmdir ${macdestdir}${prefix} || die "rmdir destprefix"
92         cp -Rp ${prefix} ${macdestdir}${prefix} || die "copy prefix"
93
94         if [ ! -d ${macdestdir}${pkgdbdir} ]; then
95                 mkdir -p ${macdestdir}${pkgdbdir} || die "mkdir destdbdir"
96                 rmdir ${macdestdir}${pkgdbdir} || die "rmdir destdbdir"
97                 cp -Rp ${pkgdbdir} ${macdestdir}${pkgdbdir} || die "copy dbdir"
98         fi
99
100         ${sedprog} -e "s|%WRKDIR%|${wrkdir}|g" \
101                 -e "s|%TARGETDIR%|${targetdir}|g" -e "s|%DATE%|${date}|g" \
102                 < macpkg.pmproj.in > ${wrkdir}/macpkg.pmproj
103         ${packagemaker} -build -proj ${wrkdir}/macpkg.pmproj -p "${binary_macpkg}"
104 }
105
106 mkbinarykit_tar()
107 {
108         # in case tar was built by bootstrap
109         PATH="$prefix/bin:$PATH"; export PATH
110         cd / && tar -hcf "${binary_kit}" .$prefix .$pkgdbdir .$etc_mk_conf
111 }
112
113 mkbinarykit_tgz()
114 {
115         # in case tar was built by bootstrap
116         PATH="$prefix/bin:$PATH"; export PATH
117         cd / && tar -hcf - .$prefix .$pkgdbdir .$etc_mk_conf | gzip > "${binary_gzip_kit}"
118 }
119
120 die()
121 {
122         echo >&2 "$@"
123         exit 1
124 }
125
126 echo_msg()
127 {
128         echo "===> $@"
129 }
130
131 # see if we're using gcc.  If so, set $compiler_is_gnu to '1'.
132 get_compiler()
133 {
134         testcc="${CC}"
135         # normally, we'd just use 'cc', but certain configure tools look
136         # for gcc specifically, so we have to see if that comes first
137         if [ -z "${testcc}" ]; then
138                 save_IFS="${IFS}"
139                 IFS=':'
140                 for dir in ${PATH}; do
141                         test -z "$dir" && dir=.
142                         if [ -x "$dir/gcc" ]; then
143                                 testcc="$dir/gcc"
144                                 break
145                         fi
146                 done
147                 IFS="${save_IFS}"
148         fi
149
150         cat >${wrkdir}/$$.c <<EOF
151 #ifdef __GNUC__
152 indeed
153 #endif
154 EOF
155         compiler_is_gnu=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c indeed`
156         rm -f ${wrkdir}/$$.c
157
158 }
159 get_abi()
160 {
161         abi_opsys=$@
162
163         if [ -n "$abi" ]; then
164                 die "ERROR: $abi_opsys has special ABI handling, --abi not supported (yet)."
165         fi
166
167         case "$abi_opsys" in
168         IRIX)
169                 if [ `uname -r` -ge 6 ]; then
170                 abi=`sed -e 's/.*\(abi=\)\([on]*[36][24]\).*/\2/' /etc/compiler.defaults`
171                 isa=`sed -e 's/.*\(isa=mips\)\([1234]\).*/\2/' /etc/compiler.defaults`
172                 case "$abi" in
173                 o32)
174                         imakeopts="-DBuildO32 -DSgiISAo32=$isa"
175                         abi=""
176                         ;;
177                 n32)    imakeopts="-DBuildN32 -DSgiISA32=$isa"
178                         abi="32"
179                         ;;
180                 64 | n64)
181                         imakeopts="-DBuild64bit -DSgiISA64=$isa"
182                         abi="64"
183                         ;;
184                 esac
185                 else # IRIX before 6
186                 abi=32
187                 fi
188                 ;;
189         esac
190 }
191
192 get_machine_arch_aix()
193 {
194         _cpuid=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
195         if /usr/sbin/lsattr -El $_cpuid | grep ' POWER' >/dev/null 2>&1; then
196                 echo rs6000
197         else
198                 echo powerpc
199         fi
200 }
201
202 check_prog()
203 {
204         _var="$1"; _name="$2"
205
206         eval _tmp=\"\$$_var\"
207         if [ "x$_tmp" != "x" ]; then
208                 # Variable is already set (by the user, for example)
209                 return 0
210         fi
211
212         for _d in `echo $PATH | tr ':' ' '`; do
213                 if [ -f "$_d/$_name" ] && [ -x "$_d/$_name" ]; then
214                         # Program found
215                         eval $_var=\""$_d/$_name"\"
216                         return 1
217                 fi
218         done
219
220         die "$_name not found in path."
221 }
222
223 opsys_finish()
224 {
225         case "$opsys" in
226         IRIX)
227                 if [ -n "$imakeopts" ]; then
228                         echo "IMAKEOPTS+=               $imakeopts" >> ${TARGET_MKCONF}
229                 fi
230                 if [ `uname -r` -lt 6 ]; then
231                         echo_msg "Installing fake ldd script"
232                         run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/fakeldd $prefix/sbin"
233                         need_extras=yes
234                         echo "LDD=                      $prefix/sbin/fakeldd" >> ${TARGET_MKCONF}
235                 fi
236                 ;;
237         Haiku)
238                 need_extras=yes
239                 echo "LDD=                      $prefix/sbin/fakeldd" >> ${TARGET_MKCONF}
240                 ;;
241         esac
242 }
243
244 is_root()
245 {
246         if [ `uname -s` = "IRIX" ]; then
247                 if [ `uname -r` -lt 6  -a -z "$ID" ]; then
248         # older version of IRIX have an id command with limited features
249                         if [ "`$idprog`" != "uid=0(root) gid=0(sys)" ]; then
250                                 return 0
251                         fi
252                         return 1
253                 fi
254         fi
255         if [ `$idprog -u` != 0 ]; then
256                 return 0
257         fi
258         return 1
259 }
260
261 # run a command, abort if it fails
262 run_cmd()
263 {
264         echo_msg "running: $@"
265         eval "$@"
266         ret=$?
267         if [ $ret -ne 0 ]; then
268                 echo_msg "exited with status $ret"
269                 die "aborted."
270         fi
271 }
272
273 # Some versions of mkdir (notably SunOS) bail out too easily, so use the
274 # install-sh wrapper instead.
275 mkdir_p()
276 {
277         for dir in $@; do
278                 run_cmd "$install_sh -d -o $user -g $group $dir"
279         done
280 }
281
282 mkdir_p_early()
283 {
284         [ -d "$1" ] && return 0
285         mkdir -p "$1" 2> /dev/null && return 0
286         parent=`dirname "$1"`
287         mkdir_p_early "$parent"
288         if [ ! -d "$1" ] && mkdir "$1"; then
289                 echo_msg "mkdir $1 exited with status $?"
290                 die "aborted."
291         fi
292         return 0
293 }
294
295 copy_src()
296 {
297         _src="$1"; _dst="$2"
298         if [ ! -d $wrkdir/$_dst ]; then
299                 mkdir_p $wrkdir/$_dst
300         fi
301         $cpprog -r $_src/* $wrkdir/$_dst
302 }
303
304 get_optarg()
305 {
306         expr "x$1" : "x[^=]*=\\(.*\\)"
307 }
308
309 checkarg_sane_absolute_path() {
310         case "$1" in
311         "")     ;; # the default value will be used.
312         *[!-A-Za-z0-9_./]*)
313                 die "ERROR: Invalid characters in path $1 (from $2)." ;;
314         */)     die "ERROR: The argument to $2 must not end in /." ;;
315         /*)     ;;
316         *)      die "ERROR: The argument to $2 must be an absolute path." ;;
317         esac
318 }
319
320 checkarg_sane_relative_path() {
321         case "$1" in
322         "")     ;; # the default value will be used.
323         *[!-A-Za-z0-9_./]*)
324                 die "ERROR: Invalid characters in path $1 (from $2)." ;;
325         /*)     die "ERROR: The argument to $2 must be a relative path." ;;
326         *)      ;;
327         esac
328 }
329
330 bootstrap_sh=${SH-/bin/sh}
331 bootstrap_sh_set=${SH+set}
332
333 case "$bootstrap_sh" in
334 /*)
335         ;;
336 *)
337         echo "ERROR: The variable SH must contain an absolute path" 1>&2
338         exit 1
339         ;;
340 esac
341
342 # On some newer Ubuntu installations, /bin/sh is a symlink to /bin/dash,
343 # whose echo(1) is not BSD-compatible.
344 dash_echo_test=`$bootstrap_sh -c 'echo "\\100"'`
345 if [ "$dash_echo_test" = "@" ]; then
346         { echo "ERROR: Your shell's echo command is not BSD-compatible."
347           echo "ERROR: Please select another shell by setting the environment"
348           echo "ERROR: variable SH."
349         } 1>&2
350         exit 1;
351 fi
352
353 if [ -n "$PKG_PATH" ]; then
354         echo "ERROR: Please unset PKG_PATH before running bootstrap." 1>&2
355         exit 1;
356 fi
357
358 build_start=`date`
359 echo_msg "bootstrap command: $0 $@"
360 echo_msg "bootstrap started: $build_start"
361
362 # ensure system locations are empty; we will set them later when we know
363 # whether they will be system wide or user specific
364 prefix=
365 pkgdbdir=
366 pkgmandir=
367 sysconfdir=
368 varbase=
369
370 full=no
371 compiler=""
372 quiet=no
373 mk_fragment=
374
375 while [ $# -gt 0 ]; do
376         case $1 in
377         --workdir=*)    wrkdir=`get_optarg "$1"` ;;
378         --workdir)      wrkdir="$2"; shift ;;
379         --prefix=*)     prefix=`get_optarg "$1"` ;;
380         --prefix)       prefix="$2"; shift ;;
381         --pkgdbdir=*)   pkgdbdir=`get_optarg "$1"` ;;
382         --pkgdbdir)     pkgdbdir="$2"; shift ;;
383         --pkgmandir=*)  pkgmandir=`get_optarg "$1"` ;;
384         --pkgmandir)    pkgmandir="$2"; shift ;;
385         --sysconfdir=*) sysconfdir=`get_optarg "$1"` ;;
386         --sysconfdir)   sysconfdir="$2"; shift ;;
387         --varbase=*)    varbase=`get_optarg "$1"` ;;
388         --varbase)      varbase="$2"; shift ;;
389         --compiler=*)   compiler=`get_optarg "$1"` ;;
390         --compiler)     compiler="$2"; shift ;;
391         --abi=*)        abi=`get_optarg "$1"` ;;
392         --abi)          abi="$2"; shift ;;
393         --unprivileged | --ignore-user-check) unprivileged=yes ;;
394         --prefer-pkgsrc=*)
395                         prefer_pkgsrc=`get_optarg "$1"` ;;
396         --prefer-pkgsrc)
397                         prefer_pkgsrc="$2"; shift ;;
398         --preserve-path) preserve_path=yes ;;
399         --mk-fragment=*)
400                         mk_fragment=`get_optarg "$1"` ;;
401         --mk-fragment)
402                         mk_fragment="$2"; shift ;;
403         --binary-kit=*)
404                         binary_kit=`get_optarg "$1"` ;;
405         --binary-kit)
406                         binary_kit="$2"; shift ;;
407         --gzip-binary-kit=*)
408                         binary_gzip_kit=`get_optarg "$1"` ;;
409         --gzip-binary-kit)
410                         binary_gzip_kit="$2"; shift ;;
411         --binary-macpkg=*)
412                         binary_macpkg=`get_optarg "$1"` ;;
413         --binary-macpkg)
414                         binary_macpkg="$2"; shift ;;
415         --full)         full=yes ;;
416         --quiet)        quiet=yes ;;
417         --help)         echo "$usage"; exit ;;
418         -h)             echo "$usage"; exit ;;
419         --*)            echo "$usage"; exit 1 ;;
420         esac
421         shift
422 done
423
424 checkarg_sane_absolute_path "$wrkdir" "--workdir"
425 checkarg_sane_absolute_path "$prefix" "--prefix"
426 checkarg_sane_absolute_path "$pkgdbdir" "--pkgdbdir"
427 checkarg_sane_absolute_path "$sysconfdir" "--sysconfdir"
428 checkarg_sane_absolute_path "$varbase" "--varbase"
429 checkarg_sane_relative_path "$pkgmandir" "--pkgmandir"
430
431 # set defaults for system locations if not already set by the user
432 wrkobjdir=${wrkdir}/pkgsrc
433 if [ "$unprivileged" = "yes" ]; then
434         [ -z "$prefix" ] && prefix=${HOME}/pkg
435 elif [ -z "$prefix" -o "$prefix" = "/usr/pkg" ]; then
436         prefix=/usr/pkg
437         [ -z "$varbase" ] && varbase=/var
438 fi
439
440 [ -z "$varbase" ] && varbase=${prefix}/var
441 [ -z "$pkgdbdir" ] && pkgdbdir=${varbase}/db/pkg
442
443 if [ "$prefix" = "/usr" ]; then
444         [ -z "$pkgmandir" ] && pkgmandir=share/man
445 else
446         [ -z "$pkgmandir" ] && pkgmandir=man
447 fi
448 mandir=${prefix}/${pkgmandir}
449 [ -z "$sysconfdir" ] && sysconfdir=${prefix}/etc
450
451 if [ "x$preserve_path" != "xyes" ]; then
452         PATH="$PATH:/sbin:/usr/sbin"
453 fi
454
455 overpath=""
456 root_user=root
457 bmakexenv=
458 bmakexargs=
459 need_extras=no
460 case "$opsys" in
461 AIX)
462         root_group=system
463         need_bsd_install=yes
464         need_awk=yes
465         need_sed=yes
466         need_fixed_strip=yes
467         set_opsys=no
468         machine_arch=`get_machine_arch_aix`
469         ;;
470 Darwin)
471         root_group=wheel
472         need_bsd_install=no
473         need_awk=no
474         need_sed=no
475         set_opsys=no
476         machine_arch=`uname -p`
477         CC=${CC:-"gcc -isystem /usr/include"}; export CC
478         osrev=`uname -r`
479         macosx_version=`echo $osrev | awk -F . '{ print "10."$1-4; }'`
480         case "$macosx_version" in
481         10.[0-4])
482                 packagemaker=/Developer/Tools/packagemaker
483                 ;;
484         *)
485                 packagemaker=/Developer/usr/bin/packagemaker
486                 ;;
487         esac
488         unset osrev macosx_version
489         ;;
490 DragonFly)
491         root_group=wheel
492         need_bsd_install=no
493         need_awk=no
494         need_sed=no
495         set_opsys=no
496         check_prog tarprog tar
497         machine_arch=`uname -p`
498         ;;
499 FreeBSD)
500         root_group=wheel
501         need_bsd_install=no
502         need_awk=no
503         need_sed=no
504         set_opsys=no
505         machine_arch=`uname -p`
506         ;;
507 Haiku)
508         root_user=user
509         root_group=root
510         need_bsd_install=no
511         need_awk=no
512         need_sed=no
513         set_opsys=no
514         case `uname -m` in
515         BeMac)
516                 machine_arch=powerpc
517                 ;;
518         BePC)
519                 machine_arch=i386
520                 ;;
521         *)
522                 machine_arch=`uname -p`
523                 ;;
524         esac
525         ;;
526 HPUX)
527         root_group=sys
528         need_bsd_install=yes
529         need_awk=yes
530         need_sed=yes
531         set_opsys=no
532         machine_arch=`uname -m | sed 's/^9000.*$/hppa/'`
533         ;;
534 Interix)
535         is_root () {
536                 if id -G | grep -q 131616; then
537                         return 1
538                 fi
539                 return 0
540         }
541         mkdir_p () {
542                 mkdir -p "$@" # allows umask to take effect
543         }
544         default_install_mode=0775
545         root_user=`id -u`
546         root_group=131616
547         case `uname -r` in
548         3.* | 5.*)
549                 need_bsd_install=yes
550                 need_awk=yes
551                 need_sed=yes
552                 set_opsys=no
553                 need_xargs=yes
554                 ;;
555         *)
556                 need_bsd_install=no
557                 need_awk=no
558                 need_sed=no
559                 set_opsys=no
560                 need_xargs=no
561                 ;;
562         esac
563         # only used for unprivileged builds
564         groupsprog="id -gn"
565         # for bootstrap only; pkgsrc uses CPPFLAGS
566         CC="gcc -D_ALL_SOURCE"; export CC
567         ac_cv_header_poll_h=no; export ac_cv_header_poll_h
568         ac_cv_func_poll=no; export ac_cv_func_poll
569         ;;
570 IRIX*)
571         if [ -d "/usr/freeware/bin" ]; then
572                 overpath="/usr/freeware/bin:$overpath"
573         fi
574         if [ -d "/usr/bsd" ]; then
575                 overpath="/usr/bsd:$overpath"
576         fi
577         if [ -d "/usr/bsd/bin" ]; then
578                 overpath="/usr/bsd/bin:$overpath"
579         fi
580         root_group=sys
581         need_bsd_install=yes
582         get_abi "IRIX"
583         opsys=IRIX
584         need_awk=yes
585         need_sed=yes
586         set_opsys=yes
587         machine_arch=mipseb
588         bmakexargs="MACHINE_ARCH=$machine_arch"
589         bmakexenv="MAKE=pmake"
590         check_compiler=yes
591         if [ `uname -r` -lt 6 ]; then
592 # IRIX 5's mkdir bails out with an error when trying to create with the -p
593 # option an already existing directory
594                 need_mkdir=yes
595         fi
596         ;;
597 Linux)
598         if [ -f /etc/ssdlinux_version ]; then
599                 root_group=wheel
600         else
601                 root_group=root
602         fi
603         need_bsd_install=no
604         need_awk=no
605         need_sed=no
606         set_opsys=no
607         machine_arch=`uname -m | sed -e 's/i.86/i386/'`
608         ;;
609 MirBSD)
610         root_group=wheel
611         need_pax=yes
612         need_mtree=no
613         need_bsd_install=no
614         need_awk=no
615         need_sed=no
616         set_opsys=no
617         check_prog mtreeprog mtree
618         machine_arch=`arch -s`
619         # there is no /usr/bin/cc, so use mgcc if unset
620         test -n "$CC" || { CC=mgcc; export CC; }
621         # get some variables from the native make if unset
622         for var in CFLAGS CPPFLAGS LDFLAGS; do
623                 # check if variable is already set
624                 eval _tmp=\"\$$var\"
625                 [ "x$_tmp" != x ] && continue
626                 # ask the native make (EXPERIMENTAL = don't add -Werror)
627                 # the -I${.CURDIR} dance is to prevent junk in CPPFLAGS
628                 _tmp=`printf '%s\nall:\n\t@%s %%s %s=${%s:M*:Q:Q}\n%s\n%s\n' \
629                     $var'+=-I${.CURDIR}' printf $var $var':S/-I${.CURDIR}//' \
630                     EXPERIMENTAL=yes '.include <bsd.prog.mk>' | \
631                     (unset MAKECONF; /usr/bin/make -f - all 2>/dev/null) | \
632                     sed 's/^x//'`
633                 eval $_tmp
634                 eval export $var
635         done
636         ;;
637 NetBSD)
638         root_group=wheel
639         need_bsd_install=no
640         need_awk=no
641         need_sed=no
642         set_opsys=no
643         machine_arch=`uname -p`
644         ;;
645 OpenBSD)
646         root_group=wheel
647         need_bsd_install=no
648         need_awk=no
649         need_sed=no
650         set_opsys=no
651         machine_arch=`uname -m`
652         ;;
653 OSF1)
654         root_group=system
655         need_bsd_install=yes
656         need_awk=yes
657         need_sed=yes
658         need_ksh=yes
659         set_opsys=no
660         ;;
661 QNX)
662         root_group=root
663         need_bsd_install=yes
664         need_awk=yes
665         need_sed=yes
666         set_opsys=no
667         groupsprog="id -gn"
668         whoamiprog="id -un"
669         machine_arch=`uname -p | sed -e 's/x86/i386/'`
670         ;;
671 SunOS)
672         root_group=root
673         need_bsd_install=yes
674         if [ -x "/usr/gnu/bin/awk" ]; then
675                 need_awk=no
676         else
677                 need_awk=yes
678         fi
679         if [ -x "/usr/gnu/bin/sed" ]; then
680                 need_sed=no
681         else
682                 need_sed=yes
683         fi
684         if [ "`uname -r`" = "5.11" ]; then
685                 case "`uname -v`" in
686                 joyent_*)
687                         bootstrap_sh=${SH:-/usr/bin/bash}
688                         bootstrap_sh_set=set
689                         ;;
690                 *)
691                         bootstrap_sh=${SH:-/bin/ksh}
692                         bootstrap_sh_set=set
693                         ;;
694                 esac
695         else
696                 need_ksh=yes
697         fi
698         set_opsys=no
699         idprog="/usr/xpg4/bin/id"
700         groupsprog="${idprog} -gn"
701         whoamiprog="${idprog} -un"
702         machine_arch=`uname -p | sed -e 's/i86pc/i386/'`
703         check_compiler=yes
704         ;;
705 UnixWare)
706         root_group=sys
707         need_bsd_install=no
708         BSTRAP_ENV="INSTALL=/usr/ucb/install $BSTRAP_ENV"
709         need_mkdir=yes
710         need_awk=yes
711         need_sed=yes
712         whoamiprog=/usr/ucb/whoami
713         set_opsys=no
714         CC="gcc -DUNIXWARE"; export CC
715         ;;
716 *)
717         echo "This platform ($opsys) is untried - good luck, and thanks for using pkgsrc"
718         root_group=wheel
719         need_bsd_install=yes
720         need_awk=yes
721         need_sed=yes
722         set_opsys=no
723         ;;
724 esac
725
726 # If "--full" is specified, then install all of the platform-independent
727 # bootstrap software.
728 #
729 case "$full" in
730 yes)
731         need_bsd_install=yes
732         need_awk=yes
733         need_sed=yes
734         need_ksh=yes
735         ;;
736 esac
737
738 case "$quiet" in
739 yes)
740         configure_quiet_flags="--quiet"
741         make_quiet_flags="-s"
742         ;;
743 no)
744         configure_quiet_flags=""
745         make_quiet_flags=""
746 esac
747
748 # export OPSYS and MACHINE_ARCH for pkg_install. we only set
749 # MACHINE_ARCH on platforms where we override bmake's value.
750 OPSYS=${opsys}
751 export OPSYS
752 if [ "${machine_arch}" != "" ]; then
753         MACHINE_ARCH=${machine_arch}
754         export MACHINE_ARCH
755 fi
756
757 if [ "x$preserve_path" != "xyes" ]; then
758         PATH="$overpath:$PATH"
759 fi
760
761 check_prog awkprog awk
762 check_prog chmodprog chmod
763 if [ -n "$CP" ]; then
764         cpprog="$CP"
765 else
766         check_prog cpprog cp
767 fi
768 if [ -n "$ID" ]; then
769         idprog="$ID"
770 else
771         check_prog idprog id
772 fi
773 check_prog groupsprog groups
774 check_prog lnprog ln
775 check_prog lsprog ls
776 check_prog rmdirprog rmdir
777 check_prog sedprog sed
778 check_prog shprog sh
779 check_prog whoamiprog whoami
780
781 if [ -d "${wrkdir}" ] || [ -f "${wrkdir}" ]; then
782         echo "\"${wrkdir}\" already exists, please remove it or use --workdir.";
783         exit 1
784 fi
785
786 mkdir_p_early ${wrkdir}
787 if touch ${wrkdir}/.writeable; then
788         :
789 else
790         echo "\"${wrkdir}\" is not writeable. Try $0 -h.";
791         exit 1
792 fi
793 echo "Working directory is: ${wrkdir}"
794
795 if [ "$compiler" = "" ] && [ x"$check_compiler" = x"yes" ]; then
796         get_compiler
797         if [ $compiler_is_gnu -gt 0 ]; then
798                 compiler="gcc"
799         else
800                 case "$opsys" in
801                 IRIX)
802                         if [ `uname -r` -ge 6 ]; then
803                                 compiler="mipspro"
804                         else
805                                 compiler="ido"
806                         fi
807                         test -n "$CC" || CC=cc
808                         ;;
809                 SunOS)  compiler="sunpro"
810                         test -n "$CC" || CC=cc
811                         ;;
812                 esac
813         fi
814 fi
815
816 mkdir_p_early ${wrkdir}/bin
817
818 # build install-sh
819 run_cmd "$sedprog -e 's|@DEFAULT_INSTALL_MODE@|'${default_install_mode-0755}'|' $pkgsrcdir/sysutils/install-sh/files/install-sh.in > $wrkdir/bin/install-sh"
820 run_cmd "$chmodprog +x $wrkdir/bin/install-sh"
821 install_sh="$shprog $wrkdir/bin/install-sh"
822
823 is_root
824 if [ $? = 1 ]; then
825         user=$root_user
826         group=$root_group
827 else
828         if [ $unprivileged = "no" ]; then
829                 die "You must be either root to install bootstrap-pkgsrc or use the --unprivileged option."
830         fi
831
832         user=`$whoamiprog`
833         group=`$groupsprog | $awkprog '{print $1}'`
834         echo_msg "building as unprivileged user $user/$group"
835
836         # force bmake install target to use $user and $group
837         echo "BINOWN=$user
838 BINGRP=$group
839 LIBOWN=$user
840 LIBGRP=$group
841 MANOWN=$user
842 MANGRP=$group" > ${wrkdir}/Makefile.inc
843 fi
844
845 # export the proper environment
846 PATH=$prefix/bin:$prefix/sbin:${PATH}; export PATH
847 if [ -d /usr/ccs/bin -a -x /usr/ccs/bin/make ]; then
848         PATH=${PATH}:/usr/ccs/bin; export PATH
849 fi
850 PKG_DBDIR=$pkgdbdir; export PKG_DBDIR
851 LOCALBASE=$prefix; export LOCALBASE
852 VARBASE=$varbase; export VARBASE
853
854 # set up an example mk.conf file
855 TARGET_MKCONF=${wrkdir}/mk.conf.example
856 echo_msg "Creating default mk.conf in ${wrkdir}"
857 echo "# Example ${sysconfdir}/mk.conf file produced by bootstrap-pkgsrc" > ${TARGET_MKCONF}
858 echo "# `date`" >> ${TARGET_MKCONF}
859 echo "" >> ${TARGET_MKCONF}
860 echo ".ifdef BSD_PKG_MK # begin pkgsrc settings" >> ${TARGET_MKCONF}
861 echo "" >> ${TARGET_MKCONF}
862
863 # IRIX64 needs to be set to IRIX, for example
864 if [ "$set_opsys" = "yes" ]; then
865         echo "OPSYS=                    $opsys" >> ${TARGET_MKCONF}
866 fi
867
868 if [ -n "$abi" ]; then
869         echo "ABI=                      $abi" >> ${TARGET_MKCONF}
870 fi
871 if [ "$compiler" != "" ]; then
872         echo "PKGSRC_COMPILER=  $compiler" >> ${TARGET_MKCONF}
873 fi
874 case "$compiler" in
875 sunpro)
876         echo "CC=                       cc"        >> ${TARGET_MKCONF}
877         echo "CXX=                      CC"        >> ${TARGET_MKCONF}
878         echo "CPP=                      \${CC} -E" >> ${TARGET_MKCONF}
879         ;;
880 esac
881 if [ -n "$GCCBASE" ]; then
882         echo "GCCBASE=          $GCCBASE" >> ${TARGET_MKCONF}
883 fi
884 if [ -n "$SUNWSPROBASE" ]; then
885         echo "SUNWSPROBASE=             $SUNWSPROBASE" >> ${TARGET_MKCONF}
886 fi
887 echo "" >> ${TARGET_MKCONF}
888
889 # enable unprivileged builds if not root
890 if [ "$unprivileged" = "yes" ]; then
891         echo "UNPRIVILEGED=             yes" >> ${TARGET_MKCONF}
892 fi
893
894 # save environment in example mk.conf
895 echo "PKG_DBDIR=                $pkgdbdir" >> ${TARGET_MKCONF}
896 echo "LOCALBASE=                $prefix" >> ${TARGET_MKCONF}
897 echo "VARBASE=          $varbase" >> ${TARGET_MKCONF}
898 if [ "${sysconfdir}" != "${prefix}/etc" ]; then
899         echo "PKG_SYSCONFBASE=  $sysconfdir" >> ${TARGET_MKCONF}
900 fi
901 echo "PKG_TOOLS_BIN=            $prefix/sbin" >> ${TARGET_MKCONF}
902 echo "PKGMANDIR=                $pkgmandir" >> ${TARGET_MKCONF}
903 echo "" >> ${TARGET_MKCONF}
904
905 if [ -n "$prefer_pkgsrc" ]; then
906         echo "PREFER_PKGSRC=            $prefer_pkgsrc" >> ${TARGET_MKCONF}
907         echo "" >> ${TARGET_MKCONF}
908 fi
909
910 BOOTSTRAP_MKCONF=${wrkdir}/mk.conf
911 cp ${TARGET_MKCONF} ${BOOTSTRAP_MKCONF}
912
913 # sbin is used by pkg_install, share/mk by bootstrap-mk-files
914 mkdir_p $wrkdir/sbin $wrkdir/share/mk
915 mkdir_p_early ${wrkdir}
916
917 if [ "$need_bsd_install" = "yes" ]; then
918         BSTRAP_ENV="INSTALL='$prefix/bin/install-sh -c' $BSTRAP_ENV"
919         echo "TOOLS_PLATFORM.install?=  $prefix/bin/install-sh" >> ${TARGET_MKCONF}
920         echo "TOOLS_PLATFORM.install?=  $wrkdir/bin/install-sh" >> ${BOOTSTRAP_MKCONF}
921 fi
922
923 if [ "$need_fixed_strip" = "yes" ] ; then
924         echo_msg "Installing fixed strip script"
925         run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/strip-sh $wrkdir/bin/strip"
926         echo "TOOLS_PLATFORM.strip?=            $prefix/bin/strip" >> ${TARGET_MKCONF}
927         echo "TOOLS_PLATFORM.strip?=            $wrkdir/bin/strip" >> ${BOOTSTRAP_MKCONF}
928         need_extras=yes
929 fi
930
931 if [ "$need_mkdir" = "yes" -a -z "$MKDIR" ]; then
932         echo_msg "Installing fixed mkdir script \"mkdir-sh\""
933         run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/mkdir-sh $wrkdir/bin/mkdir-sh"
934         echo "TOOLS_PLATFORM.mkdir?=            $prefix/bin/mkdir-sh -p" >> ${TARGET_MKCONF}
935         echo "TOOLS_PLATFORM.mkdir?=            $wrkdir/bin/mkdir-sh -p" >> ${BOOTSTRAP_MKCONF}
936         need_extras=yes
937 fi
938
939 if [ "$need_xargs" = "yes" ]; then
940         echo_msg "Installing fixed xargs script"
941         run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/xargs-sh $wrkdir/bin/xargs"
942         echo "TOOLS_PLATFORM.xargs?=            $prefix/bin/xargs" >> ${TARGET_MKCONF}
943         echo "TOOLS_PLATFORM.xargs?=            $wrkdir/bin/xargs" >> ${BOOTSTRAP_MKCONF}
944         need_extras=yes
945 fi
946
947 echo_msg "Bootstrapping mk-files"
948 run_cmd "(cd ${pkgsrcdir}/pkgtools/bootstrap-mk-files/files && env CP=${cpprog} \
949  OPSYS=${opsys} MK_DST=${wrkdir}/share/mk ROOT_GROUP=${root_group} \
950 ROOT_USER=${root_user} SED=${sedprog} SYSCONFDIR=${sysconfdir} \
951 $shprog ./bootstrap.sh)"
952
953 bootstrap_bmake() {
954         echo_msg "Bootstrapping bmake"
955         copy_src $pkgsrcdir/devel/bmake/files bmake
956         run_cmd "(cd $wrkdir/bmake && env $bmakexenv $shprog ./boot-strap $configure_quiet_flags -q -o $opsys --prefix=$wrkdir --sysconfdir=$wrkdir --mksrc none --with-default-sys-path="$wrkdir/share/mk" $bmakexargs)"
957         run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/bmake/$opsys/bmake $wrkdir/bin/bmake"
958 }
959 bootstrap_bmake
960
961 bmake="$wrkdir/bin/bmake $make_quiet_flags"
962
963 # build libnbcompat
964 echo_msg "Building libnbcompat"
965 copy_src $pkgsrcdir/pkgtools/libnbcompat/files libnbcompat
966 run_cmd "(cd $wrkdir/libnbcompat; $shprog ./configure $configure_quiet_flags -C --prefix=$prefix --mandir=$mandir --sysconfdir=$sysconfdir --enable-bsd-getopt --enable-db && $bmake $make_quiet_flags)"
967
968 # bootstrap ksh if necessary
969 case "$need_ksh" in
970 yes)    echo_msg "Bootstrapping ksh"
971         copy_src $pkgsrcdir/shells/pdksh/files ksh
972         test -n "$CC" || CC=gcc # default to gcc if no compiler is specified
973         run_cmd "(cd $wrkdir/ksh && env $BSTRAP_ENV $shprog ./configure $configure_quiet_flags --prefix=$prefix --mandir=$mandir --sysconfdir=$sysconfdir && $bmake)"
974         run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/ksh/ksh $wrkdir/bin/pdksh"
975         echo "TOOLS_PLATFORM.sh?=               $prefix/bin/pdksh" >> ${TARGET_MKCONF}
976         echo "TOOLS_PLATFORM.sh?=               $wrkdir/bin/pdksh" >> ${BOOTSTRAP_MKCONF}
977         echo "TOOLS_PLATFORM.ksh?=              $prefix/bin/pdksh" >> ${TARGET_MKCONF}
978         echo "TOOLS_PLATFORM.ksh?=              $wrkdir/bin/pdksh" >> ${BOOTSTRAP_MKCONF}
979 # Now rebootstrap bmake for ksh
980         echo_msg "Rebootstrapping bmake for ksh"
981         bmakexargs="$bmakexargs --with-defshell=$wrkdir/bin/pdksh"
982         bootstrap_bmake
983         ;;
984 esac
985
986 # bootstrap awk if necessary
987 case "$need_awk" in
988 yes)    echo_msg "Bootstrapping awk"
989         copy_src $pkgsrcdir/lang/nawk/files awk
990         test -n "$CC" || CC=gcc # default to gcc if no compiler is specified
991         run_cmd "(cd $wrkdir/awk && $bmake -f Makefile CC=\"${CC}\" CFLAGS=\"${CFLAGS}\")"
992         run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/awk/a.out $wrkdir/bin/nawk"
993         echo "TOOLS_PLATFORM.awk?=              $prefix/bin/nawk" >> ${TARGET_MKCONF}
994         echo "TOOLS_PLATFORM.awk?=              $wrkdir/bin/nawk" >> ${BOOTSTRAP_MKCONF}
995         ;;
996 esac
997
998 # bootstrap sed if necessary
999 case "$need_sed" in
1000 yes)    echo_msg "Bootstrapping sed"
1001         copy_src $pkgsrcdir/textproc/nbsed/files sed
1002         run_cmd "(cd $wrkdir/sed; env $BSTRAP_ENV CPPFLAGS='$CPPFLAGS -I../libnbcompat' LDFLAGS='$LDFLAGS -L../libnbcompat' LIBS='$LIBS -lnbcompat' $shprog ./configure $configure_quiet_flags -C --prefix=$prefix --mandir=$mandir --sysconfdir=$sysconfdir --program-transform-name='s,sed,nbsed,' && $bmake)"
1003         run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/sed/sed $wrkdir/bin/sed"
1004         echo "TOOLS_PLATFORM.sed?=              $prefix/bin/nbsed" >> ${TARGET_MKCONF}
1005         echo "TOOLS_PLATFORM.sed?=              $wrkdir/bin/sed" >> ${BOOTSTRAP_MKCONF}
1006         ;;
1007 esac
1008
1009 # bootstrap pkg_install
1010 echo_msg "Bootstrapping pkgtools"
1011 copy_src $pkgsrcdir/pkgtools/pkg_install/files pkg_install
1012 run_cmd "(cd $wrkdir/pkg_install; env $BSTRAP_ENV \
1013 CPPFLAGS='$CPPFLAGS -I../libnbcompat -I../../libnbcompat' \
1014 LDFLAGS='$LDFLAGS -L../libnbcompat -L../../libnbcompat' \
1015 LIBS='$LIBS -lnbcompat' $shprog ./configure $configure_quiet_flags -C \
1016 --enable-bootstrap --prefix=$prefix --sysconfdir=$sysconfdir \
1017 --with-pkgdbdir=$pkgdbdir --mandir=$mandir $pkg_install_args && $bmake)"
1018 run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/admin/pkg_admin $wrkdir/sbin/pkg_admin"
1019 run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/create/pkg_create $wrkdir/sbin/pkg_create"
1020 run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/info/pkg_info $wrkdir/sbin/pkg_info"
1021 echo "PKG_ADMIN_CMD?=                   $wrkdir/sbin/pkg_admin" >> ${BOOTSTRAP_MKCONF}
1022 echo "PKG_CREATE_CMD?=                  $wrkdir/sbin/pkg_create" >> ${BOOTSTRAP_MKCONF}
1023 echo "PKG_INFO_CMD?=                    $wrkdir/sbin/pkg_info" >> ${BOOTSTRAP_MKCONF}
1024
1025 MAKECONF=$wrkdir/mk.conf
1026 export MAKECONF
1027
1028 if [ "$bootstrap_sh_set" = "set" ]; then
1029         echo "TOOLS_PLATFORM.sh?=               ${bootstrap_sh}" >> ${TARGET_MKCONF}
1030         echo "TOOLS_PLATFORM.sh?=               ${bootstrap_sh}" >> ${BOOTSTRAP_MKCONF}
1031 fi
1032
1033 # preserve compiler and tool environment variables settings
1034 if test -n "$CP"; then
1035         echo "TOOLS_PLATFORM.cp?=               $CP" >> ${TARGET_MKCONF}
1036         echo "TOOLS_PLATFORM.cp?=               $CP" >> ${BOOTSTRAP_MKCONF}
1037 fi
1038 if test -n "$GREP"; then
1039         echo "TOOLS_PLATFORM.grep?=             $GREP" >> ${TARGET_MKCONF}
1040         echo "TOOLS_PLATFORM.grep?=             $GREP" >> ${BOOTSTRAP_MKCONF}
1041 fi
1042 if test -n "$ID"; then
1043         echo "TOOLS_PLATFORM.id?=               $ID" >> ${TARGET_MKCONF}
1044         echo "TOOLS_PLATFORM.id?=               $ID" >> ${BOOTSTRAP_MKCONF}
1045 fi
1046 if test -n "$MKDIR"; then
1047         echo "TOOLS_PLATFORM.mkdir?=            $MKDIR" >> ${TARGET_MKCONF}
1048         echo "TOOLS_PLATFORM.mkdir?=            $MKDIR" >> ${BOOTSTRAP_MKCONF}
1049 fi
1050 if test -n "$TEST"; then
1051         echo "TOOLS_PLATFORM.test?=             $TEST" >> ${TARGET_MKCONF}
1052         echo "TOOLS_PLATFORM.test?=             $TEST" >> ${BOOTSTRAP_MKCONF}
1053 fi
1054 if test -n "$TOUCH"; then
1055         echo "TOOLS_PLATFORM.touch?=            $TOUCH" >> ${TARGET_MKCONF}
1056         echo "TOOLS_PLATFORM.touch?=            $TOUCH" >> ${BOOTSTRAP_MKCONF}
1057 fi
1058 if test -n "$XARGS"; then
1059         echo "TOOLS_PLATFORM.xargs?=            $XARGS" >> ${TARGET_MKCONF}
1060         echo "TOOLS_PLATFORM.xargs?=            $XARGS" >> ${BOOTSTRAP_MKCONF}
1061 fi
1062 if test -n "$CFLAGS"; then
1063         echo "CFLAGS+=          $CFLAGS" >> ${TARGET_MKCONF}
1064         echo "DBG=                      # prevent DBG from adding default optimizer flags" >> ${TARGET_MKCONF}
1065         echo "DBG=                      # prevent DBG from adding default optimizer flags" >> ${BOOTSTRAP_MKCONF}
1066 fi
1067 if test -n "$CPPFLAGS"; then
1068         echo "CPPFLAGS+=                $CPPFLAGS" >> ${TARGET_MKCONF}
1069 fi
1070 if test -n "$LDFLAGS"; then
1071         echo "LDFLAGS+=         $LDFLAGS" >> ${TARGET_MKCONF}
1072 fi
1073 if test -n "$LIBS"; then
1074         echo "LIBS+=            $LIBS" >> ${TARGET_MKCONF}
1075 fi
1076
1077 # opsys specific fiddling
1078 opsys_finish
1079
1080 echo "WRKOBJDIR=                ${wrkdir}/wrk" >> ${BOOTSTRAP_MKCONF}
1081
1082 echo "" >> ${TARGET_MKCONF}
1083 echo "" >> ${BOOTSTRAP_MKCONF}
1084 if test -n "${mk_fragment}"; then
1085         cat "${mk_fragment}" >> ${TARGET_MKCONF}
1086         echo "" >> ${TARGET_MKCONF}
1087 fi
1088 echo ".endif                    # end pkgsrc settings" >> ${TARGET_MKCONF}
1089 echo ".endif                    # end pkgsrc settings" >> ${BOOTSTRAP_MKCONF}
1090
1091 # register packages
1092 # usage: register_package <packagedirectory> [additional arguments]
1093 build_package() {
1094         run_cmd "(cd $pkgsrcdir/$1 && $bmake USE_DESTDIR=no -DPKG_PRESERVE MAKECONF=${BOOTSTRAP_MKCONF} install)"
1095 }
1096
1097 #
1098 # Please make sure that the following packages and
1099 # only the following packages set BOOTSTRAP_PKG=yes.
1100 #
1101 echo_msg "Installing packages"
1102 build_package "pkgtools/bootstrap-mk-files"
1103 case "$need_bsd_install" in
1104 yes)    build_package "sysutils/install-sh";;
1105 esac
1106 case "$need_ksh" in
1107 yes)    build_package "shells/pdksh";;
1108 esac
1109 build_package "devel/bmake"
1110 case "$need_awk" in
1111 yes)    build_package "lang/nawk";;
1112 esac
1113 case "$need_sed" in
1114 yes)    build_package "textproc/nbsed";;
1115 esac
1116 case "$need_extras" in
1117 yes)    build_package "pkgtools/bootstrap-extras";;
1118 esac
1119 build_package "pkgtools/pkg_install"
1120
1121 etc_mk_conf="$sysconfdir/mk.conf"
1122
1123 # Install the example mk.conf so that it is used, but only if it doesn't
1124 # exist yet. This can happen with non-default sysconfdir settings.
1125 mkdir_p "$sysconfdir"
1126 if [ ! -f "$etc_mk_conf" ]; then
1127         cp "$TARGET_MKCONF" "$etc_mk_conf"
1128         TARGET_MKCONF="$etc_mk_conf"
1129 fi
1130
1131 hline="==========================================================================="
1132 echo ""
1133 echo "$hline"
1134 echo ""
1135 echo "Please remember to add $prefix/bin to your PATH environment variable"
1136 echo "and $mandir to your MANPATH environment variable, if necessary."
1137 echo ""
1138 echo "An example mk.conf file with the settings you provided to \"bootstrap\""
1139 echo "has been created for you. It can be found in:"
1140 echo ""
1141 echo "      ${TARGET_MKCONF}"
1142 echo ""
1143 if [ "$TARGET_MKCONF" != "$etc_mk_conf" ]; then
1144         echo "Please copy it to $etc_mk_conf to use it."
1145         echo ""
1146 fi
1147 echo "You can find extensive documentation of the NetBSD Packages Collection"
1148 echo "in $pkgsrcdir/doc/pkgsrc.txt."
1149 echo ""
1150 echo "Hopefully everything is now complete."
1151 echo "Thank you for using pkgsrc!"
1152 echo ""
1153 echo "$hline"
1154 echo ""
1155
1156 [ -n "${binary_kit}" ] && mkbinarykit_tar
1157 [ -n "${binary_gzip_kit}" ] && mkbinarykit_tgz
1158 [ -n "${binary_macpkg}" ] && mkbinarykit_macpkg
1159
1160 echo_msg "bootstrap started: $build_start"
1161 echo_msg "bootstrap ended:   `date`"
1162
1163 exit 0