#!/bin/sh
#
# (C)`10 PKG-Builder for elwix by Michael Pounov <misho@elwix.org>
#
# ./build.sh [package] [make_tool] [prefix_dir] [build_arch_str]
#
# $Id: build.sh,v 1.11 2014/01/05 23:18:11 misho Exp $
#
CMD=$1
MK=${2:-make}
P=${3:-/tmp/elwix}
B=$4
PFX="--prefix ${P}"
shift; shift; shift; shift;
echo ">>> Working script ${MK} into ${PFX}"
if [ -n "${B}" ]; then
PFX="${PFX} --build ${B}"
fi
TOP=$(pwd)
echo ">>> TOPDIR=${TOP}"
if [ $P = "/tmp/elwix" ]; then
rm -rf /tmp/elwix
install -d /tmp/elwix
install -d /tmp/elwix/bin
install -d /tmp/elwix/include
install -d /tmp/elwix/lib
install -d /tmp/elwix/libexec
install -d /tmp/elwix/man
install -d /tmp/elwix/man/man1
install -d /tmp/elwix/man/man2
install -d /tmp/elwix/man/man3
install -d /tmp/elwix/man/man4
install -d /tmp/elwix/man/man5
install -d /tmp/elwix/man/man6
install -d /tmp/elwix/man/man7
install -d /tmp/elwix/man/man8
install -d /tmp/elwix/man/man9
install -d /tmp/elwix/sbin
install -d /tmp/elwix/share
fi
find . -name .deps -type d -exec rm -rf {} \;
case $CMD in
sudo)
cd sudo
./configure --sysconfdir=/etc --libexecdir=/usr/local/libexec --with-ignore-dot \
--with-tty-tickets --with-env-editor --with-logincap \
--with-long-otp-prompt --with-pam --with-logfac=local2 \
--with-bsm-audit ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
install src/sudo ${P}/bin || exit 1
ln ${P}/bin/sudo ${P}/bin/sudoedit || exit 1
install plugins/sudoers/sudoreplay ${P}/bin || exit 1
install plugins/sudoers/visudo ${P}/sbin || exit 1
install plugins/sudoers/.libs/sudoers.so ${P}/libexec || exit 1
install src/.libs/libsudo_noexec.so ${P}/libexec || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
expat)
cd expat
./configure ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
mpd)
cd libpdel
${MK} clean || exit 1
${MK} || exit 1
find . -name \*.so\* -type f -exec install {} ${P}/lib \;
cd ..
cd mpd/src
${MK} clean || exit 1
${MK} || exit 1
install mpd5 ${P}/sbin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
libevent)
cd libevent
./configure ${PFX} --mandir=${P}/man --infodir=${P}/info || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
mini_sendmail)
cd mini_sendmail
${MK} clean || exit 1
${MK} || exit 1
install mini_sendmail ${P}/sbin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
choparp)
cd choparp
rm -f choparp
${MK} choparp || exit 1
install choparp ${P}/sbin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
ttcp)
cd ttcp
rm -f ttcp
${MK} ttcp || exit 1
install ttcp ${P}/bin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
trafshow)
cd trafshow
./configure --sysconfdir=/etc ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
ipsec-tools)
cd ipsec-tools
./configure --enable-shared --sysconfdir=/etc/racoon --localstatedir=/var/run \
--enable-debug --enable-ipv6 --enable-adminport --enable-stats \
--enable-dpd --enable-natt=yes --enable-frag --enable-hybrid \
--without-libpam --disable-gssapi --with-libradius --without-libldap \
--disable-samode-unspec --disable-rc5 --disable-idea ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
dhcp)
cd dhcp
./configure --localstatedir=/var --enable-paranoia --enable-early-chroot \
--enable-dhcpv6 ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
install server/dhcpd ${P}/sbin || exit 1
install relay/dhcrelay ${P}/sbin || exit 1
install dhcpctl/omshell ${P}/bin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
dhcping)
cd dhcping
./configure ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
mrouted)
cd mrouted
${MK} clean || exit 1
${MK} || exit 1
install map-mbone ${P}/sbin || exit 1
install mrinfo ${P}/sbin || exit 1
install mrouted ${P}/sbin || exit 1
install mtrace ${P}/sbin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
igmpproxy)
cd igmpproxy
./configure ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
bmon)
cd bmon
./configure --disable-rrd --disable-asound --disable-dbi ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
iftop)
cd iftop
./configure --with-resolver=netdb_1thread ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
arping)
echo ">>> Building libnet ..."
cd libnet
./configure ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Building arping ..."
cd ../arping
env LDFLAGS=-L${TOP}/libnet/src CFLAGS=-I${TOP}/libnet/include ./configure ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
hping2)
cd hping2
./configure ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
install hping2 ${P}/sbin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
mtr)
cd mtr
./configure --enable-ipv6 --without-gtk --without-glib ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
ipguard)
cd ipguard
${MK} clean || exit 1
${MK} || exit 1
install ipguard ${P}/sbin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
miniupnpd)
cd miniupnpd
${MK} clean || exit 1
${MK} || exit 1
install miniupnpd ${P}/sbin || exit 1
install miniupnpdctl ${P}/sbin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
miniupnpc)
cd miniupnpc
${MK} clean || exit 1
${MK} || exit 1
install libminiupnpc.so ${P}/lib || exit 1
install external-ip.sh ${P}/bin || exit 1
install upnpc-shared ${P}/bin/upnpc || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
smartmontools)
cd smartmontools
./configure --enable-sample --disable-dependency-tracking --enable-drivedb ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
libiconv)
cd libiconv
./configure --enable-static --without-libintl-prefix ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
quagga)
cd quagga
./configure --enable-user=quagga --enable-group=quagga \
--sysconfdir=/etc/quagga --localstatedir=/var/run/quagga \
--enable-vtysh --enable-opaque-lsa --enable-rtadv ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
pcre)
cd pcre
./configure --enable-utf --enable-unicode-properties --enable-pcre8 \
--enable-pcre16 --enable-pcre32 ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
libxml2)
cd libxml2
./configure --without-python ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
php)
cd php
./configure --with-layout=GNU --localstatedir=/var --with-config-file-scan-dir=/etc/php \
--disable-all --enable-libxml --enable-xml --with-libxml-dir=${P} --with-openssl \
--enable-zip --enable-sqlite-utf8 ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
rm -f ${P}/bin/php
strip -s ${P}/bin/php-cgi
echo ">>> Now rebuild elwix $CMD program ..."
;;
scan_ffs)
cd scan_ffs
${MK} clean || exit 1
${MK} || exit 1
install scan_ffs ${P}/bin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
dnsmasq)
cd dnsmasq
${MK} clean || exit 1
${MK} || exit 1
install src/dnsmasq ${P}/bin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
rsync)
cd rsync
./configure.sh --disable-debug --enable-ipv6 --with-rsyncd-conf=/etc/rsyncd.conf \
--disable-iconv --with-included-popt ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
istgt)
cd istgt
./configure --enable-symlink-device ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
install src/istgt ${P}/bin || exit 1
install src/istgtcontrol ${P}/bin || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
ntp)
cd ntp
./configure --without-ntpsnmpd --with-crypto --enable-ipv6 --enable-BANCOMM \
--enable-GPSVME --enable-ACTS --enable-ARBITER --enable-ARCRON_MSF \
--enable-AS2201 --enable-ATOM --enable-CHRONOLOG --enable-CHU \
--enable-AUDIO_CHU --enable-DATUM --enable-DUMBCLOCK --enable-FG \
--enable-HEATH --enable-HOPFSERIAL --enable-HOPFPCI --enable-HPGPS \
--enable-IRIG --enable-JJY --enable-JUPITER --enable-LEITCH \
--enable-LOCAL_CLOCK --enable-MX4200 --enable-NEOCLOCK4X --enable-NMEA \
--enable-ONCORE --enable-PALISADE --enable-PCF --enable-PST \
--enable-RIPENCC --enable-SHM --enable-SPECTRACOM --enable-TRUETIME \
--enable-ULINK --enable-WWV --enable-ZYFER --enable-COMPUTIME \
--enable-DCF7000 --enable-HOPF6021 --enable-MEINBERG --enable-RAWDCF \
--enable-RCC8000 --enable-SCHMID --enable-TRIMTAIP --enable-TRIMTSIP \
--enable-WHARTON --enable-VARITEXT ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
nginx)
cd nginx
./configure --conf-path=/etc/nginx.conf --user=www --group=www \
--pid-path=/var/run/nginx.pid \
--error-log-path=/var/log/nginx-error.log \
--lock-path=/var/run/nging.lock \
--http-log-path=/var/log/nginx-access.log --with-ipv6 \
--with-http_ssl_module --with-http_mp4_module ${PFX} || exit 1
# ${MK} clean || exit 1
${MK} || exit 1
# ${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
spawn-fcgi)
cd spawn-fcgi
./configure ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
lighttpd)
cd lighttpd
./configure --enable-static --with-openssl ${PFX} || exit 1
${MK} clean || exit 1
${MK} || exit 1
${MK} install || exit 1
echo ">>> Now rebuild elwix $CMD program ..."
;;
*)
echo "Package not supported at this moment ..."
exit 1
esac
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>