2008-02-11 17:19:10 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#!/usr/bin/env bash
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Programs returning != 0 will not cause script to exit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set +e
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Case insensitive string comparison
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								shopt -s nocaseglob
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#shopt -s nocasematch
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ECHO=echo
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								OS=
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ARCH=
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WORD=
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-11 17:19:10 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								GIT_PROTOCOL=${GIT_PROTOCOL:="git"}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								GIT_URL=${GIT_URL:=$GIT_PROTOCOL"://factorcode.org/git/factor.git"}
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								SCRIPT_ARGS="$*"
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-11 17:19:10 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								REQUIRE_CLANG_VERSION=3.1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# return 1 on found
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-13 14:38:41 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test_program_installed() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if ! [[ -n $(type -p $1) ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return 0;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return 1;
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-13 14:38:41 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# return 1 on found
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test_programs_installed() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-17 19:56:31 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    local installed=0;
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO -n "Checking for all($*)..."
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    for i in "$@" ;
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        test_program_installed $i
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if [[ $? -eq 1 ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            installed=$(( $installed + 1 ))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    done
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $installed -eq $# ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "found!"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "all not found."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return 0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-04-21 00:23:16 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								exit_script() {
							 | 
						
					
						
							
								
									
										
										
										
											2011-01-24 06:20:59 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $FIND_MAKE_TARGET = true ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # Must be echo not $ECHO
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-25 15:59:07 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        echo $MAKE_TARGET;
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-22 12:09:42 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit $1
							 | 
						
					
						
							
								
									
										
										
										
											2009-04-21 00:23:16 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ensure_program_installed() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-17 19:56:31 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    local installed=0;
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO -n "Checking for any($*)..."
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    for i in "$@" ;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        test_program_installed $i
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if [[ $? -eq 1 ]]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            $ECHO "found $i!"
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            installed=$(( $installed + 1 ))
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            return
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    done
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "none found."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO -n "Install "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $# -eq 1 ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO -n $1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO -n "any of [ $* ]"
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO " and try again."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $OS == macosx ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "If you have Xcode 4.3 or higher installed, you must install the"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "Command Line Tools from Xcode Preferences > Downloads in order"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "to build Factor."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit_script 1;
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								check_ret() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    RET=$?
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $RET -ne 0 ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       $ECHO $1 failed
							 | 
						
					
						
							
								
									
										
										
										
											2009-04-21 00:23:16 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       exit_script 2
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-13 14:38:41 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_downloader() {
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    test_program_installed wget
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -ne 0 ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-05 07:57:09 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        DOWNLOADER="wget -nd"
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        DOWNLOADER_NAME=wget
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    test_program_installed curl
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -ne 0 ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-29 00:46:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        DOWNLOADER="curl -L -f -O"
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        DOWNLOADER_NAME=curl
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "error: wget or curl required"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit_script 11
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-13 14:38:41 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-13 15:32:43 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_md5sum() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    test_program_installed md5sum
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -ne 0 ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MD5SUM=md5sum
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MD5SUM="md5 -r"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-13 15:32:43 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-27 01:18:01 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								semver_into() {
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-02 18:46:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    RE_SEMVER="^([0-9]*)\.([0-9]*)\.([0-9]*)-?(.*)?$" # 3.3.3-5
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    CLANG_RE_OLD="^([0-9]*)\.([0-9]*)-?(.*)?$" # 3.3-5
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $1 =~ $RE_SEMVER ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        export "$2=${BASH_REMATCH[1]}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        export "$3=${BASH_REMATCH[2]}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        export "$4=${BASH_REMATCH[3]}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        export "$5=${BASH_REMATCH[4]}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    elif [[ $1 =~ $CLANG_RE_OLD ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        export "$2=${BASH_REMATCH[1]}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        export "$3=${BASH_REMATCH[2]}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        export "$4=0"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        export "$5=${BASH_REMATCH[3]}"
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-02 18:46:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        echo "unsupported version number, please report a bug: $1"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        exit 123
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-02 18:46:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-27 01:18:01 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								clang_version_ok() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    CLANG_VERSION=$(clang --version | head -n1)
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    CLANG_VERSION_RE='^[a-zA-Z0-9 ]* version (.*)$' # 3.3-5
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $CLANG_VERSION =~ $CLANG_VERSION_RE ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        export "CLANG_VERSION=${BASH_REMATCH[1]}"
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        local CLANG_MAJOR CLANG_MINOR CLANG_PATCH CLANG_SPECIAL
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        semver_into "$CLANG_VERSION" CLANG_MAJOR CLANG_MINOR CLANG_PATCH CLANG_SPECIAL
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if [[ $CLANG_MAJOR -lt 3
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            || ( $CLANG_MAJOR -eq 3 && $CLANG_MINOR -le 1 )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            echo "clang version required >= $REQUIRE_CLANG_VERSION, got $CLANG_VERSION"
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            return 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return 0
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-27 01:18:01 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-24 01:39:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_cc() {
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-05 07:57:09 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # on Cygwin we MUST use the MinGW "cross-compiler", therefore check these first
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # furthermore, we prefer 64 bit over 32 bit versions if both are available
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    test_programs_installed x86_64-w64-mingw32-gcc x86_64-w64-mingw32-g++
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -ne 0 ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        [ -z "$CC" ] && CC=x86_64-w64-mingw32-gcc
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        [ -z "$CXX" ] && CXX=x86_64-w64-mingw32-g++
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    test_programs_installed i686-w64-mingw32-gcc i686-w64-mingw32-g++
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -ne 0 ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        [ -z "$CC" ] && CC=i686-w64-mingw32-gcc
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        [ -z "$CXX" ] && CXX=i686-w64-mingw32-g++
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    test_programs_installed clang clang++
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-27 01:18:01 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -ne 0 ]] && clang_version_ok ; then
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-24 01:39:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        [ -z "$CC" ] && CC=clang
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        [ -z "$CXX" ] && CXX=clang++
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-05 07:57:09 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # gcc and g++ will fail to correctly build Factor on Cygwin
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    test_programs_installed gcc g++
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-26 16:59:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -ne 0 ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-24 01:39:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        [ -z "$CC" ] && CC=gcc
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        [ -z "$CXX" ] && CXX=g++
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-24 01:39:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-27 01:18:01 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "error: high enough version of either (clang/clang++) or (gcc/g++) required!"
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit_script 10
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-11 16:44:50 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_make() {
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-08 16:21:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case $OS in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        freebsd) MAKE=gmake ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *) MAKE=make ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    esac
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $MAKE = 'gmake' ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ensure_program_installed gmake
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-11 16:44:50 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								check_installed_programs() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed chmod
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed uname
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed git
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed wget curl
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-05 07:57:09 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed clang x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc gcc
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed clang++ x86_64-w64-mingw32-g++ i686-w64-mingw32-g++ g++ cl
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-11 16:44:50 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed make gmake
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed md5sum md5
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed cut
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 22:03:32 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								check_library_exists() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    GCC_TEST=factor-library-test.c
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    GCC_OUT=factor-library-test.out
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO -n "Checking for library $1..."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "int main(){return 0;}" > $GCC_TEST
							 | 
						
					
						
							
								
									
										
										
										
											2011-04-06 18:49:15 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $CC $GCC_TEST -o $GCC_OUT -l $1 2>&-
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -ne 0 ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-26 00:11:19 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "not found."
							 | 
						
					
						
							
								
									
										
										
										
											2011-04-06 18:49:15 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "found."
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $DELETE -f $GCC_TEST
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret $DELETE
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $DELETE -f $GCC_OUT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret $DELETE
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 22:03:32 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								check_X11_libraries() {
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-29 18:24:24 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    check_library_exists GL
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_library_exists X11
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_library_exists pango-1.0
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 22:03:32 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-04-06 18:49:15 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								check_gtk_libraries() {
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-29 18:24:24 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    check_library_exists gobject-2.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_library_exists gtk-x11-2.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_library_exists gdk-x11-2.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_library_exists gdk_pixbuf-2.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_library_exists gtkglext-x11-1.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_library_exists atk-1.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_library_exists gio-2.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_library_exists gdkglext-x11-1.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_library_exists pango-1.0
							 | 
						
					
						
							
								
									
										
										
										
											2011-04-06 18:49:15 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 22:03:32 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								check_libraries() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case $OS in
							 | 
						
					
						
							
								
									
										
										
										
											2011-04-06 18:49:15 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            linux) check_X11_libraries
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                   check_gtk_libraries;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            unix) check_gtk_libraries;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    esac
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 22:03:32 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 19:03:01 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								check_factor_exists() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ -d "factor" ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "A directory called 'factor' already exists."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "Rename or delete it and try again."
							 | 
						
					
						
							
								
									
										
										
										
											2009-04-21 00:23:16 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        exit_script 4
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 19:03:01 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								find_os() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ -n $OS ]] ; then return; fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Finding OS..."
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-17 19:56:31 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    local uname_s=$(uname -s)
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret uname
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case $uname_s in
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-18 21:25:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        CYGWIN_NT-5.2-WOW64) OS=windows;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *CYGWIN_NT*) OS=windows;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *CYGWIN*) OS=windows;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MINGW32*) OS=windows;;
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-29 17:29:40 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        MSYS_NT*) OS=windows;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *darwin*) OS=macosx;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *Darwin*) OS=macosx;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *linux*) OS=linux;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *Linux*) OS=linux;;
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-08 16:21:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        FreeBSD) OS=freebsd;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    esac
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								find_architecture() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ -n $ARCH ]] ; then return; fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Finding ARCH..."
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    uname_m=$(uname -m)
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret uname
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case $uname_m in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       i386) ARCH=x86;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       i686) ARCH=x86;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-16 16:59:07 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       i86pc) ARCH=x86;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-07 08:51:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       amd64) ARCH=x86;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-09 15:01:04 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       ppc64) ARCH=ppc;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       *86) ARCH=x86;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       *86_64) ARCH=x86;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       "Power Macintosh") ARCH=ppc;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    esac
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								find_num_cores() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Finding num cores..."
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-08 16:21:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    NUM_CORES=1
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    uname_s=$(uname -s)
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    check_ret uname
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case $uname_s in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        CYGWIN_NT-5.2-WOW64 | *CYGWIN_NT* | *CYGWIN* | MINGW32*) NUM_CORES=$NUMBER_OF_PROCESSORS;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *darwin* | *Darwin* | *linux* | *Linux*) NUM_CORES=$(getconf _NPROCESSORS_ONLN);;
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-08 16:21:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        freebsd) NUM_CORES=$(sysctl -n hw.ncpu);;
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    esac
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								echo_test_program() {
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-29 01:23:03 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    #! Must be 'echo'
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    echo -e "int main(){ return (long)(8*sizeof(void*)); }"
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 22:24:36 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								c_find_word_size() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Finding WORD..."
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    C_WORD="factor-word-size"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo_test_program | $CC -o $C_WORD -xc -
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret $CC
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ./$C_WORD
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    WORD=$?
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $DELETE -f $C_WORD
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:00:54 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								intel_macosx_word_size() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed sysctl
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO -n "Testing if your Intel Mac supports 64bit binaries..."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    sysctl machdep.cpu.extfeatures | grep EM64T >/dev/null
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 22:24:36 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -eq 0 ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-20 16:53:18 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        WORD=64
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "yes!"
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 22:24:36 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        WORD=32
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "no."
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 22:24:36 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								find_word_size() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ -n $WORD ]] ; then return; fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $OS == macosx && $ARCH == x86 ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        intel_macosx_word_size
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        c_find_word_size
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 22:24:36 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_factor_binary() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case $OS in
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-18 21:25:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        windows) FACTOR_BINARY=factor.com;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *) FACTOR_BINARY=factor;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    esac
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_factor_library() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case $OS in
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-18 21:25:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        windows) FACTOR_LIBRARY=factor.dll;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        macosx) FACTOR_LIBRARY=libfactor.dylib;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *) FACTOR_LIBRARY=libfactor.a;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    esac
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_factor_image() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    FACTOR_IMAGE=factor.image
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    FACTOR_IMAGE_FRESH=factor.image.fresh
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								echo_build_info() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO OS=$OS
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO ARCH=$ARCH
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO NUM_CORES=$NUM_CORES
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO WORD=$WORD
							 | 
						
					
						
							
								
									
										
										
										
											2016-11-15 23:52:07 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO DEBUG=$DEBUG
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-23 17:17:58 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO REPRODUCIBLE=$REPRODUCIBLE
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-09 03:54:34 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO CURRENT_BRANCH=$CURRENT_BRANCH
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO FACTOR_BINARY=$FACTOR_BINARY
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO FACTOR_LIBRARY=$FACTOR_LIBRARY
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO FACTOR_IMAGE=$FACTOR_IMAGE
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO MAKE_TARGET=$MAKE_TARGET
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO BOOT_IMAGE=$BOOT_IMAGE
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO MAKE_IMAGE_TARGET=$MAKE_IMAGE_TARGET
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO GIT_PROTOCOL=$GIT_PROTOCOL
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO GIT_URL=$GIT_URL
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO DOWNLOADER=$DOWNLOADER
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO CC=$CC
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-06 18:06:48 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO CXX=$CXX
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO MAKE=$MAKE
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO COPY=$COPY
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO DELETE=$DELETE
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:00:54 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								check_os_arch_word() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if ! [[ -n $OS && -n $ARCH && -n $WORD ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-28 22:40:02 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "OS: $OS"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "ARCH: $ARCH"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "WORD: $WORD"
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:00:54 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "OS, ARCH, or WORD is empty.  Please report this."
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-17 01:56:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO $MAKE_TARGET
							 | 
						
					
						
							
								
									
										
										
										
											2009-04-21 00:23:16 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        exit_script 5
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:00:54 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:00:54 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_build_info() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_os_arch_word
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-02 21:40:27 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $OS == linux && $ARCH == ppc ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2011-05-20 18:11:50 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_IMAGE_TARGET=linux-ppc.32
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_TARGET=linux-ppc-32
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-18 21:25:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    elif [[ $OS == windows && $ARCH == x86 && $WORD == 64 ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_IMAGE_TARGET=windows-x86.64
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_TARGET=windows-x86-64
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    elif [[ $OS == windows && $ARCH == x86 && $WORD == 32 ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_IMAGE_TARGET=windows-x86.32
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_TARGET=windows-x86-32
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-07 22:09:42 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    elif [[ $ARCH == x86 && $WORD == 64 ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_IMAGE_TARGET=unix-x86.64
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-08 21:36:05 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_TARGET=$OS-x86-64
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-04 15:39:59 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    elif [[ $ARCH == x86 && $WORD == 32 ]] ; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_IMAGE_TARGET=unix-x86.32
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_TARGET=$OS-x86-32
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-08 21:36:05 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-07 22:09:42 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_IMAGE_TARGET=$ARCH.$WORD
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-08 21:36:05 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MAKE_TARGET=$OS-$ARCH-$WORD
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-07 22:56:57 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    BOOT_IMAGE=boot.$MAKE_IMAGE_TARGET.image
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:00:54 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								parse_build_info() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ensure_program_installed cut
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Parsing make target from command line: $1"
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    OS=$(echo $1 | cut -d '-' -f 1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ARCH=$(echo $1 | cut -d '-' -f 2)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    WORD=$(echo $1 | cut -d '-' -f 3)
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-19 11:34:29 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:18:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $OS == linux && $ARCH == ppc ]] ; then WORD=32; fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $OS == linux && $ARCH == arm ]] ; then WORD=32; fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $OS == macosx && $ARCH == ppc ]] ; then WORD=32; fi
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-06 18:06:48 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "OS=$OS"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "ARCH=$ARCH"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "WORD=$WORD"
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:00:54 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								find_build_info() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    find_os
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    find_architecture
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    find_num_cores
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-24 01:39:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    set_cc
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    find_word_size
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    set_current_branch
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    set_factor_binary
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    set_factor_library
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    set_factor_image
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    set_build_info
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    set_downloader
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    set_make
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo_build_info
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-11 17:19:10 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								invoke_git() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    git "$@"
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret git
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-11 17:19:10 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								git_clone() {
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Downloading the git repository from factorcode.org..."
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    invoke_git clone $GIT_URL
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								update_script_name() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO "$(dirname $0)/_update.sh"
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								update_script() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    local -r update_script=$(update_script_name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    local -r bash_path=$(which bash)
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "#!$bash_path" >"$update_script"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "git pull \"$GIT_URL\" master" >>"$update_script"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "if [[ \$? -eq 0 ]]; then exec \"$0\" $SCRIPT_ARGS; else echo \"git pull failed\"; exit 2; fi" \
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        >>"$update_script"
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "exit 0" >>"$update_script"
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    chmod 755 "$update_script"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exec "$update_script"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								update_script_changed() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    invoke_git diff --stat "$(invoke_git merge-base HEAD FETCH_HEAD)" FETCH_HEAD | grep 'build\.sh' >/dev/null
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								git_fetch_factorcode() {
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Fetching the git repository from factorcode.org..."
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    rm -f "$(update_script_name)"
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    invoke_git fetch "$GIT_URL" master
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if update_script_changed; then
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-16 09:28:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        $ECHO "Updating and restarting the build.sh script..."
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        update_script
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "Updating the working tree..."
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        invoke_git pull "$GIT_URL" master
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-06 20:49:07 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cd_factor() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    cd "factor"
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret cd
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 19:51:24 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_copy() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case $OS in
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-18 21:25:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        windows) COPY=cp;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *) COPY=cp;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    esac
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_delete() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case $OS in
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-18 21:25:06 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        windows) DELETE=rm;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        *) DELETE=rm;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    esac
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								backup_factor() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Backing up factor..."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $COPY $FACTOR_BINARY $FACTOR_BINARY.bak
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $COPY $FACTOR_LIBRARY $FACTOR_LIBRARY.bak
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 18:00:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $COPY $BOOT_IMAGE $BOOT_IMAGE.bak
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $COPY $FACTOR_IMAGE $FACTOR_IMAGE.bak
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Done with backup."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-11 11:19:42 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								check_makefile_exists() {
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-16 09:43:22 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ ! -e "GNUmakefile" ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO ""
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "***GNUmakefile not found***"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "You are likely in the wrong directory."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "Run this script from your factor directory:"
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-15 06:16:33 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "     ./build.sh"
							 | 
						
					
						
							
								
									
										
										
										
											2009-04-21 00:23:16 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        exit_script 6
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-11 11:19:42 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-11 17:19:10 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								invoke_make() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-11 11:19:42 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_makefile_exists
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $MAKE $MAKE_OPTS "$@"
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-11 11:19:42 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret $MAKE
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-11 17:19:10 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 19:51:24 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								make_clean() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    invoke_make clean
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								make_factor() {
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Building factor with $NUM_CORES cores"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    invoke_make CC=$CC CXX=$CXX $MAKE_TARGET -j$NUM_CORES
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-29 01:48:55 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								make_clean_factor() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    make_clean
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    make_factor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 22:34:38 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								current_git_branch() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    git rev-parse --abbrev-ref HEAD
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								check_url() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $DOWNLOADER_NAME == 'wget' ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if [[ $(wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK') ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            return 0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            return 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    elif [[ $DOWNLOADER_NAME == 'curl' ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-17 19:56:31 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        local code=$(curl -sL -w "%{http_code}\\n" "$1" -o /dev/null)
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if [[ $code -eq 200 ]]; then return 0; else return 1; fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "error: wget or curl required in check_url"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        exit_script 12
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# If we are on a branch, first try to get a boot image for that branch.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Otherwise, just use `master`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_boot_image_vars() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    set_current_branch
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-17 19:56:31 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    local url="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/checksums.txt"
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    check_url $url
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -eq 0 ]]; then
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-17 19:56:31 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        CHECKSUM_URL="$url"
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        BOOT_IMAGE_URL="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/${BOOT_IMAGE}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        CHECKSUM_URL="http://downloads.factorcode.org/images/master/checksums.txt"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        BOOT_IMAGE_URL="http://downloads.factorcode.org/images/master/${BOOT_IMAGE}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_current_branch() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-04 21:31:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [ -n "${CI_BRANCH}" ]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        CURRENT_BRANCH="${CI_BRANCH}"
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-09 04:22:13 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-04 21:31:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        CURRENT_BRANCH=$(current_git_branch)
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-09 04:22:13 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-09 03:54:34 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								update_boot_image() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    set_boot_image_vars
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Deleting old images..."
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $DELETE checksums.txt* > /dev/null 2>&1
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-22 12:09:42 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # delete boot images with one or two characters after the dot
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 18:00:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $DELETE $BOOT_IMAGE.{?,??} > /dev/null 2>&1
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $DELETE temp/staging.*.image > /dev/null 2>&1
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ -f $BOOT_IMAGE ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        get_url $CHECKSUM_URL
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-19 07:30:03 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        local factorcode_md5=$(cat checksums.txt | grep $BOOT_IMAGE | cut -f2 -d' ')
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        set_md5sum
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-19 07:30:03 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        local disk_md5=$($MD5SUM $BOOT_IMAGE | cut -f1 -d' ')
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "Factorcode md5: $factorcode_md5";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "Disk md5: $disk_md5";
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if [[ "$factorcode_md5" == "$disk_md5" ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            $ECHO "Your disk boot image matches the one on factorcode.org."
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        else
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            $DELETE $BOOT_IMAGE > /dev/null 2>&1
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            get_boot_image
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        get_boot_image
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								get_boot_image() {
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Downloading boot image $BOOT_IMAGE."
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    get_url "${BOOT_IMAGE_URL}"
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-13 14:38:41 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								get_url() {
							 | 
						
					
						
							
								
									
										
										
										
											2011-01-24 06:20:59 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ -z $DOWNLOADER ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:19:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        set_downloader;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO $DOWNLOADER $1 ;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-08 13:00:40 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $DOWNLOADER $1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret $DOWNLOADER
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-19 15:18:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								get_config_info() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    find_build_info
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_installed_programs
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_libraries
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								copy_fresh_image() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Copying $FACTOR_IMAGE to $FACTOR_IMAGE_FRESH..."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $COPY $FACTOR_IMAGE $FACTOR_IMAGE_FRESH
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-19 15:18:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								bootstrap() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ./$FACTOR_BINARY -i=$BOOT_IMAGE
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-29 01:48:55 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    copy_fresh_image
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 22:03:32 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								install() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_factor_exists
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    get_config_info
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    git_clone
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    cd_factor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    make_factor
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    set_boot_image_vars
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    get_boot_image
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    bootstrap
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 22:03:32 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								update() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    get_config_info
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 13:05:56 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    git_fetch_factorcode
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    backup_factor
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-29 01:48:55 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    make_clean_factor
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-04 14:44:46 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-21 16:17:01 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								download_and_bootstrap() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    update_boot_image
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    bootstrap
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 22:03:32 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-29 01:48:55 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								net_bootstrap_no_pull() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    get_config_info
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    make_clean_factor
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-21 16:17:01 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    download_and_bootstrap
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-29 01:48:55 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-04 14:44:46 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								refresh_image() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ./$FACTOR_BINARY -e="USING: vocabs.loader vocabs.refresh system memory ; refresh-all save 0 exit"
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret factor
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-18 18:07:24 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								make_boot_image() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-16 20:26:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ./$FACTOR_BINARY -e="\"$MAKE_IMAGE_TARGET\" USING: system bootstrap.image memory ; make-image save 0 exit"
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret factor
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-04 14:44:46 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-28 02:21:57 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								install_deps_apt() {
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-08 22:08:26 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    sudo apt install --yes libc6-dev libpango1.0-dev libx11-dev xorg-dev libgtk2.0-dev gtk2-engines-pixbuf libgtkglext1-dev wget git git-doc rlwrap clang make screen tmux libssl-dev
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret sudo
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-03 22:17:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-03 20:04:18 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								install_deps_pacman() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-18 11:24:14 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    sudo pacman --noconfirm -Syu gcc clang make rlwrap git wget pango glibc gtk2 gtk3 gtkglext gtk-engines gdk-pixbuf2 libx11 screen tmux
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-03 20:04:18 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret sudo
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-24 01:39:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								install_deps_dnf() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    sudo dnf --assumeyes install gcc gcc-c++ glibc-devel binutils libX11-devel pango-devel gtk3-devel gdk-pixbuf2-devel gtkglext-devel tmux rlwrap wget
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    check_ret sudo
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-08 16:21:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								install_deps_pkg() {
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-09 14:39:25 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    sudo pkg install --yes git gmake gcc rlwrap ripgrep curl gmake x11-toolkits/gtk30 x11-toolkits/gtkglext pango cairo vim
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-08 16:21:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-24 01:39:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-04-07 18:14:26 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								install_deps_macosx() {
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-08 13:00:40 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    test_program_installed git
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [[ $? -ne 1 ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ensure_program_installed yes
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "git not found."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "This script requires either git-core or port."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "If it fails, install git-core or port and try again."
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ensure_program_installed port
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $ECHO "Installing git-core with port...this will take awhile."
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        yes | sudo port install git-core
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-08 13:00:40 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:11:00 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-19 15:18:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								usage() {
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-12 17:05:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "usage: $0 command [optional-target]"
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-10 01:56:59 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  install - git clone, compile, bootstrap"
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-28 02:21:57 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  deps-apt - install required packages for Factor on Linux using apt"
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-03 20:04:18 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  deps-pacman - install required packages for Factor on Linux using pacman"
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-29 12:19:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  deps-dnf - install required packages for Factor on Linux using dnf"
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-08 16:21:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  deps-pkg - install required packages for Factor on FreeBSD using pkg"
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-10 01:56:59 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  deps-macosx - install git on MacOSX using port"
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-08 21:02:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  self-update - git pull, recompile, make local boot image, bootstrap"
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-10 01:56:59 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  quick-update - git pull, refresh-all, save"
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-29 21:44:32 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  update|latest - git pull, recompile, download a boot image, bootstrap"
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-08 22:35:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  compile - compile the binary"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  recompile - recompile the binary"
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-16 21:35:59 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  bootstrap - bootstrap with existing boot image"
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-08 21:02:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  net-bootstrap - recompile, download a boot image, bootstrap"
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-10 01:56:59 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  make-target - find and print the os-arch-cpu string"
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-23 17:17:58 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  report|info - print the build variables"
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:07:53 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $ECHO "  update-boot-image - get the boot image for the current branch of for master"
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-10 01:56:59 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO ""
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-24 00:14:53 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "If you are behind a firewall, invoke as:"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "env GIT_PROTOCOL=http $0 <command>"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO ""
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "Example for overriding the default target:"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "    $0 update macosx-x86-32"
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-19 15:18:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-16 16:56:17 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								MAKE_TARGET=unknown
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:00:54 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# -n is nonzero length, -z is zero length
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								if [[ -n "$2" ]] ; then
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:24:45 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    parse_build_info $2
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:00:54 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-23 17:41:20 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-23 17:17:58 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if [ "$#" -gt 3 ]; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									usage
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $ECHO "error: too many arguments"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-13 23:00:54 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-11-19 17:27:12 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_copy
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set_delete
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								case "$1" in
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    install) install ;;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-28 02:21:57 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    deps-apt) install_deps_apt ;;
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-03 20:04:18 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    deps-pacman) install_deps_pacman ;;
							 | 
						
					
						
							
								
									
										
										
										
											2011-04-07 18:14:26 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    deps-macosx) install_deps_macosx ;;
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-24 01:39:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    deps-dnf) install_deps_dnf ;;
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-08 16:21:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    deps-pkg) install_deps_pkg ;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    self-update) update; make_boot_image; bootstrap;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    quick-update) update; refresh_image ;;
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-23 17:17:58 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    update|latest) update; download_and_bootstrap ;;
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-09 13:48:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    compile) find_build_info; make_factor ;;
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-08 22:35:53 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    recompile) find_build_info; make_clean; make_factor ;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    bootstrap) get_config_info; bootstrap ;;
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-29 01:48:55 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    net-bootstrap) net_bootstrap_no_pull ;;
							 | 
						
					
						
							
								
									
										
										
										
											2009-04-21 00:23:16 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    make-target) FIND_MAKE_TARGET=true; ECHO=false; find_build_info; exit_script ;;
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-23 17:17:58 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    report|info) find_build_info ;;
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-24 01:39:00 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    full-report) find_build_info; check_installed_programs; check_libraries ;;
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 20:05:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    update-boot-image) find_build_info; check_installed_programs; update_boot_image;;
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-04 16:25:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    *) usage ;;
							 | 
						
					
						
							
								
									
										
										
										
											2007-11-24 18:59:11 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								esac
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-09 03:54:34 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 |