first commit
[scm/bb/meta-tizen.git] / recipes-tizen / swig / swig.inc
1 DESCRIPTION = "Simplified Wrapper and Interface Generator"
2 HOMEPAGE = "http://www.swig.org/"
3 SECTION = "Development/Languages/C and C++"
4 LICENSE = "GPL-3.0+ and BSD-3-Clause"
5
6 SRC_URI = ""
7
8 S = "${WORKDIR}/git"
9
10 PROVIDES = ""
11
12 #PROVIDES by swig 
13 PROVIDES += "swig"
14 RPROVIDES_swig += "swig"
15
16 #PROVIDES by swig-examples 
17 PROVIDES += "swig-examples"
18 RPROVIDES_swig-examples += "swig-examples"
19
20 #PROVIDES by swig-doc 
21 PROVIDES += "swig-doc"
22 RPROVIDES_swig-doc += "swig-doc"
23
24 RDEPENDS = ""
25 #RDEPENDS of swig-examples (${PN}-examples)
26 RDEPENDS_${PN}-examples += "swig"
27
28 #RDEPENDS of swig-doc (${PN}-doc)
29 RDEPENDS_${PN}-doc += "swig"
30
31
32 DEPENDS = ""
33 #DEPENDS of swig 
34 DEPENDS += "pcre"
35 DEPENDS += "gcc-cross"
36 DEPENDS += "fdupes-native"
37 inherit pythonnative
38 DEPENDS += "automake-native"
39 inherit perlnative
40 DEPENDS += "libtool-cross"
41 DEPENDS += "autoconf-native"
42 DEPENDS += "boost"
43
44 do_patch() {
45  chmod -Rf a+rX,u+w,g-w,o-w ${S}
46  #setup -q
47  cp ${S}/packaging/swig.manifest .
48  
49  
50 }
51
52 do_configure() {
53 }
54
55 do_compile() {
56  LANG=C
57  export LANG
58  unset DISPLAY
59  CFLAGS="-O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables" ; export CFLAGS ; 
60  CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CXXFLAGS ; 
61  FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I%_fmoddir}" ; export FFLAGS ; 
62  LD_AS_NEEDED=1; export LD_AS_NEEDED ; 
63  
64  sh autogen.sh
65  
66    CFLAGS="${CFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CFLAGS ; 
67    CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CXXFLAGS ; 
68    FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I%_fmoddir}" ; export FFLAGS ; 
69    autotools_do_configure --build=${TARGET_SYS} --host=${HOST_SYS} \
70          --target=x86_64-tizen-linux \
71          --program-prefix= \
72          --prefix=/usr \
73          --exec-prefix=/usr \
74          --bindir=/usr/bin \
75          --sbindir=/usr/sbin \
76          --sysconfdir=/etc \
77          --datadir=/usr/share \
78          --includedir=/usr/include \
79          --libdir=/usr/lib \
80          --libexecdir=/usr/libexec \
81          --localstatedir=/var \
82          --sharedstatedir=/usr/com \
83          --mandir=/usr/share/man \
84          --infodir=/usr/share/info --disable-ccache
85  make -j16
86  
87  exit 0
88  # Segfaults
89  rm -f Examples/test-suite/python/li_std_containers_int_runme.py
90  rm -f Examples/test-suite/python/li_boost_shared_ptr_runme.py
91  make check
92  
93  
94  
95 }
96
97 do_install() {
98  echo export RPM_BUILD_ROOT=${D}
99  LANG=C
100  export LANG
101  unset DISPLAY
102  rm -rf ${D} 
103  mkdir -p ${D} 
104  
105  
106    oe_runmake \
107          DESTDIR=${D} \
108          INSTALL_ROOT=${D} \
109          BINDIR=/usr/bin \
110    install  
111    rm -f ${D}/usr/share/info/dir 
112    find ${D} -regex ".*\.la$" | xargs rm -f -- 
113    find ${D} -regex ".*\.a$" | xargs rm -f --
114  
115  install -d ${D}/usr/share/doc/packages/swig
116  cp -a TODO ANNOUNCE CHANGES* LICENSE README Doc/{Devel,Manual} \
117         ${D}/usr/share/doc/packages/swig
118  install -d ${D}/usr/lib/swig
119  cp -a Examples ${D}/usr/lib/swig/examples
120  rm -rf ${D}/usr/lib/swig/examples/test-suite
121  
122  # rm files that are not needed for running or rebuilding the examples
123  find ${D}/usr/lib/swig \
124         -name '*.dsp' -o -name '*.vcproj' -o -name '*.sln' -o \
125         -name '*.o' -o -name '*_wrap.c' | xargs rm
126  
127  # fix perms
128  chmod -x ${D}/usr/share/doc/packages/swig/Manual/*
129  find ${D}/usr/lib/swig -name '*.h' -perm +111 | \
130         xargs --no-run-if-empty chmod -x
131  ln -s /usr/lib/swig/examples ${D}/usr/share/doc/packages/swig/Examples
132  
133  
134   _target=""; 
135   _symlinks=0; 
136    
137   fdupes -q -n -r ${D} | 
138    while read _file; do 
139      if test -z "$_target" ; then 
140        _target="$_file"; 
141      else 
142        if test -z "$_file" ; then 
143         _target=""; 
144         continue ; 
145        fi ; 
146        if test "$_symlinks" = 1; then 
147          ln -sf "${_target#${D}}" "$_file"; 
148        else 
149          ln -f "$_target" "$_file"; 
150        fi ;
151      fi ; 
152   done 
153  
154  
155 }
156
157 PACKAGES = ""
158 PACKAGES += "swig"
159 PACKAGES += "swig-doc"
160 PACKAGES += "swig-examples"
161
162 swig_files = ""
163 swig_files += "swig.manifest"
164 swig_files += "/usr/share/doc/packages/swig"
165 swig_files += "/usr/share/doc/packages/swig/[A-Z][A-Z]*"
166 swig_files += "/usr/share/swig"
167
168 swig-doc_files = ""
169 swig-doc_files += "swig.manifest"
170 swig-doc_files += "/usr/share/doc/packages/swig/Devel"
171 swig-doc_files += "/usr/share/doc/packages/swig/Manual"
172
173 swig-examples_files = ""
174 swig-examples_files += "swig.manifest"
175 swig-examples_files += "/usr/share/doc/packages/swig/Examples"
176 swig-examples_files += "/usr/lib/swig"
177
178 FILES_${PN} = "${swig_files}"
179 FILES_${PN}-doc = "${swig-doc_files}"
180 FILES_${PN}-examples = "${swig-examples_files}"
181
182 PKG_swig= "swig"
183 PKG_swig-doc= "swig-doc"
184 PKG_swig-examples= "swig-examples"
185
186 require swig-extraconf.inc