autotools.mk 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. -e "s,$(STAGING_DIR)/usr/lib/\(libstdc++\|libsupc++\).la,$(TOOLCHAIN_DIR)/usr/lib/\1.la,g"
  22. find $(2) -name '*.la' | $(XARGS) \
  23. $(SED) "s,\(^libdir='\| \|-L\|^dependency_libs='\)/usr/lib,\1$(STAGING_DIR)/usr/lib,g" \
  24. -e "s,$(STAGING_DIR)/usr/lib/\(libstdc++\|libsupc++\).la,$(TOOLCHAIN_DIR)/usr/lib/\1.la,g"
  25. endef
  26. define remove_version_check
  27. if [ -f "$(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure" ]; then \
  28. $(SED) \
  29. 's,pardus_ltmain_version=.*,pardus_ltmain_version="$$$$pardus_lt_version",' \
  30. $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure; \
  31. fi
  32. endef
  33. ifneq ($(filter libtool,$(PKG_FIXUP)),)
  34. PKG_BUILD_DEPENDS += libtool
  35. Hooks/Configure/Pre += update_libtool remove_version_check
  36. Hooks/Configure/Post += update_libtool
  37. Hooks/InstallDev/Post += libtool_fixup_libdir
  38. endif
  39. ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
  40. PKG_BUILD_DEPENDS += libtool
  41. Hooks/Configure/Pre += update_libtool_ucxx remove_version_check
  42. Hooks/Configure/Post += update_libtool_ucxx
  43. Hooks/InstallDev/Post += libtool_fixup_libdir
  44. endif