autotools.mk 3.3 KB

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