1 # use autotools_stage_all for native packages
2 AUTOTOOLS_NATIVE_STAGE_INSTALL = "1"
4 def autotools_dep_prepend(d):
5 if bb.data.getVar('INHIBIT_AUTOTOOLS_DEPS', d, 1):
8 pn = bb.data.getVar('PN', d, 1)
11 if pn in ['autoconf-native', 'automake-native']:
13 deps += 'autoconf-native automake-native '
15 if not pn in ['libtool', 'libtool-native', 'libtool-cross']:
16 deps += 'libtool-native '
17 if not bb.data.inherits_class('native', d) \
18 and not bb.data.inherits_class('cross', d) \
19 and not bb.data.inherits_class('sdk', d) \
20 and not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1):
21 deps += 'libtool-cross '
23 return deps + 'gnu-config-native '
27 DEPENDS_prepend = "${@autotools_dep_prepend(d)}"
28 DEPENDS_virtclass-native_prepend = "${@autotools_dep_prepend(d)}"
29 DEPENDS_virtclass-nativesdk_prepend = "${@autotools_dep_prepend(d)}"
33 # Space separated list of shell scripts with variables defined to supply test
34 # results for autoconf tests we cannot run at build time.
35 export CONFIG_SITE = "${@siteinfo_get_files(d)}"
38 EXTRA_AUTORECONF = "--exclude=autopoint"
40 def autotools_set_crosscompiling(d):
41 if not bb.data.inherits_class('native', d):
42 return " cross_compiling=yes"
45 # EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
48 if [ -x ${S}/configure ] ; then
49 cfgcmd="${S}/configure \
50 --build=${BUILD_SYS} \
52 --target=${TARGET_SYS} \
54 --exec_prefix=${exec_prefix} \
56 --sbindir=${sbindir} \
57 --libexecdir=${libexecdir} \
58 --datadir=${datadir} \
59 --sysconfdir=${sysconfdir} \
60 --sharedstatedir=${sharedstatedir} \
61 --localstatedir=${localstatedir} \
63 --includedir=${includedir} \
64 --oldincludedir=${oldincludedir} \
65 --infodir=${infodir} \
69 oenote "Running $cfgcmd..."
70 $cfgcmd || oefatal "oe_runconf failed"
72 oefatal "no configure script found"
76 autotools_do_configure() {
83 # WARNING: gross hack follows:
84 # An autotools built package generally needs these scripts, however only
85 # automake or libtoolize actually install the current versions of them.
86 # This is a problem in builds that do not use libtool or automake, in the case
87 # where we -need- the latest version of these scripts. e.g. running a build
88 # for a package whose autotools are old, on an x86_64 machine, which the old
89 # config.sub does not support. Work around this by installing them manually
91 ( for ac in `find ${S} -name configure.in -o -name configure.ac`; do
92 rm -f `dirname $ac`/configure
94 if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
97 if [ x"${acpaths}" = xdefault ]; then
99 for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
100 grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
101 acpaths="$acpaths -I $i"
106 AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
108 echo "AUTOV is $AUTOV"
109 install -d ${STAGING_DATADIR}/aclocal
110 install -d ${STAGING_DATADIR}/aclocal-$AUTOV
111 acpaths="$acpaths -I${STAGING_DATADIR}/aclocal-$AUTOV -I ${STAGING_DATADIR}/aclocal"
112 # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
113 # like it was auto-generated. Work around this by blowing it away
114 # by hand, unless the package specifically asked not to run aclocal.
115 if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
118 if [ -e configure.in ]; then
119 CONFIGURE_AC=configure.in
121 CONFIGURE_AC=configure.ac
123 if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
124 if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
125 : do nothing -- we still have an old unmodified configure.ac
127 oenote Executing glib-gettextize --force --copy
128 echo "no" | glib-gettextize --force --copy
132 if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
133 oenote Executing intltoolize --copy --force --automake
134 intltoolize --copy --force --automake
136 oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
137 autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed."
142 if [ -e ${S}/configure ]; then
145 oenote "nothing to configure"
149 autotools_do_install() {
150 oe_runmake 'DESTDIR=${D}' install
153 PACKAGE_PREPROCESS_FUNCS += "autotools_prepackage_lamangler"
155 autotools_prepackage_lamangler () {
156 for i in `find ${PKGD} -name "*.la"` ; do \
157 sed -i -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${libdir}/\1,g' $i
158 sed -i -e s:${CROSS_DIR}/${HOST_SYS}::g $i
159 sed -i -e s:${CROSS_DIR}::g $i
160 sed -i -e s:${STAGING_LIBDIR}:${libdir}:g $i
161 if [ -n "${STAGING_DIR_HOST}" ]; then
162 sed -i -e s:${STAGING_DIR_HOST}::g $i
164 sed -i -e s:${STAGING_DIR}::g $i
165 sed -i -e s:${S}::g $i
166 sed -i -e s:${T}::g $i
167 sed -i -e s:${D}::g $i
171 STAGE_TEMP="${WORKDIR}/temp-staging"
173 autotools_stage_includes() {
174 if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ]
177 mkdir -p ${STAGE_TEMP}
178 make DESTDIR="${STAGE_TEMP}" install
179 cp -pPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR}
184 autotools_stage_dir() {
185 sysroot_stage_dir $1 ${STAGE_TEMP_PREFIX}$2
188 autotools_stage_libdir() {
189 sysroot_stage_libdir $1 ${STAGE_TEMP_PREFIX}$2
192 autotools_stage_all() {
193 if [ "${INHIBIT_AUTO_STAGE}" = "1" ]
198 mkdir -p ${STAGE_TEMP}
199 oe_runmake DESTDIR="${STAGE_TEMP}" install
200 rm -rf ${STAGE_TEMP}/${mandir} || true
201 rm -rf ${STAGE_TEMP}/${infodir} || true
202 sysroot_stage_dirs ${STAGE_TEMP} ${STAGE_TEMP_PREFIX}
206 EXPORT_FUNCTIONS do_configure do_install