File:  [ELWIX - Embedded LightWeight unIX -] / elwix / build_3thparty.sh
Revision 1.4.2.5: download - view: text, annotated - select for diffs - revision graph
Tue Jan 7 10:25:30 2014 UTC (10 years, 10 months ago) by misho
Branches: elwix2_2
Diff to: branchpoint 1.4: preferred, unified
patch

#!/bin/sh
#
# ELWIX build script for cross compiling 3th party software
#
# (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
#    by Michael Pounov <misho@elwix.org>
#
# $Id: build_3thparty.sh,v 1.4.2.5 2014/01/07 10:25:30 misho Exp $
#

[ -r ./config/rc.elwix ] && . ./config/rc.elwix
if [ ! -r ./config/rc.3thparty_helper ]; then
	echo
	echo "ELWIX project is not configured - Missing rc.3thparty_helper script"
	echo
	exit 1
fi

if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then
	echo
	echo "ELWIX project is not configured !?!"
	echo
	exit 1
fi
V=${VERSION}
[ -r ${CENV} ] && . ${CENV}
unset INSTALL
unset VERSION
VERSION="$V"

if [ ! -d $BSDSRC ]; then
	echo
	echo "ELWIX project is not configured - missing BSD sources !?!"
	echo
	exit 1
fi

if [ ! -d $DEST ]; then
	echo
	echo "ELWIX project is not configured - missing Dest directory !?!"
	echo
	exit 1
fi

clean_3th()
{
	echo "+++ Clean ELWIX 3th party ..."

	rm -rf ${PKG} ${ROMFS_USR2}

	install -d ${PKG}
	install -d ${PKG}/bin
	install -d ${PKG}/etc
	install -d ${PKG}/include
	install -d ${PKG}/man
	install -d ${PKG}/lib
	install -d ${PKG}/libexec
	install -d ${PKG}/sbin

	install -d ${ROMFS_USR2}
	install -d ${ROMFS_USR2}/bin
	install -d ${ROMFS_USR2}/etc
	install -d ${ROMFS_USR2}/lib
	install -d ${ROMFS_USR2}/libexec
	install -d ${ROMFS_USR2}/sbin
}

compile_3th()
{
	echo "+++ Compile ELWIX 3th party ..."

	BUILD_SH="./config/rc.3thparty_helper"

	echo "${BUILD_SH} expat ${CBUILD} ${PKG} ${TARGET_BUILD}"
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} libevent ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} libiconv ${CGBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} pcre ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} mini_sendmail ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} choparp ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} scan_ffs ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
#	${BUILD_SH} istgt ${CBUILD} ${PKG} ${TARGET_BUILD}
#	[ $? -ne 0 ] && exit 1
	${BUILD_SH} rsync ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} ttcp ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} mpd ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} mrouted ${CGBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} igmpproxy ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} sudo ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} bmon ${CGBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} mtr ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} ipguard ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} smartmontools ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} quagga ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} iftop ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} arping ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} hping2 ${CGBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} trafshow ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} ipsec-tools ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
#	${BUILD_SH} dhcp ${CBUILD} ${PKG} ${TARGET_BUILD}
#	[ $? -ne 0 ] && exit 1
#	${BUILD_SH} dhcping ${CBUILD} ${PKG} ${TARGET_BUILD}
#	[ $? -ne 0 ] && exit 1
	${BUILD_SH} dnsmasq ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} miniupnpd ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} miniupnpc ${CGBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} ntp ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} spawn-fcgi ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} lighttpd ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} libxml2 ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
	${BUILD_SH} php ${CBUILD} ${PKG} ${TARGET_BUILD}
	[ $? -ne 0 ] && exit 1
}

install_3th()
{
	LIBS="${ROMFS_USR2}/lib"
	LIBEXEC="${ROMFS_USR2}/libexec"
	BIN="${ROMFS_USR2}/bin"
	SBIN="${ROMFS_USR2}/sbin"
	ETC="${ROMFS_USR2}/etc"

	echo "+++ Install ELWIX RomFS secondary firmware ..."

	StripFiles \*.so\* ${PKG}/lib
	InstallFiles \*.so\* ${PKG}/lib $LIBS
	StripFiles \* ${PKG}/libexec
	InstallFiles \* ${PKG}/libexec $LIBEXEC
	StripFiles \* ${PKG}/bin
	InstallFiles \* ${PKG}/bin $BIN
	StripFiles \* ${PKG}/sbin
	InstallFiles \* ${PKG}/sbin $SBIN

	InstallFiles \* ${PKG}/etc $ETC

	chown -R root:wheel $SBIN $BIN $LIBDATA $LIBEXEC $LIBS
}

build_3th()
{
	echo "+++ Build ELWIX Firmware secondary image ..."

	cd ${ROMFS_USR2}
	pax -w -z -v -f${REL}/${ROMFS_IMG2} .
	cd -

# Stop using uzip fs
#	makefs -ominfree=0,bsize=8192,fsize=1024,optimization=space -s${ROMFS_SIZE2} \
#		${REL}/${ROMFS_IMG2} ${ROMFS_USR2}

#	MDDEV=$(mdconfig -a -t vnode -f ${REL}/${ROMFS_IMG2});
#	tunefs -L elwixFirmware2 /dev/$MDDEV;
#	mdconfig -d -u $MDDEV;

#	mkuzip -s 8192 -o ${REL}/${ROMFS_IMG2}.uzip ${REL}/${ROMFS_IMG2};
#	mv ${REL}/${ROMFS_IMG2}.uzip ${REL}/${ROMFS_IMG2}
}

### main()
if ! SnitVer ${PKG}/elwix.ver; then
	clean_3th
	compile_3th

	install_3th
	build_3th

	echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${PKG}/elwix.ver
else
	echo "Skipped ELWIX 3th party build ..."
fi

echo "+++ Complete build ELWIX 3th party"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>