spurious initramfs breakage fix
[openwrt/svn-archive/archive.git] / include / autotools.mk
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
8 define replace
9 if [ -f "$(PKG_BUILD_DIR)/$(3)$(1)" -a -e "$(2)/$(1)" ]; then \
10 rm -f $(PKG_BUILD_DIR)/$(3)$(1); \
11 ln -s $(2)/$(1) $(PKG_BUILD_DIR)/$(3); \
12 fi
13
14 endef
15
16 # replace copies of ltmain.sh with the build system's version
17 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)/)
18
19 # prevent libtool from linking against host development libraries
20 define libtool_fixup_libdir
21 find $(PKG_BUILD_DIR) -name '*.la' | $(XARGS) \
22 $(SED) "s,^libdir='/usr/lib',libdir='$(if $(PKG_INSTALL_DIR),$(PKG_INSTALL_DIR),$(STAGING_DIR))/usr/lib',g"
23 endef
24
25 define remove_version_check
26 if [ -f "$(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure" ]; then \
27 $(SED) \
28 's,pardus_ltmain_version=.*,pardus_ltmain_version="$$$$pardus_lt_version",' \
29 $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure; \
30 fi
31 endef
32
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/Compile/Post += libtool_fixup_libdir
38 endif