autotools.mk 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #
  2. # Copyright (C) 2007-2009 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. define replace
  8. if [ -f "$(PKG_BUILD_DIR)/$(3)$(1)" -a -e "$(2)/$(if $(4),$(4),$(1))" ]; then \
  9. rm -f $(PKG_BUILD_DIR)/$(3)$(1); \
  10. ln -s $(2)/$(if $(4),$(4),$(1)) $(PKG_BUILD_DIR)/$(3)$(1); \
  11. fi
  12. endef
  13. # replace copies of ltmain.sh with the build system's version
  14. update_libtool_common=$(call replace,ltmain.sh,$(STAGING_DIR)/host/share/libtool,$(CONFIGURE_PATH)/)$(call replace,libtool.m4,$(STAGING_DIR)/host/share/aclocal,$(CONFIGURE_PATH)/)
  15. update_libtool=$(call replace,libtool,$(STAGING_DIR)/host/bin,$(CONFIGURE_PATH)/)$(call update_libtool_common)
  16. update_libtool_ucxx=$(call replace,libtool,$(STAGING_DIR)/host/bin,$(CONFIGURE_PATH)/,libtool-ucxx)$(call update_libtool_common)
  17. # prevent libtool from linking against host development libraries
  18. define libtool_fixup_libdir
  19. find $(1) -name '*.la' | $(XARGS) \
  20. $(SED) "s,\(^libdir='\| \|-L\|^dependency_libs='\)/usr/lib,\1$(STAGING_DIR)/usr/lib,g"
  21. find $(2) -name '*.la' | $(XARGS) \
  22. $(SED) "s,\(^libdir='\| \|-L\|^dependency_libs='\)/usr/lib,\1$(STAGING_DIR)/usr/lib,g"
  23. endef
  24. define remove_version_check
  25. if [ -f "$(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure" ]; then \
  26. $(SED) \
  27. 's,pardus_ltmain_version=.*,pardus_ltmain_version="$$$$pardus_lt_version",' \
  28. $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure; \
  29. fi
  30. endef
  31. ifneq ($(filter libtool,$(PKG_FIXUP)),)
  32. PKG_BUILD_DEPENDS += libtool
  33. Hooks/Configure/Pre += update_libtool remove_version_check
  34. Hooks/Configure/Post += update_libtool
  35. Hooks/InstallDev/Post += libtool_fixup_libdir
  36. endif
  37. ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
  38. PKG_BUILD_DEPENDS += libtool
  39. Hooks/Configure/Pre += update_libtool_ucxx remove_version_check
  40. Hooks/Configure/Post += update_libtool_ucxx
  41. Hooks/InstallDev/Post += libtool_fixup_libdir
  42. endif