File:  [ELWIX - Embedded LightWeight unIX -] / elwix / build_world.sh
Revision 1.1.1.1.6.1: download - view: text, annotated - select for diffs - revision graph
Thu Feb 16 23:18:47 2012 UTC (12 years, 4 months ago) by misho
Branches: elwix1_6
Diff to: branchpoint 1.1.1.1: preferred, unified
moved from build_cross.sh cross building tools at the right place

    1: #!/bin/sh
    2: #
    3: # ELWIX build script for world
    4: #
    5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
    6: #    by Michael Pounov <misho@elwix.org>
    7: #
    8: # $Id: build_world.sh,v 1.1.1.1.6.1 2012/02/16 23:18:47 misho Exp $
    9: #
   10: 
   11: [ -r ./config/rc.elwix ] && . ./config/rc.elwix
   12: if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then
   13: 	echo
   14: 	echo "ELWIX project is not configured !?!"
   15: 	echo
   16: 	exit 1
   17: fi
   18: 
   19: if [ ! -d $BSDSRC ]; then
   20: 	echo
   21: 	echo "ELWIX project is not configured - missing BSD sources !?!"
   22: 	echo
   23: 	exit 1
   24: fi
   25: 
   26: if [ ! -d $ADIR ]; then
   27: 	echo
   28: 	echo "ELWIX project is not configured - missing TargetArch directory !?!"
   29: 	echo
   30: 	exit 1
   31: fi
   32: 
   33: if [ "${USER}" != "root" ]; then
   34: 	echo
   35: 	echo "ELWIX project is not configured - BSD kernel must compile under root !?!"
   36: 	echo
   37: 	exit 1
   38: fi
   39: 
   40: clean_world()
   41: {
   42: 	echo "+++ Clean ELWIX World ..."
   43: 	rm -rf $WORLD
   44: 	mkdir -p $WORLD
   45: 
   46: 	rm -f ${CBUILD} ${CGBUILD} ${CENV}
   47: }
   48: 
   49: build_world()
   50: {
   51: 	echo "+++ Build ELWIX World ..."
   52: 	cd $BSDSRC
   53: 	env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
   54: 		-j${PARALLEL_BUILD} buildworld DESTDIR=${WORLD}
   55: 	cd -
   56: }
   57: 
   58: install_world()
   59: {
   60: 	echo "+++ Install ELWIX World ..."
   61: 	cd $BSDSRC
   62: 	env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
   63: 		installworld DESTDIR=${WORLD}
   64: 	cd -
   65: 
   66: 	echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${WORLD}/elwix.ver
   67: }
   68: 
   69: build_cross()
   70: {
   71: 	echo "+++ Build ELWIX Cross script ..."
   72: 	cd $BSDSRC
   73: 	cat >${CENV} <<_EOF
   74: #!/bin/sh
   75: #
   76: # Create auto cross build env script
   77: #
   78: _EOF
   79: 	env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
   80: 		buildenvvars >> ${CENV}
   81: 	cat >>${CENV} <<_EOF
   82: PATH=$PKG/bin:$PKG/sbin:\$PATH:$PATH
   83: _EOF
   84: 	cd -
   85: 	cp ${CENV} ${CBUILD}
   86: 	cp ${CENV} ${CGBUILD}
   87: 	cat >>${CBUILD} <<_EOF
   88: make \$*
   89: _EOF
   90: 	cat >>${CGBUILD} <<_EOF
   91: gmake \$*
   92: _EOF
   93: 	chmod +x ${CBUILD} ${CGBUILD} ${CENV}
   94: 	echo "Done."
   95: }
   96: 
   97: ### main()
   98: if ! SnitVer ${WORLD}/elwix.ver; then
   99: 	clean_world
  100: 	build_world
  101: 	install_world
  102: 
  103: 	build_cross
  104: else
  105: 	echo "Skipped ELWIX World build ..."
  106: fi
  107: 
  108: 
  109: echo "+++ Complete build ELWIX World"

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