update openembedded-core, meta-openembedded, bitbake(version 1.23.1)
[vuplus_openvuplus_3.0] / meta-openvuplus / classes / autotools.bbclass
1 def autotools_dep_prepend(d):
2         if d.getVar('INHIBIT_AUTOTOOLS_DEPS', True):
3                 return ''
4
5         pn = d.getVar('PN', True)
6         deps = ''
7
8         if pn in ['autoconf-native', 'automake-native', 'help2man-native']:
9                 return deps
10         deps += 'autoconf-native automake-native '
11
12         if not pn in ['libtool', 'libtool-native'] and not pn.endswith("libtool-cross"):
13                 deps += 'libtool-native '
14                 if not bb.data.inherits_class('native', d) \
15                         and not bb.data.inherits_class('nativesdk', d) \
16                         and not bb.data.inherits_class('cross', d) \
17                         and not d.getVar('INHIBIT_DEFAULT_DEPS', True):
18                     deps += 'libtool-cross '
19
20         return deps + 'gnu-config-native '
21
22 EXTRA_OEMAKE = ""
23
24 DEPENDS_prepend = "${@autotools_dep_prepend(d)}"
25
26 inherit siteinfo
27
28 # Space separated list of shell scripts with variables defined to supply test
29 # results for autoconf tests we cannot run at build time.
30 export CONFIG_SITE = "${@siteinfo_get_files(d)}"
31
32 acpaths = "default"
33 EXTRA_AUTORECONF = "--exclude=autopoint"
34
35 export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}"
36
37 def autotools_set_crosscompiling(d):
38         if not bb.data.inherits_class('native', d):
39                 return " cross_compiling=yes"
40         return ""
41
42 def append_libtool_sysroot(d):
43         # Only supply libtool sysroot option for non-native packages
44         if not bb.data.inherits_class('native', d):
45                 return '--with-libtool-sysroot=${STAGING_DIR_HOST}'
46         return ""
47
48 # EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
49
50 CONFIGUREOPTS = " --build=${BUILD_SYS} \
51                   --host=${HOST_SYS} \
52                   --target=${TARGET_SYS} \
53                   --prefix=${prefix} \
54                   --exec_prefix=${exec_prefix} \
55                   --bindir=${bindir} \
56                   --sbindir=${sbindir} \
57                   --libexecdir=${libexecdir} \
58                   --datadir=${datadir} \
59                   --sysconfdir=${sysconfdir} \
60                   --sharedstatedir=${sharedstatedir} \
61                   --localstatedir=${localstatedir} \
62                   --libdir=${libdir} \
63                   --includedir=${includedir} \
64                   --oldincludedir=${oldincludedir} \
65                   --infodir=${infodir} \
66                   --mandir=${mandir} \
67                   --disable-silent-rules \
68                   ${CONFIGUREOPT_DEPTRACK} \
69                   ${@append_libtool_sysroot(d)}"
70 CONFIGUREOPT_DEPTRACK = "--disable-dependency-tracking"
71
72
73 oe_runconf () {
74         cfgscript="${S}/configure"
75         if [ -x "$cfgscript" ] ; then
76                 bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@"
77                 ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@" || bbfatal "oe_runconf failed"
78         else
79                 bbfatal "no configure script found at $cfgscript"
80         fi
81 }
82
83 AUTOTOOLS_AUXDIR ?= "${S}"
84
85 autotools_do_configure() {
86         case ${PN} in
87         autoconf*)
88         ;;
89         automake*)
90         ;;
91         *)
92                 # WARNING: gross hack follows:
93                 # An autotools built package generally needs these scripts, however only
94                 # automake or libtoolize actually install the current versions of them.
95                 # This is a problem in builds that do not use libtool or automake, in the case
96                 # where we -need- the latest version of these scripts.  e.g. running a build
97                 # for a package whose autotools are old, on an x86_64 machine, which the old
98                 # config.sub does not support.  Work around this by installing them manually
99                 # regardless.
100                 ( for ac in `find ${S} -name configure.in -o -name configure.ac`; do
101                         rm -f `dirname $ac`/configure
102                         done )
103                 if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
104                         olddir=`pwd`
105                         cd ${S}
106                         # Remove any previous copy of the m4 macros
107                         rm -rf ${B}/aclocal-copy/
108                         if [ x"${acpaths}" = xdefault ]; then
109                                 acpaths=
110                                 for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
111                                         grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
112                                         acpaths="$acpaths -I $i"
113                                 done
114                         else
115                                 acpaths="${acpaths}"
116                         fi
117                         AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
118                         automake --version
119                         echo "AUTOV is $AUTOV"
120                         if [ -d ${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV ]; then
121                                 acpaths="$acpaths -I${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV"
122                         fi
123                         # The aclocal directory could get modified by other processes 
124                         # uninstalling data from the sysroot. See Yocto #861 for details.
125                         # We avoid this by taking a copy here and then files cannot disappear.
126                         if [ -d ${STAGING_DATADIR}/aclocal ]; then
127                                 mkdir -p ${B}/aclocal-copy/
128                                 # for scratch build this directory can be empty
129                                 # so avoid cp's no files to copy error
130                                 cp -r ${STAGING_DATADIR}/aclocal/. ${B}/aclocal-copy/
131                                 acpaths="$acpaths -I ${B}/aclocal-copy/"
132                         fi
133                         # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
134                         # like it was auto-generated.  Work around this by blowing it away
135                         # by hand, unless the package specifically asked not to run aclocal.
136                         if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
137                                 rm -f aclocal.m4
138                         fi
139                         if [ -e configure.in ]; then
140                           CONFIGURE_AC=configure.in
141                         else
142                           CONFIGURE_AC=configure.ac
143                         fi
144                         if ! echo ${EXTRA_OECONF} | grep -q "\-\-disable-nls"; then
145                           if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
146                             if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
147                               : do nothing -- we still have an old unmodified configure.ac
148                             else
149                               bbnote Executing glib-gettextize --force --copy
150                               echo "no" | glib-gettextize --force --copy
151                             fi
152                           else if grep "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
153                             # We'd call gettextize here if it wasn't so broken...
154                             cp ${STAGING_DATADIR}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
155                             if [ -d ${S}/po/ -a ! -e ${S}/po/Makefile.in.in ]; then
156                               cp ${STAGING_DATADIR}/gettext/po/Makefile.in.in ${S}/po/
157                               if [ ! -e ${S}/po/remove-potcdate.sin ]; then
158                                 cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sin ${S}/po/
159                               fi
160                             fi
161                           fi
162                         fi
163                         fi
164                         mkdir -p m4
165                         if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
166                           bbnote Executing intltoolize --copy --force --automake
167                           intltoolize --copy --force --automake
168                         fi
169                         bbnote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
170                         autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || bbfatal "autoreconf execution failed."
171                         cd $olddir
172                 fi
173         ;;
174         esac
175         if [ -e ${S}/configure ]; then
176                 oe_runconf
177         else
178                 bbnote "nothing to configure"
179         fi
180 }
181
182 autotools_do_install() {
183         oe_runmake 'DESTDIR=${D}' install
184         # Info dir listing isn't interesting at this point so remove it if it exists.
185         if [ -e "${D}${infodir}/dir" ]; then
186                 rm -f ${D}${infodir}/dir
187         fi
188 }
189
190 inherit siteconfig
191
192 EXPORT_FUNCTIONS do_configure do_install