Annotation of elwix/build_tools.sh, revision 1.5.4.3

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

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