File:  [ELWIX - Embedded LightWeight unIX -] / elwix / build_init.sh
Revision 1.5: download - view: text, annotated - select for diffs - revision graph
Thu Mar 11 13:59:50 2021 UTC (3 years, 2 months ago) by misho
Branches: MAIN
CVS tags: elwix2_8, elwix2_7, HEAD, ELWIX2_7, ELWIX2_6
ver 2.6

    1: #!/bin/sh
    2: #
    3: # ELWIX build script for setup host cross compile process - *** START FIRST *** -
    4: #
    5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
    6: #    by Michael Pounov <misho@elwix.org>
    7: #
    8: # $Id: build_init.sh,v 1.5 2021/03/11 13:59:50 misho Exp $
    9: #
   10: 
   11: # ./build_init.sh [custom build rc.elwix config]
   12: if [ -n "$1" ]; then
   13: 	cd config
   14: 	ln -sf $1 rc.elwix
   15: 	cd -
   16: fi
   17: 
   18: [ -r ./config/rc.elwix ] && . ./config/rc.elwix
   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: 
   26: if [ ! -d $BSDSRC ]; then
   27: 	echo
   28: 	echo "ELWIX project is not configured - missing BSD sources !?!"
   29: 	echo
   30: 	exit 1
   31: fi
   32: 
   33: if [ "${USER}" != "root" ]; then
   34: 	echo
   35: 	echo "ELWIX project is not configured - Init must build under root !?!"
   36: 	echo
   37: 	exit 1
   38: fi
   39: 
   40: clean_pkgsrc()
   41: {
   42: 	echo "+++ Clean ELWIX pkgsrc ..."
   43: #	MNTEXISTS=$(mount | awk -vpkgsrc="${PKGSRC_DIR}" -vdstmnt="${WORLD}/usr/pkgsrc" \
   44: #		'($1 == pkgsrc && $3 == dstmnt) { printf("YES"); }')
   45: #	if [ "${MNTEXISTS}" != "YES" ]; then
   46: #		umount ${WORLD}/usr/pkgsrc
   47: #	fi
   48: 
   49: 	rm -f /elwix ${WORLD}/usr/pkgsrc
   50: 	echo "+++ Erased pkgsrc helper dirs!"
   51: }
   52: 
   53: clean_init()
   54: {
   55: 	echo "+++ Clean ELWIX Projects ..."
   56: 	echo -n "Erase *ALL* builded ELWIX projects [NO/yes]? "
   57: 	read LINE
   58: 	if [ X"$LINE" = X"yes" ]; then
   59: 		clean_pkgsrc
   60: 
   61: 		find ${BSDSRC} -name "*.o" -exec rm {} +
   62: 
   63: 		chflags -Rf noschg,nosunlink ${TOPDIR}
   64: 		rm -rf $TOPDIR
   65: 		mkdir -p $TOPDIR
   66: 		echo "+++ Erased *ALL* builded ELWIX projects!"
   67: 	fi
   68: }
   69: 
   70: install_init()
   71: {
   72: 	echo "+++ Install ELWIX Project directories ..."
   73: 
   74: 	install -d $REL
   75: 	install -d $DEST
   76: 	install -d $OBJS
   77: 	install -d $ADIR
   78: 
   79: 	install -d $BSDOBJ
   80: 
   81: #	ln -sf $BSDSRC
   82: 
   83: 	echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${TOPDIR}/elwix.ver
   84: }
   85: 
   86: ### main()
   87: install -d ${TOPDIR}
   88: 
   89: V=$(CheckVer ${TOPDIR}/elwix.ver)
   90: if [ $? -ne 0 -o X"$V" != X"${VERSION}" ]; then
   91: 	echo " Not found valid version or different version from current - Start CLEAN *ALL*"
   92: 	rm -rf $TOPDIR
   93: 	mkdir -p $TOPDIR
   94: 	echo "+++ CLEAN *ALL* complete"
   95: else
   96: 	clean_init
   97: fi
   98: 
   99: install_init
  100: 
  101: echo "+++ Complete Init ELWIX"

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