Subversion Repositories DevTools

Rev

Rev 1489 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1489 Rev 1491
Line 34... Line 34...
34
#------------------------------------------------------------------------------
34
#------------------------------------------------------------------------------
35
# Extract arguments - order not important except that the first argument is
35
# Extract arguments - order not important except that the first argument is
36
# the launch script
36
# the launch script
37
#------------------------------------------------------------------------------
37
#------------------------------------------------------------------------------
38
unset CLEAN
38
unset CLEAN
-
 
39
unset COPY_MODS_DIRS
39
unset DOWNLOAD_PKG
40
unset DOWNLOAD_PKG
40
unset DOWNLOAD_PKG_AUTO
41
unset DOWNLOAD_PKG_AUTO
41
unset DEBIAN_PACKAGE
42
unset DEBIAN_PACKAGE
42
unset APPLY_PATCHES
43
unset APPLY_PATCHES
43
unset APPLY_MODS
44
unset APPLY_MODS
Line 46... Line 47...
46
unset XGCC_IN_PATH;
47
unset XGCC_IN_PATH;
47
for arg in "$@" ; do
48
for arg in "$@" ; do
48
    val=${arg##*=}
49
    val=${arg##*=}
49
    tag=${arg%%=*}
50
    tag=${arg%%=*}
50
    case $tag in
51
    case $tag in
51
        -XGccInPath)            XGCC_IN_PATH=1;;            
52
        -XGccInPath)            XGCC_IN_PATH=1;; 
-
 
53
        -CopyModsDirs)          COPY_MODS_DIRS=1;;           
52
        -clean)                 CLEAN=1;;
54
        -clean)                 CLEAN=1;;
53
        -ShellBuild)            SHELL_BUILD="$val";;
55
        -ShellBuild)            SHELL_BUILD="$val";;
54
        -BuildName)             BUILD_NAME=$val;;
56
        -BuildName)             BUILD_NAME=$val;;
55
        -BuildVersion)          BUILD_VERSION=$val;;
57
        -BuildVersion)          BUILD_VERSION=$val;;
56
        -Platform)              PLATFORM=$val;;
58
        -Platform)              PLATFORM=$val;;
Line 223... Line 225...
223
if [ ! -f ${LAUNCH_SCRIPT} ]; then
225
if [ ! -f ${LAUNCH_SCRIPT} ]; then
224
    echo "Specified shell build script ${LAUNCH_SCRIPT} does not exist."
226
    echo "Specified shell build script ${LAUNCH_SCRIPT} does not exist."
225
    exit 1
227
    exit 1
226
fi
228
fi
227
 
229
 
-
 
230
REL_BASE_DIR=../..
228
if [ ${DOWNLOAD_PKG} ]; then
231
if [ ${DOWNLOAD_PKG} ]; then
229
 
232
 
230
    # This is the set of available download directories, consisting of downloads/
233
    # This is the set of available download directories, consisting of downloads/
231
    # and a download directory that is offset from the location of the build
234
    # and a download directory that is offset from the location of the build
232
    # script src directory.
235
    # script src directory.
233
    unset TAR_DECOMP_ARG
236
    unset TAR_DECOMP_ARG
234
    TMP=`echo ${SHELL_BUILD} | sed "s|/src/.*||"`
237
    TMP=`echo ${SHELL_BUILD} | sed "s|/src/.*||"`
235
    TMP=`cleanup_dir ${CWD}/${TMP}`
238
    TMP=`cleanup_dir ${CWD}/${TMP}`
-
 
239
    DDIR_ELSEWHERE=${TMP}
236
    DOWNLOAD_DIRS="${TMP} ${BASE_DIR}"
240
    DOWNLOAD_DIRS="${TMP} ${BASE_DIR}"
237
    for DDIR in ${DOWNLOAD_DIRS}; do
241
    for DDIR in ${DOWNLOAD_DIRS}; do
238
        TMP=${DDIR}/downloads/${DOWNLOAD_PKG}.tar.bz2
242
        TMP=${DDIR}/downloads/${DOWNLOAD_PKG}.tar.bz2
239
        if [ -e ${TMP} ]; then
243
        if [ -e ${TMP} ]; then
240
            TARBALL_FILE=${TMP}
244
            TARBALL_FILE=${TMP}
Line 257... Line 261...
257
                    TAR_DECOMP_ARG=z
261
                    TAR_DECOMP_ARG=z
258
                fi
262
                fi
259
            fi
263
            fi
260
        fi    
264
        fi    
261
    done
265
    done
-
 
266
    if [ "${SHARE_BASE_DIR}" == "${DDIR_ELSEWHERE}" ]; then
-
 
267
        REL_BASE_DIR=../$(echo ${SHELL_BUILD} | sed "s|/src/.*||")
-
 
268
    fi
262
    if [ "${TAR_DECOMP_ARG}" == "" ]; then
269
    if [ "${TAR_DECOMP_ARG}" == "" ]; then
263
        echo "Could not find download file ${DOWNLOAD_PKG}.<tar.gz|tar.bz2|tgz> in any of { ${DOWNLOAD_DIRS} }"
270
        echo "Could not find download file ${DOWNLOAD_PKG}.<tar.gz|tar.bz2|tgz> in any of { ${DOWNLOAD_DIRS} }"
264
        exit 1
271
        exit 1
265
    fi
272
    fi
266
    UNTAR_DIR=${LCL_SRC_DIR}/${DOWNLOAD_PKG}
273
    UNTAR_DIR=${LCL_SRC_DIR}/${DOWNLOAD_PKG}
Line 477... Line 484...
477
                    fi
484
                    fi
478
                done    
485
                done    
479
            fi
486
            fi
480
        fi
487
        fi
481
        
488
        
-
 
489
        #
-
 
490
        #   When a 'mods' directory is present we need to sym-link all the 
-
 
491
        #   files from there into the source tree.
-
 
492
        #
482
        cd ${UNTAR_DIR}
493
        cd ${UNTAR_DIR}
483
        MODS_DIR=${SHARE_BASE_DIR}/${DOWNLOAD_PKG_NAME}_${DOWNLOAD_PKG_VER}_mods
494
        MODS_DIR=${SHARE_BASE_DIR}/${DOWNLOAD_PKG_NAME}_${DOWNLOAD_PKG_VER}_mods
484
        if [ -d ${MODS_DIR} ]; then
495
        if [ -d ${MODS_DIR} ]; then
485
            echo " --> Applying modifications"
496
            echo " --> Applying modifications from ${MODS_DIR}"
-
 
497
            echo "     Base relative directory is  ${REL_BASE_DIR}"
-
 
498
            if [ "${COPY_MODS_DIRS}" != "" ]; then
-
 
499
                echo "     Directories are copied"
-
 
500
            else
-
 
501
                echo "     Directories are symlinked"
-
 
502
            fi                
-
 
503
 
-
 
504
            function create_mods()
-
 
505
            {
-
 
506
                local SRC
-
 
507
                local REL
-
 
508
                local DST
-
 
509
                local NAME
486
            cp -fr ${MODS_DIR}/* .
510
                local MOD_DIR=$1
-
 
511
                local REL_DEPTH=$2
-
 
512
                for SRC in `ls ${MOD_DIR}`; do
487
            ERG_CONFIG=${MODS_DIR}/ERG.config
513
                    SRC=${MOD_DIR}${SRC}
-
 
514
                    REL=`echo "${SRC}" | sed "s|${MODS_DIR}|${REL_DEPTH}/${DOWNLOAD_PKG_NAME}_${DOWNLOAD_PKG_VER}_mods|g"`
-
 
515
                    DST=`echo "${SRC}" | sed "s|${MODS_DIR}/||g"`
488
            if [ -f ${ERG_CONFIG} ]; then
516
                    if [ -d "${SRC}" ]; then
-
 
517
                        if [ -e "${DST}" ]; then
-
 
518
                            create_mods ${SRC}/ ../${REL_DEPTH}
-
 
519
                        else
-
 
520
                            if [ "${COPY_MODS_DIRS}" != "" ]; then
-
 
521
                                echo "       * Creating directory ${DST}"
-
 
522
                                mkdir -p ${DST}
-
 
523
                                create_mods ${SRC}/ ../${REL_DEPTH}
-
 
524
                            else
-
 
525
                                echo "       * Creating directory ${DST} symlink"
-
 
526
                                ln -s ${REL} ${DST}
-
 
527
                                if [ $? != 0 ]; then
-
 
528
                                    echo "ERROR: Could not create symlink from ${REL} to ${DST}"
-
 
529
                                    exit 1
-
 
530
                                fi
-
 
531
                            fi                                
-
 
532
                        fi
-
 
533
                    else
-
 
534
                        if [ -e "${DST}" ]; then
-
 
535
                            echo "       * Replacing file ${DST} with symlink"
-
 
536
                            rm -f ${DST}
-
 
537
                        else
-
 
538
                            echo "       * Creating file ${DST} symlink"
-
 
539
                        fi
489
                cp -fr ${ERG_CONFIG} .config
540
                        ln -s ${REL} ${DST}
-
 
541
                        if [ $? != 0 ]; then
-
 
542
                            echo "ERROR: Could not create symlink from ${REL} to ${DST}"
-
 
543
                            exit 1
-
 
544
                        fi
-
 
545
                    fi
-
 
546
                done
490
            fi
547
            }
-
 
548
 
-
 
549
            create_mods ${MODS_DIR}/ ${REL_BASE_DIR}
491
            VXP_CONFIG=${MODS_DIR}/VXP.config
550
            VXP_CONFIG=${MODS_DIR}/VXP.config
-
 
551
            if [ ! -f ${VXP_CONFIG} ]; then
-
 
552
                VXP_CONFIG=${MODS_DIR}/ERG.config
-
 
553
            fi
492
            if [ -f ${VXP_CONFIG} ]; then
554
            if [ -f ${VXP_CONFIG} ]; then
-
 
555
                REL=`echo "${VXP_CONFIG}" | sed "s|${MODS_DIR}|${REL_BASE_DIR}/${DOWNLOAD_PKG_NAME}_${DOWNLOAD_PKG_VER}_mods|g"`
-
 
556
                if [ -e .config ]; then
-
 
557
                    echo "       * Replacing .config with symlink"
-
 
558
                    rm -f .config
-
 
559
                else
-
 
560
                    echo "       * Creating .config symlink"
-
 
561
                fi
493
                cp -fr ${VXP_CONFIG} .config
562
                ln -s ${REL} .config
494
            fi
563
            fi
495
        fi
564
        fi
496
 
565
 
497
        mv ${UNTAR_DIR} ${WORK_DIR} 
566
        mv ${UNTAR_DIR} ${WORK_DIR} 
498
        
567
        
499
        touch ${COMPLETE_DECOMPRESS}
568
        touch ${COMPLETE_DECOMPRESS}
500
    fi        
569
    fi        
501
fi
570
fi
502
 
571
 
-
 
572
 
503
#
573
#
504
#   Source the users script
574
#   Source the users script
505
#   This is processed in the context of this script
575
#   This is processed in the context of this script
506
#
576
#
507
mkdir -p ${WORK_DIR}
577
mkdir -p ${WORK_DIR}