summaryrefslogtreecommitdiff
path: root/package/build.linux
blob: 6b67ea510466dc4519f4177b6d6f7ba833bde4ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash -xe

__copy_necessary_binaries()
{
    echo "add necessary files."
    ## ex)
    ##     ide_root_path_name=IDE
    ##     cp -rf ~~~~/file.file ${INSTALL_DIR}/${ide_root_path_name}/
}

__set_parameter()
{
    case ${TARGET_OS} in
        ubuntu-32|ubuntu-64)
            pde_path=${ROOTDIR}/indigo-pde
            ;;
        windows-32|windows-64)
            pde_path=${ROOTDIR}/indigo-winpde
            ;;
        macos-64)
            pde_path=${ROOTDIR}/indigo-macpde
            ;;
        *)
            echo "${TARGET_OS} is not support yet."
            exit 1
            ;;
    esac
    
    build_script_path=${pde_path}/pde_build
}

# clean
clean()
{
    echo "=========================================CLEAN============================================"
    __set_parameter
    ${build_script_path}/clean.sh ${package_name}
}

# build
build() 
{
    echo "=========================================BUILD============================================"
    pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
    for pkgname_and_platform in ${pkgname_and_platform_list}
    do
        pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
        package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
        platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
    
        if [ "x${TARGET_OS}" = "x${platform}" ]
        then
            __set_parameter
            ${build_script_path}/build.sh ${package_name}
       else
            echo ""
        fi
    done
}

# install
install() 
{
    pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
    for pkgname_and_platform in ${pkgname_and_platform_list}
    do
        echo "=========================================INSTALL============================================"
        pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
        package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
        platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`

        if [ "x${TARGET_OS}" = "x${platform}" ]
        then
            __set_parameter
	        INSTALL_DIR=${SRCDIR}/package/${package_name}.package.${TARGET_OS}/data
            mkdir -p ${INSTALL_DIR} 
            __copy_necessary_binaries
            ${build_script_path}/install.sh ${package_name}
        else
            echo ""
        fi
    done    
}

[ "$1" = "clean" ] && clean
[ "$1" = "build" ] && build
[ "$1" = "install" ] && install