]> gitweb.factorcode.org Git - factor.git/blob - build.sh
Build: let's remove the NO_UI variable
[factor.git] / build.sh
1 #!/usr/bin/env bash
2
3 # Programs returning != 0 will not cause script to exit
4 set +e
5
6 # Case insensitive string comparison
7 shopt -s nocaseglob
8 #shopt -s nocasematch
9
10 ECHO=echo
11 OS=
12 ARCH=
13 WORD=
14 GIT_PROTOCOL=${GIT_PROTOCOL:="git"}
15 GIT_URL=${GIT_URL:=$GIT_PROTOCOL"://factorcode.org/git/factor.git"}
16 SCRIPT_ARGS="$*"
17
18 # return 1 on found
19 test_program_installed() {
20     if ! [[ -n `type -p $1` ]] ; then
21         return 0;
22     fi
23     return 1;
24 }
25
26 # return 1 on found
27 test_programs_installed() {
28     installed=0;
29     $ECHO -n "Checking for all($*)..."
30     for i in $* ;
31     do
32         test_program_installed $i
33         if [[ $? -eq 1 ]]; then
34             installed=$(( $installed + 1 ))
35         fi
36     done
37     if [[ $installed -eq $# ]] ; then
38         $ECHO "found!"
39         return 1
40     else
41         $ECHO "all not found."
42         return 0
43     fi
44 }
45
46 exit_script() {
47     if [[ $FIND_MAKE_TARGET = true ]] ; then
48         # Must be echo not $ECHO
49         echo $MAKE_TARGET;
50     fi
51     exit $1
52 }
53
54 ensure_program_installed() {
55     installed=0;
56     $ECHO -n "Checking for any($*)..."
57     for i in $* ;
58     do
59         test_program_installed $i
60         if [[ $? -eq 1 ]]; then
61             $ECHO "found $i!"
62             installed=$(( $installed + 1 ))
63             return
64         fi
65     done
66     $ECHO "none found."
67     $ECHO -n "Install "
68     if [[ $# -eq 1 ]] ; then
69         $ECHO -n $1
70     else
71         $ECHO -n "any of [ $* ]"
72     fi
73     $ECHO " and try again."
74     if [[ $OS == macosx ]] ; then
75         $ECHO "If you have Xcode 4.3 or higher installed, you must install the"
76         $ECHO "Command Line Tools from Xcode Preferences > Downloads in order"
77         $ECHO "to build Factor."
78     fi
79     exit_script 1;
80 }
81
82 check_ret() {
83     RET=$?
84     if [[ $RET -ne 0 ]] ; then
85        $ECHO $1 failed
86        exit_script 2
87     fi
88 }
89
90 set_downloader() {
91     test_program_installed wget
92     if [[ $? -ne 0 ]] ; then
93         DOWNLOADER=wget
94         return
95     fi
96     test_program_installed curl
97     if [[ $? -ne 0 ]] ; then
98         DOWNLOADER="curl -f -O"
99         return
100     fi
101     $ECHO "error: wget or curl required"
102     exit_script 11
103 }
104
105 set_md5sum() {
106     test_program_installed md5sum
107     if [[ $? -ne 0 ]] ; then
108         MD5SUM=md5sum
109     else
110         MD5SUM="md5 -r"
111     fi
112 }
113
114 semver_into() {
115     RE_SEMVER="^([0-9]*)\.([0-9]*)\.([0-9]*)-?(.*)?$" # 3.3.3-5
116     CLANG_RE_OLD="^([0-9]*)\.([0-9]*)-?(.*)?$" # 3.3-5
117     if [[ $1 =~ $RE_SEMVER ]] ; then
118         export "$2=${BASH_REMATCH[1]}"
119         export "$3=${BASH_REMATCH[2]}"
120         export "$4=${BASH_REMATCH[3]}"
121         export "$5=${BASH_REMATCH[4]}"
122     elif [[ $1 =~ $CLANG_RE_OLD ]] ; then
123         export "$2=${BASH_REMATCH[1]}"
124         export "$3=${BASH_REMATCH[2]}"
125         export "$4=0"
126         export "$5=${BASH_REMATCH[3]}"
127     else
128         echo "unsupported version number, please report a bug: $1"
129         exit 123
130     fi
131 }
132
133 # issue 1440
134 gcc_version_ok() {
135         GCC_VERSION=`gcc -dumpversion`
136         local GCC_MAJOR local GCC_MINOR local GCC_PATCH local GCC_SPECIAL
137         semver_into $GCC_VERSION GCC_MAJOR GCC_MINOR GCC_PATCH GCC_SPECIAL
138
139         if [[ $GCC_MAJOR -lt 4
140                 || ( $GCC_MAJOR -eq 4 && $GCC_MINOR -lt 7 )
141                 || ( $GCC_MAJOR -eq 4 && $GCC_MINOR -eq 7 && $GCC_PATCH -lt 3 )
142                 || ( $GCC_MAJOR -eq 4 && $GCC_MINOR -eq 8 && $GCC_PATCH -eq 0 )
143                 ]] ; then
144                 echo "gcc version required >= 4.7.3, != 4.8.0, >= 4.8.1, got $GCC_VERSION"
145                 return 1
146         fi
147         return 0
148 }
149
150 clang_version_ok() {
151         CLANG_VERSION=`clang --version | head -n1`
152         CLANG_VERSION_RE='^[a-zA-Z0-9 ]* version (.*)$' # 3.3-5
153         if [[ $CLANG_VERSION =~ $CLANG_VERSION_RE ]] ; then
154                 export "CLANG_VERSION=${BASH_REMATCH[1]}"
155                 local CLANG_MAJOR local CLANG_MINOR local CLANG_PATCH local CLANG_SPECIAL
156                 semver_into "$CLANG_VERSION" CLANG_MAJOR CLANG_MINOR CLANG_PATCH CLANG_SPECIAL
157                 if [[ $CLANG_MAJOR -lt 3
158                         || ( $CLANG_MAJOR -eq 3 && $CLANG_MINOR -le 1 )
159                         ]] ; then
160                         echo "clang version required >= 3.1, got $CLANG_VERSION"
161                         return 1
162                 fi
163         else
164                 return 1
165         fi
166         return 0
167 }
168
169 set_cc() {
170     test_programs_installed clang clang++
171     if [[ $? -ne 0 ]] && clang_version_ok ; then
172         [ -z "$CC" ] && CC=clang
173         [ -z "$CXX" ] && CXX=clang++
174         return
175     fi
176
177     test_programs_installed gcc g++
178     if [[ $? -ne 0 ]] && gcc_version_ok ; then
179         [ -z "$CC" ] && CC=gcc
180         [ -z "$CXX" ] && CXX=g++
181         return
182     fi
183
184     $ECHO "error: high enough version of either (clang/clang++) or (gcc/g++) required!"
185     exit_script 10
186 }
187
188 set_make() {
189     MAKE='make'
190 }
191
192 check_git_branch() {
193     BRANCH=`git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,'`
194     if [ "$BRANCH" != "master" ] ; then
195         $ECHO "git branch is $BRANCH, not master"
196         exit_script 3
197     fi
198 }
199
200 check_installed_programs() {
201     ensure_program_installed chmod
202     ensure_program_installed uname
203     ensure_program_installed git
204     ensure_program_installed wget curl
205     ensure_program_installed clang gcc
206     ensure_program_installed clang++ g++ cl
207     ensure_program_installed make gmake
208     ensure_program_installed md5sum md5
209     ensure_program_installed cut
210 }
211
212 check_library_exists() {
213     GCC_TEST=factor-library-test.c
214     GCC_OUT=factor-library-test.out
215     $ECHO -n "Checking for library $1..."
216     $ECHO "int main(){return 0;}" > $GCC_TEST
217     $CC $GCC_TEST -o $GCC_OUT -l $1 2>&-
218     if [[ $? -ne 0 ]] ; then
219         $ECHO "not found."
220     else
221         $ECHO "found."
222     fi
223     $DELETE -f $GCC_TEST
224     check_ret $DELETE
225     $DELETE -f $GCC_OUT
226     check_ret $DELETE
227 }
228
229 check_X11_libraries() {
230     check_library_exists GL
231     check_library_exists X11
232     check_library_exists pango-1.0
233 }
234
235 check_gtk_libraries() {
236     check_library_exists gobject-2.0
237     check_library_exists gtk-x11-2.0
238     check_library_exists gdk-x11-2.0
239     check_library_exists gdk_pixbuf-2.0
240     check_library_exists gtkglext-x11-1.0
241     check_library_exists atk-1.0
242     check_library_exists gio-2.0
243     check_library_exists gdkglext-x11-1.0
244     check_library_exists pango-1.0
245 }
246
247
248 check_libraries() {
249     case $OS in
250             linux) check_X11_libraries
251                    check_gtk_libraries;;
252             unix) check_gtk_libraries;;
253     esac
254 }
255
256 check_factor_exists() {
257     if [[ -d "factor" ]] ; then
258         $ECHO "A directory called 'factor' already exists."
259         $ECHO "Rename or delete it and try again."
260         exit_script 4
261     fi
262 }
263
264 find_os() {
265     if [[ -n $OS ]] ; then return; fi
266     $ECHO "Finding OS..."
267     uname_s=`uname -s`
268     check_ret uname
269     case $uname_s in
270         CYGWIN_NT-5.2-WOW64) OS=windows;;
271         *CYGWIN_NT*) OS=windows;;
272         *CYGWIN*) OS=windows;;
273         MINGW32*) OS=windows;;
274         *darwin*) OS=macosx;;
275         *Darwin*) OS=macosx;;
276         *linux*) OS=linux;;
277         *Linux*) OS=linux;;
278     esac
279 }
280
281 find_architecture() {
282     if [[ -n $ARCH ]] ; then return; fi
283     $ECHO "Finding ARCH..."
284     uname_m=`uname -m`
285     check_ret uname
286     case $uname_m in
287        i386) ARCH=x86;;
288        i686) ARCH=x86;;
289        i86pc) ARCH=x86;;
290        amd64) ARCH=x86;;
291        ppc64) ARCH=ppc;;
292        *86) ARCH=x86;;
293        *86_64) ARCH=x86;;
294        "Power Macintosh") ARCH=ppc;;
295     esac
296 }
297
298 write_test_program() {
299     #! Must be 'echo'
300     echo "#include <stdio.h>" > $C_WORD.c
301     echo "int main(){printf(\"%ld\", (long)(8*sizeof(void*))); return 0; }" >> $C_WORD.c
302 }
303
304 c_find_word_size() {
305     $ECHO "Finding WORD..."
306     C_WORD=factor-word-size
307     write_test_program
308     $CC -o $C_WORD $C_WORD.c
309     WORD=$(./$C_WORD)
310     check_ret $C_WORD
311     $DELETE -f $C_WORD*
312 }
313
314 intel_macosx_word_size() {
315     ensure_program_installed sysctl
316     $ECHO -n "Testing if your Intel Mac supports 64bit binaries..."
317     sysctl machdep.cpu.extfeatures | grep EM64T >/dev/null
318     if [[ $? -eq 0 ]] ; then
319         WORD=64
320         $ECHO "yes!"
321     else
322         WORD=32
323         $ECHO "no."
324     fi
325 }
326
327 find_word_size() {
328     if [[ -n $WORD ]] ; then return; fi
329     if [[ $OS == macosx && $ARCH == x86 ]] ; then
330         intel_macosx_word_size
331     else
332         c_find_word_size
333     fi
334 }
335
336 set_factor_binary() {
337     case $OS in
338         windows) FACTOR_BINARY=factor.com;;
339         *) FACTOR_BINARY=factor;;
340     esac
341 }
342
343 set_factor_library() {
344     case $OS in
345         windows) FACTOR_LIBRARY=factor.dll;;
346         macosx) FACTOR_LIBRARY=libfactor.dylib;;
347         *) FACTOR_LIBRARY=libfactor.a;;
348     esac
349 }
350
351 set_factor_image() {
352     FACTOR_IMAGE=factor.image
353     FACTOR_IMAGE_FRESH=factor.image.fresh
354 }
355
356 echo_build_info() {
357     $ECHO OS=$OS
358     $ECHO ARCH=$ARCH
359     $ECHO WORD=$WORD
360     $ECHO DEBUG=$DEBUG
361     $ECHO FACTOR_BINARY=$FACTOR_BINARY
362     $ECHO FACTOR_LIBRARY=$FACTOR_LIBRARY
363     $ECHO FACTOR_IMAGE=$FACTOR_IMAGE
364     $ECHO MAKE_TARGET=$MAKE_TARGET
365     $ECHO BOOT_IMAGE=$BOOT_IMAGE
366     $ECHO MAKE_IMAGE_TARGET=$MAKE_IMAGE_TARGET
367     $ECHO GIT_PROTOCOL=$GIT_PROTOCOL
368     $ECHO GIT_URL=$GIT_URL
369     $ECHO DOWNLOADER=$DOWNLOADER
370     $ECHO CC=$CC
371     $ECHO CXX=$CXX
372     $ECHO MAKE=$MAKE
373     $ECHO COPY=$COPY
374     $ECHO DELETE=$DELETE
375 }
376
377 check_os_arch_word() {
378     if ! [[ -n $OS && -n $ARCH && -n $WORD ]] ; then
379         $ECHO "OS: $OS"
380         $ECHO "ARCH: $ARCH"
381         $ECHO "WORD: $WORD"
382         $ECHO "OS, ARCH, or WORD is empty.  Please report this."
383
384         $ECHO $MAKE_TARGET
385         exit_script 5
386     fi
387 }
388
389 set_build_info() {
390     check_os_arch_word
391     if [[ $OS == linux && $ARCH == ppc ]] ; then
392         MAKE_IMAGE_TARGET=linux-ppc.32
393         MAKE_TARGET=linux-ppc-32
394     elif [[ $OS == windows && $ARCH == x86 && $WORD == 64 ]] ; then
395         MAKE_IMAGE_TARGET=windows-x86.64
396         MAKE_TARGET=windows-x86-64
397     elif [[ $OS == windows && $ARCH == x86 && $WORD == 32 ]] ; then
398         MAKE_IMAGE_TARGET=windows-x86.32
399         MAKE_TARGET=windows-x86-32
400     elif [[ $ARCH == x86 && $WORD == 64 ]] ; then
401         MAKE_IMAGE_TARGET=unix-x86.64
402         MAKE_TARGET=$OS-x86-64
403     elif [[ $ARCH == x86 && $WORD == 32 ]] ; then
404         MAKE_IMAGE_TARGET=unix-x86.32
405         MAKE_TARGET=$OS-x86-32
406     else
407         MAKE_IMAGE_TARGET=$ARCH.$WORD
408         MAKE_TARGET=$OS-$ARCH-$WORD
409     fi
410     BOOT_IMAGE=boot.$MAKE_IMAGE_TARGET.image
411 }
412
413 parse_build_info() {
414     ensure_program_installed cut
415     $ECHO "Parsing make target from command line: $1"
416     OS=`echo $1 | cut -d '-' -f 1`
417     ARCH=`echo $1 | cut -d '-' -f 2`
418     WORD=`echo $1 | cut -d '-' -f 3`
419
420     if [[ $OS == linux && $ARCH == ppc ]] ; then WORD=32; fi
421     if [[ $OS == linux && $ARCH == arm ]] ; then WORD=32; fi
422     if [[ $OS == macosx && $ARCH == ppc ]] ; then WORD=32; fi
423
424     $ECHO "OS=$OS"
425     $ECHO "ARCH=$ARCH"
426     $ECHO "WORD=$WORD"
427 }
428
429 find_build_info() {
430     find_os
431     find_architecture
432     set_cc
433     find_word_size
434     set_factor_binary
435     set_factor_library
436     set_factor_image
437     set_build_info
438     set_downloader
439     set_make
440     echo_build_info
441 }
442
443 invoke_git() {
444     git $*
445     check_ret git
446 }
447
448 git_clone() {
449     $ECHO "Downloading the git repository from factorcode.org..."
450     invoke_git clone $GIT_URL
451 }
452
453 update_script_name() {
454     $ECHO `dirname $0`/_update.sh
455 }
456
457 update_script() {
458     update_script=`update_script_name`
459     bash_path=`which bash`
460     $ECHO "#!$bash_path" >"$update_script"
461     $ECHO "git pull \"$GIT_URL\" master" >>"$update_script"
462     $ECHO "if [[ \$? -eq 0 ]]; then exec \"$0\" $SCRIPT_ARGS; else echo \"git pull failed\"; exit 2; fi" \
463         >>"$update_script"
464     $ECHO "exit 0" >>"$update_script"
465
466     chmod 755 "$update_script"
467     exec "$update_script"
468 }
469
470 update_script_changed() {
471     invoke_git diff --stat `invoke_git merge-base HEAD FETCH_HEAD` FETCH_HEAD | grep 'build\.sh' >/dev/null
472 }
473
474 git_fetch_factorcode() {
475     $ECHO "Fetching the git repository from factorcode.org..."
476
477     rm -f `update_script_name`
478     invoke_git fetch "$GIT_URL" master
479
480     if update_script_changed; then
481         $ECHO "Updating and restarting the build.sh script..."
482         update_script
483     else
484         $ECHO "Updating the working tree..."
485         invoke_git pull "$GIT_URL" master
486     fi
487 }
488
489 cd_factor() {
490     cd factor
491     check_ret cd
492 }
493
494 set_copy() {
495     case $OS in
496         windows) COPY=cp;;
497         *) COPY=cp;;
498     esac
499 }
500
501 set_delete() {
502     case $OS in
503         windows) DELETE=rm;;
504         *) DELETE=rm;;
505     esac
506 }
507
508 backup_factor() {
509     $ECHO "Backing up factor..."
510     $COPY $FACTOR_BINARY $FACTOR_BINARY.bak
511     $COPY $FACTOR_LIBRARY $FACTOR_LIBRARY.bak
512     $COPY $BOOT_IMAGE $BOOT_IMAGE.bak
513     $COPY $FACTOR_IMAGE $FACTOR_IMAGE.bak
514     $ECHO "Done with backup."
515 }
516
517 check_makefile_exists() {
518     if [[ ! -e "GNUmakefile" ]] ; then
519         $ECHO ""
520         $ECHO "***GNUmakefile not found***"
521         $ECHO "You are likely in the wrong directory."
522         $ECHO "Run this script from your factor directory:"
523         $ECHO "     ./build.sh"
524         exit_script 6
525     fi
526 }
527
528 invoke_make() {
529     check_makefile_exists
530     $MAKE $MAKE_OPTS $*
531     check_ret $MAKE
532 }
533
534 make_clean() {
535     invoke_make clean
536 }
537
538 make_factor() {
539     invoke_make CC=$CC CXX=$CXX $MAKE_TARGET -j5
540 }
541
542 make_clean_factor() {
543     make_clean
544     make_factor
545 }
546
547 update_boot_images() {
548     $ECHO "Deleting old images..."
549     $DELETE checksums.txt* > /dev/null 2>&1
550     # delete boot images with one or two characters after the dot
551     $DELETE $BOOT_IMAGE.{?,??} > /dev/null 2>&1
552     $DELETE temp/staging.*.image > /dev/null 2>&1
553     if [[ -f $BOOT_IMAGE ]] ; then
554         get_url http://downloads.factorcode.org/images/latest/checksums.txt
555         factorcode_md5=`cat checksums.txt|grep $BOOT_IMAGE|cut -f2 -d' '`
556         set_md5sum
557         disk_md5=`$MD5SUM $BOOT_IMAGE|cut -f1 -d' '`
558         $ECHO "Factorcode md5: $factorcode_md5";
559         $ECHO "Disk md5: $disk_md5";
560         if [[ "$factorcode_md5" == "$disk_md5" ]] ; then
561             $ECHO "Your disk boot image matches the one on factorcode.org."
562         else
563             $DELETE $BOOT_IMAGE > /dev/null 2>&1
564             get_boot_image;
565         fi
566     else
567         get_boot_image
568     fi
569 }
570
571 get_boot_image() {
572     $ECHO "Downloading boot image $BOOT_IMAGE."
573     get_url http://downloads.factorcode.org/images/latest/$BOOT_IMAGE
574 }
575
576 get_url() {
577     if [[ -z $DOWNLOADER ]] ; then
578         set_downloader;
579     fi
580     $ECHO $DOWNLOADER $1 ;
581     $DOWNLOADER $1
582     check_ret $DOWNLOADER
583 }
584
585 get_config_info() {
586     find_build_info
587     check_installed_programs
588     check_libraries
589 }
590
591 copy_fresh_image() {
592     $ECHO "Copying $FACTOR_IMAGE to $FACTOR_IMAGE_FRESH..."
593     $COPY $FACTOR_IMAGE $FACTOR_IMAGE_FRESH
594 }
595
596 bootstrap() {
597     ./$FACTOR_BINARY -i=$BOOT_IMAGE
598     copy_fresh_image
599 }
600
601 install() {
602     check_factor_exists
603     get_config_info
604     git_clone
605     cd_factor
606     make_factor
607     get_boot_image
608     bootstrap
609 }
610
611 update() {
612     get_config_info
613     check_git_branch
614     git_fetch_factorcode
615     backup_factor
616     make_clean_factor
617 }
618
619 download_and_bootstrap() {
620     update_boot_images
621     bootstrap
622 }
623
624 net_bootstrap_no_pull() {
625     get_config_info
626     make_clean_factor
627     download_and_bootstrap
628 }
629
630 refresh_image() {
631     ./$FACTOR_BINARY -script -e="USING: vocabs.loader vocabs.refresh system memory ; refresh-all save 0 exit"
632     check_ret factor
633 }
634
635 make_boot_image() {
636     ./$FACTOR_BINARY -script -e="\"$MAKE_IMAGE_TARGET\" USING: system bootstrap.image memory ; make-image save 0 exit"
637     check_ret factor
638 }
639
640 install_deps_apt_get() {
641     sudo apt-get --yes install libc6-dev libpango1.0-dev libx11-dev xorg-dev libgtk2.0-dev gtk2-engines-pixbuf libgtkglext1-dev wget git git-doc rlwrap clang gcc make screen tmux libssl-dev g++
642     check_ret sudo
643 }
644
645 install_deps_pacman() {
646     sudo pacman --noconfirm -S gcc clang make rlwrap git wget pango glibc gtk2 gtk3 gtkglext gtk-engines gdk-pixbuf2 libx11 screen tmux
647     check_ret sudo
648 }
649
650 install_deps_dnf() {
651     sudo dnf --assumeyes install gcc gcc-c++ glibc-devel binutils libX11-devel pango-devel gtk3-devel gdk-pixbuf2-devel gtkglext-devel tmux rlwrap wget
652     check_ret sudo
653 }
654
655
656 install_deps_macosx() {
657     test_program_installed git
658     if [[ $? -ne 1 ]] ; then
659         ensure_program_installed yes
660         $ECHO "git not found."
661         $ECHO "This script requires either git-core or port."
662         $ECHO "If it fails, install git-core or port and try again."
663         ensure_program_installed port
664         $ECHO "Installing git-core with port...this will take awhile."
665         yes | sudo port install git-core
666     fi
667 }
668
669 usage() {
670     $ECHO "usage: $0 command [optional-target]"
671     $ECHO "  install - git clone, compile, bootstrap"
672     $ECHO "  deps-apt-get - install required packages for Factor on Linux using apt-get"
673     $ECHO "  deps-pacman - install required packages for Factor on Linux using pacman"
674     $ECHO "  deps-dnf - install required packages for Factor on Linux using dnf"
675     $ECHO "  deps-macosx - install git on MacOSX using port"
676     $ECHO "  self-update - git pull, recompile, make local boot image, bootstrap"
677     $ECHO "  quick-update - git pull, refresh-all, save"
678     $ECHO "  update|latest - git pull, recompile, download a boot image, bootstrap"
679     $ECHO "  bootstrap - bootstrap with existing boot image"
680     $ECHO "  net-bootstrap - recompile, download a boot image, bootstrap"
681     $ECHO "  make-target - find and print the os-arch-cpu string"
682     $ECHO "  report - print the build variables"
683     $ECHO ""
684     $ECHO "If you are behind a firewall, invoke as:"
685     $ECHO "env GIT_PROTOCOL=http $0 <command>"
686     $ECHO ""
687     $ECHO "Example for overriding the default target:"
688     $ECHO "    $0 update macosx-x86-32"
689 }
690
691 MAKE_TARGET=unknown
692
693 # -n is nonzero length, -z is zero length
694 if [[ -n "$2" ]] ; then
695     parse_build_info $2
696 fi
697
698 set_copy
699 set_delete
700
701 case "$1" in
702     install) install ;;
703     deps-apt-get) install_deps_apt_get ;;
704     deps-pacman) install_deps_pacman ;;
705     deps-macosx) install_deps_macosx ;;
706     deps-dnf) install_deps_dnf ;;
707     self-update) update; make_boot_image; bootstrap;;
708     quick-update) update; refresh_image ;;
709     update) update; download_and_bootstrap ;;
710     latest) update; download_and_bootstrap ;;
711     bootstrap) get_config_info; bootstrap ;;
712     net-bootstrap) net_bootstrap_no_pull ;;
713     make-target) FIND_MAKE_TARGET=true; ECHO=false; find_build_info; exit_script ;;
714     report) find_build_info ;;
715     full-report) find_build_info; check_installed_programs; check_libraries ;;
716     *) usage ;;
717 esac