Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 1 | ################################################################################ |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 2 | # Autotools package infrastructure |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 3 | # |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 4 | # This file implements an infrastructure that eases development of |
| 5 | # package .mk files for autotools packages. It should be used for all |
Thomas Petazzoni | c0e6b52 | 2012-04-17 16:45:20 +0200 | [diff] [blame] | 6 | # packages that use the autotools as their build system. |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 7 | # |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 8 | # See the Buildroot documentation for details on the usage of this |
| 9 | # infrastructure |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 10 | # |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 11 | # In terms of implementation, this autotools infrastructure requires |
| 12 | # the .mk file to only specify metadata informations about the |
| 13 | # package: name, version, download URL, etc. |
Bernhard Reutner-Fischer | 00b8456 | 2007-09-30 12:46:02 +0000 | [diff] [blame] | 14 | # |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 15 | # We still allow the package .mk file to override what the different |
| 16 | # steps are doing, if needed. For example, if <PKG>_BUILD_CMDS is |
| 17 | # already defined, it is used as the list of commands to perform to |
| 18 | # build the package, instead of the default autotools behaviour. The |
| 19 | # package can also define some post operation hooks. |
Bernhard Reutner-Fischer | 00b8456 | 2007-09-30 12:46:02 +0000 | [diff] [blame] | 20 | # |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 21 | ################################################################################ |
| 22 | |
Thomas Petazzoni | 102a93b | 2011-08-31 23:35:06 +0200 | [diff] [blame] | 23 | |
| 24 | # |
| 25 | # Utility function to upgrade config.sub and config.guess files |
| 26 | # |
| 27 | # argument 1 : directory into which config.guess and config.sub need |
| 28 | # to be updated. Note that config.sub and config.guess are searched |
| 29 | # recursively in this directory. |
| 30 | # |
| 31 | define CONFIG_UPDATE |
| 32 | for file in config.guess config.sub; do \ |
| 33 | for i in $$(find $(1) -name $$file); do \ |
| 34 | cp support/gnuconfig/$$file $$i; \ |
| 35 | done; \ |
| 36 | done |
| 37 | endef |
| 38 | |
Thomas Petazzoni | f4642ee | 2014-03-21 05:34:03 +0100 | [diff] [blame] | 39 | # This function generates the ac_cv_file_<foo> value for a given |
| 40 | # filename. This is needed to convince configure script doing |
| 41 | # AC_CHECK_FILE() tests that the file actually exists, since such |
| 42 | # tests cannot be done in a cross-compilation context. This function |
| 43 | # takes as argument the path of the file. An example usage is: |
| 44 | # |
| 45 | # FOOBAR_CONF_ENV = \ |
| 46 | # $(call AUTOCONF_AC_CHECK_FILE_VAL,/dev/random)=yes |
| 47 | AUTOCONF_AC_CHECK_FILE_VAL = ac_cv_file_$(subst -,_,$(subst /,_,$(subst .,_,$(1)))) |
| 48 | |
Peter Korsgaard | d58636d | 2009-01-16 10:27:48 +0000 | [diff] [blame] | 49 | ################################################################################ |
Arnout Vandecappelle (Essensium/Mind) | 46fa5cb | 2012-07-03 00:07:08 +0200 | [diff] [blame] | 50 | # inner-autotools-package -- defines how the configuration, compilation and |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 51 | # installation of an autotools package should be done, implements a |
| 52 | # few hooks to tune the build process for autotools specifities and |
| 53 | # calls the generic package infrastructure to generate the necessary |
| 54 | # make targets |
Peter Korsgaard | d58636d | 2009-01-16 10:27:48 +0000 | [diff] [blame] | 55 | # |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 56 | # argument 1 is the lowercase package name |
| 57 | # argument 2 is the uppercase package name, including an HOST_ prefix |
| 58 | # for host packages |
| 59 | # argument 3 is the uppercase package name, without the HOST_ prefix |
| 60 | # for host packages |
Thomas De Schampheleire | 26aef88 | 2014-02-05 10:44:03 +0100 | [diff] [blame] | 61 | # argument 4 is the type (target or host) |
Peter Korsgaard | d58636d | 2009-01-16 10:27:48 +0000 | [diff] [blame] | 62 | ################################################################################ |
| 63 | |
Arnout Vandecappelle (Essensium/Mind) | 46fa5cb | 2012-07-03 00:07:08 +0200 | [diff] [blame] | 64 | define inner-autotools-package |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 65 | |
Thomas Petazzoni | d2c73f5 | 2010-04-28 23:40:45 +0200 | [diff] [blame] | 66 | ifndef $(2)_LIBTOOL_PATCH |
| 67 | ifdef $(3)_LIBTOOL_PATCH |
Thomas De Schampheleire | 54456cc | 2014-06-11 21:12:24 +0200 | [diff] [blame] | 68 | $(2)_LIBTOOL_PATCH = $$($(3)_LIBTOOL_PATCH) |
Thomas Petazzoni | d2c73f5 | 2010-04-28 23:40:45 +0200 | [diff] [blame] | 69 | else |
| 70 | $(2)_LIBTOOL_PATCH ?= YES |
| 71 | endif |
| 72 | endif |
| 73 | |
Peter Korsgaard | ce1ae87 | 2011-05-17 10:00:01 +0200 | [diff] [blame] | 74 | ifndef $(2)_MAKE |
| 75 | ifdef $(3)_MAKE |
Thomas De Schampheleire | 54456cc | 2014-06-11 21:12:24 +0200 | [diff] [blame] | 76 | $(2)_MAKE = $$($(3)_MAKE) |
Peter Korsgaard | ce1ae87 | 2011-05-17 10:00:01 +0200 | [diff] [blame] | 77 | else |
Thomas De Schampheleire | 54456cc | 2014-06-11 21:12:24 +0200 | [diff] [blame] | 78 | $(2)_MAKE ?= $$(MAKE) |
Peter Korsgaard | ce1ae87 | 2011-05-17 10:00:01 +0200 | [diff] [blame] | 79 | endif |
| 80 | endif |
| 81 | |
Peter Korsgaard | 97c6870 | 2013-10-02 23:37:58 +0200 | [diff] [blame] | 82 | ifndef $(2)_AUTORECONF |
| 83 | ifdef $(3)_AUTORECONF |
Thomas De Schampheleire | 54456cc | 2014-06-11 21:12:24 +0200 | [diff] [blame] | 84 | $(2)_AUTORECONF = $$($(3)_AUTORECONF) |
Peter Korsgaard | 97c6870 | 2013-10-02 23:37:58 +0200 | [diff] [blame] | 85 | else |
| 86 | $(2)_AUTORECONF ?= NO |
| 87 | endif |
| 88 | endif |
| 89 | |
Yann E. MORIN | 8992583 | 2014-07-17 00:00:35 +0200 | [diff] [blame^] | 90 | ifndef $(2)_GETTEXTIZE |
| 91 | ifdef $(3)_GETTEXTIZE |
| 92 | $(2)_GETTEXTIZE = $$($(3)_GETTEXTIZE) |
| 93 | else |
| 94 | $(2)_GETTEXTIZE ?= NO |
| 95 | endif |
| 96 | endif |
| 97 | |
| 98 | ifndef $(2)_GETTEXTIZE_OPT |
| 99 | ifdef $(3)_GETTEXTIZE_OPT |
| 100 | $(2)_GETTEXTIZE_OPT = $$($(3)_GETTEXTIZE) |
| 101 | else |
| 102 | $(2)_GETTEXTIZE_OPT ?= -f |
| 103 | endif |
| 104 | endif |
| 105 | |
Thomas De Schampheleire | 54456cc | 2014-06-11 21:12:24 +0200 | [diff] [blame] | 106 | ifeq ($(4),host) |
| 107 | $(2)_AUTORECONF_OPT ?= $$($(3)_AUTORECONF_OPT) |
| 108 | endif |
| 109 | |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 110 | $(2)_CONF_ENV ?= |
| 111 | $(2)_CONF_OPT ?= |
Bernhard Reutner-Fischer | 00b8456 | 2007-09-30 12:46:02 +0000 | [diff] [blame] | 112 | $(2)_MAKE_ENV ?= |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 113 | $(2)_MAKE_OPT ?= |
Thomas Petazzoni | 598ade9 | 2013-06-30 21:28:53 +0200 | [diff] [blame] | 114 | $(2)_INSTALL_OPT ?= install |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 115 | $(2)_INSTALL_STAGING_OPT ?= DESTDIR=$$(STAGING_DIR) install |
Paulius Zaleckas | 31365de | 2010-03-30 17:20:55 +0200 | [diff] [blame] | 116 | $(2)_INSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) install |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 117 | |
| 118 | |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 119 | # |
| 120 | # Configure step. Only define it if not already defined by the package |
| 121 | # .mk file. And take care of the differences between host and target |
| 122 | # packages. |
| 123 | # |
| 124 | ifndef $(2)_CONFIGURE_CMDS |
Thomas De Schampheleire | 26aef88 | 2014-02-05 10:44:03 +0100 | [diff] [blame] | 125 | ifeq ($(4),target) |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 126 | |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 127 | # Configure package for target |
| 128 | define $(2)_CONFIGURE_CMDS |
| 129 | (cd $$($$(PKG)_SRCDIR) && rm -rf config.cache && \ |
| 130 | $$(TARGET_CONFIGURE_OPTS) \ |
| 131 | $$(TARGET_CONFIGURE_ARGS) \ |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 132 | $$($$(PKG)_CONF_ENV) \ |
| 133 | ./configure \ |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 134 | --target=$$(GNU_TARGET_NAME) \ |
| 135 | --host=$$(GNU_TARGET_NAME) \ |
| 136 | --build=$$(GNU_HOST_NAME) \ |
| 137 | --prefix=/usr \ |
| 138 | --exec-prefix=/usr \ |
| 139 | --sysconfdir=/etc \ |
Yann E. MORIN | a8d6e2c | 2011-08-10 00:12:34 +0200 | [diff] [blame] | 140 | --program-prefix="" \ |
Thomas De Schampheleire | e20df63 | 2014-02-05 14:51:00 +0100 | [diff] [blame] | 141 | --disable-gtk-doc \ |
| 142 | --disable-doc \ |
| 143 | --disable-docs \ |
| 144 | --disable-documentation \ |
| 145 | --with-xmlto=no \ |
Peter Korsgaard | 4e0cd2e | 2014-02-09 01:00:22 +0100 | [diff] [blame] | 146 | --with-fop=no \ |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 147 | $$(DISABLE_NLS) \ |
| 148 | $$(DISABLE_LARGEFILE) \ |
| 149 | $$(DISABLE_IPV6) \ |
Thomas Petazzoni | 009d8fc | 2011-05-30 23:57:02 +0200 | [diff] [blame] | 150 | $$(SHARED_STATIC_LIBS_OPTS) \ |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 151 | $$(QUIET) $$($$(PKG)_CONF_OPT) \ |
| 152 | ) |
| 153 | endef |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 154 | else |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 155 | |
| 156 | # Configure package for host |
Arnout Vandecappelle | 489970e | 2012-12-12 04:07:22 +0000 | [diff] [blame] | 157 | # disable all kind of documentation generation in the process, |
| 158 | # because it often relies on host tools which may or may not be |
| 159 | # installed. |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 160 | define $(2)_CONFIGURE_CMDS |
| 161 | (cd $$($$(PKG)_SRCDIR) && rm -rf config.cache; \ |
| 162 | $$(HOST_CONFIGURE_OPTS) \ |
| 163 | CFLAGS="$$(HOST_CFLAGS)" \ |
| 164 | LDFLAGS="$$(HOST_LDFLAGS)" \ |
Lionel Landwerlin | 1b41e32 | 2010-04-30 02:24:09 +0200 | [diff] [blame] | 165 | $$($$(PKG)_CONF_ENV) \ |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 166 | ./configure \ |
| 167 | --prefix="$$(HOST_DIR)/usr" \ |
| 168 | --sysconfdir="$$(HOST_DIR)/etc" \ |
Thomas Petazzoni | 009d8fc | 2011-05-30 23:57:02 +0200 | [diff] [blame] | 169 | --enable-shared --disable-static \ |
Arnout Vandecappelle | 489970e | 2012-12-12 04:07:22 +0000 | [diff] [blame] | 170 | --disable-gtk-doc \ |
| 171 | --disable-doc \ |
| 172 | --disable-docs \ |
| 173 | --disable-documentation \ |
| 174 | --with-xmlto=no \ |
| 175 | --with-fop=no \ |
Peter Korsgaard | 9f5a9de | 2013-07-17 09:37:36 +0200 | [diff] [blame] | 176 | $$(QUIET) $$($$(PKG)_CONF_OPT) \ |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 177 | ) |
| 178 | endef |
| 179 | endif |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 180 | endif |
| 181 | |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 182 | # |
| 183 | # Hook to update config.sub and config.guess if needed |
| 184 | # |
| 185 | define UPDATE_CONFIG_HOOK |
Danomi Manchego | 28bb03a | 2013-03-11 15:58:31 +0000 | [diff] [blame] | 186 | @$$(call MESSAGE,"Updating config.sub and config.guess") |
Thomas Petazzoni | 102a93b | 2011-08-31 23:35:06 +0200 | [diff] [blame] | 187 | $$(call CONFIG_UPDATE,$$(@D)) |
Eric Andersen | a7e49eb | 2007-08-10 19:07:51 +0000 | [diff] [blame] | 188 | endef |
| 189 | |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 190 | $(2)_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 191 | |
| 192 | # |
| 193 | # Hook to patch libtool to make it work properly for cross-compilation |
| 194 | # |
| 195 | define LIBTOOL_PATCH_HOOK |
Lionel Landwerlin | e131773 | 2010-11-04 03:50:22 +0100 | [diff] [blame] | 196 | @$$(call MESSAGE,"Patching libtool") |
Thomas De Schampheleire | 54456cc | 2014-06-11 21:12:24 +0200 | [diff] [blame] | 197 | $$(Q)if test "$$($$(PKG)_LIBTOOL_PATCH)" = "YES" \ |
Martin Banky | 83af822 | 2010-10-09 12:52:49 +0200 | [diff] [blame] | 198 | -a "$$($$(PKG)_AUTORECONF)" != "YES"; then \ |
| 199 | for i in `find $$($$(PKG)_SRCDIR) -name ltmain.sh`; do \ |
| 200 | ltmain_version=`sed -n '/^[ ]*VERSION=/{s/^[ ]*VERSION=//;p;q;}' $$$$i | \ |
| 201 | sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \ |
| 202 | if test $$$${ltmain_version} = '1.5'; then \ |
Thomas Petazzoni | 59a326b | 2011-08-31 23:35:04 +0200 | [diff] [blame] | 203 | support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \ |
Martin Banky | 83af822 | 2010-10-09 12:52:49 +0200 | [diff] [blame] | 204 | elif test $$$${ltmain_version} = "2.2"; then\ |
Thomas Petazzoni | 59a326b | 2011-08-31 23:35:04 +0200 | [diff] [blame] | 205 | support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \ |
Peter Korsgaard | f055b26 | 2011-03-28 21:45:06 +0200 | [diff] [blame] | 206 | elif test $$$${ltmain_version} = "2.4"; then\ |
Thomas Petazzoni | 59a326b | 2011-08-31 23:35:04 +0200 | [diff] [blame] | 207 | support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \ |
Martin Banky | 83af822 | 2010-10-09 12:52:49 +0200 | [diff] [blame] | 208 | fi \ |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 209 | done \ |
| 210 | fi |
| 211 | endef |
| 212 | |
Peter Korsgaard | 073af42 | 2009-12-30 13:42:01 +0100 | [diff] [blame] | 213 | # default values are not evaluated yet, so don't rely on this defaulting to YES |
Thomas Petazzoni | 87d0af9 | 2010-04-28 23:40:47 +0200 | [diff] [blame] | 214 | ifneq ($$($(2)_LIBTOOL_PATCH),NO) |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 215 | $(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK |
| 216 | endif |
| 217 | |
| 218 | # |
Yann E. MORIN | 8992583 | 2014-07-17 00:00:35 +0200 | [diff] [blame^] | 219 | # Hook to gettextize the package if needed |
| 220 | # |
| 221 | define GETTEXTIZE_HOOK |
| 222 | @$$(call MESSAGE,"Gettextizing") |
| 223 | $(Q)cd $$($$(PKG)_SRCDIR) && $(HOST_DIR)/usr/bin/gettextize $$($$(PKG)_GETTEXTIZE_OPT) |
| 224 | endef |
| 225 | |
| 226 | # |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 227 | # Hook to autoreconf the package if needed |
| 228 | # |
| 229 | define AUTORECONF_HOOK |
Lionel Landwerlin | e131773 | 2010-11-04 03:50:22 +0100 | [diff] [blame] | 230 | @$$(call MESSAGE,"Autoreconfiguring") |
Thomas De Schampheleire | 54456cc | 2014-06-11 21:12:24 +0200 | [diff] [blame] | 231 | $$(Q)cd $$($$(PKG)_SRCDIR) && $$(AUTORECONF) $$($$(PKG)_AUTORECONF_OPT) |
| 232 | $$(Q)if test "$$($$(PKG)_LIBTOOL_PATCH)" = "YES"; then \ |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 233 | for i in `find $$($$(PKG)_SRCDIR) -name ltmain.sh`; do \ |
przemyslaw | 3400663 | 2013-03-20 20:09:42 +0000 | [diff] [blame] | 234 | ltmain_version=`sed -n '/^[ ]*VERSION=/{s/^[ ]*VERSION=//;p;q;}' $$$$i | \ |
| 235 | sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \ |
Martin Banky | 83af822 | 2010-10-09 12:52:49 +0200 | [diff] [blame] | 236 | if test $$$${ltmain_version} = "1.5"; then \ |
Peter Korsgaard | 16d6e9b | 2011-09-17 14:16:42 +0200 | [diff] [blame] | 237 | support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \ |
Martin Banky | 83af822 | 2010-10-09 12:52:49 +0200 | [diff] [blame] | 238 | elif test $$$${ltmain_version} = "2.2"; then\ |
Peter Korsgaard | 16d6e9b | 2011-09-17 14:16:42 +0200 | [diff] [blame] | 239 | support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \ |
Peter Korsgaard | 3178a20 | 2011-05-03 10:01:28 +0200 | [diff] [blame] | 240 | elif test $$$${ltmain_version} = "2.4"; then\ |
Peter Korsgaard | 16d6e9b | 2011-09-17 14:16:42 +0200 | [diff] [blame] | 241 | support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \ |
Martin Banky | 83af822 | 2010-10-09 12:52:49 +0200 | [diff] [blame] | 242 | fi \ |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 243 | done \ |
| 244 | fi |
| 245 | endef |
| 246 | |
Arnout Vandecappelle (Essensium/Mind) | 46fa5cb | 2012-07-03 00:07:08 +0200 | [diff] [blame] | 247 | # This must be repeated from inner-generic-package, otherwise we get an empty |
Arnout Vandecappelle (Essensium/Mind) | bbc53fa | 2012-01-16 14:58:35 +0100 | [diff] [blame] | 248 | # _DEPENDENCIES if _AUTORECONF is YES. Also filter the result of _AUTORECONF |
Yann E. MORIN | 8992583 | 2014-07-17 00:00:35 +0200 | [diff] [blame^] | 249 | # and _GETTEXTIZE away from the non-host rule |
Thomas De Schampheleire | 54456cc | 2014-06-11 21:12:24 +0200 | [diff] [blame] | 250 | ifeq ($(4),host) |
| 251 | $(2)_DEPENDENCIES ?= $$(filter-out host-automake host-autoconf host-libtool \ |
Yann E. MORIN | 8992583 | 2014-07-17 00:00:35 +0200 | [diff] [blame^] | 252 | host-gettext host-toolchain $(1),\ |
Thomas De Schampheleire | 54456cc | 2014-06-11 21:12:24 +0200 | [diff] [blame] | 253 | $$(patsubst host-host-%,host-%,$$(addprefix host-,$$($(3)_DEPENDENCIES)))) |
| 254 | endif |
Arnout Vandecappelle (Essensium/Mind) | bbc53fa | 2012-01-16 14:58:35 +0100 | [diff] [blame] | 255 | |
Thomas Petazzoni | 7dfa3b3 | 2010-04-28 23:40:42 +0200 | [diff] [blame] | 256 | ifeq ($$($(2)_AUTORECONF),YES) |
Yann E. MORIN | 8992583 | 2014-07-17 00:00:35 +0200 | [diff] [blame^] | 257 | # This has to come before autoreconf |
| 258 | ifeq ($$($(2)_GETTEXTIZE),YES) |
| 259 | $(2)_PRE_CONFIGURE_HOOKS += GETTEXTIZE_HOOK |
| 260 | $(2)_DEPENDENCIES += host-gettext |
| 261 | endif |
Lionel Landwerlin | 89d1ad9 | 2010-11-04 03:50:24 +0100 | [diff] [blame] | 262 | $(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 263 | $(2)_DEPENDENCIES += host-automake host-autoconf host-libtool |
| 264 | endif |
| 265 | |
| 266 | # |
| 267 | # Build step. Only define it if not already defined by the package .mk |
| 268 | # file. |
| 269 | # |
| 270 | ifndef $(2)_BUILD_CMDS |
Thomas De Schampheleire | 26aef88 | 2014-02-05 10:44:03 +0100 | [diff] [blame] | 271 | ifeq ($(4),target) |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 272 | define $(2)_BUILD_CMDS |
Thomas Petazzoni | 43695a9 | 2011-12-24 13:07:03 +0100 | [diff] [blame] | 273 | $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPT) -C $$($$(PKG)_SRCDIR) |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 274 | endef |
| 275 | else |
| 276 | define $(2)_BUILD_CMDS |
Thomas Petazzoni | 43695a9 | 2011-12-24 13:07:03 +0100 | [diff] [blame] | 277 | $$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPT) -C $$($$(PKG)_SRCDIR) |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 278 | endef |
| 279 | endif |
| 280 | endif |
| 281 | |
| 282 | # |
| 283 | # Host installation step. Only define it if not already defined by the |
| 284 | # package .mk file. |
| 285 | # |
| 286 | ifndef $(2)_INSTALL_CMDS |
| 287 | define $(2)_INSTALL_CMDS |
Thomas Petazzoni | 598ade9 | 2013-06-30 21:28:53 +0200 | [diff] [blame] | 288 | $$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_OPT) -C $$($$(PKG)_SRCDIR) |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 289 | endef |
| 290 | endif |
| 291 | |
| 292 | # |
| 293 | # Staging installation step. Only define it if not already defined by |
| 294 | # the package .mk file. |
| 295 | # |
Thomas De Schampheleire | 7701fc5 | 2014-06-21 17:01:47 +0200 | [diff] [blame] | 296 | # Most autotools packages install libtool .la files alongside any |
| 297 | # installed libraries. These .la files sometimes refer to paths |
| 298 | # relative to the sysroot, which libtool will interpret as absolute |
Thomas De Schampheleire | 6f638ea | 2014-07-03 21:58:43 +0200 | [diff] [blame] | 299 | # paths to host libraries instead of the target libraries. Since this |
| 300 | # is not what we want, these paths are fixed by prefixing them with |
| 301 | # $(STAGING_DIR). As we configure with --prefix=/usr, this fix |
| 302 | # needs to be applied to any path that starts with /usr. |
Thomas De Schampheleire | 7701fc5 | 2014-06-21 17:01:47 +0200 | [diff] [blame] | 303 | # |
Thomas De Schampheleire | 6f638ea | 2014-07-03 21:58:43 +0200 | [diff] [blame] | 304 | # To protect against the case that the output or staging directories |
| 305 | # themselves are under /usr, we first substitute away any occurrences |
| 306 | # of these directories as @BASE_DIR@ and @STAGING_DIR@. Note that |
| 307 | # STAGING_DIR can be outside BASE_DIR when the user sets BR2_HOST_DIR |
| 308 | # to a custom value. |
Thomas De Schampheleire | 7701fc5 | 2014-06-21 17:01:47 +0200 | [diff] [blame] | 309 | # |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 310 | ifndef $(2)_INSTALL_STAGING_CMDS |
| 311 | define $(2)_INSTALL_STAGING_CMDS |
Thomas Petazzoni | 43695a9 | 2011-12-24 13:07:03 +0100 | [diff] [blame] | 312 | $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_STAGING_OPT) -C $$($$(PKG)_SRCDIR) |
Thomas De Schampheleire | 18a0e07 | 2014-07-06 17:10:51 +0200 | [diff] [blame] | 313 | find $$(STAGING_DIR)/usr/lib* -name "*.la" | xargs --no-run-if-empty \ |
Thomas De Schampheleire | 7701fc5 | 2014-06-21 17:01:47 +0200 | [diff] [blame] | 314 | $$(SED) "s:$$(BASE_DIR):@BASE_DIR@:g" \ |
Thomas De Schampheleire | 6f638ea | 2014-07-03 21:58:43 +0200 | [diff] [blame] | 315 | -e "s:$$(STAGING_DIR):@STAGING_DIR@:g" \ |
Thomas De Schampheleire | 7701fc5 | 2014-06-21 17:01:47 +0200 | [diff] [blame] | 316 | -e "s:\(['= ]\)/usr:\\1@STAGING_DIR@/usr:g" \ |
| 317 | -e "s:@STAGING_DIR@:$$(STAGING_DIR):g" \ |
Thomas De Schampheleire | 6f638ea | 2014-07-03 21:58:43 +0200 | [diff] [blame] | 318 | -e "s:@BASE_DIR@:$$(BASE_DIR):g" |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 319 | endef |
| 320 | endif |
| 321 | |
| 322 | # |
| 323 | # Target installation step. Only define it if not already defined by |
| 324 | # the package .mk file. |
| 325 | # |
| 326 | ifndef $(2)_INSTALL_TARGET_CMDS |
| 327 | define $(2)_INSTALL_TARGET_CMDS |
Thomas Petazzoni | 43695a9 | 2011-12-24 13:07:03 +0100 | [diff] [blame] | 328 | $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_TARGET_OPT) -C $$($$(PKG)_SRCDIR) |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 329 | endef |
| 330 | endif |
| 331 | |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 332 | # Call the generic package infrastructure to generate the necessary |
| 333 | # make targets |
Thomas De Schampheleire | 26aef88 | 2014-02-05 10:44:03 +0100 | [diff] [blame] | 334 | $(call inner-generic-package,$(1),$(2),$(3),$(4)) |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 335 | |
| 336 | endef |
| 337 | |
| 338 | ################################################################################ |
Arnout Vandecappelle (Essensium/Mind) | 46fa5cb | 2012-07-03 00:07:08 +0200 | [diff] [blame] | 339 | # autotools-package -- the target generator macro for autotools packages |
Thomas Petazzoni | d8b55b9 | 2009-11-08 18:37:49 +0100 | [diff] [blame] | 340 | ################################################################################ |
| 341 | |
Thomas De Schampheleire | 26aef88 | 2014-02-05 10:44:03 +0100 | [diff] [blame] | 342 | autotools-package = $(call inner-autotools-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target) |
| 343 | host-autotools-package = $(call inner-autotools-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host) |