summaryrefslogtreecommitdiffstats
path: root/meta/classes/autotools.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/autotools.bbclass')
-rw-r--r--meta/classes/autotools.bbclass250
1 files changed, 0 insertions, 250 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
deleted file mode 100644
index 9dc8ebdaa7..0000000000
--- a/meta/classes/autotools.bbclass
+++ /dev/null
@@ -1,250 +0,0 @@
1def autotools_dep_prepend(d):
2 if d.getVar('INHIBIT_AUTOTOOLS_DEPS'):
3 return ''
4
5 pn = d.getVar('PN')
6 deps = ''
7
8 if pn in ['autoconf-native', 'automake-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'):
18 deps += 'libtool-cross '
19
20 return deps
21
22DEPENDS_prepend = "${@autotools_dep_prepend(d)} "
23
24inherit siteinfo
25
26# Space separated list of shell scripts with variables defined to supply test
27# results for autoconf tests we cannot run at build time.
28# The value of this variable is filled in in a prefunc because it depends on
29# the contents of the sysroot.
30export CONFIG_SITE
31
32acpaths ?= "default"
33EXTRA_AUTORECONF = "--exclude=autopoint --exclude=gtkdocize"
34
35export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}"
36
37# When building tools for use at build-time it's recommended for the build
38# system to use these variables when cross-compiling.
39# (http://sources.redhat.com/autobook/autobook/autobook_270.html)
40export CPP_FOR_BUILD = "${BUILD_CPP}"
41export CPPFLAGS_FOR_BUILD = "${BUILD_CPPFLAGS}"
42
43export CC_FOR_BUILD = "${BUILD_CC}"
44export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
45
46export CXX_FOR_BUILD = "${BUILD_CXX}"
47export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
48
49export LD_FOR_BUILD = "${BUILD_LD}"
50export LDFLAGS_FOR_BUILD = "${BUILD_LDFLAGS}"
51
52def append_libtool_sysroot(d):
53 # Only supply libtool sysroot option for non-native packages
54 if not bb.data.inherits_class('native', d):
55 return '--with-libtool-sysroot=${STAGING_DIR_HOST}'
56 return ""
57
58CONFIGUREOPTS = " --build=${BUILD_SYS} \
59 --host=${HOST_SYS} \
60 --target=${TARGET_SYS} \
61 --prefix=${prefix} \
62 --exec_prefix=${exec_prefix} \
63 --bindir=${bindir} \
64 --sbindir=${sbindir} \
65 --libexecdir=${libexecdir} \
66 --datadir=${datadir} \
67 --sysconfdir=${sysconfdir} \
68 --sharedstatedir=${sharedstatedir} \
69 --localstatedir=${localstatedir} \
70 --libdir=${libdir} \
71 --includedir=${includedir} \
72 --oldincludedir=${oldincludedir} \
73 --infodir=${infodir} \
74 --mandir=${mandir} \
75 --disable-silent-rules \
76 ${CONFIGUREOPT_DEPTRACK} \
77 ${@append_libtool_sysroot(d)}"
78CONFIGUREOPT_DEPTRACK ?= "--disable-dependency-tracking"
79
80CACHED_CONFIGUREVARS ?= ""
81
82AUTOTOOLS_SCRIPT_PATH ?= "${S}"
83CONFIGURE_SCRIPT ?= "${AUTOTOOLS_SCRIPT_PATH}/configure"
84
85AUTOTOOLS_AUXDIR ?= "${AUTOTOOLS_SCRIPT_PATH}"
86
87oe_runconf () {
88 # Use relative path to avoid buildpaths in files
89 cfgscript_name="`basename ${CONFIGURE_SCRIPT}`"
90 cfgscript=`python3 -c "import os; print(os.path.relpath(os.path.dirname('${CONFIGURE_SCRIPT}'), '.'))"`/$cfgscript_name
91 if [ -x "$cfgscript" ] ; then
92 bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@"
93 if ! CONFIG_SHELL=${CONFIG_SHELL-/bin/bash} ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"; then
94 bbnote "The following config.log files may provide further information."
95 bbnote `find ${B} -ignore_readdir_race -type f -name config.log`
96 bbfatal_log "configure failed"
97 fi
98 else
99 bbfatal "no configure script found at $cfgscript"
100 fi
101}
102
103CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
104
105autotools_preconfigure() {
106 if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
107 if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then
108 if [ "${S}" != "${B}" ]; then
109 echo "Previously configured separate build directory detected, cleaning ${B}"
110 rm -rf ${B}
111 mkdir -p ${B}
112 else
113 # At least remove the .la files since automake won't automatically
114 # regenerate them even if CFLAGS/LDFLAGS are different
115 cd ${S}
116 if [ "${CLEANBROKEN}" != "1" -a \( -e Makefile -o -e makefile -o -e GNUmakefile \) ]; then
117 oe_runmake clean
118 fi
119 find ${S} -ignore_readdir_race -name \*.la -delete
120 fi
121 fi
122 fi
123}
124
125autotools_postconfigure(){
126 if [ -n "${CONFIGURESTAMPFILE}" ]; then
127 mkdir -p `dirname ${CONFIGURESTAMPFILE}`
128 echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
129 fi
130}
131
132EXTRACONFFUNCS ??= ""
133
134EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}"
135
136do_configure[prefuncs] += "autotools_preconfigure autotools_aclocals ${EXTRACONFFUNCS}"
137do_compile[prefuncs] += "autotools_aclocals"
138do_install[prefuncs] += "autotools_aclocals"
139do_configure[postfuncs] += "autotools_postconfigure"
140
141ACLOCALDIR = "${STAGING_DATADIR}/aclocal"
142ACLOCALEXTRAPATH = ""
143ACLOCALEXTRAPATH_class-target = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
144ACLOCALEXTRAPATH_class-nativesdk = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
145
146python autotools_aclocals () {
147 d.setVar("CONFIG_SITE", siteinfo_get_files(d, sysrootcache=True))
148}
149
150CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am"
151
152autotools_do_configure() {
153 # WARNING: gross hack follows:
154 # An autotools built package generally needs these scripts, however only
155 # automake or libtoolize actually install the current versions of them.
156 # This is a problem in builds that do not use libtool or automake, in the case
157 # where we -need- the latest version of these scripts. e.g. running a build
158 # for a package whose autotools are old, on an x86_64 machine, which the old
159 # config.sub does not support. Work around this by installing them manually
160 # regardless.
161
162 PRUNE_M4=""
163
164 for ac in `find ${S} -ignore_readdir_race -name configure.in -o -name configure.ac`; do
165 rm -f `dirname $ac`/configure
166 done
167 if [ -e ${AUTOTOOLS_SCRIPT_PATH}/configure.in -o -e ${AUTOTOOLS_SCRIPT_PATH}/configure.ac ]; then
168 olddir=`pwd`
169 cd ${AUTOTOOLS_SCRIPT_PATH}
170 mkdir -p ${ACLOCALDIR}
171 ACLOCAL="aclocal --system-acdir=${ACLOCALDIR}/"
172 if [ x"${acpaths}" = xdefault ]; then
173 acpaths=
174 for i in `find ${AUTOTOOLS_SCRIPT_PATH} -ignore_readdir_race -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
175 grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
176 acpaths="$acpaths -I $i"
177 done
178 else
179 acpaths="${acpaths}"
180 fi
181 acpaths="$acpaths ${ACLOCALEXTRAPATH}"
182 AUTOV=`automake --version | sed -e '1{s/.* //;s/\.[0-9]\+$//};q'`
183 automake --version
184 echo "AUTOV is $AUTOV"
185 if [ -d ${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV ]; then
186 ACLOCAL="$ACLOCAL --automake-acdir=${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV"
187 fi
188 # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
189 # like it was auto-generated. Work around this by blowing it away
190 # by hand, unless the package specifically asked not to run aclocal.
191 if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
192 rm -f aclocal.m4
193 fi
194 if [ -e configure.in ]; then
195 CONFIGURE_AC=configure.in
196 else
197 CONFIGURE_AC=configure.ac
198 fi
199 if grep -q "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC; then
200 if grep -q "sed.*POTFILES" $CONFIGURE_AC; then
201 : do nothing -- we still have an old unmodified configure.ac
202 else
203 bbnote Executing glib-gettextize --force --copy
204 echo "no" | glib-gettextize --force --copy
205 fi
206 elif [ "${BPN}" != "gettext" ] && grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then
207 # We'd call gettextize here if it wasn't so broken...
208 cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
209 if [ -d ${S}/po/ ]; then
210 cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/po/
211 if [ ! -e ${S}/po/remove-potcdate.sin ]; then
212 cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sin ${S}/po/
213 fi
214 fi
215 PRUNE_M4="$PRUNE_M4 gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4"
216 fi
217 mkdir -p m4
218
219 for i in $PRUNE_M4; do
220 find ${S} -ignore_readdir_race -name $i -delete
221 done
222
223 bbnote Executing ACLOCAL=\"$ACLOCAL\" autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
224 ACLOCAL="$ACLOCAL" autoreconf -Wcross -Wno-obsolete --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || die "autoreconf execution failed."
225 cd $olddir
226 fi
227 if [ -e ${CONFIGURE_SCRIPT} ]; then
228 oe_runconf
229 else
230 bbnote "nothing to configure"
231 fi
232}
233
234autotools_do_compile() {
235 oe_runmake
236}
237
238autotools_do_install() {
239 oe_runmake 'DESTDIR=${D}' install
240 # Info dir listing isn't interesting at this point so remove it if it exists.
241 if [ -e "${D}${infodir}/dir" ]; then
242 rm -f ${D}${infodir}/dir
243 fi
244}
245
246inherit siteconfig
247
248EXPORT_FUNCTIONS do_configure do_compile do_install
249
250B = "${WORKDIR}/build"