diff mbox

[v4,02/17] package/erlang-rebar: new host package

Message ID 1418135662-773-3-git-send-email-johan.oudinet@gmail.com
State Superseded
Headers show

Commit Message

Johan Oudinet Dec. 9, 2014, 2:34 p.m. UTC
From: "Yann E. MORIN" <yann.morin.1998@free.fr>

rebar is used to compile Erlang packages.

We need  host variant so as to be able to provide it to Erlang packages
that do not bundle their own version, or bundle a broken version.

Since this is a host-only package, used only internally, we do not
provide a Kconfig option for it. Packages that need it will depend on
it.

Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
[yann.morin.1998@free.fr: extract host-rebar to its own patch]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle <arnout@mind.be>

---
Changes v2 -> v3:
  - fix dependencies  (Arnout)
  - fix download location
  - add licencing info
  - add comments

Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
---
 package/erlang-rebar/erlang-rebar.mk | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 package/erlang-rebar/erlang-rebar.mk

Comments

Thomas Petazzoni Dec. 22, 2014, 2:16 p.m. UTC | #1
Dear Johan Oudinet,

On Tue,  9 Dec 2014 15:34:07 +0100, Johan Oudinet wrote:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> rebar is used to compile Erlang packages.
> 
> We need  host variant so as to be able to provide it to Erlang packages
> that do not bundle their own version, or bundle a broken version.
> 
> Since this is a host-only package, used only internally, we do not
> provide a Kconfig option for it. Packages that need it will depend on
> it.
> 
> Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
> [yann.morin.1998@free.fr: extract host-rebar to its own patch]
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Arnout Vandecappelle <arnout@mind.be>

Thanks, patch applied.

There's one thing I've noticed though: trying to run the 'rebar' binary
doesn't work:

$ LANG=C ./output/host/usr/bin/rebar 
/usr/bin/env: escript: No such file or directory

This is obviously due to:

#!/usr/bin/env escript

at the beginning of the rebar binary, and the fact that
output/host/usr/bin is not in my PATH.
Executing ./output/host/usr/bin/escript ./output/host/usr/bin/rebar
works fine. This is not a problem for Buildroot packages, as
$(HOST_DIR)/usr/bin will be in the PATH. Not sure if it's worth fixing
for other use cases.

Best regards,

Thomas
diff mbox

Patch

diff --git a/package/erlang-rebar/erlang-rebar.mk b/package/erlang-rebar/erlang-rebar.mk
new file mode 100644
index 0000000..f29eb75
--- /dev/null
+++ b/package/erlang-rebar/erlang-rebar.mk
@@ -0,0 +1,31 @@ 
+################################################################################
+#
+# erlang-rebar
+#
+################################################################################
+
+ERLANG_REBAR_VERSION = 2.5.1
+
+# Upstream publishes a release, but we can not use it as it is a release of
+# a generated rebar script, when we want the sources. So we have to use the
+# gihub helper in this case.
+ERLANG_REBAR_SITE = $(call github,rebar,rebar,$(ERLANG_REBAR_VERSION))
+
+# Although the file LICENSE state Apache-2.0, a lot (if not all) the files
+# in src/ bear the MIT licence.
+ERLANG_LICENSE = Apache-2.0, MIT
+ERLANG_LICENSE_FILES = LICENSE
+
+# We do not have a target variant, so just define the dependencies,
+# configure and build commands for the host variant.
+HOST_ERLANG_REBAR_DEPENDENCIES = host-erlang
+
+define HOST_ERLANG_REBAR_BUILD_CMDS
+	cd $(@D) && $(HOST_MAKE_ENV) $(MAKE)
+endef
+
+define HOST_ERLANG_REBAR_INSTALL_CMDS
+	$(INSTALL) -m 0755 -D $(@D)/rebar $(HOST_DIR)/usr/bin/rebar
+endef
+
+$(eval $(host-generic-package))