Skip to content

Commit

Permalink
Include Apple's zsh distribution
Browse files Browse the repository at this point in the history
This change adds zsh since version 84 (4.2.3) distributed from apple
  • Loading branch information
alganet committed Jul 6, 2024
1 parent fd40efb commit 115ac2f
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 38 deletions.
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-84.120.1
zsh_appl-84.100.1
zsh_appl-84
zsh_appl-87
zsh_appl-90
zsh_appl-92
zsh_appl-94
zsh_appl-97
@
}

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

0 comments on commit 115ac2f

Please sign in to comment.