Annotation of elwix/build_tools.sh, revision 1.3.2.2

1.2       misho       1: #!/bin/sh
                      2: #
                      3: # ELWIX build script for tools
                      4: #
                      5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
                      6: #    by Michael Pounov <misho@elwix.org>
                      7: #
1.3.2.2 ! misho       8: # $Id: build_tools.sh,v 1.3.2.1 2013/01/28 10:48:45 misho Exp $
1.2       misho       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: V=${VERSION}
                     19: [ -r ${CENV} ] && . ${CENV}
                     20: unset INSTALL
                     21: unset VERSION
                     22: VERSION="$V"
                     23: 
                     24: if [ ! -d $BSDSRC ]; then
                     25:        echo
                     26:        echo "ELWIX project is not configured - missing BSD sources !?!"
                     27:        echo
                     28:        exit 1
                     29: fi
                     30: 
                     31: if [ ! -d $DEST ]; then
                     32:        echo
                     33:        echo "ELWIX project is not configured - missing Dest directory !?!"
                     34:        echo
                     35:        exit 1
                     36: fi
                     37: 
                     38: clean_tools()
                     39: {
                     40:        echo "+++ Clean ELWIX FreeBSD tools ..."
                     41: 
                     42:        rm -rf ${WORLD}/usr/local
                     43:        install -d ${WORLD}/usr/local
                     44:        install -d ${WORLD}/usr/local/bin
                     45:        install -d ${WORLD}/usr/local/include
                     46:        install -d ${WORLD}/usr/local/lib
                     47:        install -d ${WORLD}/usr/local/libdata
                     48:        install -d ${WORLD}/usr/local/sbin
                     49: 
                     50: }
                     51: 
                     52: clean_bootstrap()
                     53: {
                     54:        echo "+++ Clean ELWIX pkgsrc bootstrap tools ..."
                     55: 
                     56:        rm -rf ${WORLD}/usr/pkgsrc/bootstrap/work
                     57:        rm -f /elwix ${WORLD}/usr/pkgsrc
                     58:        rm -rf ${WORLD}/elwix
                     59:        install -d ${WORLD}/elwix
                     60:        ln -sf ${WORLD}/elwix /elwix
                     61:        ln -sf ${PKGSRC} ${WORLD}/usr/pkgsrc
                     62: 
                     63:        install -d ${PKGDIR}
                     64:        install -d ${PKGDIR}/db
                     65:        install -d ${PKGDIR}/etc
                     66: }
                     67: 
                     68: compile_bootstrap()
                     69: {
                     70:        echo "+++ Compile ELWIX pkgsrc bootstrap tools ..."
                     71:        if [ ! -d ${WORLD}/usr/pkgsrc/bootstrap/work ]; then
                     72:                cd ${WORLD}/usr/pkgsrc/bootstrap
                     73:                ./bootstrap --prefix /elwix/pkg --pkgdbdir /elwix/pkg/db
                     74:                cd -
                     75:        else
                     76:                echo " Skip bootstrap pkgsrc - already inited pkgsrc"
                     77:        fi
                     78: 
                     79:        cat >>/elwix/pkg/etc/mk.conf << _EOF
                     80: 
                     81: .if defined(USE_CROSS_COMPILE) && !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
                     82: USE_DESTDIR=           yes
                     83: DEPENDS_TARGET=                package-install
                     84: 
                     85: TOOLDIR=                ${CROSSTOOLDIR}
                     86: CROSS_DESTDIR=         ${WORLD}
                     87: 
                     88: TARGET=                        ${TARGET}
                     89: TARGET_ARCH=           ${TARGET_ARCH}
                     90: MACHINE_PLATFORM=      FreeBSD-${PLATFORM}-${TARGET_ARCH}
                     91: MACHINE_GNU_PLATFORM=  ${TARGET_ARCH}-elwix-freebsd
                     92: 
                     93: PKGSRC_COMPILER=       gcc
                     94: USE_PKGSRC_GCC=                no
                     95: USE_NATIVE_GCC=                yes
                     96: 
                     97: .endif                 # end cross-compilation settings
                     98: _EOF
                     99: 
                    100:        echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${WORLD}/elwix/elwix.ver
                    101: }
                    102: 
                    103: compile_fbsdtools()
                    104: {
                    105:        echo "+++ Compile ELWIX FreeBSD tools ..."
                    106: 
1.3       misho     107:        cd $CROSS_FT_VIMAGE
1.2       misho     108:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    109:                clean DESTDIR=${WORLD}
                    110:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    111:                DESTDIR=${WORLD}
                    112:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    113:                install DESTDIR=${WORLD}
                    114:        cd -
                    115: 
1.3       misho     116:        cd $CROSS_FT_ATH
1.2       misho     117:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    118:                clean DESTDIR=${WORLD}
                    119:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    120:                DESTDIR=${WORLD}
                    121:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
1.3       misho     122:                install DESTDIR=${WORLD}
1.2       misho     123:        cd -
                    124: 
1.3       misho     125:        cd $CROSS_FT_IPW
1.2       misho     126:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    127:                clean DESTDIR=${WORLD}
                    128:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    129:                DESTDIR=${WORLD}
                    130:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    131:                install DESTDIR=${WORLD}/usr/local/bin
                    132:        cd -
                    133: 
1.3       misho     134:        cd $CROSS_FT_IWI
1.2       misho     135:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    136:                clean DESTDIR=${WORLD}
                    137:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    138:                DESTDIR=${WORLD}
                    139:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
1.3       misho     140:                install DESTDIR=${WORLD}/usr/local/bin
1.2       misho     141:        cd -
                    142: 
1.3       misho     143:        cd $CROSS_FT_MWL
1.2       misho     144:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    145:                clean DESTDIR=${WORLD}
                    146:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    147:                DESTDIR=${WORLD}
                    148:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    149:                install DESTDIR=${WORLD}
                    150:        cd -
                    151: 
1.3       misho     152:        cd $CROSS_FT_NET80211
1.2       misho     153:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    154:                clean DESTDIR=${WORLD}
                    155:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    156:                DESTDIR=${WORLD}
                    157:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    158:                install DESTDIR=${WORLD}
                    159:        cd -
                    160: 
                    161: #      cd $CROSS_FT_WTAP
                    162: #      env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    163: #              clean DESTDIR=${WORLD}
                    164: #      env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    165: #              DESTDIR=${WORLD}
                    166: #      env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
                    167: #              install DESTDIR=${WORLD}
                    168: #      cd -
                    169: }
                    170: 
                    171: compile_files()
                    172: {
                    173:        cd files
                    174:        env MAKEOBJDIRPREFIX=${BSDOBJ} BSDSRC=${BSDSRC} make TARGET=${TARGET} \
                    175:                TARGET_ARCH=${TARGET_ARCH} clean DESTDIR=${WORLD}
                    176:        env MAKEOBJDIRPREFIX=${BSDOBJ} BSDSRC=${BSDSRC} make TARGET=${TARGET} \
                    177:                TARGET_ARCH=${TARGET_ARCH} obj depend DESTDIR=${WORLD}
                    178:        env MAKEOBJDIRPREFIX=${BSDOBJ} BSDSRC=${BSDSRC} make TARGET=${TARGET} \
                    179:                TARGET_ARCH=${TARGET_ARCH} DESTDIR=${WORLD}
                    180:        env MAKEOBJDIRPREFIX=${BSDOBJ} BSDSRC=${BSDSRC} make TARGET=${TARGET} \
                    181:                TARGET_ARCH=${TARGET_ARCH} install DESTDIR=${WORLD}
                    182:        cd -
                    183: 
                    184:        strip -s ${WORLD}/usr/bin/csh
                    185: }
                    186: 
                    187: compile_tools()
                    188: {
                    189:        echo "+++ Compile ELWIX Cross ..."
                    190: 
                    191:        cd $CROSS_AXL
                    192:        ${AXL_CFG}
                    193:        ${CBUILD} clean
                    194:        ${CBUILD}
                    195:        ${CBUILD} install
                    196:        cd -
                    197: 
1.3       misho     198:        cd $CROSS_ELWIX
                    199:        ${ELWIX_CFG}
1.2       misho     200:        ${CBUILD} clean
                    201:        ${CBUILD}
                    202:        ${CBUILD} install
                    203:        cd -
                    204: 
                    205:        cd $CROSS_AITIO
                    206:        ${AITIO_CFG}
                    207:        ${CBUILD} clean
                    208:        ${CBUILD}
                    209:        ${CBUILD} install
                    210:        cd -
                    211: 
                    212:        cd $CROSS_AITCFG
                    213:        ${AITCFG_CFG}
                    214:        ${CBUILD} clean
                    215:        ${CBUILD}
                    216:        ${CBUILD} install
                    217:        cd -
                    218: 
                    219:        cd $CROSS_AITRPC
                    220:        ${AITRPC_CFG}
                    221:        ${CBUILD} clean
                    222:        ${CBUILD}
                    223:        ${CBUILD} install
                    224:        cd -
                    225: 
                    226:        cd $CROSS_AITSCHED
                    227:        ${AITSCHED_CFG}
                    228:        ${CBUILD} clean
                    229:        ${CBUILD}
                    230:        ${CBUILD} install
                    231:        cd -
                    232: 
                    233:        cd $CROSS_AITWWW
                    234:        ${AITWWW_CFG}
                    235:        ${CBUILD} clean
                    236:        ${CBUILD}
                    237:        ${CBUILD} install
                    238:        cd -
                    239: 
                    240:        cd $CROSS_AITPELCO
                    241:        ${AITPELCO_CFG}
                    242:        ${CBUILD} clean
                    243:        ${CBUILD}
                    244:        ${CBUILD} install
                    245:        cd -
                    246: 
                    247:        cd $CROSS_AITSYNC
                    248:        ${AITSYNC_CFG}
                    249:        ${CBUILD} clean
                    250:        ${CBUILD}
                    251:        ${CBUILD} install
                    252:        cd -
                    253: 
                    254:        cd $CROSS_AITCLI
                    255:        ${AITCLI_CFG}
                    256:        ${CBUILD} clean
                    257:        ${CBUILD}
                    258:        ${CBUILD} install
                    259:        cd -
                    260: 
                    261:        cd $CROSS_AITMQTT
                    262:        ${AITMQTT_CFG}
                    263:        ${CBUILD} clean
                    264:        ${CBUILD}
                    265:        ${CBUILD} install
                    266:        cd -
                    267: 
                    268:        cd $CROSS_EMBEDTOOLS
                    269:        ${EMBEDTOOLS_CFG}
                    270:        ${CBUILD} clean
                    271:        ${CBUILD}
                    272:        ${CBUILD} install
                    273:        cd -
                    274: 
                    275:        cd $CROSS_ANSH
                    276:        ${ANSH_CFG}
                    277:        ${CBUILD} clean
                    278:        ${CBUILD}
                    279:        ${CBUILD} install
                    280:        cd -
                    281: 
                    282:        cd $CROSS_MQTT
                    283:        ${MQTT_CFG}
                    284:        ${CBUILD} clean
                    285:        ${CBUILD}
                    286:        ${CBUILD} install
                    287:        cd -
                    288: 
                    289:        echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${WORLD}/usr/local/elwix.ver
                    290: }
                    291: 
                    292: ### main()
                    293: if ! SnitVer ${WORLD}/elwix/elwix.ver; then
                    294:        clean_bootstrap
                    295:        compile_bootstrap
                    296: else
                    297:        echo "Skipped ELWIX bootstrap pkgsrc tools build ..."
                    298: fi
                    299: 
                    300: if ! SnitVer ${WORLD}/usr/local/elwix.ver; then
                    301:        clean_tools
                    302:        compile_fbsdtools
                    303:        compile_files
                    304:        compile_tools
                    305: else
                    306:        echo "Skipped ELWIX tools build ..."
                    307: fi
                    308: 
                    309: echo "+++ Complete build ELWIX tools"

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