1 # use autotools_stage_all for native packages
2 AUTOTOOLS_NATIVE_STAGE_INSTALL = "1"
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', 'help2man-native']:
13 deps += 'autoconf-native automake-native help2man-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_deps(d)}"
28 DEPENDS_virtclass-native_prepend = "${@autotools_deps(d)}"
29 DEPENDS_virtclass-nativesdk_prepend = "${@autotools_deps(d)}"
33 def _autotools_get_sitefiles(d):
34 def inherits(d, *classes):
35 if any(bb.data.inherits_class(cls, d) for cls in classes):
38 if inherits(d, "native", "nativesdk"):
41 sitedata = siteinfo_data(d)
42 for path in d.getVar("BBPATH", True).split(":"):
43 for element in sitedata:
44 filename = os.path.join(path, "site", element)
45 if os.path.exists(filename):
48 # Space separated list of shell scripts with variables defined to supply test
49 # results for autoconf tests we cannot run at build time.
50 export CONFIG_SITE = "${@' '.join(_autotools_get_sitefiles(d))}"
53 EXTRA_AUTORECONF = "--exclude=autopoint"
55 def autotools_set_crosscompiling(d):
56 if not bb.data.inherits_class('native', d):
57 return " cross_compiling=yes"
60 def append_libtool_sysroot(d):
61 if bb.data.getVar('LIBTOOL_HAS_SYSROOT', d, 1) == "yes":
62 if bb.data.getVar('BUILD_SYS', d, 1) == bb.data.getVar('HOST_SYS', d, 1):
63 return '--with-libtool-sysroot'
65 return '--with-libtool-sysroot=${STAGING_DIR_HOST}'
68 # EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
70 CONFIGUREOPTS = " --build=${BUILD_SYS} \
72 --target=${TARGET_SYS} \
74 --exec_prefix=${exec_prefix} \
76 --sbindir=${sbindir} \
77 --libexecdir=${libexecdir} \
78 --datadir=${datadir} \
79 --sysconfdir=${sysconfdir} \
80 --sharedstatedir=${sharedstatedir} \
81 --localstatedir=${localstatedir} \
83 --includedir=${includedir} \
84 --oldincludedir=${oldincludedir} \
85 --infodir=${infodir} \
87 ${@append_libtool_sysroot(d)} \
91 if [ -x ${S}/configure ] ; then
93 ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"
95 oefatal "no configure script found"
99 autotools_do_configure() {
106 # WARNING: gross hack follows:
107 # An autotools built package generally needs these scripts, however only
108 # automake or libtoolize actually install the current versions of them.
109 # This is a problem in builds that do not use libtool or automake, in the case
110 # where we -need- the latest version of these scripts. e.g. running a build
111 # for a package whose autotools are old, on an x86_64 machine, which the old
112 # config.sub does not support. Work around this by installing them manually
114 ( for ac in `find ${S} -name configure.in -o -name configure.ac`; do
115 rm -f `dirname $ac`/configure
117 if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
120 if [ x"${acpaths}" = xdefault ]; then
122 for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
123 grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
124 acpaths="$acpaths -I $i"
129 AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
131 echo "AUTOV is $AUTOV"
132 install -d ${STAGING_DATADIR}/aclocal
133 install -d ${STAGING_DATADIR}/aclocal-$AUTOV
134 acpaths="$acpaths -I${STAGING_DATADIR}/aclocal-$AUTOV -I ${STAGING_DATADIR}/aclocal"
135 # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
136 # like it was auto-generated. Work around this by blowing it away
137 # by hand, unless the package specifically asked not to run aclocal.
138 if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
141 if [ -e configure.in ]; then
142 CONFIGURE_AC=configure.in
144 CONFIGURE_AC=configure.ac
146 if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
147 if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
148 : do nothing -- we still have an old unmodified configure.ac
150 oenote Executing glib-gettextize --force --copy
151 echo "no" | glib-gettextize --force --copy
153 else if grep "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
154 if [ -e ${STAGING_DATADIR}/gettext/config.rpath ]; then
155 cp ${STAGING_DATADIR}/gettext/config.rpath ${S}/
157 oenote ${STAGING_DATADIR}/gettext/config.rpath not found. gettext is not installed.
163 oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
164 autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed."
165 if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
166 oenote Executing intltoolize --copy --force --automake
167 intltoolize --copy --force --automake
173 if [ -e ${S}/configure ]; then
176 oenote "nothing to configure"
180 autotools_do_install() {
181 oe_runmake 'DESTDIR=${D}' install
184 PACKAGE_PREPROCESS_FUNCS += "${@['autotools_prepackage_lamangler',''][bb.data.getVar('LIBTOOL_HAS_SYSROOT', d, 1) == "yes"]}"
185 autotools_prepackage_lamangler () {
186 for i in `find ${PKGD} -name "*.la"` ; do \
187 sed -i -e 's:${STAGING_LIBDIR}:${libdir}:g;' \
189 -e 's:-I${WORKDIR}\S*: :g;' \
190 -e 's:-L${WORKDIR}\S*: :g;' \
195 # STAGE_TEMP_PREFIX is used for a speedup by packaged-staging
196 STAGE_TEMP="${WORKDIR}/temp-staging"
197 STAGE_TEMP_PREFIX = ""
199 autotools_stage_includes() {
200 if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ]
203 mkdir -p ${STAGE_TEMP}
204 make DESTDIR="${STAGE_TEMP}" install
205 cp -pPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR}
210 autotools_stage_dir() {
211 sysroot_stage_dir $1 ${STAGE_TEMP_PREFIX}$2
214 autotools_stage_libdir() {
215 sysroot_stage_libdir $1 ${STAGE_TEMP_PREFIX}$2
218 autotools_stage_all() {
219 if [ "${INHIBIT_AUTO_STAGE}" = "1" ]
224 mkdir -p ${STAGE_TEMP}
225 oe_runmake DESTDIR="${STAGE_TEMP}" install
226 rm -rf ${STAGE_TEMP}/${mandir} || true
227 rm -rf ${STAGE_TEMP}/${infodir} || true
228 sysroot_stage_dirs ${STAGE_TEMP} ${STAGE_TEMP_PREFIX}
232 EXPORT_FUNCTIONS do_configure do_install