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