--- elwix/build_world.sh 2014/01/05 23:14:22 1.3 +++ elwix/build_world.sh 2017/02/13 16:52:46 1.5 @@ -5,7 +5,7 @@ # (C) AITNET ltd - Sofia/Bulgaria # by Michael Pounov # -# $Id: build_world.sh,v 1.3 2014/01/05 23:14:22 misho Exp $ +# $Id: build_world.sh,v 1.5 2017/02/13 16:52:46 misho Exp $ # [ -r ./config/rc.elwix ] && . ./config/rc.elwix @@ -37,9 +37,12 @@ if [ "${USER}" != "root" ]; then exit 1 fi +# Set TARGET_CPUTYPE only for world compiling. Don't use this in kernel build! +X_TARGET_CPUTYPE="TARGET_CPUTYPE=${TARGET_CPUTYPE}" + clean_world() { - echo "+++ Clean ELWIX World ..." + echo "+++ Clean ELWIX World ... $WORLD" rm -rf $WORLD mkdir -p $WORLD @@ -51,9 +54,8 @@ build_toolchain() echo "+++ Build ELWIX Toolchain ..." cd $BSDSRC env MAKEOBJDIRPREFIX=${BSDOBJ} make ${PARALLEL_BUILD} \ - TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - MAKEOBJDIRPREFIX=${BSDOBJ} SRCCONF=${SRCCONF} \ - DESTDIR=${WORLD} toolchain + TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} ${X_TARGET_CPUTYPE} \ + SRCCONF=${SRCCONF} __MAKE_CONF=${MAKECONF} DESTDIR=${WORLD} toolchain if [ $? -eq 0 ]; then cd - else @@ -67,12 +69,12 @@ build_world() cd $BSDSRC if [ -z "$1" ]; then env MAKEOBJDIRPREFIX=${BSDOBJ} make ${PARALLEL_BUILD} \ - TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - MAKEOBJDIRPREFIX=${BSDOBJ} SRCCONF=${SRCCONF} buildworld + TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} ${X_TARGET_CPUTYPE} \ + SRCCONF=${SRCCONF} __MAKE_CONF=${MAKECONF} buildworld else env MAKEOBJDIRPREFIX=${BSDOBJ} NO_CLEAN="YES" make ${PARALLEL_BUILD} \ - TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - MAKEOBJDIRPREFIX=${BSDOBJ} SRCCONF=${SRCCONF} buildworld + TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} ${X_TARGET_CPUTYPE} \ + SRCCONF=${SRCCONF} __MAKE_CONF=${MAKECONF} buildworld fi if [ $? -eq 0 ]; then cd - @@ -83,16 +85,18 @@ build_world() install_world() { - echo "+++ Install ELWIX World ..." + echo "+++ Install ELWIX World ... $WORLD" cd $BSDSRC env MAKEOBJDIRPREFIX=${BSDOBJ} make \ - TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - MAKEOBJDIRPREFIX=${BSDOBJ} SRCCONF=${SRCCONF} DESTDIR=${WORLD} installworld + TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} ${X_TARGET_CPUTYPE} \ + SRCCONF=${SRCCONF} __MAKE_CONF=${MAKECONF} DESTDIR=${WORLD} installworld cd - if [ $? -eq 0 ]; then echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${WORLD}/elwix.ver fi + + echo "+++ Completed ELWIX World ... $WORLD" } build_cross() @@ -106,10 +110,15 @@ build_cross() # export \\ _EOF - make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - MAKEOBJDIRPREFIX=${BSDOBJ} buildenvvars >> ${CENV} + env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} ${X_TARGET_CPUTYPE} \ + buildenvvars >> ${CENV} cat >>${CENV} <<_EOF PATH=$WORLD/elwix/pkg/bin:$WORLD/elwix/pkg/sbin:/elwix/pkg/bin:/elwix/pkg/sbin:$PKG/bin:$PKG/sbin:\$PATH:$PATH + +if [ -n "\${REPLACE_MAKEOBJDIRPREFIX}" ]; then + MAKEOBJDIRPREFIX="\${REPLACE_MAKEOBJDIRPREFIX}" +fi + _EOF cd - cp ${CENV} ${CBUILD} @@ -118,12 +127,15 @@ _EOF cat >>${CBUILD} <<_EOF make \$* _EOF + echo "+++ Ready cross script ${CBUILD}" cat >>${CGBUILD} <<_EOF gmake \$* _EOF + echo "+++ Ready cross script ${CGBUILD}" cat >>${CEXEC} <<_EOF eval \$* _EOF + echo "+++ Ready cross script ${CEXEC}" chmod +x ${CBUILD} ${CGBUILD} ${CEXEC} ${CENV} echo "Done." }