Fix factor.sh for NetBSD
parent
3c4f742c95
commit
bacc5dc610
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash -e
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Programs returning != 0 will not cause script to exit
|
# Programs returning != 0 will not cause script to exit
|
||||||
set +e
|
set +e
|
||||||
|
@ -11,6 +11,9 @@ OS=
|
||||||
ARCH=
|
ARCH=
|
||||||
WORD=
|
WORD=
|
||||||
NO_UI=
|
NO_UI=
|
||||||
|
GIT_PROTOCOL=${GIT_PROTOCOL:="git"}
|
||||||
|
GIT_URL=${GIT_URL:=$GIT_PROTOCOL"://factorcode.org/git/factor.git"}
|
||||||
|
|
||||||
|
|
||||||
ensure_program_installed() {
|
ensure_program_installed() {
|
||||||
echo -n "Checking for $1..."
|
echo -n "Checking for $1..."
|
||||||
|
@ -51,6 +54,9 @@ check_installed_programs() {
|
||||||
ensure_program_installed wget
|
ensure_program_installed wget
|
||||||
ensure_program_installed gcc
|
ensure_program_installed gcc
|
||||||
ensure_program_installed make
|
ensure_program_installed make
|
||||||
|
case $OS in
|
||||||
|
netbsd) ensure_program_installed gmake;;
|
||||||
|
esac
|
||||||
check_gcc_version
|
check_gcc_version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +112,7 @@ find_os() {
|
||||||
*Darwin*) OS=macosx;;
|
*Darwin*) OS=macosx;;
|
||||||
*linux*) OS=linux;;
|
*linux*) OS=linux;;
|
||||||
*Linux*) OS=linux;;
|
*Linux*) OS=linux;;
|
||||||
|
*NetBSD*) OS=netbsd;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,6 +160,8 @@ echo_build_info() {
|
||||||
echo MAKE_TARGET=$MAKE_TARGET
|
echo MAKE_TARGET=$MAKE_TARGET
|
||||||
echo BOOT_IMAGE=$BOOT_IMAGE
|
echo BOOT_IMAGE=$BOOT_IMAGE
|
||||||
echo MAKE_IMAGE_TARGET=$MAKE_IMAGE_TARGET
|
echo MAKE_IMAGE_TARGET=$MAKE_IMAGE_TARGET
|
||||||
|
echo GIT_PROTOCOL=$GIT_PROTOCOL
|
||||||
|
echo GIT_URL=$GIT_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
set_build_info() {
|
set_build_info() {
|
||||||
|
@ -188,22 +197,19 @@ find_build_info() {
|
||||||
echo_build_info
|
echo_build_info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invoke_git() {
|
||||||
|
git $*
|
||||||
|
check_ret git
|
||||||
|
}
|
||||||
|
|
||||||
git_clone() {
|
git_clone() {
|
||||||
echo "Downloading the git repository from factorcode.org..."
|
echo "Downloading the git repository from factorcode.org..."
|
||||||
git clone git://factorcode.org/git/factor.git
|
invoke_git clone $GIT_URL
|
||||||
check_ret git
|
|
||||||
}
|
}
|
||||||
|
|
||||||
git_pull_factorcode() {
|
git_pull_factorcode() {
|
||||||
echo "Updating the git repository from factorcode.org..."
|
echo "Updating the git repository from factorcode.org..."
|
||||||
git pull git://factorcode.org/git/factor.git master
|
invoke_git pull $GIT_URL master
|
||||||
check_ret git
|
|
||||||
}
|
|
||||||
|
|
||||||
http_git_pull_factorcode() {
|
|
||||||
echo "Updating the git repository from factorcode.org..."
|
|
||||||
git pull http://factorcode.org/git/factor.git master
|
|
||||||
check_ret git
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cd_factor() {
|
cd_factor() {
|
||||||
|
@ -211,21 +217,28 @@ cd_factor() {
|
||||||
check_ret cd
|
check_ret cd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invoke_make() {
|
||||||
|
case $OS in
|
||||||
|
netbsd) make='gmake';;
|
||||||
|
*) make='make';;
|
||||||
|
esac
|
||||||
|
$make $*
|
||||||
|
check_ret $make
|
||||||
|
}
|
||||||
|
|
||||||
make_clean() {
|
make_clean() {
|
||||||
make clean
|
invoke_make clean
|
||||||
check_ret make
|
|
||||||
}
|
}
|
||||||
|
|
||||||
make_factor() {
|
make_factor() {
|
||||||
make NO_UI=$NO_UI $MAKE_TARGET -j5
|
invoke_make NO_UI=$NO_UI $MAKE_TARGET -j5
|
||||||
check_ret make
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_boot_images() {
|
delete_boot_images() {
|
||||||
echo "Deleting old images..."
|
echo "Deleting old images..."
|
||||||
rm $BOOT_IMAGE > /dev/null 2>&1
|
rm $BOOT_IMAGE > /dev/null 2>&1
|
||||||
rm $BOOT_IMAGE.* > /dev/null 2>&1
|
rm $BOOT_IMAGE.* > /dev/null 2>&1
|
||||||
rm staging.*.image > /dev/null 2>&1
|
rm staging.*.image > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
get_boot_image() {
|
get_boot_image() {
|
||||||
|
@ -257,8 +270,8 @@ maybe_download_dlls() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_config_info() {
|
get_config_info() {
|
||||||
check_installed_programs
|
|
||||||
find_build_info
|
find_build_info
|
||||||
|
check_installed_programs
|
||||||
check_libraries
|
check_libraries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,13 +298,6 @@ update() {
|
||||||
make_factor
|
make_factor
|
||||||
}
|
}
|
||||||
|
|
||||||
http_update() {
|
|
||||||
get_config_info
|
|
||||||
http_git_pull_factorcode
|
|
||||||
make_clean
|
|
||||||
make_factor
|
|
||||||
}
|
|
||||||
|
|
||||||
update_bootstrap() {
|
update_bootstrap() {
|
||||||
delete_boot_images
|
delete_boot_images
|
||||||
get_boot_image
|
get_boot_image
|
||||||
|
@ -299,7 +305,7 @@ update_bootstrap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh_image() {
|
refresh_image() {
|
||||||
./$FACTOR_BINARY -script -e="refresh-all save 0 USE: system exit"
|
./$FACTOR_BINARY -script -e="USE: vocabs.loader refresh-all USE: memory save 0 USE: system exit"
|
||||||
check_ret factor
|
check_ret factor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,6 +322,8 @@ install_libraries() {
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: $0 install|install-x11|self-update|quick-update|update|bootstrap|wget-bootstrap"
|
echo "usage: $0 install|install-x11|self-update|quick-update|update|bootstrap|wget-bootstrap"
|
||||||
|
echo "If you are behind a firewall, invoke as:"
|
||||||
|
echo "env GIT_PROTOCOL=http $0 <command>"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -324,7 +332,6 @@ case "$1" in
|
||||||
self-update) update; make_boot_image; bootstrap;;
|
self-update) update; make_boot_image; bootstrap;;
|
||||||
quick-update) update; refresh_image ;;
|
quick-update) update; refresh_image ;;
|
||||||
update) update; update_bootstrap ;;
|
update) update; update_bootstrap ;;
|
||||||
http-update) http_update; update_bootstrap ;;
|
|
||||||
bootstrap) get_config_info; bootstrap ;;
|
bootstrap) get_config_info; bootstrap ;;
|
||||||
wget-bootstrap) get_config_info; delete_boot_images; get_boot_image; bootstrap ;;
|
wget-bootstrap) get_config_info; delete_boot_images; get_boot_image; bootstrap ;;
|
||||||
*) usage ;;
|
*) usage ;;
|
||||||
|
|
Loading…
Reference in New Issue