autotools.mk 965 B

123456789101112131415161718192021222324252627282930
  1. #
  2. # Copyright (C) 2007 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)/$(1)" ]; then \
  9. rm -f $(PKG_BUILD_DIR)/$(3)$(1); \
  10. ln -s $(2)/$(1) $(PKG_BUILD_DIR)/$(3); \
  11. fi
  12. endef
  13. # replace copies of ltmain.sh with the build system's version
  14. update_libtool=$(call replace,libtool,$(STAGING_DIR)/host/bin,$(CONFIGURE_PATH)/)$(call replace,ltmain.sh,$(STAGING_DIR)/host/share/libtool,$(CONFIGURE_PATH)/)
  15. # prevent libtool from linking against host development libraries
  16. define libtool_fixup_libdir
  17. find $(PKG_BUILD_DIR) -name '*.la' | $(XARGS) \
  18. $(SED) "s,^libdir='/usr/lib',libdir='$(strip $(1))/usr/lib',g"
  19. endef
  20. ifneq ($(filter libtool,$(PKG_FIXUP)),)
  21. PKG_BUILD_DEPENDS += libtool
  22. Hooks/Configure/Pre += update_libtool
  23. Hooks/Configure/Post += update_libtool
  24. Hooks/Build/Post += libtool_fixup_libdir
  25. endif