erlang.mk 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ################################################################################
  2. #
  3. # erlang
  4. #
  5. ################################################################################
  6. ERLANG_VERSION = 26.0.2
  7. ERLANG_RELEASE = $(firstword $(subst ., ,$(ERLANG_VERSION)))
  8. ERLANG_SITE = \
  9. https://github.com/erlang/otp/releases/download/OTP-$(ERLANG_VERSION)
  10. ERLANG_SOURCE = otp_src_$(ERLANG_VERSION).tar.gz
  11. ERLANG_DEPENDENCIES = host-erlang
  12. ERLANG_LICENSE = Apache-2.0
  13. ERLANG_LICENSE_FILES = LICENSE.txt
  14. ERLANG_CPE_ID_VENDOR = erlang
  15. ERLANG_CPE_ID_PRODUCT = erlang\/otp
  16. ERLANG_INSTALL_STAGING = YES
  17. define ERLANG_FIX_AUTOCONF_VERSION
  18. $(SED) "s/USE_AUTOCONF_VERSION=.*/USE_AUTOCONF_VERSION=$(AUTOCONF_VERSION)/" $(@D)/otp_build
  19. endef
  20. # Patched erts/aclocal.m4
  21. define ERLANG_RUN_AUTOCONF
  22. cd $(@D) && PATH=$(BR_PATH) ./otp_build update_configure --no-commit
  23. endef
  24. ERLANG_DEPENDENCIES += host-autoconf
  25. ERLANG_PRE_CONFIGURE_HOOKS += \
  26. ERLANG_FIX_AUTOCONF_VERSION \
  27. ERLANG_RUN_AUTOCONF
  28. HOST_ERLANG_DEPENDENCIES += host-autoconf
  29. HOST_ERLANG_PRE_CONFIGURE_HOOKS += \
  30. ERLANG_FIX_AUTOCONF_VERSION \
  31. ERLANG_RUN_AUTOCONF
  32. # Return the EIV (Erlang Interface Version, EI_VSN)
  33. # $(1): base directory, i.e. either $(HOST_DIR) or $(STAGING_DIR)/usr
  34. erlang_ei_vsn = `sed -r -e '/^erl_interface-(.+)/!d; s//\1/' $(1)/lib/erlang/releases/$(ERLANG_RELEASE)/installed_application_versions`
  35. # The configure checks for these functions fail incorrectly
  36. ERLANG_CONF_ENV = ac_cv_func_isnan=yes ac_cv_func_isinf=yes
  37. # Set erl_xcomp variables. See xcomp/erl-xcomp.conf.template
  38. # for documentation.
  39. ERLANG_CONF_ENV += erl_xcomp_sysroot=$(STAGING_DIR)
  40. ERLANG_CONF_OPTS = --without-javac
  41. # Force ERL_TOP to the downloaded source directory. This prevents
  42. # Erlang's configure script from inadvertently using files from
  43. # a version of Erlang installed on the host.
  44. ERLANG_CONF_ENV += ERL_TOP=$(@D)
  45. HOST_ERLANG_CONF_ENV += ERL_TOP=$(@D)
  46. # erlang uses openssl for all things crypto. Since the host tools (such as
  47. # rebar) uses crypto, we need to build host-erlang with support for openssl.
  48. HOST_ERLANG_DEPENDENCIES += host-openssl
  49. HOST_ERLANG_CONF_OPTS = --without-javac --with-ssl=$(HOST_DIR)
  50. HOST_ERLANG_CONF_OPTS += --without-termcap
  51. ifeq ($(BR2_PACKAGE_NCURSES),y)
  52. ERLANG_CONF_OPTS += --with-termcap
  53. ERLANG_DEPENDENCIES += ncurses
  54. else
  55. ERLANG_CONF_OPTS += --without-termcap
  56. endif
  57. ifeq ($(BR2_PACKAGE_OPENSSL),y)
  58. ERLANG_CONF_OPTS += --with-ssl
  59. ERLANG_DEPENDENCIES += openssl
  60. else
  61. ERLANG_CONF_OPTS += --without-ssl
  62. endif
  63. ifeq ($(BR2_PACKAGE_UNIXODBC),y)
  64. ERLANG_DEPENDENCIES += unixodbc
  65. ERLANG_CONF_OPTS += --with-odbc
  66. else
  67. ERLANG_CONF_OPTS += --without-odbc
  68. endif
  69. # Always use Buildroot's zlib
  70. ERLANG_CONF_OPTS += --disable-builtin-zlib
  71. ERLANG_DEPENDENCIES += zlib
  72. # Remove source, example, gs and wx files from staging and target.
  73. ERLANG_REMOVE_PACKAGES = gs wx
  74. ifneq ($(BR2_PACKAGE_ERLANG_MEGACO),y)
  75. ERLANG_REMOVE_PACKAGES += megaco
  76. endif
  77. define ERLANG_REMOVE_STAGING_UNUSED
  78. for package in $(ERLANG_REMOVE_PACKAGES); do \
  79. rm -rf $(STAGING_DIR)/usr/lib/erlang/lib/$${package}-*; \
  80. done
  81. endef
  82. define ERLANG_REMOVE_TARGET_UNUSED
  83. find $(TARGET_DIR)/usr/lib/erlang -type d -name src -prune -exec rm -rf {} \;
  84. find $(TARGET_DIR)/usr/lib/erlang -type d -name examples -prune -exec rm -rf {} \;
  85. for package in $(ERLANG_REMOVE_PACKAGES); do \
  86. rm -rf $(TARGET_DIR)/usr/lib/erlang/lib/$${package}-*; \
  87. done
  88. endef
  89. ERLANG_POST_INSTALL_STAGING_HOOKS += ERLANG_REMOVE_STAGING_UNUSED
  90. ERLANG_POST_INSTALL_TARGET_HOOKS += ERLANG_REMOVE_TARGET_UNUSED
  91. $(eval $(autotools-package))
  92. $(eval $(host-autotools-package))