#!/bin/bash
# Build script for vim
# Vi IMproved text editor

set -e

cd "$SRCDIR"

# Go directly into src/ to bypass the wrapper script
# (ksh93 has a built-in SRCDIR that causes infinite loops with the wrapper)
cd src

# Configure vim - minimal build, disable NLS to avoid locale issues on illumos
# Use bash explicitly due to ksh93 compatibility issues
CONFIG_SHELL=/usr/bin/bash /usr/bin/bash ./configure \
    --prefix=$PREFIX \
    --with-features=huge \
    --enable-multibyte \
    --disable-gui \
    --without-x \
    --disable-gpm \
    --disable-sysmouse \
    --disable-nls

gmake -j${JOBS:-1}
gmake install DESTDIR="$PKGDIR"

# Create vi symlink
ln -sf vim "$PKGDIR$PREFIX/bin/vi"
