Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | def autotools_dep_prepend(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 | |
| 20 | return deps + 'gnu-config-native ' |
| 21 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | DEPENDS_prepend = "${@autotools_dep_prepend(d)} " |
| 23 | |
| 24 | inherit 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. |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 28 | # The value of this variable is filled in in a prefunc because it depends on |
| 29 | # the contents of the sysroot. |
| 30 | export CONFIG_SITE |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 32 | acpaths ?= "default" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 33 | EXTRA_AUTORECONF = "--exclude=autopoint" |
| 34 | |
| 35 | export 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) |
| 40 | export CPP_FOR_BUILD = "${BUILD_CPP}" |
| 41 | export CPPFLAGS_FOR_BUILD = "${BUILD_CPPFLAGS}" |
| 42 | |
| 43 | export CC_FOR_BUILD = "${BUILD_CC}" |
| 44 | export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}" |
| 45 | |
| 46 | export CXX_FOR_BUILD = "${BUILD_CXX}" |
| 47 | export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}" |
| 48 | |
| 49 | export LD_FOR_BUILD = "${BUILD_LD}" |
| 50 | export LDFLAGS_FOR_BUILD = "${BUILD_LDFLAGS}" |
| 51 | |
| 52 | def 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 | |
| 58 | CONFIGUREOPTS = " --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)}" |
| 78 | CONFIGUREOPT_DEPTRACK ?= "--disable-dependency-tracking" |
| 79 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 80 | CACHED_CONFIGUREVARS ?= "" |
| 81 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 82 | AUTOTOOLS_SCRIPT_PATH ?= "${S}" |
| 83 | CONFIGURE_SCRIPT ?= "${AUTOTOOLS_SCRIPT_PATH}/configure" |
| 84 | |
| 85 | AUTOTOOLS_AUXDIR ?= "${AUTOTOOLS_SCRIPT_PATH}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 86 | |
| 87 | oe_runconf () { |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 88 | # Use relative path to avoid buildpaths in files |
| 89 | cfgscript_name="`basename ${CONFIGURE_SCRIPT}`" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 90 | 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] | 91 | if [ -x "$cfgscript" ] ; then |
| 92 | bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@" |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 93 | if ! CONFIG_SHELL=/bin/bash ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"; then |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 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" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 97 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 98 | else |
| 99 | bbfatal "no configure script found at $cfgscript" |
| 100 | fi |
| 101 | } |
| 102 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 103 | CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate" |
| 104 | |
| 105 | autotools_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} |
Patrick Williams | d7e9631 | 2015-09-22 08:09:05 -0500 | [diff] [blame] | 111 | mkdir -p ${B} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 117 | oe_runmake clean |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 118 | fi |
| 119 | find ${S} -ignore_readdir_race -name \*.la -delete |
| 120 | fi |
| 121 | fi |
| 122 | fi |
| 123 | } |
| 124 | |
| 125 | autotools_postconfigure(){ |
| 126 | if [ -n "${CONFIGURESTAMPFILE}" ]; then |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 127 | mkdir -p `dirname ${CONFIGURESTAMPFILE}` |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 128 | echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE} |
| 129 | fi |
| 130 | } |
| 131 | |
| 132 | EXTRACONFFUNCS ??= "" |
| 133 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 134 | EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}" |
| 135 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 136 | do_configure[prefuncs] += "autotools_preconfigure autotools_aclocals ${EXTRACONFFUNCS}" |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 137 | do_compile[prefuncs] += "autotools_aclocals" |
| 138 | do_install[prefuncs] += "autotools_aclocals" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 139 | do_configure[postfuncs] += "autotools_postconfigure" |
| 140 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 141 | ACLOCALDIR = "${STAGING_DATADIR}/aclocal" |
| 142 | ACLOCALEXTRAPATH = "" |
| 143 | ACLOCALEXTRAPATH_class-target = " -I ${STAGING_DATADIR_NATIVE}/aclocal/" |
| 144 | ACLOCALEXTRAPATH_class-nativesdk = " -I ${STAGING_DATADIR_NATIVE}/aclocal/" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 145 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 146 | python autotools_aclocals () { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 147 | d.setVar("CONFIG_SITE", siteinfo_get_files(d, sysrootcache=True)) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 148 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 149 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 150 | CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am" |
| 151 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 152 | autotools_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. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 161 | |
| 162 | PRUNE_M4="" |
| 163 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 164 | 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] | 165 | rm -f `dirname $ac`/configure |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 166 | done |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 167 | 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] | 168 | olddir=`pwd` |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 169 | cd ${AUTOTOOLS_SCRIPT_PATH} |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 170 | mkdir -p ${ACLOCALDIR} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 171 | ACLOCAL="aclocal --system-acdir=${ACLOCALDIR}/" |
| 172 | if [ x"${acpaths}" = xdefault ]; then |
| 173 | acpaths= |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 174 | 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] | 175 | grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 176 | acpaths="$acpaths -I $i" |
| 177 | done |
| 178 | else |
| 179 | acpaths="${acpaths}" |
| 180 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 181 | acpaths="$acpaths ${ACLOCALEXTRAPATH}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 199 | if grep -q "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC; then |
| 200 | if grep -q "sed.*POTFILES" $CONFIGURE_AC; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 206 | elif [ "${BPN}" != "gettext" ] && grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 207 | # We'd call gettextize here if it wasn't so broken... |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 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/ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 213 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 214 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 215 | 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] | 216 | fi |
| 217 | mkdir -p m4 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 218 | if grep -q "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC; then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 219 | if ! echo "${DEPENDS}" | grep -q intltool-native; then |
| 220 | bbwarn "Missing DEPENDS on intltool-native" |
| 221 | fi |
| 222 | PRUNE_M4="$PRUNE_M4 intltool.m4" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 223 | bbnote Executing intltoolize --copy --force --automake |
| 224 | intltoolize --copy --force --automake |
| 225 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 226 | |
| 227 | for i in $PRUNE_M4; do |
| 228 | find ${S} -ignore_readdir_race -name $i -delete |
| 229 | done |
| 230 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 231 | bbnote Executing ACLOCAL=\"$ACLOCAL\" autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 232 | ACLOCAL="$ACLOCAL" autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || die "autoreconf execution failed." |
| 233 | cd $olddir |
| 234 | fi |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 235 | if [ -e ${CONFIGURE_SCRIPT} ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 236 | oe_runconf |
| 237 | else |
| 238 | bbnote "nothing to configure" |
| 239 | fi |
| 240 | } |
| 241 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 242 | autotools_do_compile() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 243 | oe_runmake |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 244 | } |
| 245 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 246 | autotools_do_install() { |
| 247 | oe_runmake 'DESTDIR=${D}' install |
| 248 | # Info dir listing isn't interesting at this point so remove it if it exists. |
| 249 | if [ -e "${D}${infodir}/dir" ]; then |
| 250 | rm -f ${D}${infodir}/dir |
| 251 | fi |
| 252 | } |
| 253 | |
| 254 | inherit siteconfig |
| 255 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 256 | EXPORT_FUNCTIONS do_configure do_compile do_install |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 257 | |
| 258 | B = "${WORKDIR}/build" |