--- elwix/addpkg_gmake2frm.sh 2017/10/08 09:54:58 1.1 +++ elwix/addpkg_gmake2frm.sh 2021/03/11 13:59:50 1.2 @@ -0,0 +1,86 @@ +#!/bin/sh +# +# ELWIX test build script for cross compile 3th party software and +# adds to second firmware image if its ok. +# +# (C) AITNET ltd - Sofia/Bulgaria +# by Michael Pounov +# +# $Id: addpkg_gmake2frm.sh,v 1.2 2021/03/11 13:59:50 misho Exp $ +# + +[ -r ./config/rc.elwix ] && . ./config/rc.elwix +if [ ! -r ./config/rc.3thparty_helper ]; then + echo + echo "ELWIX project is not configured - Missing rc.3thparty_helper script" + echo + exit 1 +fi + +if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then + echo + echo "ELWIX project is not configured !?!" + echo + exit 1 +fi +V=${VERSION} +[ -r ${CENV} ] && . ${CENV} +unset INSTALL +unset VERSION +VERSION="$V" + +if [ ! -d $BSDSRC ]; then + echo + echo "ELWIX project is not configured - missing BSD sources !?!" + echo + exit 1 +fi + +if [ ! -d $DEST ]; then + echo + echo "ELWIX project is not configured - missing Dest directory !?!" + echo + exit 1 +fi + +compile_3th() +{ + echo "+++ Compile ELWIX 3th party software ..." + + BUILD_SH="./config/rc.3thparty_helper" + + ENVS="" + NAME=${1} + shift + if [ -n "${1}" ]; then + ENVS="env $*" + echo "+ Adds to environment ${ENVS}" + fi + + echo "+ Using cross compiler script ${CGBUILD}" + ${ENVS} ${BUILD_SH} ${NAME} ${CGBUILD} ${PKG} ${TARGET_BUILD} + [ $? -ne 0 ] && exit 1 + + echo "Done." +} + + +### main() +# ./build_3thpkg.sh [make] [env varz ...] +install -d ${PKG} +install -d ${PKG}/bin +install -d ${PKG}/etc +install -d ${PKG}/include +install -d ${PKG}/man +install -d ${PKG}/lib +install -d ${PKG}/libexec +install -d ${PKG}/sbin + +install -d ${ROMFS_USR2} +install -d ${ROMFS_USR2}/bin +install -d ${ROMFS_USR2}/etc +install -d ${ROMFS_USR2}/lib +install -d ${ROMFS_USR2}/libexec +install -d ${ROMFS_USR2}/sbin + +compile_3th $*