Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Apple's zsh distribution #13

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches:
- "main"
jobs:
# TODO macos-latest outside docker
build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.can_fail_build }}
Expand Down
1 change: 1 addition & 0 deletions variants/bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

shvr_current_bash ()
{
# TODO https://github.com/apple-oss-distributions/bash
cat <<-@
bash_5.2.21
bash_5.1.16
Expand Down
101 changes: 63 additions & 38 deletions variants/zsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ shvr_current_zsh ()
cat <<-@
zsh_5.9
zsh_5.8.1
zsh_appl-100.120.1
zsh_appl-100
@
}

Expand All @@ -25,53 +27,76 @@ shvr_targets_zsh ()
zsh_5.1.1
zsh_5.0.8
zsh_4.2.7
zsh_appl-100.120.1
zsh_appl-100
zsh_appl-97
zsh_appl-94
zsh_appl-92
zsh_appl-90
zsh_appl-87
zsh_appl-84.120.1
zsh_appl-84.100.1
zsh_appl-84
@
}

shvr_build_zsh ()
{
version="$1"
version_major="${version%%\.*}"

if test "$version" = "$version_major"
then return 1
fi

version_minor="${version#$version_major\.}"
version_patch="${version_minor#*\.}"

if test "$version_patch" = "$version_minor"
then version_patch="0"
else version_minor="${version_minor%\.*}"
fi

fork_name="${1%%-*}"
fork_version="${1#*-}"
build_srcdir="${SHVR_DIR_SRC}/zsh/${version}"
mkdir -p "${build_srcdir}"

if
test "$version_major" -gt 4 -a "${version_minor}" -gt 0 ||
test "$version_major" -gt 5
then
apt-get -y install \
wget gcc make autoconf libtinfo-dev xz-utils
wget -O "${build_srcdir}.tar.xz" \
"https://downloads.sourceforge.net/project/zsh/zsh/$version/zsh-$version.tar.xz"
tar --extract \
--file="${build_srcdir}.tar.xz" \
--strip-components=1 \
--directory="${build_srcdir}"
else
apt-get -y install \
wget gcc make autoconf libtinfo-dev
wget -O "${build_srcdir}.tar.gz" \
"https://downloads.sourceforge.net/project/zsh/zsh/$version/zsh-$version.tar.gz"
tar --extract \
--file="${build_srcdir}.tar.gz" \
--strip-components=1 \
--directory="${build_srcdir}"
fi

cd "${build_srcdir}"
case "$fork_name" in
*'appl')
build_innerdir="zsh"
archiver="gz"
version_major=-1
version_url="https://github.com/apple-oss-distributions/zsh/archive/refs/tags/zsh-$fork_version.tar.gz"

apt-get -y install \
wget gcc make autoconf libtinfo-dev
;;
*)
build_innerdir="."
version_major="${version%%\.*}"

if test "$version" = "$version_major"
then return 1
fi

version_minor="${version#$version_major\.}"
version_patch="${version_minor#*\.}"

if test "$version_patch" = "$version_minor"
then version_patch="0"
else version_minor="${version_minor%\.*}"
fi

if
test "$version_major" -gt 4 -a "${version_minor}" -gt 0 ||
test "$version_major" -gt 5
then
archiver="xz"
apt-get -y install \
wget gcc make autoconf libtinfo-dev xz-utils
else
archiver="gz"
apt-get -y install \
wget gcc make autoconf libtinfo-dev
fi

version_url="https://downloads.sourceforge.net/project/zsh/zsh/$version/zsh-$version.tar.$archiver"
;;
esac
wget -O "${build_srcdir}.tar.$archiver" "$version_url"
tar --extract \
--file="${build_srcdir}.tar.$archiver" \
--strip-components=1 \
--directory="${build_srcdir}"

cd "${build_srcdir}/${build_innerdir}"

./Util/preconfig
./configure \
Expand Down
Loading