xref: /OK3568_Linux_fs/buildroot/package/erlang/erlang.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# erlang
4#
5################################################################################
6
7# See note below when updating Erlang
8ERLANG_VERSION = 22.2
9ERLANG_SITE = http://www.erlang.org/download
10ERLANG_SOURCE = otp_src_$(ERLANG_VERSION).tar.gz
11ERLANG_DEPENDENCIES = host-erlang
12
13ERLANG_LICENSE = Apache-2.0
14ERLANG_LICENSE_FILES = LICENSE.txt
15ERLANG_CPE_ID_VENDOR = erlang
16ERLANG_CPE_ID_PRODUCT = erlang\/otp
17ERLANG_INSTALL_STAGING = YES
18
19# windows specific issue: https://nvd.nist.gov/vuln/detail/CVE-2021-29221
20ERLANG_IGNORE_CVES += CVE-2021-29221
21
22# Remove the leftover deps directory from the ssl app
23# See https://bugs.erlang.org/browse/ERL-1168
24define ERLANG_REMOVE_SSL_DEPS
25	rm -rf $(@D)/lib/ssl/src/deps
26endef
27ERLANG_POST_PATCH_HOOKS += ERLANG_REMOVE_SSL_DEPS
28
29# Patched erts/aclocal.m4
30define ERLANG_RUN_AUTOCONF
31	cd $(@D) && PATH=$(BR_PATH) ./otp_build autoconf
32endef
33ERLANG_DEPENDENCIES += host-autoconf
34ERLANG_PRE_CONFIGURE_HOOKS += ERLANG_RUN_AUTOCONF
35HOST_ERLANG_DEPENDENCIES += host-autoconf
36HOST_ERLANG_PRE_CONFIGURE_HOOKS += ERLANG_RUN_AUTOCONF
37
38# Whenever updating Erlang, this value should be updated as well, to the
39# value of EI_VSN in the file lib/erl_interface/vsn.mk
40ERLANG_EI_VSN = 3.13.1
41
42# The configure checks for these functions fail incorrectly
43ERLANG_CONF_ENV = ac_cv_func_isnan=yes ac_cv_func_isinf=yes
44
45# Set erl_xcomp variables. See xcomp/erl-xcomp.conf.template
46# for documentation.
47ERLANG_CONF_ENV += erl_xcomp_sysroot=$(STAGING_DIR)
48
49ERLANG_CONF_OPTS = --without-javac
50
51# Force ERL_TOP to the downloaded source directory. This prevents
52# Erlang's configure script from inadvertantly using files from
53# a version of Erlang installed on the host.
54ERLANG_CONF_ENV += ERL_TOP=$(@D)
55HOST_ERLANG_CONF_ENV += ERL_TOP=$(@D)
56
57# erlang uses openssl for all things crypto. Since the host tools (such as
58# rebar) uses crypto, we need to build host-erlang with support for openssl.
59HOST_ERLANG_DEPENDENCIES += host-openssl
60HOST_ERLANG_CONF_OPTS = --without-javac --with-ssl=$(HOST_DIR)
61
62HOST_ERLANG_CONF_OPTS += --without-termcap
63
64ifeq ($(BR2_PACKAGE_NCURSES),y)
65ERLANG_CONF_OPTS += --with-termcap
66ERLANG_DEPENDENCIES += ncurses
67else
68ERLANG_CONF_OPTS += --without-termcap
69endif
70
71ifeq ($(BR2_PACKAGE_OPENSSL),y)
72ERLANG_CONF_OPTS += --with-ssl
73ERLANG_DEPENDENCIES += openssl
74else
75ERLANG_CONF_OPTS += --without-ssl
76endif
77
78ifeq ($(BR2_PACKAGE_UNIXODBC),y)
79ERLANG_DEPENDENCIES += unixodbc
80ERLANG_CONF_OPTS += --with-odbc
81else
82ERLANG_CONF_OPTS += --without-odbc
83endif
84
85# Always use Buildroot's zlib
86ERLANG_CONF_OPTS += --disable-builtin-zlib
87ERLANG_DEPENDENCIES += zlib
88
89# Remove source, example, gs and wx files from staging and target.
90ERLANG_REMOVE_PACKAGES = gs wx
91
92ifneq ($(BR2_PACKAGE_ERLANG_MEGACO),y)
93ERLANG_REMOVE_PACKAGES += megaco
94endif
95
96define ERLANG_REMOVE_STAGING_UNUSED
97	for package in $(ERLANG_REMOVE_PACKAGES); do \
98		rm -rf $(STAGING_DIR)/usr/lib/erlang/lib/$${package}-*; \
99	done
100endef
101
102define ERLANG_REMOVE_TARGET_UNUSED
103	find $(TARGET_DIR)/usr/lib/erlang -type d -name src -prune -exec rm -rf {} \;
104	find $(TARGET_DIR)/usr/lib/erlang -type d -name examples -prune -exec rm -rf {} \;
105	for package in $(ERLANG_REMOVE_PACKAGES); do \
106		rm -rf $(TARGET_DIR)/usr/lib/erlang/lib/$${package}-*; \
107	done
108endef
109
110ERLANG_POST_INSTALL_STAGING_HOOKS += ERLANG_REMOVE_STAGING_UNUSED
111ERLANG_POST_INSTALL_TARGET_HOOKS += ERLANG_REMOVE_TARGET_UNUSED
112
113$(eval $(autotools-package))
114$(eval $(host-autotools-package))
115