From c34c6bf206ecdae17f7ad35ac58cb55ac1f204f8 Mon Sep 17 00:00:00 2001 From: Debian User Date: Sat, 24 Nov 2007 21:03:32 -0600 Subject: [PATCH] Support NO_UI if libraries aren't found on Linux --- misc/factor.sh | 85 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/misc/factor.sh b/misc/factor.sh index eb231cd565..af0511ee50 100755 --- a/misc/factor.sh +++ b/misc/factor.sh @@ -10,6 +10,7 @@ shopt -s nocaseglob OS= ARCH= WORD= +NO_UI=0 ensure_program_installed() { echo -n "Checking for $1..." @@ -49,6 +50,34 @@ check_installed_programs() { check_gcc_version } +check_library_exists() { + GCC_TEST=factor-library-test.c + GCC_OUT=factor-library-test.out + echo "Checking for library $1" + echo "int main(){return 0;}" > $GCC_TEST + gcc $GCC_TEST -o $GCC_OUT -l $1 + if [[ $? -ne 0 ]] ; then + echo "Warning: library $1 not found." + echo "***Factor will compile NO_UI=1" + NO_UI=1 + fi + rm -f GCC_TEST + rm -f GCC_OUT +} + +check_X11_libraries() { + check_library_exists freetype + check_library_exists GLU + check_library_exists GL + check_library_exists X11 +} + +check_libraries() { + case $OS in + linux) check_X11_libraries;; + esac +} + check_factor_exists() { if [[ -d "factor" ]] ; then echo "A directory called 'factor' already exists." @@ -151,7 +180,7 @@ make_clean() { } make_factor() { - make $MAKE_TARGET -j5 + make NO_UI=$NO_UI $MAKE_TARGET -j5 check_ret make } @@ -185,31 +214,33 @@ usage() { echo "usage: $0 install|update" } +install() { + check_factor_exists + check_installed_programs + find_build_info + check_libraries + git_clone + cd_factor + make_factor + get_boot_image + maybe_download_dlls + bootstrap +} + +update() { + check_installed_programs + find_build_info + check_libraries + git_pull_factorcode + make_clean + make_factor + delete_boot_images + get_boot_image + bootstrap +} + case "$1" in - install) - check_factor_exists - check_installed_programs - find_build_info - git_clone - cd_factor - make_factor - get_boot_image - maybe_download_dlls - bootstrap - ;; - - update) - check_installed_programs - find_build_info - git_pull_factorcode - make_clean - make_factor - delete_boot_images - get_boot_image - bootstrap - ;; - - *) - usage - ;; + install) install ;; + update) update ;; + *) usage ;; esac