summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/autotools.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2025-11-07 13:31:53 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-11-07 13:31:53 +0000
commit8c22ff0d8b70d9b12f0487ef696a7e915b9e3173 (patch)
treeefdc32587159d0050a69009bdf2330a531727d95 /meta/classes-recipe/autotools.bbclass
parentd412d2747595c1cc4a5e3ca975e3adc31b2f7891 (diff)
downloadpoky-8c22ff0d8b70d9b12f0487ef696a7e915b9e3173.tar.gz
The poky repository master branch is no longer being updated.
You can either: a) switch to individual clones of bitbake, openembedded-core, meta-yocto and yocto-docs b) use the new bitbake-setup You can find information about either approach in our documentation: https://docs.yoctoproject.org/ Note that "poky" the distro setting is still available in meta-yocto as before and we continue to use and maintain that. Long live Poky! Some further information on the background of this change can be found in: https://lists.openembedded.org/g/openembedded-architecture/message/2179 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/autotools.bbclass')
-rw-r--r--meta/classes-recipe/autotools.bbclass248
1 files changed, 0 insertions, 248 deletions
diff --git a/meta/classes-recipe/autotools.bbclass b/meta/classes-recipe/autotools.bbclass
deleted file mode 100644
index bd477dc60f..0000000000
--- a/meta/classes-recipe/autotools.bbclass
+++ /dev/null
@@ -1,248 +0,0 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7def get_autotools_dep(d):
8 if d.getVar('INHIBIT_AUTOTOOLS_DEPS'):
9 return ''
10
11 pn = d.getVar('PN')
12 deps = ''
13
14 if pn in ['autoconf-native', 'automake-native']:
15 return deps
16 deps += 'autoconf-native automake-native '
17
18 if not pn in ['libtool', 'libtool-native'] and not pn.endswith("libtool-cross"):
19 deps += 'libtool-native '
20 if not bb.data.inherits_class('native', d) \
21 and not bb.data.inherits_class('nativesdk', d) \
22 and not bb.data.inherits_class('cross', d) \
23 and not d.getVar('INHIBIT_DEFAULT_DEPS'):
24 deps += 'libtool-cross '
25
26 return deps
27
28
29DEPENDS:prepend = "${@get_autotools_dep(d)} "
30
31inherit siteinfo
32
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# The value of this variable is filled in in a prefunc because it depends on
36# the contents of the sysroot.
37export CONFIG_SITE
38
39EXTRA_AUTORECONF += "--exclude=autopoint"
40
41export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}"
42
43# When building tools for use at build-time it's recommended for the build
44# system to use these variables when cross-compiling.
45# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
46# https://stackoverflow.com/questions/24201260/autotools-cross-compilation-and-generated-sources/24208587#24208587
47export CPP_FOR_BUILD = "${BUILD_CPP}"
48export CPPFLAGS_FOR_BUILD = "${BUILD_CPPFLAGS}"
49
50export CC_FOR_BUILD = "${BUILD_CC}"
51export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
52
53export CXX_FOR_BUILD = "${BUILD_CXX}"
54export CXXFLAGS_FOR_BUILD = "${BUILD_CXXFLAGS}"
55
56export LD_FOR_BUILD = "${BUILD_LD}"
57export LDFLAGS_FOR_BUILD = "${BUILD_LDFLAGS}"
58
59CONFIGUREOPTS = " --build=${BUILD_SYS} \
60 --host=${HOST_SYS} \
61 --target=${TARGET_SYS} \
62 --prefix=${prefix} \
63 --exec_prefix=${exec_prefix} \
64 --bindir=${bindir} \
65 --sbindir=${sbindir} \
66 --libexecdir=${libexecdir} \
67 --datadir=${datadir} \
68 --sysconfdir=${sysconfdir} \
69 --sharedstatedir=${sharedstatedir} \
70 --localstatedir=${localstatedir} \
71 --libdir=${libdir} \
72 --includedir=${includedir} \
73 --oldincludedir=${includedir} \
74 --infodir=${infodir} \
75 --mandir=${mandir} \
76 --disable-silent-rules \
77 ${CONFIGUREOPT_DEPTRACK}"
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_sitefiles ${EXTRACONFFUNCS}"
137do_configure[postfuncs] += "autotools_postconfigure"
138
139# Tell autoconf to load the site defaults from siteinfo
140python autotools_sitefiles () {
141 sitefiles, searched = siteinfo_get_files(d, sysrootcache=True)
142 d.setVar("CONFIG_SITE", " ".join(sitefiles))
143}
144
145do_configure[file-checksums] += "${@' '.join(siteinfo_get_files(d, sysrootcache=False)[1])}"
146
147CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in *.m4 Makefile.am"
148
149autotools_do_configure() {
150 # WARNING: gross hack follows:
151 # An autotools built package generally needs these scripts, however only
152 # automake or libtoolize actually install the current versions of them.
153 # This is a problem in builds that do not use libtool or automake, in the case
154 # where we -need- the latest version of these scripts. e.g. running a build
155 # for a package whose autotools are old, on an x86_64 machine, which the old
156 # config.sub does not support. Work around this by installing them manually
157 # regardless.
158
159 PRUNE_M4=""
160
161 for ac in `find ${S} -ignore_readdir_race -name configure.in -o -name configure.ac`; do
162 rm -f `dirname $ac`/configure
163 done
164 if [ -e ${AUTOTOOLS_SCRIPT_PATH}/configure.in -o -e ${AUTOTOOLS_SCRIPT_PATH}/configure.ac ]; then
165 olddir=`pwd`
166 cd ${AUTOTOOLS_SCRIPT_PATH}
167 # aclocal looks in the native sysroot by default, so tell it to also look in the target sysroot.
168 ACLOCAL="aclocal --aclocal-path=${STAGING_DATADIR}/aclocal/"
169 # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
170 # like it was auto-generated. Work around this by blowing it away
171 # by hand, unless the package specifically asked not to run aclocal.
172 if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
173 bbnote Removing existing aclocal.m4
174 rm -f aclocal.m4
175 fi
176 if [ -e configure.in ]; then
177 CONFIGURE_AC=configure.in
178 else
179 CONFIGURE_AC=configure.ac
180 fi
181 if grep -q "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC; then
182 if grep -q "sed.*POTFILES" $CONFIGURE_AC; then
183 : do nothing -- we still have an old unmodified configure.ac
184 else
185 bbnote Executing glib-gettextize --force --copy
186 echo "no" | glib-gettextize --force --copy
187 fi
188 elif [ "${BPN}" != "gettext" ] && grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then
189 # Gettextize could be called here, however it doesn't make the job much easier:
190 # It doesn't discover relevant po folders on its own, so they still need to be
191 # found by some heurestics. Also, it would require always the full gettext
192 # package always, instead of gettext-minimal-native.
193 cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
194 if [ -d ${S}/po ]; then
195 # Copy the latest Makefile.in.in to the /po folder, regardless if it exists or not
196 # If it exists, then also look for identical Makefile.in.in files, and update them too
197 makefiles_to_update="./po/Makefile.in.in"
198 if [ -f ${S}/po/Makefile.in.in ]; then
199 # search for all Makefile.in.in files that are identical to ./po/Makefile.in.in, by md5sum
200 base_makefile_hash=`md5sum ${S}/po/Makefile.in.in | tr -s ' ' | cut -f1 -d' '`
201 makefiles_to_update=`find ${S} -name Makefile.in.in -exec md5sum {} \+ | grep $base_makefile_hash | tr -s ' ' | cut -d' ' -f2`
202 fi
203 bbnote List of Makefile.in.ins to update: $makefiles_to_update
204 for makefile in ${makefiles_to_update}; do
205 makefile_dir=$(dirname $makefile)
206 bbnote Executing: cp ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${makefile_dir}/
207 cp ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${makefile_dir}/
208 if [ ! -e ${makefile_dir}/remove-potcdate.sed ]; then
209 cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sed ${makefile_dir}/
210 fi
211 done
212 for makevars in `find ${S} -name Makevars`; do
213 bbnote Concatenating Makevars: $makevars
214 cat ${STAGING_DATADIR_NATIVE}/gettext/po/Makevars.template.minimal ${makevars} >> ${makevars}.yocto_temp
215 mv ${makevars}.yocto_temp ${makevars}
216 done
217 fi
218 PRUNE_M4="$PRUNE_M4 gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4"
219 fi
220 mkdir -p m4
221
222 for i in $PRUNE_M4; do
223 find ${S} -ignore_readdir_race -name $i -delete
224 done
225
226 bbnote Executing ACLOCAL=\"$ACLOCAL\" autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF}
227 ACLOCAL="$ACLOCAL" autoreconf -Wcross -Wno-obsolete --verbose --install --force ${EXTRA_AUTORECONF} || die "autoreconf execution failed."
228 cd $olddir
229 fi
230
231 oe_runconf
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
246EXPORT_FUNCTIONS do_configure do_compile do_install
247
248B = "${WORKDIR}/build"