Skip to content
Myr

[install] Build fzf if prebuilt binary doesn't work

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #617

authored by Junegunn Choi · committed by Junegunn Choi · parent a9a29df · Browse files · 1 file+20 added−16 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+20 added−16 removed

  • other:+20 added−16 removed

1 file+20 added−16 removed

modified:install+20 added-16 removed
7 unmodified lines
8auto_completion=9key_bindings=10update_config=211binary_arch=12allow_legacy=1314help() {15 cat << EOF16usage: $0 [OPTIONS]
20 unmodified lines
37 --all)38 auto_completion=139 key_bindings=140 update_config=141 allow_legacy=142 ;;43 --key-bindings) key_bindings=1 ;;44 --no-key-bindings) key_bindings=0 ;;45 --completion) auto_completion=1 ;;
120 unmodified lines
166 *) binary_available=0 binary_error=1 ;;167esac168169install_ruby_fzf() {170 if [ -z "$allow_legacy" ]; then171 ask "Do you want to install legacy Ruby version instead?" && exit 1172 fi173 echo "Installing legacy Ruby version ..."174175 # ruby executable176 echo -n "Checking Ruby executable ... "
63 unmodified lines
240cd "$fzf_base"241if [ -n "$binary_error" ]; then242 if [ $binary_available -eq 0 ]; then243 echo "No prebuilt binary for $archi ..."239 if command -v go > /dev/null; then240 echo -n "Building binary (go get -u github.com/junegunn/fzf/src/fzf) ... "241 if [ -z "${GOPATH-}" ]; then242 export GOPATH="${TMPDIR:-/tmp}/fzf-gopath"243 mkdir -p "$GOPATH"244 fi245 if go get -u github.com/junegunn/fzf/src/fzf; then246 echo "OK"247 cp "$GOPATH/bin/fzf" "$fzf_base/bin/"248 else249 echo "Failed to build binary ..."250 install_ruby_fzf251 fi244 else245 echo " - $binary_error !!!"246 fi247 if command -v go > /dev/null; then248 echo -n "Building binary (go get -u github.com/junegunn/fzf/src/fzf) ... "249 if [ -z "${GOPATH-}" ]; then250 export GOPATH="${TMPDIR:-/tmp}/fzf-gopath"251 mkdir -p "$GOPATH"252 fi253 if go get -u github.com/junegunn/fzf/src/fzf; then254 echo "OK"255 cp "$GOPATH/bin/fzf" "$fzf_base/bin/"256 else253 echo "go executable not found. Cannot build binary ..."257 echo "Failed to build binary ..."258 install_ruby_fzf259 fi260 else257 echo " - $binary_error !!!"258 exit 1261 echo "go executable not found. Cannot build binary ..."262 install_ruby_fzf263 fi264fi265266[[ "$*" =~ "--bin" ]] && exit 0
142 unmodified lines