File:  [ELWIX - Embedded LightWeight unIX -] / elwix / build_3thparty.sh
Revision 1.5.2.1: download - view: text, annotated - select for diffs - revision graph
Thu Nov 3 13:41:37 2016 UTC (7 years, 7 months ago) by misho
Branches: elwix2_3
Diff to: branchpoint 1.5: preferred, unified
update 3th party sw

    1: #!/bin/sh
    2: #
    3: # ELWIX build script for cross compiling 3th party software
    4: #
    5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
    6: #    by Michael Pounov <misho@elwix.org>
    7: #
    8: # $Id: build_3thparty.sh,v 1.5.2.1 2016/11/03 13:41:37 misho Exp $
    9: #
   10: 
   11: [ -r ./config/rc.elwix ] && . ./config/rc.elwix
   12: if [ ! -r ./config/rc.3thparty_helper ]; then
   13: 	echo
   14: 	echo "ELWIX project is not configured - Missing rc.3thparty_helper script"
   15: 	echo
   16: 	exit 1
   17: fi
   18: 
   19: if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then
   20: 	echo
   21: 	echo "ELWIX project is not configured !?!"
   22: 	echo
   23: 	exit 1
   24: fi
   25: V=${VERSION}
   26: [ -r ${CENV} ] && . ${CENV}
   27: unset INSTALL
   28: unset VERSION
   29: VERSION="$V"
   30: 
   31: if [ ! -d $BSDSRC ]; then
   32: 	echo
   33: 	echo "ELWIX project is not configured - missing BSD sources !?!"
   34: 	echo
   35: 	exit 1
   36: fi
   37: 
   38: if [ ! -d $DEST ]; then
   39: 	echo
   40: 	echo "ELWIX project is not configured - missing Dest directory !?!"
   41: 	echo
   42: 	exit 1
   43: fi
   44: 
   45: clean_3th()
   46: {
   47: 	echo "+++ Clean ELWIX 3th party ..."
   48: 
   49: 	rm -rf ${PKG} ${ROMFS_USR2}
   50: 
   51: 	install -d ${PKG}
   52: 	install -d ${PKG}/bin
   53: 	install -d ${PKG}/etc
   54: 	install -d ${PKG}/include
   55: 	install -d ${PKG}/man
   56: 	install -d ${PKG}/lib
   57: 	install -d ${PKG}/libexec
   58: 	install -d ${PKG}/sbin
   59: 
   60: 	install -d ${ROMFS_USR2}
   61: 	install -d ${ROMFS_USR2}/bin
   62: 	install -d ${ROMFS_USR2}/etc
   63: 	install -d ${ROMFS_USR2}/lib
   64: 	install -d ${ROMFS_USR2}/libexec
   65: 	install -d ${ROMFS_USR2}/sbin
   66: }
   67: 
   68: compile_3th()
   69: {
   70: 	echo "+++ Compile ELWIX 3th party ..."
   71: 
   72: 	BUILD_SH="./config/rc.3thparty_helper"
   73: 
   74: #	${BUILD_SH} expat ${CBUILD} ${PKG} ${TARGET_BUILD}
   75: #	[ $? -ne 0 ] && exit 1
   76: #	${BUILD_SH} libevent ${CBUILD} ${PKG} ${TARGET_BUILD}
   77: #	[ $? -ne 0 ] && exit 1
   78: #	${BUILD_SH} libiconv ${CGBUILD} ${PKG} ${TARGET_BUILD}
   79: #	[ $? -ne 0 ] && exit 1
   80: #	${BUILD_SH} pcre ${CBUILD} ${PKG} ${TARGET_BUILD}
   81: #	[ $? -ne 0 ] && exit 1
   82: 
   83: 	${BUILD_SH} mini_sendmail ${CBUILD} ${PKG} ${TARGET_BUILD}
   84: 	[ $? -ne 0 ] && exit 1
   85: 	${BUILD_SH} choparp ${CBUILD} ${PKG} ${TARGET_BUILD}
   86: 	[ $? -ne 0 ] && exit 1
   87: 	${BUILD_SH} ipguard ${CBUILD} ${PKG} ${TARGET_BUILD}
   88: 	[ $? -ne 0 ] && exit 1
   89: 	${BUILD_SH} igmpproxy ${CBUILD} ${PKG} ${TARGET_BUILD}
   90: 	[ $? -ne 0 ] && exit 1
   91: 	${BUILD_SH} ttcp ${CBUILD} ${PKG} ${TARGET_BUILD}
   92: 	[ $? -ne 0 ] && exit 1
   93: 	${BUILD_SH} bmon ${CGBUILD} ${PKG} ${TARGET_BUILD}
   94: 	[ $? -ne 0 ] && exit 1
   95: 	${BUILD_SH} mtr ${CBUILD} ${PKG} ${TARGET_BUILD}
   96: 	[ $? -ne 0 ] && exit 1
   97: 	${BUILD_SH} hping2 ${CGBUILD} ${PKG} ${TARGET_BUILD}
   98: 	[ $? -ne 0 ] && exit 1
   99: 	${BUILD_SH} arping ${CBUILD} ${PKG} ${TARGET_BUILD}
  100: 	[ $? -ne 0 ] && exit 1
  101: 	${BUILD_SH} rsync ${CBUILD} ${PKG} ${TARGET_BUILD}
  102: 	[ $? -ne 0 ] && exit 1
  103: 	${BUILD_SH} mpd ${CBUILD} ${PKG} ${TARGET_BUILD}
  104: 	[ $? -ne 0 ] && exit 1
  105: 	${BUILD_SH} dnsmasq ${CBUILD} ${PKG} ${TARGET_BUILD}
  106: 	[ $? -ne 0 ] && exit 1
  107: 	${BUILD_SH} readline ${CGBUILD} ${PKG} ${TARGET_BUILD}
  108: 	[ $? -ne 0 ] && exit 1
  109: 	env CFLAGS="-I${PKG}/include" LDFLAGS="-L${PKG}/lib" ${BUILD_SH} quagga ${CBUILD} ${PKG} ${TARGET_BUILD}
  110: 	[ $? -ne 0 ] && exit 1
  111: 
  112: #	${BUILD_SH} iftop ${CBUILD} ${PKG} ${TARGET_BUILD}
  113: #	[ $? -ne 0 ] && exit 1
  114: #	${BUILD_SH} iperf ${CBUILD} ${PKG} ${TARGET_BUILD}
  115: #	[ $? -ne 0 ] && exit 1
  116: #	${BUILD_SH} sudo ${CBUILD} ${PKG} ${TARGET_BUILD}
  117: #	[ $? -ne 0 ] && exit 1
  118: #	${BUILD_SH} smartmontools ${CBUILD} ${PKG} ${TARGET_BUILD}
  119: #	[ $? -ne 0 ] && exit 1
  120: #	${BUILD_SH} trafshow ${CBUILD} ${PKG} ${TARGET_BUILD}
  121: #	[ $? -ne 0 ] && exit 1
  122: #	${BUILD_SH} ipsec-tools ${CGBUILD} ${PKG} ${TARGET_BUILD}
  123: #	[ $? -ne 0 ] && exit 1
  124: #	${BUILD_SH} dhcp ${CBUILD} ${PKG} ${TARGET_BUILD}
  125: #	[ $? -ne 0 ] && exit 1
  126: #	${BUILD_SH} dhcping ${CBUILD} ${PKG} ${TARGET_BUILD}
  127: #	[ $? -ne 0 ] && exit 1
  128: #	${BUILD_SH} miniupnpd ${CBUILD} ${PKG} ${TARGET_BUILD}
  129: #	[ $? -ne 0 ] && exit 1
  130: #	${BUILD_SH} miniupnpc ${CGBUILD} ${PKG} ${TARGET_BUILD}
  131: #	[ $? -ne 0 ] && exit 1
  132: #	${BUILD_SH} ntp ${CBUILD} ${PKG} ${TARGET_BUILD}
  133: #	[ $? -ne 0 ] && exit 1
  134: #	${BUILD_SH} spawn-fcgi ${CBUILD} ${PKG} ${TARGET_BUILD}
  135: #	[ $? -ne 0 ] && exit 1
  136: #	${BUILD_SH} lighttpd ${CBUILD} ${PKG} ${TARGET_BUILD}
  137: #	[ $? -ne 0 ] && exit 1
  138: #	${BUILD_SH} libxml2 ${CBUILD} ${PKG} ${TARGET_BUILD}
  139: #	[ $? -ne 0 ] && exit 1
  140: #	${BUILD_SH} php ${CBUILD} ${PKG} ${TARGET_BUILD}
  141: #	[ $? -ne 0 ] && exit 1
  142: 	echo
  143: }
  144: 
  145: install_3th()
  146: {
  147: 	LIBS="${ROMFS_USR2}/lib"
  148: 	LIBEXEC="${ROMFS_USR2}/libexec"
  149: 	BIN="${ROMFS_USR2}/bin"
  150: 	SBIN="${ROMFS_USR2}/sbin"
  151: 	ETC="${ROMFS_USR2}/etc"
  152: 
  153: 	echo "+++ Install ELWIX RomFS secondary firmware ..."
  154: 
  155: 	StripFiles \*.so\* ${PKG}/lib
  156: 	InstallFiles \*.so\* ${PKG}/lib $LIBS
  157: 	StripFiles \* ${PKG}/libexec
  158: 	InstallFiles \* ${PKG}/libexec $LIBEXEC
  159: 	StripFiles \* ${PKG}/bin
  160: 	InstallFiles \* ${PKG}/bin $BIN
  161: 	StripFiles \* ${PKG}/sbin
  162: 	InstallFiles \* ${PKG}/sbin $SBIN
  163: 
  164: 	InstallFiles \* ${PKG}/etc $ETC
  165: 
  166: 	chown -R root:wheel $SBIN $BIN $LIBDATA $LIBEXEC $LIBS
  167: }
  168: 
  169: build_3th()
  170: {
  171: 	echo "+++ Build ELWIX Firmware secondary image ..."
  172: 
  173: 	cd ${ROMFS_USR2}
  174: 	pax -w -z -v -f${REL}/${ROMFS_IMG2} .
  175: 	cd -
  176: 
  177: # Stop using uzip fs
  178: #	makefs -ominfree=0,bsize=8192,fsize=1024,optimization=space -s${ROMFS_SIZE2} \
  179: #		${REL}/${ROMFS_IMG2} ${ROMFS_USR2}
  180: 
  181: #	MDDEV=$(mdconfig -a -t vnode -f ${REL}/${ROMFS_IMG2});
  182: #	tunefs -L elwixFirmware2 /dev/$MDDEV;
  183: #	mdconfig -d -u $MDDEV;
  184: 
  185: #	mkuzip -s 8192 -o ${REL}/${ROMFS_IMG2}.uzip ${REL}/${ROMFS_IMG2};
  186: #	mv ${REL}/${ROMFS_IMG2}.uzip ${REL}/${ROMFS_IMG2}
  187: }
  188: 
  189: ### main()
  190: if ! SnitVer ${PKG}/elwix.ver; then
  191: 	clean_3th || exit 1
  192: 	compile_3th || exit 1
  193: 
  194: 	install_3th || exit 1
  195: 	build_3th || exit 1
  196: 
  197: 	echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${PKG}/elwix.ver
  198: else
  199: 	echo "Skipped ELWIX 3th party build ..."
  200: fi
  201: 
  202: echo "+++ Complete build ELWIX 3th party"

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