| 1 | # Sets $PATH to the locations of some precompiled binaries.
|
| 2 | # An alternative to nix-shell.
|
| 3 | #
|
| 4 | # Usage:
|
| 5 | # source build/dev-shell.sh
|
| 6 | #
|
| 7 | # Note: assumes that $REPO_ROOT is $PWD.
|
| 8 | #
|
| 9 | # IMPORTANT: sourced by _build/oils.sh, so it must remain POSIX SHELL
|
| 10 |
|
| 11 | ROOT_WEDGE_DIR=/wedge/oils-for-unix.org
|
| 12 | # Also in build/deps.sh
|
| 13 | USER_WEDGE_DIR=~/wedge/oils-for-unix.org
|
| 14 |
|
| 15 | # put 'python2' in $PATH
|
| 16 | readonly WEDGE_PY2_DIR=$ROOT_WEDGE_DIR/pkg/python2/2.7.18/bin
|
| 17 | if test -d $WEDGE_PY2_DIR; then
|
| 18 | export PATH="$WEDGE_PY2_DIR:$PATH"
|
| 19 | fi
|
| 20 |
|
| 21 | # put 'python3' in $PATH
|
| 22 | readonly WEDGE_PY3_DIR=$ROOT_WEDGE_DIR/pkg/python3/3.10.4/bin
|
| 23 | # Unconditionally add it to PATH; otherwise build/deps.sh install-wedges won't
|
| 24 | # work
|
| 25 | export PATH="$WEDGE_PY3_DIR:$PATH"
|
| 26 |
|
| 27 | readonly WEDGE_BLOATY_DIR=$ROOT_WEDGE_DIR/pkg/bloaty/1.1 # not in bin
|
| 28 | if test -d $WEDGE_BLOATY_DIR; then
|
| 29 | export PATH="$WEDGE_BLOATY_DIR:$PATH"
|
| 30 | fi
|
| 31 |
|
| 32 | readonly WEDGE_RE2C_DIR=$ROOT_WEDGE_DIR/pkg/re2c/3.0/bin
|
| 33 | if test -d $WEDGE_RE2C_DIR; then
|
| 34 | export PATH="$WEDGE_RE2C_DIR:$PATH"
|
| 35 | fi
|
| 36 |
|
| 37 | # uftrace must be installed by wedge?
|
| 38 | readonly UFTRACE_WEDGE_DIR=$ROOT_WEDGE_DIR/pkg/uftrace/0.13/bin
|
| 39 | if test -d $UFTRACE_WEDGE_DIR; then
|
| 40 | export PATH="$UFTRACE_WEDGE_DIR:$PATH"
|
| 41 | fi
|
| 42 |
|
| 43 | # FALLBACK without busybox wedge: test/spec.sh link-busybox-ash
|
| 44 | readonly ASH_SYMLINK_DIR="$PWD/_tmp/shells"
|
| 45 | if test -d $ASH_SYMLINK_DIR; then
|
| 46 | export PATH="$ASH_SYMLINK_DIR:$PATH"
|
| 47 | fi
|
| 48 |
|
| 49 | readonly WEDGE_SOUFFLE_DIR=$USER_WEDGE_DIR/pkg/souffle/2.4.1/bin
|
| 50 | if test -d $WEDGE_SOUFFLE_DIR; then
|
| 51 | export PATH="$WEDGE_SOUFFLE_DIR:$PATH"
|
| 52 | fi
|
| 53 |
|
| 54 | # test/spec-bin.sh builds binaries
|
| 55 | # This takes precedence over $ASH_SYMLINK_DIR
|
| 56 | readonly SPEC_DIR="$PWD/../oil_DEPS/spec-bin"
|
| 57 |
|
| 58 | if test -d $SPEC_DIR; then
|
| 59 | export PATH="$SPEC_DIR:$PATH"
|
| 60 | fi
|
| 61 |
|
| 62 | #
|
| 63 | # NEW spec-bin wedges found before old ../oil_DEPS
|
| 64 | #
|
| 65 |
|
| 66 | readonly BASH_WEDGE_DIR=$USER_WEDGE_DIR/pkg/bash/4.4/bin
|
| 67 | if test -d $BASH_WEDGE_DIR; then
|
| 68 | export PATH="$BASH_WEDGE_DIR:$PATH"
|
| 69 | fi
|
| 70 |
|
| 71 | # bash 5 found before bash 4
|
| 72 | readonly BASH5_WEDGE_DIR=$USER_WEDGE_DIR/pkg/bash/5.2.21/bin
|
| 73 | if test -d $BASH5_WEDGE_DIR; then
|
| 74 | export PATH="$BASH5_WEDGE_DIR:$PATH"
|
| 75 | fi
|
| 76 |
|
| 77 | readonly DASH_WEDGE_DIR=$USER_WEDGE_DIR/pkg/dash/0.5.10.2/bin
|
| 78 | if test -d $DASH_WEDGE_DIR; then
|
| 79 | export PATH="$DASH_WEDGE_DIR:$PATH"
|
| 80 | fi
|
| 81 |
|
| 82 | readonly MKSH_WEDGE_DIR=$USER_WEDGE_DIR/pkg/mksh/R52c
|
| 83 | if test -d $MKSH_WEDGE_DIR; then
|
| 84 | export PATH="$MKSH_WEDGE_DIR:$PATH"
|
| 85 | fi
|
| 86 |
|
| 87 | readonly ZSH_WEDGE_DIR=$USER_WEDGE_DIR/pkg/zsh/5.1.1/bin
|
| 88 | if test -d $ZSH_WEDGE_DIR; then
|
| 89 | export PATH="$ZSH_WEDGE_DIR:$PATH"
|
| 90 | fi
|
| 91 |
|
| 92 | readonly BUSYBOX_WEDGE_DIR=$USER_WEDGE_DIR/pkg/busybox/1.35.0
|
| 93 | if test -d $BUSYBOX_WEDGE_DIR; then
|
| 94 | export PATH="$BUSYBOX_WEDGE_DIR:$PATH"
|
| 95 | fi
|
| 96 |
|
| 97 | readonly YASH_WEDGE_DIR=$USER_WEDGE_DIR/pkg/yash/2.49/bin
|
| 98 | if test -d $YASH_WEDGE_DIR; then
|
| 99 | export PATH="$YASH_WEDGE_DIR:$PATH"
|
| 100 | fi
|
| 101 |
|
| 102 | if test -d ~/R; then
|
| 103 | # 2023-07: Hack to keep using old versions on lenny.local
|
| 104 | # In 2023-04, dplyr stopped supporting R 3.4.4 on Ubuntu Bionic
|
| 105 | # https://cran.r-project.org/web/packages/dplyr/index.html
|
| 106 | export R_LIBS_USER=~/R
|
| 107 | else
|
| 108 | R_LIBS_WEDGE=~/wedge/oils-for-unix.org/pkg/R-libs/2023-04-18
|
| 109 | export R_LIBS_USER=$R_LIBS_WEDGE
|
| 110 | fi
|
| 111 |
|
| 112 | # So we can run Python 2 scripts directly, e.g. asdl/asdl_main.py
|
| 113 | export PYTHONPATH='.'
|
| 114 |
|
| 115 | # We can also run mycpp/mycpp_main.py directly
|
| 116 | #
|
| 117 | # But NOT bin/oils_for_unix.py (Python 2). Those need to find our stripped down
|
| 118 | # vendor/typing.py, but we CANNOT put vendor/ in $PYTHONPATH, because then
|
| 119 | # mycpp would import it and fail.
|
| 120 |
|
| 121 | readonly site_packages=lib/python3.10/site-packages
|
| 122 |
|
| 123 | #readonly PY3_LIBS_VERSION=2023-07-27
|
| 124 | # Use older version because containers aren't rebuild. TODO: fix this
|
| 125 | readonly PY3_LIBS_VERSION=2023-03-04
|
| 126 |
|
| 127 | # Note: Version should match the one in build/deps.sh
|
| 128 | readonly PY3_LIBS_WEDGE=$USER_WEDGE_DIR/pkg/py3-libs/$PY3_LIBS_VERSION/$site_packages
|
| 129 | # Unconditionally add to PYTHONPATH; otherwise build/deps.sh install-wedges
|
| 130 | # can't work in one shot
|
| 131 | export PYTHONPATH="$PY3_LIBS_WEDGE:$PYTHONPATH"
|
| 132 |
|
| 133 | MYPY_VERSION=0.780
|
| 134 | # TODO: would be nice to upgrade to newer version
|
| 135 | #readonly MYPY_VERSION=0.971
|
| 136 |
|
| 137 | # Containers copy it here
|
| 138 | readonly MYPY_WEDGE=$USER_WEDGE_DIR/pkg/mypy/$MYPY_VERSION
|
| 139 | if test -d "$MYPY_WEDGE"; then
|
| 140 | export PYTHONPATH="$MYPY_WEDGE:$PYTHONPATH"
|
| 141 | fi
|
| 142 |
|
| 143 | # Hack for misconfigured RC cluster! Some machines have the empty string in
|
| 144 | # their $PATH (due to some having CUDA and others not).
|
| 145 | #
|
| 146 | # TODO: I should fix the machines, and make this a FATAL error. The $PATH
|
| 147 | # leaks on purpose because we might want to run with nix-shell -- see
|
| 148 | # test/spec-common.sh.
|
| 149 | case $PATH in
|
| 150 | *::*)
|
| 151 | PATH=$(echo "$PATH" | sed 's/::/:/g')
|
| 152 | ;;
|
| 153 | esac
|