autotools.mk 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #
  2. # Copyright (C) 2007-2008 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)/)$(call replace,libtool.m4,$(STAGING_DIR)/host/share/aclocal,$(CONFIGURE_PATH)/)
  15. # prevent libtool from linking against host development libraries
  16. define libtool_fixup_libdir
  17. find $(1) -name '*.la' | $(XARGS) \
  18. $(SED) "s,\(^libdir='\| \|-L\|^dependency_libs='\)/usr/lib,\1$(STAGING_DIR)/usr/lib,g"
  19. find $(2) -name '*.la' | $(XARGS) \
  20. $(SED) "s,\(^libdir='\| \|-L\|^dependency_libs='\)/usr/lib,\1$(STAGING_DIR)/usr/lib,g"
  21. endef
  22. define remove_version_check
  23. if [ -f "$(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure" ]; then \
  24. $(SED) \
  25. 's,pardus_ltmain_version=.*,pardus_ltmain_version="$$$$pardus_lt_version",' \
  26. $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure; \
  27. fi
  28. endef
  29. ifneq ($(filter libtool,$(PKG_FIXUP)),)
  30. PKG_BUILD_DEPENDS += libtool
  31. Hooks/Configure/Pre += update_libtool remove_version_check
  32. Hooks/Configure/Post += update_libtool
  33. Hooks/InstallDev/Post += libtool_fixup_libdir
  34. endif