source: trunk/include/autotools.mk

Last change on this file was 48421, checked in by nbd, 6 months ago

include/autotools.mk: fix gettext installation path

Signed-off-by: Felix Fietkau <nbd@…>

  • Property copyright set to Copyright (C) 2007-2008 Openwrt.org
  • Property licence set to GPLv2
  • Property svn:eol-style set to native
File size: 5.1 KB
Line 
1#
2# Copyright (C) 2007-2012 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8autoconf_bool = $(patsubst %,$(if $($(1)),--enable,--disable)-%,$(2))
9
10# delete *.la-files from staging_dir - we can not yet remove respective lines within all package
11# Makefiles, since backfire still uses libtool v1.5.x which (may) require those files
12define libtool_remove_files
13        find $(1) -name '*.la' | $(XARGS) rm -f;
14endef
15
16
17AM_TOOL_PATHS:= \
18        AUTOM4TE=$(STAGING_DIR_HOST)/bin/autom4te \
19        AUTOCONF=$(STAGING_DIR_HOST)/bin/autoconf \
20        AUTOMAKE=$(STAGING_DIR_HOST)/bin/automake \
21        ACLOCAL=$(STAGING_DIR_HOST)/bin/aclocal \
22        AUTOHEADER=$(STAGING_DIR_HOST)/bin/autoheader \
23        LIBTOOLIZE=$(STAGING_DIR_HOST)/bin/libtoolize \
24        LIBTOOL=$(STAGING_DIR_HOST)/bin/libtool \
25        M4=$(STAGING_DIR_HOST)/bin/m4 \
26        AUTOPOINT=true
27
28# 1: build dir
29# 2: remove files
30# 3: automake paths
31# 4: libtool paths
32# 5: extra m4 dirs
33define autoreconf
34        (cd $(1); \
35                $(patsubst %,rm -f %;,$(2)) \
36                $(foreach p,$(3), \
37                        if [ -f $(p)/configure.ac ] || [ -f $(p)/configure.in ]; then \
38                                [ -d $(p)/autom4te.cache ] && rm -rf autom4te.cache; \
39                                [ -e $(p)/config.rpath ] || \
40                                                ln -s $(SCRIPT_DIR)/config.rpath $(p)/config.rpath; \
41                                touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; \
42                                $(AM_TOOL_PATHS) $(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \
43                                        $(if $(word 2,$(3)),--no-recursive) \
44                                        -B $(STAGING_DIR_HOST)/share/aclocal \
45                                        $(patsubst %,-I %,$(5)) \
46                                        $(patsubst %,-I %,$(4)) $(p) || true; \
47                        fi; \
48                ) \
49        );
50endef
51
52# 1: build dir
53define patch_libtool
54        @(cd $(1); \
55                for lt in $$$$($$(STAGING_DIR_HOST)/bin/find . -name ltmain.sh); do \
56                        lt_version="$$$$($$(STAGING_DIR_HOST)/bin/sed -ne 's,^[[:space:]]*VERSION="\?\([0-9]\.[0-9]\+\).*,\1,p' $$$$lt)"; \
57                        case "$$$$lt_version" in \
58                                1.5|2.2|2.4) echo "autotools.mk: Found libtool v$$$$lt_version - applying patch to $$$$lt"; \
59                                        (cd $$$$(dirname $$$$lt) && $$(PATCH) -N -s -p1 < $$(TOPDIR)/tools/libtool/files/libtool-v$$$$lt_version.patch || true) ;; \
60                                *) echo "autotools.mk: error: Unsupported libtool version v$$$$lt_version - cannot patch $$$$lt"; exit 1 ;; \
61                        esac; \
62                done; \
63        );
64endef
65
66
67PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH)
68PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH)
69PKG_MACRO_PATHS?=m4
70PKG_REMOVE_FILES?=aclocal.m4
71
72Hooks/InstallDev/Post += libtool_remove_files
73
74define autoreconf_target
75  $(strip $(call autoreconf, \
76    $(PKG_BUILD_DIR), $(PKG_REMOVE_FILES), \
77    $(PKG_AUTOMAKE_PATHS), $(PKG_LIBTOOL_PATHS), \
78    $(STAGING_DIR)/host/share/aclocal $(STAGING_DIR)/usr/share/aclocal $(PKG_MACRO_PATHS)))
79endef
80
81define patch_libtool_target
82  $(strip $(call patch_libtool, \
83    $(PKG_BUILD_DIR)))
84endef
85
86define gettext_version_target
87        (cd $(PKG_BUILD_DIR) && \
88                GETTEXT_VERSION=$(shell $(STAGING_DIR)/host/bin/gettext -V | $(STAGING_DIR_HOST)/bin/sed -ne '1s/.* //p') && \
89                $(STAGING_DIR_HOST)/bin/sed \
90                        -i $(PKG_BUILD_DIR)/configure.ac \
91                        -e "s/AM_GNU_GETTEXT_VERSION(.*)/AM_GNU_GETTEXT_VERSION(\[$$$$GETTEXT_VERSION\])/g" && \
92                $(STAGING_DIR)/host/bin/autopoint --force \
93        );
94endef
95
96ifneq ($(filter gettext-version,$(PKG_FIXUP)),)
97  Hooks/Configure/Pre += gettext_version_target
98 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
99  Hooks/Configure/Pre += autoreconf_target
100 endif
101endif
102
103ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
104  Hooks/Configure/Pre += patch_libtool_target
105endif
106
107ifneq ($(filter libtool,$(PKG_FIXUP)),)
108  PKG_BUILD_DEPENDS += libtool libintl libiconv
109 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
110  Hooks/Configure/Pre += autoreconf_target
111 endif
112endif
113
114ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
115  PKG_BUILD_DEPENDS += libtool libintl libiconv
116 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
117  Hooks/Configure/Pre += autoreconf_target
118 endif
119endif
120
121ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
122  ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
123    Hooks/Configure/Pre += autoreconf_target
124  endif
125endif
126
127
128HOST_FIXUP?=$(PKG_FIXUP)
129HOST_LIBTOOL_PATHS?=$(if $(PKG_LIBTOOL_PATHS),$(PKG_LIBTOOL_PATHS),.)
130HOST_AUTOMAKE_PATHS?=$(if $(PKG_AUTOMAKE_PATHS),$(PKG_AUTOMAKE_PATHS),.)
131HOST_MACRO_PATHS?=$(if $(PKG_MACRO_PATHS),$(PKG_MACRO_PATHS),m4)
132HOST_REMOVE_FILES?=$(PKG_REMOVE_FILES)
133
134define autoreconf_host
135  $(strip $(call autoreconf, \
136    $(HOST_BUILD_DIR), $(HOST_REMOVE_FILES), \
137    $(HOST_AUTOMAKE_PATHS), $(HOST_LIBTOOL_PATHS), \
138    $(HOST_MACRO_PATHS)))
139endef
140
141define patch_libtool_host
142  $(strip $(call patch_libtool, \
143    $(HOST_BUILD_DIR)))
144endef
145
146ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
147  Hooks/HostConfigure/Pre += patch_libtool_host
148endif
149
150ifneq ($(filter patch-libtool,$(HOST_FIXUP)),)
151  Hooks/HostConfigure/Pre += $(strip $(call patch_libtool,$(HOST_BUILD_DIR)))
152endif
153
154ifneq ($(filter libtool,$(HOST_FIXUP)),)
155 ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
156  Hooks/HostConfigure/Pre += autoreconf_host
157 endif
158endif
159
160ifneq ($(filter libtool-ucxx,$(HOST_FIXUP)),)
161 ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
162  Hooks/HostConfigure/Pre += autoreconf_host
163 endif
164endif
165
166ifneq ($(filter autoreconf,$(HOST_FIXUP)),)
167  ifeq ($(filter autoreconf,$(Hooks/HostConfigure/Pre)),)
168    Hooks/HostConfigure/Pre += autoreconf_host
169  endif
170endif
Note: See TracBrowser for help on using the repository browser.