File:  [ELWIX - Embedded LightWeight unIX -] / elwix / build_3thparty.sh
Revision 1.7.2.1: download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 12:41:17 2021 UTC (3 years, 3 months ago) by misho
Branches: elwix2_7
Diff to: branchpoint 1.7: preferred, unified
adds new version of sqlite
remove comments from 3thparty script
set new elwix kernel

    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.7.2.1 2021/03/17 12:41:17 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 ... ${PKG}, ${ROMFS_USR2}"
   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: 	for i in ${CROSS_3THPARTY}; do
   75: 		if [ -d "${CROSS_3THPATH}$i" ]; then
   76: 			MK=$(eval echo "\$${i}_MAKE")
   77: 			env CFLAGS="-I${PKG}/include" LDFLAGS="-L${PKG}/lib" ${BUILD_SH} \
   78: 				$i $MK ${PKG} ${TARGET_BUILD} || Die "ERROR:: with $i packet!"
   79: 		else
   80: 			Die "Error:: ${CROSS_PATH}$i not found!"
   81: 		fi
   82: 	done
   83: 
   84: 	echo
   85: }
   86: 
   87: install_3th()
   88: {
   89: 	LIBS="${ROMFS_USR2}/lib"
   90: 	LIBEXEC="${ROMFS_USR2}/libexec"
   91: 	BIN="${ROMFS_USR2}/bin"
   92: 	SBIN="${ROMFS_USR2}/sbin"
   93: 	ETC="${ROMFS_USR2}/etc"
   94: 
   95: 	echo "+++ Install ELWIX RomFS secondary firmware ... ${ROMFS_USR2}"
   96: 
   97: 	StripFiles \*.so\* ${PKG}/lib
   98: 	InstallFiles \*.so\* ${PKG}/lib $LIBS
   99: 	InstallLinks \*.so\* ${PKG}/lib $LIBS
  100: 	StripFiles \* ${PKG}/libexec
  101: 	InstallFiles \* ${PKG}/libexec $LIBEXEC
  102: 	StripFiles \* ${PKG}/bin
  103: 	InstallFiles \* ${PKG}/bin $BIN
  104: 	StripFiles \* ${PKG}/sbin
  105: 	InstallFiles \* ${PKG}/sbin $SBIN
  106: 
  107: 	InstallFiles \* ${PKG}/etc $ETC
  108: 
  109: 	chown -R root:wheel $SBIN $BIN $LIBDATA $LIBEXEC $LIBS
  110: }
  111: 
  112: build_3th()
  113: {
  114: 	echo "+++ Build ELWIX Firmware secondary image ... ${ROMFS_USR2} --> ${REL}/${ROMFS_IMG2}"
  115: 
  116: 	cd ${ROMFS_USR2}
  117: 	pax -w -z -v -f${REL}/${ROMFS_IMG2} .
  118: 	cd -
  119: 
  120: # Stop using uzip fs
  121: #	makefs -ominfree=0,bsize=8192,fsize=1024,optimization=space -s${ROMFS_SIZE2} \
  122: #		${REL}/${ROMFS_IMG2} ${ROMFS_USR2}
  123: 
  124: #	MDDEV=$(mdconfig -a -t vnode -f ${REL}/${ROMFS_IMG2});
  125: #	tunefs -L elwixFirmware2 /dev/$MDDEV;
  126: #	mdconfig -d -u $MDDEV;
  127: 
  128: #	mkuzip -s 8192 -o ${REL}/${ROMFS_IMG2}.uzip ${REL}/${ROMFS_IMG2};
  129: #	mv ${REL}/${ROMFS_IMG2}.uzip ${REL}/${ROMFS_IMG2}
  130: 
  131: 	echo "+++ Complited ELWIX Firmware secondary image ... ${REL}/${ROMFS_IMG2}"
  132: }
  133: 
  134: ### main()
  135: if [ -n "${1}" ]; then
  136: 	rm ${PKG}/elwix.ver
  137: fi
  138: 
  139: if ! SnitVer ${PKG}/elwix.ver; then
  140: 	clean_3th || exit 1
  141: 	compile_3th || exit 1
  142: 
  143: 	install_3th || exit 1
  144: 	build_3th || exit 1
  145: 
  146: 	echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${PKG}/elwix.ver
  147: else
  148: 	echo "Skipped ELWIX 3th party build ..."
  149: fi
  150: 
  151: echo "+++ Complete build ELWIX 3th party"

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