autotools.mk 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #
  2. # Copyright (C) 2007-2010 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. autoconf_bool = $(patsubst %,$(if $($(1)),--enable,--disable)-%,$(2))
  8. # delete *.la-files from staging_dir - we can not yet remove respective lines within all package
  9. # Makefiles, since backfire still uses libtool v1.5.x which (may) require those files
  10. define libtool_remove_files
  11. find $(1) -name '*.la' | $(XARGS) rm -f;
  12. endef
  13. AM_TOOL_PATHS:= \
  14. AUTOM4TE=$(STAGING_DIR_HOST)/bin/autom4te \
  15. AUTOCONF=$(STAGING_DIR_HOST)/bin/autoconf \
  16. AUTOMAKE=$(STAGING_DIR_HOST)/bin/automake \
  17. ACLOCAL=$(STAGING_DIR_HOST)/bin/aclocal \
  18. AUTOHEADER=$(STAGING_DIR_HOST)/bin/autoheader \
  19. LIBTOOLIZE=$(STAGING_DIR_HOST)/bin/libtoolize \
  20. M4=$(STAGING_DIR_HOST)/bin/m4 \
  21. AUTOPOINT=true
  22. # 1: build dir
  23. # 2: remove files
  24. # 3: automake paths
  25. # 4: libtool paths
  26. # 5: extra m4 dirs
  27. define autoreconf
  28. (cd $(1); \
  29. $(patsubst %,rm -f %;,$(2)) \
  30. $(foreach p,$(3), \
  31. if [ -f $(p)/configure.ac ] || [ -f $(p)/configure.in ]; then \
  32. [ -f $(p)/aclocal.m4 ] && [ ! -f $(p)/acinclude.m4 ] && mv aclocal.m4 acinclude.m4; \
  33. [ -d $(p)/autom4te.cache ] && rm -rf autom4te.cache; \
  34. touch NEWS AUTHORS COPYING ChangeLog; \
  35. $(AM_TOOL_PATHS) $(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \
  36. -B $(STAGING_DIR_HOST)/share/aclocal \
  37. $(patsubst %,-B %,$(5)) \
  38. $(patsubst %,-I %,$(4)) -I m4 $(4) || true; \
  39. fi; \
  40. ) \
  41. );
  42. endef
  43. PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH)
  44. PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH)
  45. PKG_REMOVE_FILES?=aclocal.m4
  46. Hooks/InstallDev/Post += libtool_remove_files
  47. define autoreconf_target
  48. $(strip $(call autoreconf, \
  49. $(PKG_BUILD_DIR), $(PKG_REMOVE_FILES), \
  50. $(PKG_AUTOMAKE_PATHS), $(PKG_LIBTOOL_PATHS), \
  51. $(STAGING_DIR)/host/share/aclocal $(STAGING_DIR)/usr/share/aclocal))
  52. endef
  53. ifneq ($(filter libtool,$(PKG_FIXUP)),)
  54. PKG_BUILD_DEPENDS += libtool libintl libiconv
  55. ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
  56. Hooks/Configure/Pre += autoreconf_target
  57. endif
  58. endif
  59. ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
  60. PKG_BUILD_DEPENDS += libtool libintl libiconv
  61. ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
  62. Hooks/Configure/Pre += autoreconf_target
  63. endif
  64. endif
  65. ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
  66. ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
  67. Hooks/Configure/Pre += autoreconf_target
  68. endif
  69. endif
  70. HOST_FIXUP?=$(PKG_FIXUP)
  71. HOST_LIBTOOL_PATHS?=$(if $(PKG_LIBTOOL_PATHS),$(PKG_LIBTOOL_PATHS),.)
  72. HOST_AUTOMAKE_PATHS?=$(if $(PKG_AUTOMAKE_PATHS),$(PKG_AUTOMAKE_PATHS),.)
  73. HOST_REMOVE_FILES?=$(PKG_REMOVE_FILES)
  74. define autoreconf_host
  75. $(strip $(call autoreconf, \
  76. $(HOST_BUILD_DIR), $(HOST_REMOVE_FILES), \
  77. $(HOST_AUTOMAKE_PATHS), $(HOST_LIBTOOL_PATHS)))
  78. endef
  79. ifneq ($(filter libtool,$(HOST_FIXUP)),)
  80. ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
  81. Hooks/HostConfigure/Pre += autoreconf_host
  82. endif
  83. endif
  84. ifneq ($(filter libtool-ucxx,$(HOST_FIXUP)),)
  85. ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
  86. Hooks/HostConfigure/Pre += autoreconf_host
  87. endif
  88. endif
  89. ifneq ($(filter autoreconf,$(HOST_FIXUP)),)
  90. ifeq ($(filter autoreconf,$(Hooks/HostConfigure/Pre)),)
  91. Hooks/HostConfigure/Pre += autoreconf_host
  92. endif
  93. endif