プロジェクト

全般

プロフィール

omniorb_crosbuild.sh

n-ando, 2012/08/10 17:14

 
1
#!/bin/sh
2
#
3
# @file omniorb_crossbuild.sh
4
# @brief OpenRTM configure script for armel cross compilation
5
# @author Noriaki Ando <n-ando@aist.go.jp>
6
#
7
# Usage: omniorb_crossbuild.sh <prefix>
8
#
9
# Please execute under omniORB source directory.
10
#
11
# EXAMPLE
12
# $ cd omniORB-X.Y.Z
13
# $ <path_to_this_script>/omniorb_crossbuild.sh /usr/arm-linux-gnueabi
14
# $ sudo make install
15
#
16
#
17

    
18
PREFIX=""
19
usage()
20
{
21
    echo "Usage: omniorb_crossbuild.sh <prefix>"
22
    echo ""
23
    echo "Please execute under omniORB source directory."
24
    echo ""
25
    echo "EXAMPLE"
26
    echo "  $ cd omniORB-X.Y.Z"
27
    echo "  $ <path_to_this_script>/$(basename $0) /usr/arm-linux-gnueabi"
28
    echo ""
29
}
30

    
31
patch_gen()
32
{
33
    cat <<EOT
34
--- omniORB-4.1.2/include/omniORB4/CORBA_sysdep.h       2007-02-06 02:39:17.000000000 +0900
35
+++ omniORB-4.1.2.patched/include/omniORB4/CORBA_sysdep.h       2012-08-10 15:22:38.000000000 +0900
36
@@ -126,7 +126,7 @@
37
 //
38

    
39
 #if defined(__arm__)
40
-#  if defined(__armv5teb__)
41
+#  if defined(__armv5teb__) || defined(__VFP_FP__)
42
 #    define NO_OMNI_MIXED_ENDIAN_DOUBLE
43
 #  else
44
 #    define OMNI_MIXED_ENDIAN_DOUBLE
45
EOT
46
}
47

    
48
patch_apply()
49
{
50
    need_patch=`grep '__armv5teb__' include/omniORB4/CORBA_sysdep.h | grep __VFP_FP__`
51
    if test "x$need_patch" = "x"; then
52
        patch_gen > CORBA_sysdep_h.patch
53
        patch -p1 < CORBA_sysdep_h.patch
54
    fi
55
}
56

    
57

    
58
check_arg()
59
{
60
    if test $# -eq 0; then
61
        echo "ERROR: At least one argument is required."
62
        echo ""
63
        usage
64
        exit 1
65
    fi
66
    if ! test -d $1; then
67
        echo "ERROR: $1 is not directory."
68
        exit 1
69
    fi
70
    PREFIX=$1
71
}
72

    
73
configure()
74
{
75
    ./configure --prefix=$PREFIX \
76
        CXX=/usr/bin/arm-linux-gnueabi-g++ \
77
        CC=/usr/bin/arm-linux-gnueabi-gcc \
78
        CXXFLAGS=-s \
79
        CFLAGS=-s \
80
        --build=i386-linux-gnu \
81
        --host=arm-linux-gnueabi \
82
        --target=arm-linux-gnu \
83
        --with-omniorb=/usr/arm-linux-gnueabi \
84
        --with-includes=-I/usr/arm-linux-gnueabi/include
85
}
86

    
87
check_arg $@
88
patch_apply
89
configure
90
make clean
91
make CC=gcc -C src/tool/omniidl/cxx/cccp
92
make CXX=g++ -C src/tool/omniidl/cxx
93
make CC=gcc-3.4 -C src/tool/omkdepend
94
make
95

    
96

    
97
exit 0