| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2014 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # This is for bash on NaCl. Note that you cannot use external commands | 6 # This is for bash on NaCl. Note that you cannot use external commands |
| 7 # until the installation is completed. Also, you cannot use features | 7 # until the installation is completed. Also, you cannot use features |
| 8 # which nacl_io does not support yet (e.g., pipes and sub-shells). | 8 # which nacl_io does not support yet (e.g., pipes and sub-shells). |
| 9 | 9 |
| 10 CheckNaClEnabled() { | 10 CheckNaClEnabled() { |
| 11 # Skip check on if this isn't newlib. | 11 # Skip check on if this isn't newlib. |
| 12 if [[ "${TOOLCHAIN}" != newlib ]]; then | 12 if [[ ${TOOLCHAIN} != newlib ]]; then |
| 13 return | 13 return |
| 14 fi | 14 fi |
| 15 TMP_CHECK_FILE="/tmp/.enable_nacl_check.nexe" | 15 TMP_CHECK_FILE="/tmp/.enable_nacl_check.nexe" |
| 16 # Assume we can reuse the test file if present. | 16 # Assume we can reuse the test file if present. |
| 17 if [[ ! -e ${TMP_CHECK_FILE} ]]; then | 17 if [[ ! -e ${TMP_CHECK_FILE} ]]; then |
| 18 geturl -q _platform_specific/${NACL_ARCH}/bash.nexe \ | 18 geturl -q _platform_specific/${NACL_ARCH}/bash.nexe \ |
| 19 ${TMP_CHECK_FILE} || exit 1 | 19 ${TMP_CHECK_FILE} || exit 1 |
| 20 fi | 20 fi |
| 21 ${TMP_CHECK_FILE} -c 'exit 42' | 21 ${TMP_CHECK_FILE} -c 'exit 42' |
| 22 if [[ $? != 42 ]]; then | 22 if [[ $? != 42 ]]; then |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 echo "*********************** ERROR ***********************" | 33 echo "*********************** ERROR ***********************" |
| 34 // TODO: A more proper way to handle error would be "exit 1" here | 34 // TODO: A more proper way to handle error would be "exit 1" here |
| 35 // and keep window open so that error message could be shown. | 35 // and keep window open so that error message could be shown. |
| 36 while [[ 1 == 1 ]]; do | 36 while [[ 1 == 1 ]]; do |
| 37 read | 37 read |
| 38 done | 38 done |
| 39 fi | 39 fi |
| 40 } | 40 } |
| 41 | 41 |
| 42 InstallBasePackages() { | 42 InstallBasePackages() { |
| 43 local default_packages="" |
| 44 |
| 45 # For glibc, we need to install some library dependencies first |
| 46 if [[ ${TOOLCHAIN} == glibc ]]; then |
| 47 default_packages+="\ |
| 48 -i zlib \ |
| 49 -i bzip2 \ |
| 50 -i openssl \ |
| 51 -i ncurses \ |
| 52 -i readline" |
| 53 fi |
| 54 |
| 43 # Core packages. | 55 # Core packages. |
| 44 local default_packages="\ | 56 local default_packages+="\ |
| 57 -i corelibs \ |
| 58 -i nacl-spawn \ |
| 45 -i coreutils \ | 59 -i coreutils \ |
| 46 -i bash \ | 60 -i bash \ |
| 47 -i curl \ | 61 -i curl \ |
| 48 -i findutils \ | 62 -i findutils \ |
| 63 -i pcre \ |
| 49 -i grep \ | 64 -i grep \ |
| 50 -i git \ | 65 -i git \ |
| 51 -i less \ | 66 -i less \ |
| 52 -i make \ | 67 -i make \ |
| 53 -i nano \ | 68 -i nano \ |
| 54 -i python \ | 69 -i python \ |
| 55 -i grep \ | |
| 56 -i vim" | 70 -i vim" |
| 57 | 71 |
| 58 local have_gcc=0 | 72 local have_gcc=0 |
| 59 if [[ "${NACL_ARCH}" == "i686" || "${NACL_ARCH}" == "x86_64" ]]; then | 73 if [[ ${TOOLCHAIN} == glibc ]]; then |
| 60 default_packages+=" \ | 74 if [[ ${NACL_ARCH} == i686 || ${NACL_ARCH} == x86_64 ]]; then |
| 61 -i emacs \ | 75 default_packages+=" \ |
| 62 -i mingn.base \ | 76 -i binutils \ |
| 63 -i mingn.lib" | 77 -i gcc \ |
| 64 have_gcc=1 | 78 -i mingn" |
| 79 have_gcc=1 |
| 80 fi |
| 65 fi | 81 fi |
| 66 | 82 |
| 67 # Check for updates on some packages. | 83 # Check for updates on some packages. |
| 68 package ${default_packages[@]} $@ | 84 package ${default_packages[@]} $@ |
| 69 | 85 |
| 70 if [[ ${have_gcc} == 0 ]]; then | 86 if [[ ${have_gcc} == 0 ]]; then |
| 71 echo "WARNING: \ | 87 echo "WARNING: \ |
| 72 emacs and gcc not yet available for your platform (coming soon)." | 88 emacs and gcc not yet available for your platform (coming soon)." |
| 73 fi | 89 fi |
| 74 } | 90 } |
| 75 | 91 |
| 76 CheckNaClEnabled | 92 CheckNaClEnabled |
| 77 InstallBasePackages $@ | 93 InstallBasePackages $@ |
| OLD | NEW |