autotools.mk 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. LIBTOOL=$(STAGING_DIR_HOST)/bin/libtool \
  21. M4=$(STAGING_DIR_HOST)/bin/m4 \
  22. AUTOPOINT=true
  23. # 1: build dir
  24. # 2: remove files
  25. # 3: automake paths
  26. # 4: libtool paths
  27. # 5: extra m4 dirs
  28. define autoreconf
  29. (cd $(1); \
  30. $(patsubst %,rm -f %;,$(2)) \
  31. $(foreach p,$(3), \
  32. if [ -f $(p)/configure.ac ] || [ -f $(p)/configure.in ]; then \
  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)) $(4) || true; \
  39. fi; \
  40. ) \
  41. );
  42. endef
  43. PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH)
  44. PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH)
  45. PKG_MACRO_PATHS?=m4
  46. PKG_REMOVE_FILES?=aclocal.m4
  47. Hooks/InstallDev/Post += libtool_remove_files
  48. define autoreconf_target
  49. $(strip $(call autoreconf, \
  50. $(PKG_BUILD_DIR), $(PKG_REMOVE_FILES), \
  51. $(PKG_AUTOMAKE_PATHS), $(PKG_LIBTOOL_PATHS), \
  52. $(STAGING_DIR)/host/share/aclocal $(STAGING_DIR)/usr/share/aclocal $(PKG_MACRO_PATHS)))
  53. endef
  54. ifneq ($(filter libtool,$(PKG_FIXUP)),)
  55. PKG_BUILD_DEPENDS += libtool libintl libiconv
  56. ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
  57. Hooks/Configure/Pre += autoreconf_target
  58. endif
  59. endif
  60. ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
  61. PKG_BUILD_DEPENDS += libtool libintl libiconv
  62. ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
  63. Hooks/Configure/Pre += autoreconf_target
  64. endif
  65. endif
  66. ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
  67. ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
  68. Hooks/Configure/Pre += autoreconf_target
  69. endif
  70. endif
  71. HOST_FIXUP?=$(PKG_FIXUP)
  72. HOST_LIBTOOL_PATHS?=$(if $(PKG_LIBTOOL_PATHS),$(PKG_LIBTOOL_PATHS),.)
  73. HOST_AUTOMAKE_PATHS?=$(if $(PKG_AUTOMAKE_PATHS),$(PKG_AUTOMAKE_PATHS),.)
  74. HOST_MACRO_PATHS?=$(if $(PKG_MACRO_PATHS),$(PKG_MACRO_PATHS),m4)
  75. HOST_REMOVE_FILES?=$(PKG_REMOVE_FILES)
  76. define autoreconf_host
  77. $(strip $(call autoreconf, \
  78. $(HOST_BUILD_DIR), $(HOST_REMOVE_FILES), \
  79. $(HOST_AUTOMAKE_PATHS), $(HOST_LIBTOOL_PATHS), \
  80. $(HOST_MACRO_PATHS)))
  81. endef
  82. ifneq ($(filter libtool,$(HOST_FIXUP)),)
  83. ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
  84. Hooks/HostConfigure/Pre += autoreconf_host
  85. endif
  86. endif
  87. ifneq ($(filter libtool-ucxx,$(HOST_FIXUP)),)
  88. ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
  89. Hooks/HostConfigure/Pre += autoreconf_host
  90. endif
  91. endif
  92. ifneq ($(filter autoreconf,$(HOST_FIXUP)),)
  93. ifeq ($(filter autoreconf,$(Hooks/HostConfigure/Pre)),)
  94. Hooks/HostConfigure/Pre += autoreconf_host
  95. endif
  96. endif