Files
zsh/source.sh
T

76 lines
3.0 KiB
Bash

# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# The prepare function is executed in the root of the temp directory
# This function is used for putting downloaded files to the correct location or applying patches
prepare() {
cd "$BPM_SOURCE"
# Change config location in documentation to /etc/zsh
sed 's|/etc/z|/etc/zsh/z|g' -i Doc/*.*
# Set correct keymap path
sed -i 's#/usr/share/keymaps#/usr/share/kbd/keymaps#g' Completion/Unix/Command/_loadkeys
# Fix usb.ids path
sed -i 's#/usr/share/misc/usb.ids#/usr/share/hwdata/usb.ids#g' Completion/Linux/Command/_lsusb
# Remove unneeded and conflicting completion scripts
for _fpath in AIX BSD Cygwin Darwin Debian Mandriva openSUSE Redhat Solaris; do
rm -rf Completion/$_fpath
sed "s#\s*Completion/$_fpath/\*/\*##g" -i Src/Zle/complete.mdd
done
rm Completion/Linux/Command/_pkgtool
# Force generation of documentation with correct paths
rm Doc/version.yo
autoreconf -fi
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
./configure --prefix=/usr \
--sysconfdir=/etc/zsh \
--docdir=/usr/share/doc/zsh \
--htmldir=/usr/share/doc/zsh/html \
--enable-etcdir=/etc/zsh \
--enable-zshenv=/etc/zsh/zshenv \
--enable-zlogin=/etc/zsh/zlogin \
--enable-zlogout=/etc/zsh/zlogout \
--enable-zprofile=/etc/zsh/zprofile \
--enable-zshrc=/etc/zsh/zshrc \
--enable-maildir-support \
--enable-multibyte \
--enable-function-subdirs \
--enable-fndir=/usr/share/zsh/functions \
--enable-scriptdir=/usr/share/zsh/scripts \
--with-tcsetpgrp \
--enable-pcre \
--enable-gdbm \
--enable-cap \
--enable-zsh-secure-free
make
}
# The check function is executed in the source directory
# This function is used to run tests to verify the package has been compiled correctly
check() {
HOME="$BPM_WORKDIR" make check
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
make DESTDIR="$BPM_OUTPUT" install
# Install package documentation
make DESTDIR="$BPM_OUTPUT" install.info install.html
# Install default zsh config files
install -d "$BPM_OUTPUT"/etc/zsh
install -m644 "$BPM_WORKDIR"/zprofile "$BPM_OUTPUT"/etc/zsh/zprofile
install -m644 "$BPM_WORKDIR"/zshrc "$BPM_OUTPUT"/etc/zsh/zshrc
# Install package license
install -Dm644 "$BPM_SOURCE"/LICENCE "$BPM_OUTPUT"/usr/share/licenses/zsh/LICENCE
}