1 # SPDX-License-Identifier: GPL-2.0-only
3 # Copyright (C) 2007-2020 OpenWrt.org
5 ifneq ($(__autotools_inc
),1)
8 autoconf_bool
= $(patsubst %,$(if
$($(1)),--enable
,--disable
)-%,$(2))
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
12 define libtool_remove_files
13 find
$(1) -name
'*.la' |
$(XARGS
) rm -f
;
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 \
35 $(patsubst %,rm -f
%;,$(2)) \
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
; \
43 LIBTOOLIZE
='$(STAGING_DIR_HOST)/bin/libtoolize --install' \
44 $(STAGING_DIR_HOST
)/bin
/autoreconf
-v
-f
-i
-s \
45 $(if
$(word 2,$(3)),--no-recursive
) \
46 -B
$(STAGING_DIR_HOST
)/share
/aclocal \
47 $(patsubst %,-I
%,$(5)) \
48 $(patsubst %,-I
%,$(4)) $(p
) || true
; \
57 for lt in
$$$$($$(STAGING_DIR_HOST
)/bin
/find .
-name ltmain.sh
); do \
58 lt_version
="$$$$($$(STAGING_DIR_HOST)/bin/sed -ne 's,^[[:space:]]*VERSION="\?\
([0-9]\.
[0-9]\
+\
).
*,\
1,p
' $$$$lt)"; \
59 case "$$$$lt_version" in \
60 1.5|2.2|2.4) echo "autotools.mk: Found libtool v$$$$lt_version - applying patch to $$$$lt"; \
61 (cd $$$$(dirname $$$$lt) && $$(PATCH) -N -s -p1 < $$(TOPDIR)/tools/libtool/files/libtool-v$$$$lt_version.patch || true) ;; \
62 *) echo "autotools.mk: error: Unsupported libtool version v$$$$lt_version - cannot patch $$$$lt"; exit 1 ;; \
68 define set_libtool_abiver
70 -e 's
,^soname_spec
=.
*,soname_spec
="\\$$$${libname}\\$$$${shared_ext}.$(PKG_ABI_VERSION)",' \
71 -e 's
,^library_names_spec
=.
*,library_names_spec
="\\$$$${libname}\\$$$${shared_ext}.$(PKG_ABI_VERSION) \\$$$${libname}\\$$$${shared_ext}",' \
72 $(PKG_BUILD_DIR)/libtool
75 PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH)
76 PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH)
78 PKG_REMOVE_FILES?=aclocal.m4
80 Hooks/InstallDev/Post += libtool_remove_files
82 define autoreconf_target
83 $(strip $(call autoreconf, \
84 $(PKG_BUILD_DIR), $(PKG_REMOVE_FILES), \
85 $(PKG_AUTOMAKE_PATHS), $(PKG_LIBTOOL_PATHS), \
86 $(STAGING_DIR)/host/share/aclocal $(STAGING_DIR_HOSTPKG)/share/aclocal $(STAGING_DIR)/usr/share/aclocal $(PKG_MACRO_PATHS)))
89 define patch_libtool_target
90 $(strip $(call patch_libtool, \
94 define gettext_version_target
95 (cd $(PKG_BUILD_DIR) && \
96 GETTEXT_VERSION=$(shell $(STAGING_DIR_HOSTPKG)/bin/gettext -V | $(STAGING_DIR_HOST)/bin/sed -rne '1s
/.
*\b([0-9]\.
[0-9]+(\.
[0-9]+)?
)\b.
*/\
1/p
' ) && \
97 $(STAGING_DIR_HOST)/bin/sed \
98 -i $(PKG_BUILD_DIR)/configure.ac \
99 -e "s/AM_GNU_GETTEXT_VERSION(.*)/AM_GNU_GETTEXT_VERSION(\[$$$$GETTEXT_VERSION\])/g" && \
100 $(STAGING_DIR_HOSTPKG)/bin/autopoint --force \
104 ifneq ($(filter gettext-version,$(PKG_FIXUP)),)
105 Hooks/Configure/Pre += gettext_version_target
106 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
107 Hooks/Configure/Pre += autoreconf_target
111 ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
112 Hooks/Configure/Pre += patch_libtool_target
115 ifneq ($(filter libtool,$(PKG_FIXUP)),)
116 PKG_BUILD_DEPENDS += libtool gettext libiconv
117 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
118 Hooks/Configure/Pre += autoreconf_target
122 ifneq ($(filter libtool-abiver,$(PKG_FIXUP)),)
123 Hooks/Configure/Post += set_libtool_abiver
126 ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
127 PKG_BUILD_DEPENDS += libtool gettext libiconv
128 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
129 Hooks/Configure/Pre += autoreconf_target
133 ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
134 ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
135 Hooks/Configure/Pre += autoreconf_target
140 HOST_FIXUP?=$(PKG_FIXUP)
141 HOST_LIBTOOL_PATHS?=$(if $(PKG_LIBTOOL_PATHS),$(PKG_LIBTOOL_PATHS),.)
142 HOST_AUTOMAKE_PATHS?=$(if $(PKG_AUTOMAKE_PATHS),$(PKG_AUTOMAKE_PATHS),.)
143 HOST_MACRO_PATHS?=$(if $(PKG_MACRO_PATHS),$(PKG_MACRO_PATHS),m4)
144 HOST_REMOVE_FILES?=$(PKG_REMOVE_FILES)
146 define autoreconf_host
147 $(strip $(call autoreconf, \
148 $(HOST_BUILD_DIR), $(HOST_REMOVE_FILES), \
149 $(HOST_AUTOMAKE_PATHS), $(HOST_LIBTOOL_PATHS), \
150 $(HOST_MACRO_PATHS)))
153 define patch_libtool_host
154 $(strip $(call patch_libtool, \
158 ifneq ($(filter patch-libtool,$(HOST_FIXUP)),)
159 Hooks/HostConfigure/Pre += patch_libtool_host
162 ifneq ($(filter libtool,$(HOST_FIXUP)),)
163 ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
164 Hooks/HostConfigure/Pre += autoreconf_host
168 ifneq ($(filter libtool-ucxx,$(HOST_FIXUP)),)
169 ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
170 Hooks/HostConfigure/Pre += autoreconf_host
174 ifneq ($(filter autoreconf,$(HOST_FIXUP)),)
175 ifeq ($(filter autoreconf,$(Hooks/HostConfigure/Pre)),)
176 Hooks/HostConfigure/Pre += autoreconf_host
180 endif #__autotools_inc