Update erlang.mk

This commit is contained in:
Gerhard Lazu 2020-03-06 09:18:22 +00:00
parent e9e7d92263
commit c461ccab0a
No known key found for this signature in database
GPG Key ID: A28DE70C9444D7A6
1 changed files with 142 additions and 29 deletions

171
erlang.mk vendored
View File

@ -17,7 +17,7 @@
ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST)))
export ERLANG_MK_FILENAME
ERLANG_MK_VERSION = 2.0.0-pre.2-495-g8217957
ERLANG_MK_VERSION = 2019.07.01-18-g7edc30a
ERLANG_MK_WITHOUT =
# Make 3.81 and 3.82 are deprecated.
@ -66,7 +66,7 @@ export ERLANG_MK_TMP
# "erl" command.
ERL = erl +A0 -noinput -boot start_clean
ERL = erl +A1 -noinput -boot no_dot_erlang
# Platform detection.
@ -1236,9 +1236,9 @@ pkg_elixir_commit = master
PACKAGES += elli
pkg_elli_name = elli
pkg_elli_description = Simple, robust and performant Erlang web server
pkg_elli_homepage = https://github.com/knutin/elli
pkg_elli_homepage = https://github.com/elli-lib/elli
pkg_elli_fetch = git
pkg_elli_repo = https://github.com/knutin/elli
pkg_elli_repo = https://github.com/elli-lib/elli
pkg_elli_commit = master
PACKAGES += elvis
@ -2811,11 +2811,11 @@ pkg_myproto_commit = master
PACKAGES += mysql
pkg_mysql_name = mysql
pkg_mysql_description = Erlang MySQL Driver (from code.google.com)
pkg_mysql_homepage = https://github.com/dizzyd/erlang-mysql-driver
pkg_mysql_description = MySQL client library for Erlang/OTP
pkg_mysql_homepage = https://github.com/mysql-otp/mysql-otp
pkg_mysql_fetch = git
pkg_mysql_repo = https://github.com/dizzyd/erlang-mysql-driver
pkg_mysql_commit = master
pkg_mysql_repo = https://github.com/mysql-otp/mysql-otp
pkg_mysql_commit = 1.5.1
PACKAGES += n2o
pkg_n2o_name = n2o
@ -3025,6 +3025,14 @@ pkg_parsexml_fetch = git
pkg_parsexml_repo = https://github.com/maxlapshin/parsexml
pkg_parsexml_commit = master
PACKAGES += partisan
pkg_partisan_name = partisan
pkg_partisan_description = High-performance, high-scalability distributed computing with Erlang and Elixir.
pkg_partisan_homepage = http://partisan.cloud
pkg_partisan_fetch = git
pkg_partisan_repo = https://github.com/lasp-lang/partisan
pkg_partisan_commit = master
PACKAGES += pegjs
pkg_pegjs_name = pegjs
pkg_pegjs_description = An implementation of PEG.js grammar for Erlang.
@ -3145,6 +3153,14 @@ pkg_procket_fetch = git
pkg_procket_repo = https://github.com/msantos/procket
pkg_procket_commit = master
PACKAGES += prometheus
pkg_prometheus_name = prometheus
pkg_prometheus_description = Prometheus.io client in Erlang
pkg_prometheus_homepage = https://github.com/deadtrickster/prometheus.erl
pkg_prometheus_fetch = git
pkg_prometheus_repo = https://github.com/deadtrickster/prometheus.erl
pkg_prometheus_commit = master
PACKAGES += prop
pkg_prop_name = prop
pkg_prop_description = An Erlang code scaffolding and generator system.
@ -4330,9 +4346,64 @@ $(foreach p,$(DEP_EARLY_PLUGINS),\
$(call core_dep_plugin,$p,$(firstword $(subst /, ,$p))),\
$(call core_dep_plugin,$p/early-plugins.mk,$p))))
dep_name = $(if $(dep_$(1)),$(1),$(if $(pkg_$(1)_name),$(pkg_$(1)_name),$(1)))
dep_repo = $(patsubst git://github.com/%,https://github.com/%, \
$(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo)))
# Query functions.
query_fetch_method = $(if $(dep_$(1)),$(call _qfm_dep,$(word 1,$(dep_$(1)))),$(call _qfm_pkg,$(1)))
_qfm_dep = $(if $(dep_fetch_$(1)),$(1),$(if $(IS_DEP),legacy,fail))
_qfm_pkg = $(if $(pkg_$(1)_fetch),$(pkg_$(1)_fetch),fail)
query_name = $(if $(dep_$(1)),$(1),$(if $(pkg_$(1)_name),$(pkg_$(1)_name),$(1)))
query_repo = $(call _qr,$(1),$(call query_fetch_method,$(1)))
_qr = $(if $(query_repo_$(2)),$(call query_repo_$(2),$(1)),$(call dep_repo,$(1)))
query_repo_default = $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo))
query_repo_git = $(patsubst git://github.com/%,https://github.com/%,$(call query_repo_default,$(1)))
query_repo_git-subfolder = $(call query_repo_git,$(1))
query_repo_git-submodule = -
query_repo_hg = $(call query_repo_default,$(1))
query_repo_svn = $(call query_repo_default,$(1))
query_repo_cp = $(call query_repo_default,$(1))
query_repo_ln = $(call query_repo_default,$(1))
query_repo_hex = https://hex.pm/packages/$(if $(word 3,$(dep_$(1))),$(word 3,$(dep_$(1))),$(1))
query_repo_fail = -
query_repo_legacy = -
query_version = $(call _qv,$(1),$(call query_fetch_method,$(1)))
_qv = $(if $(query_version_$(2)),$(call query_version_$(2),$(1)),$(call dep_commit,$(1)))
query_version_default = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit)))
query_version_git = $(call query_version_default,$(1))
query_version_git-subfolder = $(call query_version_git,$(1))
query_version_git-submodule = -
query_version_hg = $(call query_version_default,$(1))
query_version_svn = -
query_version_cp = -
query_version_ln = -
query_version_hex = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_commit)))
query_version_fail = -
query_version_legacy = -
query_extra = $(call _qe,$(1),$(call query_fetch_method,$(1)))
_qe = $(if $(query_extra_$(2)),$(call query_extra_$(2),$(1)),-)
query_extra_git = -
query_extra_git-subfolder = $(if $(dep_$(1)),subfolder=$(word 4,$(dep_$(1))),-)
query_extra_git-submodule = -
query_extra_hg = -
query_extra_svn = -
query_extra_cp = -
query_extra_ln = -
query_extra_hex = $(if $(dep_$(1)),package-name=$(word 3,$(dep_$(1))),-)
query_extra_fail = -
query_extra_legacy = -
query_absolute_path = $(addprefix $(DEPS_DIR)/,$(call query_name,$(1)))
# Deprecated legacy query functions.
dep_fetch = $(call query_fetch_method,$(1))
dep_name = $(call query_name,$(1))
dep_repo = $(call query_repo_git,$(1))
dep_commit = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(if $(filter hex,$(word 1,$(dep_$(1)))),$(word 2,$(dep_$(1))),$(word 3,$(dep_$(1)))),$(pkg_$(1)_commit)))
LOCAL_DEPS_DIRS = $(foreach a,$(LOCAL_DEPS),$(if $(wildcard $(APPS_DIR)/$(a)),$(APPS_DIR)/$(a)))
@ -4609,7 +4680,7 @@ define dep_autopatch_rebar.erl
end,
Write("\n")
end(),
GetHexVsn = fun(N) ->
GetHexVsn = fun(N, NP) ->
case file:consult("$(call core_native_path,$(DEPS_DIR)/$1/rebar.lock)") of
{ok, Lock} ->
io:format("~p~n", [Lock]),
@ -4619,7 +4690,7 @@ define dep_autopatch_rebar.erl
case lists:keyfind(atom_to_binary(N, latin1), 1, LockPkgs) of
{_, {pkg, _, Vsn}, _} ->
io:format("~p~n", [Vsn]),
{N, {hex, binary_to_list(Vsn)}};
{N, {hex, NP, binary_to_list(Vsn)}};
_ ->
false
end;
@ -4648,9 +4719,10 @@ define dep_autopatch_rebar.erl
false -> [];
{_, Deps} ->
[begin case case Dep of
N when is_atom(N) -> GetHexVsn(N);
{N, S} when is_atom(N), is_list(S) -> {N, {hex, SemVsn(S)}};
{_, S, {pkg, N}} -> {N, {hex, S}};
N when is_atom(N) -> GetHexVsn(N, N);
{N, S} when is_atom(N), is_list(S) -> {N, {hex, N, SemVsn(S)}};
{N, {pkg, NP}} when is_atom(N) -> GetHexVsn(N, NP);
{N, S, {pkg, NP}} -> {N, {hex, NP, S}};
{N, S} when is_tuple(S) -> {N, S};
{N, _, S} -> {N, S};
{N, _, S, _} -> {N, S};
@ -4659,7 +4731,7 @@ define dep_autopatch_rebar.erl
false -> ok;
{Name, Source} ->
{Method, Repo, Commit} = case Source of
{hex, V} -> {hex, V, undefined};
{hex, NPV, V} -> {hex, V, NPV};
{git, R} -> {git, R, master};
{M, R, {branch, C}} -> {M, R, C};
{M, R, {ref, C}} -> {M, R, C};
@ -4940,7 +5012,7 @@ endef
define dep_fetch_hex
mkdir -p $(ERLANG_MK_TMP)/hex $(DEPS_DIR)/$1; \
$(call core_http_get,$(ERLANG_MK_TMP)/hex/$1.tar,\
https://repo.hex.pm/tarballs/$1-$(strip $(word 2,$(dep_$1))).tar); \
https://repo.hex.pm/tarballs/$(if $(word 3,$(dep_$1)),$(word 3,$(dep_$1)),$1)-$(strip $(word 2,$(dep_$1))).tar); \
tar -xOf $(ERLANG_MK_TMP)/hex/$1.tar contents.tar.gz | tar -C $(DEPS_DIR)/$1 -xzf -;
endef
@ -4956,16 +5028,6 @@ define dep_fetch_legacy
cd $(DEPS_DIR)/$(1) && git checkout -q $(if $(word 2,$(dep_$(1))),$(word 2,$(dep_$(1))),master);
endef
define dep_fetch
$(if $(dep_$(1)), \
$(if $(dep_fetch_$(word 1,$(dep_$(1)))), \
$(word 1,$(dep_$(1))), \
$(if $(IS_DEP),legacy,fail)), \
$(if $(filter $(1),$(PACKAGES)), \
$(pkg_$(1)_fetch), \
fail))
endef
define dep_target
$(DEPS_DIR)/$(call dep_name,$1): | $(ERLANG_MK_TMP)
$(eval DEP_NAME := $(call dep_name,$1))
@ -5048,6 +5110,12 @@ ERLANG_MK_RECURSIVE_REL_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-rel-deps-list.log
ERLANG_MK_RECURSIVE_TEST_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-test-deps-list.log
ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-shell-deps-list.log
ERLANG_MK_QUERY_DEPS_FILE = $(ERLANG_MK_TMP)/query-deps.log
ERLANG_MK_QUERY_DOC_DEPS_FILE = $(ERLANG_MK_TMP)/query-doc-deps.log
ERLANG_MK_QUERY_REL_DEPS_FILE = $(ERLANG_MK_TMP)/query-rel-deps.log
ERLANG_MK_QUERY_TEST_DEPS_FILE = $(ERLANG_MK_TMP)/query-test-deps.log
ERLANG_MK_QUERY_SHELL_DEPS_FILE = $(ERLANG_MK_TMP)/query-shell-deps.log
# Copyright (c) 2013-2016, Loïc Hoguin <essen@ninenines.eu>
# This file is part of erlang.mk and subject to the terms of the ISC License.
@ -5381,6 +5449,9 @@ else
| sed "s/{id,[[:space:]]*\"git\"}/{id, \"$(subst /,\/,$(GITDESCRIBE))\"}/" \
> ebin/$(PROJECT).app
endif
ifneq ($(wildcard src/$(PROJECT).appup),)
$(verbose) cp src/$(PROJECT).appup ebin/
endif
clean:: clean-app
@ -6232,7 +6303,7 @@ app:: $(C_SRC_ENV) $(C_SRC_OUTPUT_FILE)
test-build:: $(C_SRC_ENV) $(C_SRC_OUTPUT_FILE)
$(C_SRC_OUTPUT_FILE): $(OBJECTS)
$(verbose) mkdir -p priv/
$(verbose) mkdir -p $(dir $@)
$(link_verbose) $(CC) $(OBJECTS) \
$(LDFLAGS) $(if $(filter $(C_SRC_TYPE),shared),-shared) $(LDLIBS) \
-o $(C_SRC_OUTPUT_FILE)
@ -6894,6 +6965,7 @@ proto_verbose = $(proto_verbose_$(V))
# Core targets.
ifneq ($(wildcard src/),)
ifneq ($(filter gpb protobuffs,$(BUILD_DEPS) $(DEPS)),)
PROTO_FILES := $(filter %.proto,$(ALL_SRC_FILES))
ERL_FILES += $(addprefix src/,$(patsubst %.proto,%_pb.erl,$(notdir $(PROTO_FILES))))
@ -6940,6 +7012,7 @@ $(PROJECT).d:: $(PROTO_FILES)
$(if $(strip $?),$(proto_verbose) $(call erlang,$(call compile_proto.erl,$?)))
endif
endif
endif
# Copyright (c) 2013-2016, Loïc Hoguin <essen@ninenines.eu>
# This file is part of erlang.mk and subject to the terms of the ISC License.
@ -7597,3 +7670,43 @@ list-shell-deps: $(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST)
list-deps list-doc-deps list-rel-deps list-test-deps list-shell-deps:
$(verbose) cat $^
# Query dependencies recursively.
.PHONY: query-deps query-doc-deps query-rel-deps query-test-deps \
query-shell-deps
QUERY ?= name fetch_method repo version
define query_target
$(1): $(2) clean-tmp-query.log
ifeq ($(IS_APP)$(IS_DEP),)
$(verbose) rm -f $(4)
endif
$(verbose) $(foreach dep,$(3),\
echo $(PROJECT): $(foreach q,$(QUERY),$(call query_$(q),$(dep))) >> $(4) ;)
$(if $(filter-out query-deps,$(1)),,\
$(verbose) set -e; for dep in $(3) ; do \
if grep -qs ^$$$$dep$$$$ $(ERLANG_MK_TMP)/query.log; then \
:; \
else \
echo $$$$dep >> $(ERLANG_MK_TMP)/query.log; \
$(MAKE) -C $(DEPS_DIR)/$$$$dep $$@ QUERY="$(QUERY)" IS_DEP=1 || true; \
fi \
done)
ifeq ($(IS_APP)$(IS_DEP),)
$(verbose) touch $(4)
$(verbose) cat $(4)
endif
endef
clean-tmp-query.log:
ifeq ($(IS_DEP),)
$(verbose) rm -f $(ERLANG_MK_TMP)/query.log
endif
$(eval $(call query_target,query-deps,$(ERLANG_MK_RECURSIVE_DEPS_LIST),$(BUILD_DEPS) $(DEPS),$(ERLANG_MK_QUERY_DEPS_FILE)))
$(eval $(call query_target,query-doc-deps,$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST),$(DOC_DEPS),$(ERLANG_MK_QUERY_DOC_DEPS_FILE)))
$(eval $(call query_target,query-rel-deps,$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST),$(REL_DEPS),$(ERLANG_MK_QUERY_REL_DEPS_FILE)))
$(eval $(call query_target,query-test-deps,$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST),$(TEST_DEPS),$(ERLANG_MK_QUERY_TEST_DEPS_FILE)))
$(eval $(call query_target,query-shell-deps,$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST),$(SHELL_DEPS),$(ERLANG_MK_QUERY_SHELL_DEPS_FILE)))