PKG_NAME = elixir
PKG_VERS = 1.15.8
PKG_EXT = tar.gz
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/elixir-lang/elixir/archive
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS = native/erlang

HOMEPAGE = https://elixir-lang.org
COMMENT  = Elixir is a dynamic, functional language designed for building scalable and maintainable applications. Elixir leverages the Erlang VM, known for running low-latency, distributed and fault-tolerant systems, while also being successfully used in web development and the embedded software domain.

LICENSE = Apache 2.0
# Elixir's Makefile has .NOTPARALLEL: compile due to bootstrap dependencies
# but make -j can override this, causing race conditions during the bootstrap phase
DISABLE_PARALLEL_MAKE = 1

ERLANG_BIN_DIR = $(realpath $(WORK_DIR)/../../../native/erlang/work-native/install/usr/local/bin)

CONFIGURE_TARGET = nop
INSTALL_ARGS = install DESTDIR=$(INSTALL_DIR) PREFIX=$(INSTALL_PREFIX)

# REMARKS: 
# build fails in native/elixir folder due to ERLANG_BIN_DIR, 
# but succeeds in dependencies folders (i.e. cross/rabbitmq and spk/rabbitmq)
ENV += PATH=$$PATH:$(ERLANG_BIN_DIR)
# build fails in dependencies folders (i.e. spk/rabbitmq) due to missing HOME,
# but succeeds in native/elixir folder
ENV += HOME=$(WORK_DIR)
ENV += LANG=C.UTF-8

include ../../mk/spksrc.native-cc.mk
