#!/bin/bash
# Build script for tree# Directory listing utility - no external dependenciesset -e
cd "$SRCDIR"# illumos fix: rename 'struct comment' to avoid conflict with /usr/include/pwd.h# which also defines struct commentfor f in *.h *.c; do sed -i 's/struct comment/struct tree_comment/g'"$f"done# tree uses a simple Makefile, needs some adjustments for illumos# Override Linux-specific flagsgmake -j${JOBS:-1}\
CC=gcc \
CFLAGS="-O2 -Wall -fomit-frame-pointer -DSOLARIS"\
LDFLAGS=""\
prefix=$PREFIX \
MANDIR=$PREFIX/share/man
# Manual install since Makefile doesn't properly support DESTDIRmkdir -p "$PKGDIR$PREFIX/bin"mkdir -p "$PKGDIR$PREFIX/share/man/man1"install -m 755 tree "$PKGDIR$PREFIX/bin/tree"install -m 644 doc/tree.1 "$PKGDIR$PREFIX/share/man/man1/tree.1"