Skip to content

Commit

Permalink
[build/deps] Moving shells from test/spec-bin
Browse files Browse the repository at this point in the history
- busybox ash working
- bash has a weird error on Fedora only!
  - zsh still does too
- yash somehow doesn't support out-of-tree builds, which conflicts with
  WEDGE
  - however it's also not totally necessary
  - though I think we might build it into some Soil images, in which
    case I should probably fix this
  • Loading branch information
Andy C committed Jan 23, 2024
1 parent 2a5c3c9 commit 58df065
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 0 deletions.
34 changes: 34 additions & 0 deletions build/deps.sh
Expand Up @@ -57,6 +57,9 @@ readonly PY2_URL="https://www.python.org/ftp/python/2.7.18/Python-$PY2_VERSION.t
readonly PY3_VERSION=3.10.4
readonly PY3_URL="https://www.python.org/ftp/python/3.10.4/Python-$PY3_VERSION.tar.xz"

readonly BASH_VER=4.4 # don't clobber BASH_VERSION
readonly BASH_URL="https://www.oilshell.org/blob/spec-bin/bash-$BASH_VER.tar.gz"

readonly DASH_VERSION=0.5.10.2
readonly DASH_URL="https://www.oilshell.org/blob/spec-bin/dash-$DASH_VERSION.tar.gz"

Expand All @@ -66,6 +69,12 @@ readonly ZSH_URL="https://www.oilshell.org/blob/spec-bin/zsh-$ZSH_VERSION.tar.xz
readonly MKSH_VERSION=R52c
readonly MKSH_URL="https://www.oilshell.org/blob/spec-bin/mksh-$MKSH_VERSION.tgz"

readonly BUSYBOX_VERSION='1.35.0'
readonly BUSYBOX_URL="https://www.oilshell.org/blob/spec-bin/busybox-$BUSYBOX_VERSION.tar.bz2"

readonly YASH_VERSION=2.49
readonly YASH_URL="https://www.oilshell.org/blob/spec-bin/yash-$YASH_VERSION.tar.xz"

readonly MYPY_GIT_URL=https://github.com/python/mypy
readonly MYPY_VERSION=0.780

Expand Down Expand Up @@ -272,6 +281,9 @@ fetch() {
maybe-extract $DEPS_SOURCE_DIR/python2 "$(basename $PY2_URL)" Python-$PY2_VERSION
maybe-extract $DEPS_SOURCE_DIR/python3 "$(basename $PY3_URL)" Python-$PY3_VERSION

download-to $DEPS_SOURCE_DIR/bash "$BASH_URL"
maybe-extract $DEPS_SOURCE_DIR/bash "$(basename $BASH_URL)" dash-$BASH_VER

download-to $DEPS_SOURCE_DIR/dash "$DASH_URL"
maybe-extract $DEPS_SOURCE_DIR/dash "$(basename $DASH_URL)" dash-$DASH_VERSION

Expand All @@ -281,6 +293,12 @@ fetch() {
download-to $DEPS_SOURCE_DIR/mksh "$MKSH_URL"
maybe-extract $DEPS_SOURCE_DIR/mksh "$(basename $MKSH_URL)" mksh-$MKSH_VERSION

download-to $DEPS_SOURCE_DIR/busybox "$BUSYBOX_URL"
maybe-extract $DEPS_SOURCE_DIR/busybox "$(basename $BUSYBOX_URL)" busybox-$BUSYBOX_VERSION

download-to $DEPS_SOURCE_DIR/yash "$YASH_URL"
maybe-extract $DEPS_SOURCE_DIR/yash "$(basename $YASH_URL)" yash-$DASH_VERSION

# Patch: this tarball doesn't follow the convention $name-$version
if test -d $DEPS_SOURCE_DIR/mksh/mksh; then
pushd $DEPS_SOURCE_DIR/mksh
Expand Down Expand Up @@ -467,6 +485,11 @@ install-py3-libs() {
}

install-spec-bin() {
# Error on Fedora
#if ! wedge-exists bash $BASH_VER relative; then
# deps/wedge.sh unboxed-build _build/deps-source/bash
#fi

if ! wedge-exists dash $DASH_VERSION relative; then
deps/wedge.sh unboxed-build _build/deps-source/dash
fi
Expand All @@ -475,6 +498,17 @@ install-spec-bin() {
deps/wedge.sh unboxed-build _build/deps-source/mksh
fi

if ! wedge-exists busybox $BUSYBOX_VERSION relative; then
deps/wedge.sh unboxed-build _build/deps-source/busybox
fi

return

# Hm this has problem with out-of-tree build? I think Oils does too actually
if ! wedge-exists yash $YASH_VERSION relative; then
deps/wedge.sh unboxed-build _build/deps-source/yash
fi

return
# Disabled because of 'boolcodes' issue
# zsh ./configure is NOT detecting 'boolcodes', and then it has a broken
Expand Down
37 changes: 37 additions & 0 deletions deps/source.medo/bash/WEDGE
@@ -0,0 +1,37 @@
# Wedge definition for bash
#
# Loaded by deps/wedge.sh.

set -o nounset
set -o pipefail
set -o errexit

# sourced
WEDGE_NAME='bash'
WEDGE_VERSION='4.4'

wedge-make() {
local src_dir=$1
local build_dir=$2
local install_dir=$3

time $src_dir/configure --prefix=$install_dir

time make
}

wedge-install() {
local build_dir=$1

pushd $build_dir

time make install

popd
}

wedge-smoke-test() {
local install_dir=$1

$install_dir/bin/bash -c 'echo "hi from bash"'
}
36 changes: 36 additions & 0 deletions deps/source.medo/busybox/WEDGE
@@ -0,0 +1,36 @@
# Wedge definition for busybox
#
# Loaded by deps/wedge.sh.

set -o nounset
set -o pipefail
set -o errexit

# sourced
WEDGE_NAME='busybox'
WEDGE_VERSION='1.35.0'

wedge-make() {
local src_dir=$1
local build_dir=$2
local install_dir=$3

# Out of tree instructions from INSTALL
make KBUILD_SRC=$src_dir -f $src_dir/Makefile defconfig

time make
}

wedge-install() {
local build_dir=$1
local install_dir=$2

cp -v $build_dir/busybox $install_dir
ln -s -f -v busybox $install_dir/ash
}

wedge-smoke-test() {
local install_dir=$1

$install_dir/ash -c 'echo "hi from busybox ash"'
}
40 changes: 40 additions & 0 deletions deps/source.medo/yash/WEDGE
@@ -0,0 +1,40 @@
# Wedge definition for yash
#
# Loaded by deps/wedge.sh.

set -o nounset
set -o pipefail
set -o errexit

# sourced
WEDGE_NAME='yash'
WEDGE_VERSION='2.49'

wedge-make() {
local src_dir=$1
local build_dir=$2
local install_dir=$3

# 9/2021: from VirtualBox VM
# The terminfo (curses) library is unavailable!
# Add the "--disable-lineedit" option and try again.
time $src_dir/configure --disable-lineedit --prefix=$install_dir

time make
}

wedge-install() {
local build_dir=$1

pushd $build_dir

time make install

popd
}

wedge-smoke-test() {
local install_dir=$1

$install_dir/bin/yash -c 'echo "hi from yash"'
}

0 comments on commit 58df065

Please sign in to comment.