Skip to content

Instantly share code, notes, and snippets.

@rsnk96
Forked from nicoulaj/build-zsh.sh
Last active July 19, 2018 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsnk96/87229bd910e01f2ee7c35f96d7cb2f6c to your computer and use it in GitHub Desktop.
Save rsnk96/87229bd910e01f2ee7c35f96d7cb2f6c to your computer and use it in GitHub Desktop.
Build Zsh from sources on Ubuntu
#!/bin/bash
# Build Zsh from sources on Ubuntu.
# From http://zsh.sourceforge.net/Arc/git.html and sources INSTALL file.
execute () {
echo "$ $*"
OUTPUT=$($@ 2>&1)
if [ $? -ne 0 ]; then
echo "$OUTPUT"
echo ""
echo "Failed to Execute $*" >&2
exit 1
fi
}
# Speed up the process
# Env Var NUMJOBS overrides automatic detection
if [[ -n $NUMJOBS ]]; then
MJOBS=$NUMJOBS
elif [[ -f /proc/cpuinfo ]]; then
MJOBS=$(grep -c processor /proc/cpuinfo)
elif [[ "$OSTYPE" == "darwin"* ]]; then
MJOBS=$(sysctl -n machdep.cpu.thread_count)
else
MJOBS=4
fi
# Some packages may be missing
execute sudo apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo
#git clone git://git.code.sf.net/p/zsh/code zsh
execute git clone https://github.com/zsh-users/zsh zsh # Mirror of above repo
execute cd zsh
execute ./Util/preconfig
# Options from Ubuntu Zsh package rules file (http://launchpad.net/ubuntu/+source/zsh)
./configure --prefix=/usr \
--mandir=/usr/share/man \
--bindir=/bin \
--infodir=/usr/share/info \
--enable-maildir-support \
--enable-max-jobtable-size=256 \
--enable-etcdir=/etc/zsh \
--enable-function-subdirs \
--enable-site-fndir=/usr/local/share/zsh/site-functions \
--enable-fndir=/usr/share/zsh/functions \
--with-tcsetpgrp \
--with-term-lib="ncursesw" \
--enable-cap \
--enable-pcre \
--enable-readnullcmd=pager \
--enable-custom-patchlevel=Debian \
LDFLAGS="-Wl,--as-needed -g"
execute make -j $MJOBS
execute make check
execute sudo make install
execute sudo make install.info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment