3 # use autotools_stage_all for native packages
4 AUTOTOOLS_NATIVE_STAGE_INSTALL = "1"
6 def autotools_dep_prepend(d):
9 if bb.data.getVar('INHIBIT_AUTOTOOLS_DEPS', d, 1):
12 pn = bb.data.getVar('PN', d, 1)
15 if pn in ['autoconf-native', 'automake-native']:
17 deps += 'autoconf-native automake-native '
19 if not pn in ['libtool', 'libtool-native', 'libtool-cross']:
20 deps += 'libtool-native '
21 if not bb.data.inherits_class('native', d) \
22 and not bb.data.inherits_class('cross', d) \
23 and not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1):
24 deps += 'libtool-cross '
26 return deps + 'gnu-config-native '
29 DEPENDS_prepend = "${@autotools_dep_prepend(d)}"
31 EXTRA_AUTORECONF = "--exclude=autopoint"
33 def autotools_set_crosscompiling(d):
35 if not bb.data.inherits_class('native', d):
36 return " cross_compiling=yes"
39 # EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
42 if [ -x ${S}/configure ] ; then
43 cfgcmd="${S}/configure \
44 --build=${BUILD_SYS} \
46 --target=${TARGET_SYS} \
48 --exec_prefix=${exec_prefix} \
50 --sbindir=${sbindir} \
51 --libexecdir=${libexecdir} \
52 --datadir=${datadir} \
53 --sysconfdir=${sysconfdir} \
54 --sharedstatedir=${sharedstatedir} \
55 --localstatedir=${localstatedir} \
57 --includedir=${includedir} \
58 --oldincludedir=${oldincludedir} \
59 --infodir=${infodir} \
61 --enable-mainainer-mode \
64 oenote "Running $cfgcmd..."
65 $cfgcmd || oefatal "oe_runconf failed"
67 oefatal "no configure script found"
71 autotools_do_configure() {
78 # WARNING: gross hack follows:
79 # An autotools built package generally needs these scripts, however only
80 # automake or libtoolize actually install the current versions of them.
81 # This is a problem in builds that do not use libtool or automake, in the case
82 # where we -need- the latest version of these scripts. e.g. running a build
83 # for a package whose autotools are old, on an x86_64 machine, which the old
84 # config.sub does not support. Work around this by installing them manually
86 ( for ac in `find ${S} -name configure.in -o -name configure.ac`; do
87 rm -f `dirname $ac`/configure
89 if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
92 if [ x"${acpaths}" = xdefault ]; then
94 for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
95 grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
96 acpaths="$acpaths -I $i"
101 AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
103 echo "AUTOV is $AUTOV"
104 install -d ${STAGING_DATADIR}/aclocal
105 install -d ${STAGING_DATADIR}/aclocal-$AUTOV
106 acpaths="$acpaths -I${STAGING_DATADIR}/aclocal-$AUTOV -I ${STAGING_DATADIR}/aclocal"
107 # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
108 # like it was auto-generated. Work around this by blowing it away
109 # by hand, unless the package specifically asked not to run aclocal.
110 if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
113 if [ -e configure.in ]; then
114 CONFIGURE_AC=configure.in
116 CONFIGURE_AC=configure.ac
118 if grep "^AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
119 if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
120 : do nothing -- we still have an old unmodified configure.ac
122 oenote Executing glib-gettextize --force --copy
123 echo "no" | glib-gettextize --force --copy
126 if grep "^[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
127 oenote Executing intltoolize --copy --force --automake
128 intltoolize --copy --force --automake
130 oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
132 autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed."
137 if [ -e ${S}/configure ]; then
140 oenote "nothing to configure"
144 autotools_do_install() {
145 oe_runmake 'DESTDIR=${D}' install
147 for i in `find ${D} -name "*.la"` ; do \
148 sed -i -e s:${STAGING_LIBDIR}:${libdir}:g $i
149 sed -i -e s:${D}::g $i
150 sed -i -e 's:-I${WORKDIR}\S*: :g' $i
151 sed -i -e 's:-L${WORKDIR}\S*: :g' $i
155 STAGE_TEMP="${WORKDIR}/temp-staging"
157 autotools_stage_includes() {
158 if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ]
161 mkdir -p ${STAGE_TEMP}
162 make DESTDIR="${STAGE_TEMP}" install
163 cp -pPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR}
168 autotools_stage_dir() {
171 # This will remove empty directories so we can ignore them
172 rmdir "$from" 2> /dev/null || true
173 if [ -d "$from" ]; then
175 cp -fpPR "$from"/* "$to"
179 autotools_stage_all() {
180 if [ "${INHIBIT_AUTO_STAGE}" = "1" ]
185 mkdir -p ${STAGE_TEMP}
186 oe_runmake DESTDIR="${STAGE_TEMP}" install
187 autotools_stage_dir ${STAGE_TEMP}/${includedir} ${STAGING_INCDIR}
188 if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
189 autotools_stage_dir ${STAGE_TEMP}/${bindir} ${STAGING_DIR_HOST}${layout_bindir}
190 autotools_stage_dir ${STAGE_TEMP}/${sbindir} ${STAGING_DIR_HOST}${layout_sbindir}
191 autotools_stage_dir ${STAGE_TEMP}/${base_bindir} ${STAGING_DIR_HOST}${layout_base_bindir}
192 autotools_stage_dir ${STAGE_TEMP}/${base_sbindir} ${STAGING_DIR_HOST}${layout_base_sbindir}
193 autotools_stage_dir ${STAGE_TEMP}/${libexecdir} ${STAGING_DIR_HOST}${layout_libexecdir}
195 if [ -d ${STAGE_TEMP}/${libdir} ]
198 cd ${STAGE_TEMP}/${libdir}
199 las=$(find . -name \*.la -type f)
201 echo "Found la files: $las"
202 if [ -n "$las" ]; then
203 # If there are .la files then libtool was used in the
204 # build, so install them with magic mangling.
208 echo "oe_libinstall -C ${S} -so $(basename $i .la) ${STAGING_LIBDIR}/${dir}"
209 oe_libinstall -C ${S} -so $(basename $i .la) ${STAGING_LIBDIR}/${dir}
212 # Otherwise libtool wasn't used, and lib/ can be copied
214 autotools_stage_dir ${STAGE_TEMP}/${libdir} ${STAGING_LIBDIR}
218 # Ok, this is nasty. pkgconfig.bbclass is usually used to install .pc files,
219 # however some packages rely on the presence of .pc files to enable/disable
220 # their configurataions in which case we better should not install everything
221 # unconditionally, but rather depend on the actual results of make install.
222 # The good news though: a) there are not many packages doing this and
223 # b) packaged staging will fix that anyways. :M:
224 if [ "${AUTOTOOLS_STAGE_PKGCONFIG}" = "1" ]
226 echo "cp -f ${STAGE_TEMP}/${libdir}/pkgconfig/*.pc ${STAGING_LIBDIR}/pkgconfig/"
227 cp -f ${STAGE_TEMP}/${libdir}/pkgconfig/*.pc ${STAGING_LIBDIR}/pkgconfig/
229 rm -rf ${STAGE_TEMP}/${mandir} || true
230 rm -rf ${STAGE_TEMP}/${infodir} || true
231 autotools_stage_dir ${STAGE_TEMP}/${datadir} ${STAGING_DATADIR}
235 EXPORT_FUNCTIONS do_configure do_install