#! /bin/bash PROJECT=mbedtls # Available sub-projects. AVAILABLE_PROJECTS=( mbedtls ) # Enabled sub-projects. PROJECTS=( mbedtls ) # Additional options (see functions sources below). # Options followed by a ':' require an argument, by '::' allow an optional argument. SHORT_OPTIONS= # Long options are not available with BSD getopt. LONG_OPTIONS= # Help for additional options usage() { # option h "help" "display this help and exit" return } # Find the directory containing this script. source="${BASH_SOURCE[0]}" while [ -h "${source}" ] ; do SCRIPTS="$(cd -P "$(dirname "${source}")" && pwd)" source="$(readlink "${source}")" [[ ${source} != /* ]] && source="$DIR/${source}" done SCRIPTS="$(cd -P "$(dirname "${source}")" && pwd)" # Get support functions and definitions. source ${SCRIPTS}/support local=${LOCAL}/${PROJECT}/${TARGETTUPLE} # Projects. mbedtls="${SRCTOP} https://github.com/ARMmbed/mbedtls.git mbedtls git" # Check for needed libraries. check_libraries() { return 0 } configure() { # Configure checked out projects. run check_checkout run check_libraries run mkdir -p ${BUILDDIR} run cd ${BUILDDIR} run cp -pr ${PROJECTDIR}/* . cc="${CC} ${CFLAGS}" run echo export CC="${cc}" | run tee Makefile run echo export AR=${AR} | run tee -a Makefile run echo export RANLIB=${RANLIB} | run tee -a Makefile run echo export SHARED=1 | run tee -a Makefile run cat ${PROJECTDIR}/Makefile | \ run sed -e "s:DESTDIR=/usr/local:DESTDIR=${local}:" | \ run tee -a Makefile } tests() { # Run regression tests. run cd ${BUILDDIR} run ${MAKE} -j ${MAXJOBS} -C ${BUILDDIR} check } install() { run check_checkout run check_configure run check_libraries run cd ${BUILDDIR} run ${MAKE} install run mkdir -p ${LOCALLIB} run cp -pr ${local}/lib/* ${LOCALLIB} run mkdir -p ${LOCALLIBECC}/include run cp -pr ${local}/include/* ${LOCALLIBECC}/include if [ "${LOCALBIN}" != "${local}/bin" ] ; then run mkdir -p ${LOCALBIN} run cp -pr ${local}/bin/* ${LOCALBIN} fi } if [ "${CHECKOUT}" == "y" ] ; then checkout || exit 1 fi if [ "${CONFIGURE}" == "y" ] ; then configure || exit 1 fi if [ "${UPDATE}" == "y" ] ; then update || exit 1 fi if [ "${PATCH}" == "y" ] ; then patch || exit 1 fi if [ "${CREATE_PATCH}" == "y" ] ; then create_patch || exit 1 fi if [ "${BUILD}" == "y" ] ; then build || exit 1 fi if [ "${TESTS}" == "y" ] ; then tests || exit 1 fi if [ "${INSTALL}" == "y" ] ; then install || exit 1 fi