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 | |
| 8 | if pn in ['autoconf-native', 'automake-native', 'help2man-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) \ |
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. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 28 | export CONFIG_SITE = "${@siteinfo_get_files(d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 30 | acpaths ?= "default" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | EXTRA_AUTORECONF = "--exclude=autopoint" |
| 32 | |
| 33 | export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}" |
| 34 | |
| 35 | # When building tools for use at build-time it's recommended for the build |
| 36 | # system to use these variables when cross-compiling. |
| 37 | # (http://sources.redhat.com/autobook/autobook/autobook_270.html) |
| 38 | export CPP_FOR_BUILD = "${BUILD_CPP}" |
| 39 | export CPPFLAGS_FOR_BUILD = "${BUILD_CPPFLAGS}" |
| 40 | |
| 41 | export CC_FOR_BUILD = "${BUILD_CC}" |
| 42 | export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}" |
| 43 | |
| 44 | export CXX_FOR_BUILD = "${BUILD_CXX}" |
| 45 | export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}" |
| 46 | |
| 47 | export LD_FOR_BUILD = "${BUILD_LD}" |
| 48 | export LDFLAGS_FOR_BUILD = "${BUILD_LDFLAGS}" |
| 49 | |
| 50 | def append_libtool_sysroot(d): |
| 51 | # Only supply libtool sysroot option for non-native packages |
| 52 | if not bb.data.inherits_class('native', d): |
| 53 | return '--with-libtool-sysroot=${STAGING_DIR_HOST}' |
| 54 | return "" |
| 55 | |
| 56 | CONFIGUREOPTS = " --build=${BUILD_SYS} \ |
| 57 | --host=${HOST_SYS} \ |
| 58 | --target=${TARGET_SYS} \ |
| 59 | --prefix=${prefix} \ |
| 60 | --exec_prefix=${exec_prefix} \ |
| 61 | --bindir=${bindir} \ |
| 62 | --sbindir=${sbindir} \ |
| 63 | --libexecdir=${libexecdir} \ |
| 64 | --datadir=${datadir} \ |
| 65 | --sysconfdir=${sysconfdir} \ |
| 66 | --sharedstatedir=${sharedstatedir} \ |
| 67 | --localstatedir=${localstatedir} \ |
| 68 | --libdir=${libdir} \ |
| 69 | --includedir=${includedir} \ |
| 70 | --oldincludedir=${oldincludedir} \ |
| 71 | --infodir=${infodir} \ |
| 72 | --mandir=${mandir} \ |
| 73 | --disable-silent-rules \ |
| 74 | ${CONFIGUREOPT_DEPTRACK} \ |
| 75 | ${@append_libtool_sysroot(d)}" |
| 76 | CONFIGUREOPT_DEPTRACK ?= "--disable-dependency-tracking" |
| 77 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 78 | CACHED_CONFIGUREVARS ?= "" |
| 79 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 80 | AUTOTOOLS_SCRIPT_PATH ?= "${S}" |
| 81 | CONFIGURE_SCRIPT ?= "${AUTOTOOLS_SCRIPT_PATH}/configure" |
| 82 | |
| 83 | AUTOTOOLS_AUXDIR ?= "${AUTOTOOLS_SCRIPT_PATH}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 84 | |
| 85 | oe_runconf () { |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 86 | # Use relative path to avoid buildpaths in files |
| 87 | cfgscript_name="`basename ${CONFIGURE_SCRIPT}`" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 88 | 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] | 89 | if [ -x "$cfgscript" ] ; then |
| 90 | bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 91 | if ! ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"; then |
| 92 | bbnote "The following config.log files may provide further information." |
| 93 | bbnote `find ${B} -ignore_readdir_race -type f -name config.log` |
| 94 | bbfatal_log "configure failed" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 95 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 96 | else |
| 97 | bbfatal "no configure script found at $cfgscript" |
| 98 | fi |
| 99 | } |
| 100 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 101 | CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate" |
| 102 | |
| 103 | autotools_preconfigure() { |
| 104 | if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then |
| 105 | if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then |
| 106 | if [ "${S}" != "${B}" ]; then |
| 107 | echo "Previously configured separate build directory detected, cleaning ${B}" |
| 108 | rm -rf ${B} |
Patrick Williams | d7e9631 | 2015-09-22 08:09:05 -0500 | [diff] [blame] | 109 | mkdir -p ${B} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | else |
| 111 | # At least remove the .la files since automake won't automatically |
| 112 | # regenerate them even if CFLAGS/LDFLAGS are different |
| 113 | cd ${S} |
| 114 | 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] | 115 | oe_runmake clean |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 116 | fi |
| 117 | find ${S} -ignore_readdir_race -name \*.la -delete |
| 118 | fi |
| 119 | fi |
| 120 | fi |
| 121 | } |
| 122 | |
| 123 | autotools_postconfigure(){ |
| 124 | if [ -n "${CONFIGURESTAMPFILE}" ]; then |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 125 | mkdir -p `dirname ${CONFIGURESTAMPFILE}` |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 126 | echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE} |
| 127 | fi |
| 128 | } |
| 129 | |
| 130 | EXTRACONFFUNCS ??= "" |
| 131 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 132 | EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}" |
| 133 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 134 | do_configure[prefuncs] += "autotools_preconfigure autotools_aclocals ${EXTRACONFFUNCS}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 135 | do_configure[postfuncs] += "autotools_postconfigure" |
| 136 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 137 | ACLOCALDIR = "${STAGING_DATADIR}/aclocal" |
| 138 | ACLOCALEXTRAPATH = "" |
| 139 | ACLOCALEXTRAPATH_class-target = " -I ${STAGING_DATADIR_NATIVE}/aclocal/" |
| 140 | ACLOCALEXTRAPATH_class-nativesdk = " -I ${STAGING_DATADIR_NATIVE}/aclocal/" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 141 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 142 | python autotools_aclocals () { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 143 | # Refresh variable with cache files |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame^] | 144 | d.setVar("CONFIG_SITE", siteinfo_get_files(d, sysrootcache=True)) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 145 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 146 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 147 | CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am" |
| 148 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 149 | autotools_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. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 158 | |
| 159 | PRUNE_M4="" |
| 160 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 161 | 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] | 162 | rm -f `dirname $ac`/configure |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 163 | done |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 164 | 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] | 165 | olddir=`pwd` |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 166 | cd ${AUTOTOOLS_SCRIPT_PATH} |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 167 | mkdir -p ${ACLOCALDIR} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 168 | ACLOCAL="aclocal --system-acdir=${ACLOCALDIR}/" |
| 169 | if [ x"${acpaths}" = xdefault ]; then |
| 170 | acpaths= |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 171 | 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] | 172 | grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 173 | acpaths="$acpaths -I $i" |
| 174 | done |
| 175 | else |
| 176 | acpaths="${acpaths}" |
| 177 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 178 | acpaths="$acpaths ${ACLOCALEXTRAPATH}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 179 | AUTOV=`automake --version | sed -e '1{s/.* //;s/\.[0-9]\+$//};q'` |
| 180 | automake --version |
| 181 | echo "AUTOV is $AUTOV" |
| 182 | if [ -d ${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV ]; then |
| 183 | ACLOCAL="$ACLOCAL --automake-acdir=${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV" |
| 184 | fi |
| 185 | # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look |
| 186 | # like it was auto-generated. Work around this by blowing it away |
| 187 | # by hand, unless the package specifically asked not to run aclocal. |
| 188 | if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then |
| 189 | rm -f aclocal.m4 |
| 190 | fi |
| 191 | if [ -e configure.in ]; then |
| 192 | CONFIGURE_AC=configure.in |
| 193 | else |
| 194 | CONFIGURE_AC=configure.ac |
| 195 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 196 | if grep -q "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC; then |
| 197 | if grep -q "sed.*POTFILES" $CONFIGURE_AC; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 198 | : do nothing -- we still have an old unmodified configure.ac |
| 199 | else |
| 200 | bbnote Executing glib-gettextize --force --copy |
| 201 | echo "no" | glib-gettextize --force --copy |
| 202 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 203 | elif grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 204 | # We'd call gettextize here if it wasn't so broken... |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 205 | cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/ |
| 206 | if [ -d ${S}/po/ ]; then |
| 207 | cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/po/ |
| 208 | if [ ! -e ${S}/po/remove-potcdate.sin ]; then |
| 209 | cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sin ${S}/po/ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 210 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 211 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 212 | 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] | 213 | fi |
| 214 | mkdir -p m4 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 215 | if grep -q "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC; then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 216 | if ! echo "${DEPENDS}" | grep -q intltool-native; then |
| 217 | bbwarn "Missing DEPENDS on intltool-native" |
| 218 | fi |
| 219 | PRUNE_M4="$PRUNE_M4 intltool.m4" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 220 | bbnote Executing intltoolize --copy --force --automake |
| 221 | intltoolize --copy --force --automake |
| 222 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 223 | |
| 224 | for i in $PRUNE_M4; do |
| 225 | find ${S} -ignore_readdir_race -name $i -delete |
| 226 | done |
| 227 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 228 | bbnote Executing ACLOCAL=\"$ACLOCAL\" autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths |
| 229 | ACLOCAL="$ACLOCAL" autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || die "autoreconf execution failed." |
| 230 | cd $olddir |
| 231 | fi |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 232 | if [ -e ${CONFIGURE_SCRIPT} ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 233 | oe_runconf |
| 234 | else |
| 235 | bbnote "nothing to configure" |
| 236 | fi |
| 237 | } |
| 238 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 239 | autotools_do_compile() { |
| 240 | oe_runmake |
| 241 | } |
| 242 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 243 | autotools_do_install() { |
| 244 | oe_runmake 'DESTDIR=${D}' install |
| 245 | # Info dir listing isn't interesting at this point so remove it if it exists. |
| 246 | if [ -e "${D}${infodir}/dir" ]; then |
| 247 | rm -f ${D}${infodir}/dir |
| 248 | fi |
| 249 | } |
| 250 | |
| 251 | inherit siteconfig |
| 252 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 253 | EXPORT_FUNCTIONS do_configure do_compile do_install |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 254 | |
| 255 | B = "${WORKDIR}/build" |