autotools.mk 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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)/)$(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 $(PKG_BUILD_DIR) -name '*.la' | $(XARGS) \
  18. $(SED) "s,^libdir='/usr/lib',libdir='$(if $(PKG_INSTALL_DIR),$(PKG_INSTALL_DIR),$(STAGING_DIR))/usr/lib',g"
  19. endef
  20. define remove_version_check
  21. if [ -f "$(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure" ]; then \
  22. $(SED) \
  23. 's,pardus_ltmain_version=.*,pardus_ltmain_version="$$$$pardus_lt_version",' \
  24. $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure; \
  25. fi
  26. endef
  27. ifneq ($(filter libtool,$(PKG_FIXUP)),)
  28. PKG_BUILD_DEPENDS += libtool
  29. Hooks/Configure/Pre += update_libtool remove_version_check
  30. Hooks/Configure/Post += update_libtool
  31. Hooks/Compile/Post += libtool_fixup_libdir
  32. endif