autotools.mk 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. $(if $(word 2,$(3)),--no-recursive) \
  37. -B $(STAGING_DIR_HOST)/share/aclocal \
  38. $(patsubst %,-I %,$(5)) \
  39. $(patsubst %,-I %,$(4)) $(4) || true; \
  40. [ -e $(p)/config.rpath ] || \
  41. ln -s $(SCRIPT_DIR)/config.rpath $(p)/config.rpath;
  42. fi; \
  43. ) \
  44. );
  45. endef
  46. PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH)
  47. PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH)
  48. PKG_MACRO_PATHS?=m4
  49. PKG_REMOVE_FILES?=aclocal.m4
  50. Hooks/InstallDev/Post += libtool_remove_files
  51. define autoreconf_target
  52. $(strip $(call autoreconf, \
  53. $(PKG_BUILD_DIR), $(PKG_REMOVE_FILES), \
  54. $(PKG_AUTOMAKE_PATHS), $(PKG_LIBTOOL_PATHS), \
  55. $(STAGING_DIR)/host/share/aclocal $(STAGING_DIR)/usr/share/aclocal $(PKG_MACRO_PATHS)))
  56. endef
  57. ifneq ($(filter libtool,$(PKG_FIXUP)),)
  58. PKG_BUILD_DEPENDS += libtool libintl libiconv
  59. ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
  60. Hooks/Configure/Pre += autoreconf_target
  61. endif
  62. endif
  63. ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
  64. PKG_BUILD_DEPENDS += libtool libintl libiconv
  65. ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
  66. Hooks/Configure/Pre += autoreconf_target
  67. endif
  68. endif
  69. ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
  70. ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
  71. Hooks/Configure/Pre += autoreconf_target
  72. endif
  73. endif
  74. HOST_FIXUP?=$(PKG_FIXUP)
  75. HOST_LIBTOOL_PATHS?=$(if $(PKG_LIBTOOL_PATHS),$(PKG_LIBTOOL_PATHS),.)
  76. HOST_AUTOMAKE_PATHS?=$(if $(PKG_AUTOMAKE_PATHS),$(PKG_AUTOMAKE_PATHS),.)
  77. HOST_MACRO_PATHS?=$(if $(PKG_MACRO_PATHS),$(PKG_MACRO_PATHS),m4)
  78. HOST_REMOVE_FILES?=$(PKG_REMOVE_FILES)
  79. define autoreconf_host
  80. $(strip $(call autoreconf, \
  81. $(HOST_BUILD_DIR), $(HOST_REMOVE_FILES), \
  82. $(HOST_AUTOMAKE_PATHS), $(HOST_LIBTOOL_PATHS), \
  83. $(HOST_MACRO_PATHS)))
  84. endef
  85. ifneq ($(filter libtool,$(HOST_FIXUP)),)
  86. ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
  87. Hooks/HostConfigure/Pre += autoreconf_host
  88. endif
  89. endif
  90. ifneq ($(filter libtool-ucxx,$(HOST_FIXUP)),)
  91. ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
  92. Hooks/HostConfigure/Pre += autoreconf_host
  93. endif
  94. endif
  95. ifneq ($(filter autoreconf,$(HOST_FIXUP)),)
  96. ifeq ($(filter autoreconf,$(Hooks/HostConfigure/Pre)),)
  97. Hooks/HostConfigure/Pre += autoreconf_host
  98. endif
  99. endif