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 | |
| 152 | python () { |
| 153 | sitefiles, searched = siteinfo_get_files(d, sysrootcache=False) |
| 154 | d.appendVarFlag("do_configure", "file-checksums", " " + " ".join(searched)) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 155 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 156 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 157 | CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am" |
| 158 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 159 | autotools_do_configure() { |
| 160 | # WARNING: gross hack follows: |
| 161 | # An autotools built package generally needs these scripts, however only |
| 162 | # automake or libtoolize actually install the current versions of them. |
| 163 | # This is a problem in builds that do not use libtool or automake, in the case |
| 164 | # where we -need- the latest version of these scripts. e.g. running a build |
| 165 | # for a package whose autotools are old, on an x86_64 machine, which the old |
| 166 | # config.sub does not support. Work around this by installing them manually |
| 167 | # regardless. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 168 | |
| 169 | PRUNE_M4="" |
| 170 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 171 | 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] | 172 | rm -f `dirname $ac`/configure |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 173 | done |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 174 | 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] | 175 | olddir=`pwd` |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 176 | cd ${AUTOTOOLS_SCRIPT_PATH} |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 177 | mkdir -p ${ACLOCALDIR} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 178 | ACLOCAL="aclocal --system-acdir=${ACLOCALDIR}/" |
| 179 | if [ x"${acpaths}" = xdefault ]; then |
| 180 | acpaths= |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 181 | 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] | 182 | grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 183 | acpaths="$acpaths -I $i" |
| 184 | done |
| 185 | else |
| 186 | acpaths="${acpaths}" |
| 187 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 188 | acpaths="$acpaths ${ACLOCALEXTRAPATH}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 189 | AUTOV=`automake --version | sed -e '1{s/.* //;s/\.[0-9]\+$//};q'` |
| 190 | automake --version |
| 191 | echo "AUTOV is $AUTOV" |
| 192 | if [ -d ${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV ]; then |
| 193 | ACLOCAL="$ACLOCAL --automake-acdir=${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV" |
| 194 | fi |
| 195 | # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look |
| 196 | # like it was auto-generated. Work around this by blowing it away |
| 197 | # by hand, unless the package specifically asked not to run aclocal. |
| 198 | if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then |
| 199 | rm -f aclocal.m4 |
| 200 | fi |
| 201 | if [ -e configure.in ]; then |
| 202 | CONFIGURE_AC=configure.in |
| 203 | else |
| 204 | CONFIGURE_AC=configure.ac |
| 205 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 206 | if grep -q "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC; then |
| 207 | if grep -q "sed.*POTFILES" $CONFIGURE_AC; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 208 | : do nothing -- we still have an old unmodified configure.ac |
| 209 | else |
| 210 | bbnote Executing glib-gettextize --force --copy |
| 211 | echo "no" | glib-gettextize --force --copy |
| 212 | fi |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 213 | elif [ "${BPN}" != "gettext" ] && grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 214 | # We'd call gettextize here if it wasn't so broken... |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 215 | cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/ |
| 216 | if [ -d ${S}/po/ ]; then |
| 217 | cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/po/ |
| 218 | if [ ! -e ${S}/po/remove-potcdate.sin ]; then |
| 219 | cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sin ${S}/po/ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 220 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 221 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 222 | 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] | 223 | fi |
| 224 | mkdir -p m4 |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 225 | |
| 226 | for i in $PRUNE_M4; do |
| 227 | find ${S} -ignore_readdir_race -name $i -delete |
| 228 | done |
| 229 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 230 | bbnote Executing ACLOCAL=\"$ACLOCAL\" autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 231 | 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] | 232 | cd $olddir |
| 233 | fi |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 234 | if [ -e ${CONFIGURE_SCRIPT} ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 235 | oe_runconf |
| 236 | else |
| 237 | bbnote "nothing to configure" |
| 238 | fi |
| 239 | } |
| 240 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 241 | autotools_do_compile() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 242 | oe_runmake |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 243 | } |
| 244 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 245 | autotools_do_install() { |
| 246 | oe_runmake 'DESTDIR=${D}' install |
| 247 | # Info dir listing isn't interesting at this point so remove it if it exists. |
| 248 | if [ -e "${D}${infodir}/dir" ]; then |
| 249 | rm -f ${D}${infodir}/dir |
| 250 | fi |
| 251 | } |
| 252 | |
| 253 | inherit siteconfig |
| 254 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 255 | EXPORT_FUNCTIONS do_configure do_compile do_install |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 256 | |
| 257 | B = "${WORKDIR}/build" |