From: Johan Oudinet <johan.oudinet@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 01/15] package/pkg-autotools.mk: Factorize hooks.
Date: Fri, 7 Nov 2014 14:28:37 +0100 [thread overview]
Message-ID: <1415366931-6870-2-git-send-email-johan.oudinet@gmail.com> (raw)
In-Reply-To: <1415366931-6870-1-git-send-email-johan.oudinet@gmail.com>
Define common macros only once (instead of as many times as
there are inner-autotools-package calls).
Factorize LIBTOOL_PATCH_HOOK and AUTORECONF_HOOK to avoid duplicated
code.
Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
---
package/pkg-autotools.mk | 119 ++++++++++++++++++++++-------------------------
1 file changed, 56 insertions(+), 63 deletions(-)
diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
index 09f9412..65af6f0 100644
--- a/package/pkg-autotools.mk
+++ b/package/pkg-autotools.mk
@@ -46,6 +46,57 @@ endef
# $(call AUTOCONF_AC_CHECK_FILE_VAL,/dev/random)=yes
AUTOCONF_AC_CHECK_FILE_VAL = ac_cv_file_$(subst -,_,$(subst /,_,$(subst .,_,$(1))))
+# Recipe that patches libtool so it works properly with
+# cross-compilation.
+define PATCH_LIBTOOL
+ $(Q)if test "$($(PKG)_LIBTOOL_PATCH)" = "YES"; then \
+ for i in `find $($(PKG)_SRCDIR) -name ltmain.sh`; do \
+ ltmain_version=`sed -n '/^[ ]*VERSION=/{s/^[ ]*VERSION=//;p;q;}' $$$$i | \
+ sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
+ if test $${ltmain_version} = 1.5; then \
+ $(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
+ elif test $${ltmain_version} = 2.2; then\
+ $(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
+ elif test $${ltmain_version} = 2.4; then\
+ $(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
+ fi \
+ done \
+ fi
+endef
+
+#
+# Hook to update config.sub and config.guess if needed
+#
+define UPDATE_CONFIG_HOOK
+ @$(call MESSAGE,"Updating config.sub and config.guess")
+ $(call CONFIG_UPDATE,$(@D))
+endef
+
+#
+# Hook to patch libtool to make it work properly for cross-compilation
+#
+define LIBTOOL_PATCH_HOOK
+ @$(call MESSAGE,"Patching libtool")
+ $(call PATCH_LIBTOOL)
+endef
+
+#
+# Hook to gettextize the package if needed
+#
+define GETTEXTIZE_HOOK
+ @$(call MESSAGE,"Gettextizing")
+ $(Q)cd $($(PKG)_SRCDIR) && $(GETTEXTIZE) $($(PKG)_GETTEXTIZE_OPTS)
+endef
+
+#
+# Hook to autoreconf the package if needed
+#
+define AUTORECONF_HOOK
+ @$(call MESSAGE,"Autoreconfiguring")
+ $(Q)cd $($(PKG)_SRCDIR) && $($(PKG)_AUTORECONF_ENV) $(AUTORECONF) $($(PKG)_AUTORECONF_OPTS)
+ $(call PATCH_LIBTOOL)
+endef
+
################################################################################
# inner-autotools-package -- defines how the configuration, compilation and
# installation of an autotools package should be done, implements a
@@ -183,71 +234,8 @@ endef
endif
endif
-#
-# Hook to update config.sub and config.guess if needed
-#
-define UPDATE_CONFIG_HOOK
- @$$(call MESSAGE,"Updating config.sub and config.guess")
- $$(call CONFIG_UPDATE,$$(@D))
-endef
-
$(2)_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
-#
-# Hook to patch libtool to make it work properly for cross-compilation
-#
-define LIBTOOL_PATCH_HOOK
- @$$(call MESSAGE,"Patching libtool")
- $$(Q)if test "$$($$(PKG)_LIBTOOL_PATCH)" = "YES" \
- -a "$$($$(PKG)_AUTORECONF)" != "YES"; then \
- for i in `find $$($$(PKG)_SRCDIR) -name ltmain.sh`; do \
- ltmain_version=`sed -n '/^[ ]*VERSION=/{s/^[ ]*VERSION=//;p;q;}' $$$$i | \
- sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
- if test $$$${ltmain_version} = '1.5'; then \
- $$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
- elif test $$$${ltmain_version} = "2.2"; then\
- $$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
- elif test $$$${ltmain_version} = "2.4"; then\
- $$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
- fi \
- done \
- fi
-endef
-
-# default values are not evaluated yet, so don't rely on this defaulting to YES
-ifneq ($$($(2)_LIBTOOL_PATCH),NO)
-$(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
-endif
-
-#
-# Hook to gettextize the package if needed
-#
-define GETTEXTIZE_HOOK
- @$$(call MESSAGE,"Gettextizing")
- $(Q)cd $$($$(PKG)_SRCDIR) && $$(GETTEXTIZE) $$($$(PKG)_GETTEXTIZE_OPTS)
-endef
-
-#
-# Hook to autoreconf the package if needed
-#
-define AUTORECONF_HOOK
- @$$(call MESSAGE,"Autoreconfiguring")
- $$(Q)cd $$($$(PKG)_SRCDIR) && $$($$(PKG)_AUTORECONF_ENV) $$(AUTORECONF) $$($$(PKG)_AUTORECONF_OPTS)
- $$(Q)if test "$$($$(PKG)_LIBTOOL_PATCH)" = "YES"; then \
- for i in `find $$($$(PKG)_SRCDIR) -name ltmain.sh`; do \
- ltmain_version=`sed -n '/^[ ]*VERSION=/{s/^[ ]*VERSION=//;p;q;}' $$$$i | \
- sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
- if test $$$${ltmain_version} = "1.5"; then \
- $$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
- elif test $$$${ltmain_version} = "2.2"; then\
- $$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
- elif test $$$${ltmain_version} = "2.4"; then\
- $$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
- fi \
- done \
- fi
-endef
-
# This must be repeated from inner-generic-package, otherwise we get an empty
# _DEPENDENCIES if _AUTORECONF is YES. Also filter the result of _AUTORECONF
# and _GETTEXTIZE away from the non-host rule
@@ -265,6 +253,11 @@ $(2)_DEPENDENCIES += host-gettext
endif
$(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK
$(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
+else
+# default values are not evaluated yet, so don't rely on this defaulting to YES
+ifneq ($$($(2)_LIBTOOL_PATCH),NO)
+$(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
+endif
endif
#
--
2.1.0
next prev parent reply other threads:[~2014-11-07 13:28 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 13:28 [Buildroot] [PATCH v2 00/15] ejabberd: XMPP server Johan Oudinet
2014-11-07 13:28 ` Johan Oudinet [this message]
2014-11-10 22:13 ` [Buildroot] [PATCH v2 01/15] package/pkg-autotools.mk: Factorize hooks Yann E. MORIN
2014-11-11 12:52 ` Yann E. MORIN
2014-11-11 13:03 ` Arnout Vandecappelle
2014-11-11 13:17 ` Yann E. MORIN
2014-11-11 13:33 ` Arnout Vandecappelle
2014-11-11 17:26 ` Yann E. MORIN
2014-11-07 13:28 ` [Buildroot] [PATCH v2 02/15] package/pkg-rebar.mk: new infrastructure Johan Oudinet
2014-11-10 23:31 ` Yann E. MORIN
2014-11-11 14:55 ` Arnout Vandecappelle
2014-11-11 15:35 ` Yann E. MORIN
2014-11-11 16:55 ` Johan Oudinet
2014-11-11 17:21 ` Yann E. MORIN
2014-11-07 13:28 ` [Buildroot] [PATCH v2 03/15] erlang-goldrush: new package Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 04/15] erlang-lager: " Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 05/15] erlang-p1-zlib: " Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 06/15] erlang-p1-yaml: " Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 07/15] erlang-p1-xml: " Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 08/15] erlang-p1-utils: " Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 09/15] erlang-p1-tls: " Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 10/15] erlang-p1-stun: " Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 11/15] erlang-p1-stringprep: " Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 12/15] erlang-p1-sip: " Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 13/15] erlang-p1-iconv: " Johan Oudinet
2014-11-10 16:37 ` Yann E. MORIN
2014-11-10 17:30 ` Yann E. MORIN
2014-11-11 3:30 ` Johan Oudinet
2014-11-11 10:04 ` Yann E. MORIN
2014-11-07 13:28 ` [Buildroot] [PATCH v2 14/15] erlang-p1-cache-tab: " Johan Oudinet
2014-11-07 13:28 ` [Buildroot] [PATCH v2 15/15] ejabberd: " Johan Oudinet
2014-11-10 16:02 ` [Buildroot] [PATCH v2 00/15] ejabberd: XMPP server Yann E. MORIN
2014-11-12 0:28 ` Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415366931-6870-2-git-send-email-johan.oudinet@gmail.com \
--to=johan.oudinet@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.