Skip to contentSkip to conversation

ejabberd: XMPP server

PATCH Superseded Johan Oudinet 3 participants 33 messages Nov 7, 2014 – Nov 12, 2014

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover ejabberd: XMPP server

Since ejabberd build system relies on rebar to download its dependencies, we've packaged all of them separately and modified ejabberd makefile to not download any dependency.

Actually, every erlang package that is introduced here rely on the rebar software. Thus, we also introduce a new infrastructure to simplify the development of such packages in buildroot.

Changes v1 -> v2:
- use BR_PATH instead of an hard-coded path in pkg-rebar.mk.
- update erlang-p1-iconv version to fix a link error with libiconv.

Johan Oudinet (15):
package/pkg-autotools.mk: Factorize hooks.
package/pkg-rebar.mk: new infrastructure.
erlang-goldrush: new package.
erlang-lager: new package.
erlang-p1-zlib: new package.
erlang-p1-yaml: new package.
erlang-p1-xml: new package.
erlang-p1-utils: new package.
erlang-p1-tls: new package.
erlang-p1-stun: new package.
erlang-p1-stringprep: new package.
erlang-p1-sip: new package.
erlang-p1-iconv: new package.
erlang-p1-cache-tab: new package.
ejabberd: new package.

 docs/manual/adding-packages-rebar.txt              | 157 ++++++++++++++
 docs/manual/adding-packages.txt                    |   2 +
 package/Config.in                                  |  17 ++
 package/Makefile.in                                |   1 +
 package/ejabberd/0001-remove-deps.patch            |  20 ++
 package/ejabberd/0002-disable-rebar-deps.patch     |  70 +++++++
 package/ejabberd/0003-disable-test.patch           |  21 ++
 package/ejabberd/0004-disable-version-check.patch  |  20 ++
 package/ejabberd/0005-fix-includes.patch           |  45 ++++
 package/ejabberd/0006-remove-doc.patch             |  26 +++
 package/ejabberd/0007-fix-init.patch               |  99 +++++++++
 .../ejabberd/0008-fix-install-permissions.patch    |  76 +++++++
 package/ejabberd/Config.in                         |  21 ++
 package/ejabberd/S50ejabberd                       |  35 ++++
 package/ejabberd/check-erlang-lib                  |  55 +++++
 package/ejabberd/ejabberd.mk                       |  51 +++++
 package/erlang-goldrush/Config.in                  |   6 +
 package/erlang-goldrush/erlang-goldrush.mk         |  14 ++
 package/erlang-lager/Config.in                     |  12 ++
 package/erlang-lager/erlang-lager.mk               |  14 ++
 package/erlang-p1-cache-tab/Config.in              |   6 +
 package/erlang-p1-cache-tab/erlang-p1-cache-tab.mk |  13 ++
 package/erlang-p1-iconv/Config.in                  |   6 +
 package/erlang-p1-iconv/erlang-p1-iconv.mk         |  17 ++
 package/erlang-p1-sip/Config.in                    |   8 +
 .../erlang-p1-sip-01-fix-includes.patch            |  19 ++
 package/erlang-p1-sip/erlang-p1-sip.mk             |  14 ++
 package/erlang-p1-stringprep/Config.in             |   5 +
 .../erlang-p1-stringprep/erlang-p1-stringprep.mk   |  13 ++
 package/erlang-p1-stun/Config.in                   |   7 +
 package/erlang-p1-stun/erlang-p1-stun.mk           |  14 ++
 package/erlang-p1-tls/Config.in                    |   5 +
 package/erlang-p1-tls/erlang-p1-tls.mk             |  14 ++
 package/erlang-p1-utils/Config.in                  |   5 +
 package/erlang-p1-utils/erlang-p1-utils.mk         |  14 ++
 package/erlang-p1-xml/Config.in                    |   6 +
 package/erlang-p1-xml/erlang-p1-xml.mk             |  14 ++
 package/erlang-p1-yaml/Config.in                   |   6 +
 package/erlang-p1-yaml/erlang-p1-yaml.mk           |  13 ++
 package/erlang-p1-zlib/Config.in                   |   5 +
 package/erlang-p1-zlib/erlang-p1-zlib.mk           |  13 ++
 package/erlang-rebar/erlang-rebar.mk               |  20 ++
 package/pkg-autotools.mk                           | 119 +++++------
 package/pkg-rebar.mk                               | 229 +++++++++++++++++++++
 support/scripts/erlang-ei-vsn                      |  19 ++
 45 files changed, 1303 insertions(+), 63 deletions(-)
 create mode 100644 docs/manual/adding-packages-rebar.txt
 create mode 100644 package/ejabberd/0001-remove-deps.patch
 create mode 100644 package/ejabberd/0002-disable-rebar-deps.patch
 create mode 100644 package/ejabberd/0003-disable-test.patch
 create mode 100644 package/ejabberd/0004-disable-version-check.patch
 create mode 100644 package/ejabberd/0005-fix-includes.patch
 create mode 100644 package/ejabberd/0006-remove-doc.patch
 create mode 100644 package/ejabberd/0007-fix-init.patch
 create mode 100644 package/ejabberd/0008-fix-install-permissions.patch
 create mode 100644 package/ejabberd/Config.in
 create mode 100644 package/ejabberd/S50ejabberd
 create mode 100755 package/ejabberd/check-erlang-lib
 create mode 100644 package/ejabberd/ejabberd.mk
 create mode 100644 package/erlang-goldrush/Config.in
 create mode 100644 package/erlang-goldrush/erlang-goldrush.mk
 create mode 100644 package/erlang-lager/Config.in
 create mode 100644 package/erlang-lager/erlang-lager.mk
 create mode 100644 package/erlang-p1-cache-tab/Config.in
 create mode 100644 package/erlang-p1-cache-tab/erlang-p1-cache-tab.mk
 create mode 100644 package/erlang-p1-iconv/Config.in
 create mode 100644 package/erlang-p1-iconv/erlang-p1-iconv.mk
 create mode 100644 package/erlang-p1-sip/Config.in
 create mode 100644 package/erlang-p1-sip/erlang-p1-sip-01-fix-includes.patch
 create mode 100644 package/erlang-p1-sip/erlang-p1-sip.mk
 create mode 100644 package/erlang-p1-stringprep/Config.in
 create mode 100644 package/erlang-p1-stringprep/erlang-p1-stringprep.mk
 create mode 100644 package/erlang-p1-stun/Config.in
 create mode 100644 package/erlang-p1-stun/erlang-p1-stun.mk
 create mode 100644 package/erlang-p1-tls/Config.in
 create mode 100644 package/erlang-p1-tls/erlang-p1-tls.mk
 create mode 100644 package/erlang-p1-utils/Config.in
 create mode 100644 package/erlang-p1-utils/erlang-p1-utils.mk
 create mode 100644 package/erlang-p1-xml/Config.in
 create mode 100644 package/erlang-p1-xml/erlang-p1-xml.mk
 create mode 100644 package/erlang-p1-yaml/Config.in
 create mode 100644 package/erlang-p1-yaml/erlang-p1-yaml.mk
 create mode 100644 package/erlang-p1-zlib/Config.in
 create mode 100644 package/erlang-p1-zlib/erlang-p1-zlib.mk
 create mode 100644 package/erlang-rebar/erlang-rebar.mk
 create mode 100644 package/pkg-rebar.mk
 create mode 100755 support/scripts/erlang-ei-vsn
Signature · 1 line
2.1.0
#1 lore raw

PATCH v2 1/15 package/pkg-autotools.mk: Factorize hooks.

Define common macros only once (instead of as many times as there are inner-autotools-package calls).
Factorize LIBTOOL_PATCH_HOOK and AUTORECONF_HOOK to avoid duplicated code.

---
 package/pkg-autotools.mk | 119 ++++++++++++++++++++++-------------------------
 1 file changed, 56 insertions(+), 63 deletions(-)
package/pkg-autotools.mk +56 -63
index 09f9412..65af6f0 100644
@@ -46,6 +46,57 @@ endef
 #	$(call AUTOCONF_AC_CHECK_FILE_VAL,/dev/random)=yes
 AUTOCONF_AC_CHECK_FILE_VAL = ac_cv_file_$(subst -,_,$(subst /,_,$(subst .,_,$(1))))
 
+# Recipe that patches libtool so it works properly with
+# cross-compilation.
+define PATCH_LIBTOOL
+	$(Q)if test "$($(PKG)_LIBTOOL_PATCH)" = "YES"; then \
+		for i in `find $($(PKG)_SRCDIR) -name ltmain.sh`; do \
+			ltmain_version=`sed -n '/^[ 	]*VERSION=/{s/^[ 	]*VERSION=//;p;q;}' $$$$i | \
+			sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
+			if test $${ltmain_version} = 1.5; then \
+				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
+			elif test $${ltmain_version} = 2.2; then\
+				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
+			elif test $${ltmain_version} = 2.4; then\
+				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
+			fi \
+		done \
+	fi
+endef
+
+#
+# Hook to update config.sub and config.guess if needed
+#
+define UPDATE_CONFIG_HOOK
+	@$(call MESSAGE,"Updating config.sub and config.guess")
+	$(call CONFIG_UPDATE,$(@D))
+endef
+
+#
+# Hook to patch libtool to make it work properly for cross-compilation
+#
+define LIBTOOL_PATCH_HOOK
+	@$(call MESSAGE,"Patching libtool")
+	$(call PATCH_LIBTOOL)
+endef
+
+#
+# Hook to gettextize the package if needed
+#
+define GETTEXTIZE_HOOK
+	@$(call MESSAGE,"Gettextizing")
+	$(Q)cd $($(PKG)_SRCDIR) && $(GETTEXTIZE) $($(PKG)_GETTEXTIZE_OPTS)
+endef
+
+#
+# Hook to autoreconf the package if needed
+#
+define AUTORECONF_HOOK
+	@$(call MESSAGE,"Autoreconfiguring")
+	$(Q)cd $($(PKG)_SRCDIR) && $($(PKG)_AUTORECONF_ENV) $(AUTORECONF) $($(PKG)_AUTORECONF_OPTS)
+	$(call PATCH_LIBTOOL)
+endef
+
 ################################################################################
 # inner-autotools-package -- defines how the configuration, compilation and
 # installation of an autotools package should be done, implements a
@@ -183,71 +234,8 @@ endef
 endif
 endif
 
-#
-# Hook to update config.sub and config.guess if needed
-#
-define UPDATE_CONFIG_HOOK
-	@$$(call MESSAGE,"Updating config.sub and config.guess")
-	$$(call CONFIG_UPDATE,$$(@D))
-endef
-
 $(2)_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
 
-#
-# Hook to patch libtool to make it work properly for cross-compilation
-#
-define LIBTOOL_PATCH_HOOK
-	@$$(call MESSAGE,"Patching libtool")
-	$$(Q)if test "$$($$(PKG)_LIBTOOL_PATCH)" = "YES" \
-		-a "$$($$(PKG)_AUTORECONF)" != "YES"; then \
-		for i in `find $$($$(PKG)_SRCDIR) -name ltmain.sh`; do \
-			ltmain_version=`sed -n '/^[ 	]*VERSION=/{s/^[ 	]*VERSION=//;p;q;}' $$$$i | \
-			sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
-			if test $$$${ltmain_version} = '1.5'; then \
-				$$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
-			elif test $$$${ltmain_version} = "2.2"; then\
-				$$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
-			elif test $$$${ltmain_version} = "2.4"; then\
-				$$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
-			fi \
-		done \
-	fi
-endef
-
-# default values are not evaluated yet, so don't rely on this defaulting to YES
-ifneq ($$($(2)_LIBTOOL_PATCH),NO)
-$(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
-endif
-
-#
-# Hook to gettextize the package if needed
-#
-define GETTEXTIZE_HOOK
-	@$$(call MESSAGE,"Gettextizing")
-	$(Q)cd $$($$(PKG)_SRCDIR) && $$(GETTEXTIZE) $$($$(PKG)_GETTEXTIZE_OPTS)
-endef
-
-#
-# Hook to autoreconf the package if needed
-#
-define AUTORECONF_HOOK
-	@$$(call MESSAGE,"Autoreconfiguring")
-	$$(Q)cd $$($$(PKG)_SRCDIR) && $$($$(PKG)_AUTORECONF_ENV) $$(AUTORECONF) $$($$(PKG)_AUTORECONF_OPTS)
-	$$(Q)if test "$$($$(PKG)_LIBTOOL_PATCH)" = "YES"; then \
-		for i in `find $$($$(PKG)_SRCDIR) -name ltmain.sh`; do \
-			ltmain_version=`sed -n '/^[ 	]*VERSION=/{s/^[ 	]*VERSION=//;p;q;}' $$$$i | \
-			sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
-			if test $$$${ltmain_version} = "1.5"; then \
-				$$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
-			elif test $$$${ltmain_version} = "2.2"; then\
-				$$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
-			elif test $$$${ltmain_version} = "2.4"; then\
-				$$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
-			fi \
-		done \
-	fi
-endef
-
 # This must be repeated from inner-generic-package, otherwise we get an empty
 # _DEPENDENCIES if _AUTORECONF is YES.  Also filter the result of _AUTORECONF
 # and _GETTEXTIZE away from the non-host rule
@@ -265,6 +253,11 @@ $(2)_DEPENDENCIES += host-gettext
 endif
 $(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK
 $(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
+else
+# default values are not evaluated yet, so don't rely on this defaulting to YES
+ifneq ($$($(2)_LIBTOOL_PATCH),NO)
+$(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
+endif
 endif
 
 #
Signature · 1 line
2.1.0
#2 lore raw

PATCH v2 1/15 package/pkg-autotools.mk: Factorize hooks.

Johan, All,

On 2014-11-07 14:28 +0100, Johan Oudinet spake thusly:

Quoted 4 lines

Define common macros only once (instead of as many times as there are inner-autotools-package calls).
Factorize LIBTOOL_PATCH_HOOK and AUTORECONF_HOOK to avoid duplicated code.

Sorry it takes so long to review this series. Touching the infra is not for the faint of heart, and reviews are really complex and time-consuming.

Quoted 36 lines
---
 package/pkg-autotools.mk | 119 ++++++++++++++++++++++-------------------------
 1 file changed, 56 insertions(+), 63 deletions(-)
package/pkg-autotools.mk +23 -0
index 09f9412..65af6f0 100644
@@ -46,6 +46,57 @@ endef
 #	$(call AUTOCONF_AC_CHECK_FILE_VAL,/dev/random)=yes
 AUTOCONF_AC_CHECK_FILE_VAL = ac_cv_file_$(subst -,_,$(subst /,_,$(subst .,_,$(1))))
 
+# Recipe that patches libtool so it works properly with
+# cross-compilation.
+define PATCH_LIBTOOL
+	$(Q)if test "$($(PKG)_LIBTOOL_PATCH)" = "YES"; then \
+		for i in `find $($(PKG)_SRCDIR) -name ltmain.sh`; do \
+			ltmain_version=`sed -n '/^[ 	]*VERSION=/{s/^[ 	]*VERSION=//;p;q;}' $$$$i | \
+			sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
+			if test $${ltmain_version} = 1.5; then \
+				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
+			elif test $${ltmain_version} = 2.2; then\
+				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
+			elif test $${ltmain_version} = 2.4; then\
+				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
+			fi \
+		done \
+	fi
+endef
+
+#
+# Hook to update config.sub and config.guess if needed
+#
+define UPDATE_CONFIG_HOOK
+	@$(call MESSAGE,"Updating config.sub and config.guess")

package/pkg-autotools.mk endef · line 81

Quoted 10 lines
package/pkg-autotools.mk +10 -0
+	$(call CONFIG_UPDATE,$(@D))
+endef
+
+#
+# Hook to patch libtool to make it work properly for cross-compilation
+#
+define LIBTOOL_PATCH_HOOK
+	@$(call MESSAGE,"Patching libtool")
+	$(call PATCH_LIBTOOL)
+endef

Hmm... This patch does nore than extract the definitions out of inner-autotools-package; it also reworks the way they are called.

I'd rather we get this split in at least two patches:
- one that does the move proper
- one that reworks the calls

It will be easier to review.

[--SNIP--]

package/pkg-autotools.mk $(2)_DEPENDENCIES += host-gettext · line 261

Quoted 10 lines
package/pkg-autotools.mk +5 -0
@@ -265,6 +253,11 @@ $(2)_DEPENDENCIES += host-gettext
 endif
 $(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK
 $(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
+else
+# default values are not evaluated yet, so don't rely on this defaulting to YES
+ifneq ($$($(2)_LIBTOOL_PATCH),NO)
+$(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
+endif
 endif

I think you got the order wrong here: we want the libtool patch to be applied _before_ we autoreconf.

So, this last if-block should be the very first thing to do right after:

    ifeq ($$($(2)_AUTORECONF),YES)

I'll do some more in-depth review later, presumably after you split the patch. If you don;t have time for that, I can see to get it done tomorrow.

Again, sorry for the delay, reviewing infra changes is really tricky...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v2 1/15 package/pkg-autotools.mk: Factorize hooks.

johan, All,

On 2014-11-10 23:13 +0100, Yann E. MORIN spake thusly:

Quoted 5 lines

On 2014-11-07 14:28 +0100, Johan Oudinet spake thusly:

Quoted 4 lines

Define common macros only once (instead of as many times as there are inner-autotools-package calls).
Factorize LIBTOOL_PATCH_HOOK and AUTORECONF_HOOK to avoid duplicated code.

[--SNIP--]

Quoted 3 lines

I'll do some more in-depth review later, presumably after you split the patch. If you don;t have time for that, I can see to get it done tomorrow.

So, are you working on this, or can I go hacking this?

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH v2 1/15 package/pkg-autotools.mk: Factorize hooks.

In reply to Yann E. MORIN

Hi Johan,

I'm mostly going to negate Yann's comments :-)

I also have a few additional remarks, but they're not for this patch and
probably not even for you.

Quoted 10 lines · Yann E. MORIN

Johan, All,

On 2014-11-07 14:28 +0100, Johan Oudinet spake thusly:

Quoted 4 lines

Define common macros only once (instead of as many times as there are inner-autotools-package calls).
Factorize LIBTOOL_PATCH_HOOK and AUTORECONF_HOOK to avoid duplicated code.

Sorry it takes so long to review this series. Touching the infra is not for the faint of heart, and reviews are really complex and time-consuming.

_This_ is true...

Quoted 37 lines
Quoted 37 lines
---
 package/pkg-autotools.mk | 119 ++++++++++++++++++++++-------------------------
 1 file changed, 56 insertions(+), 63 deletions(-)
package/pkg-autotools.mk +23 -0
index 09f9412..65af6f0 100644
@@ -46,6 +46,57 @@ endef
 #	$(call AUTOCONF_AC_CHECK_FILE_VAL,/dev/random)=yes
 AUTOCONF_AC_CHECK_FILE_VAL = ac_cv_file_$(subst -,_,$(subst /,_,$(subst .,_,$(1))))
 
+# Recipe that patches libtool so it works properly with
+# cross-compilation.
+define PATCH_LIBTOOL
+	$(Q)if test "$($(PKG)_LIBTOOL_PATCH)" = "YES"; then \
+		for i in `find $($(PKG)_SRCDIR) -name ltmain.sh`; do \
+			ltmain_version=`sed -n '/^[ 	]*VERSION=/{s/^[ 	]*VERSION=//;p;q;}' $$$$i | \
+			sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
+			if test $${ltmain_version} = 1.5; then \
+				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
+			elif test $${ltmain_version} = 2.2; then\
+				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
+			elif test $${ltmain_version} = 2.4; then\
+				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
+			fi \
+		done \
+	fi
+endef
+
+#
+# Hook to update config.sub and config.guess if needed
+#
+define UPDATE_CONFIG_HOOK
+	@$(call MESSAGE,"Updating config.sub and config.guess")
Quoted 8 lines

package/pkg-autotools.mk endef · line 79

Quoted 8 lines
package/pkg-autotools.mk +8 -0
+	$(call CONFIG_UPDATE,$(@D))
+endef
+
+#
+# Hook to patch libtool to make it work properly for cross-compilation
+#
+define LIBTOOL_PATCH_HOOK
+	@$(call MESSAGE,"Patching libtool")

This message could be hoisted into PATCH_LIBTOOL itself (or rather,
PATCH_LIBTOOL could be moved down here). It makes total sense to display the 'Patching libtool' message even when autoreconf is done (and actually, currently it is displayed, just not at the right time).

Quoted 9 lines

package/pkg-autotools.mk endef · line 81

Quoted 2 lines
package/pkg-autotools.mk +2 -0
+	$(call PATCH_LIBTOOL)
+endef

Hmm... This patch does nore than extract the definitions out of inner-autotools-package; it also reworks the way they are called.

I'd rather we get this split in at least two patches:
- one that does the move proper
- one that reworks the calls

That is true.

Quoted 7 lines

It will be easier to review.

[--SNIP--]

package/pkg-autotools.mk $(2)_DEPENDENCIES += host-gettext · line 254

Quoted 3 lines
package/pkg-autotools.mk +0 -0
@@ -265,6 +253,11 @@ $(2)_DEPENDENCIES += host-gettext
 endif
 $(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK

For a separate patch, it would be nice to turn this into

$(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK
ifneq ($$($(2)_LIBTOOL_PATCH),NO)
$(2)_PRE_CONFIGURE_HOOKS += LIBTOOL_PATCH_HOOK
endif

and remove the libtool stuff from AUTORECONF_HOOK.

With that done, the shell condition can be removed from the libtool hook as well.

Quoted 10 lines

package/pkg-autotools.mk $(2)_DEPENDENCIES += host-gettext · line 261

Quoted 7 lines
package/pkg-autotools.mk +5 -0
 $(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
+else
+# default values are not evaluated yet, so don't rely on this defaulting to YES
+ifneq ($$($(2)_LIBTOOL_PATCH),NO)
+$(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
+endif
 endif

I think you got the order wrong here: we want the libtool patch to be applied _before_ we autoreconf.

No, we don't. We want it to be done after the autoreconf, because autoreconf
generates the libtool scripts.

In the original, there was a shell condition that evaluates that AUTORECONF is
not YES in the LIBTOOL_PATCH_HOOK. So you would get the message that libtool is patched before the autoreconf, but the actual patching only happens after the reconf.

Regards,
Arnout

Quoted 13 lines

So, this last if-block should be the very first thing to do right after:

    ifeq ($$($(2)_AUTORECONF),YES)

I'll do some more in-depth review later, presumably after you split the patch. If you don;t have time for that, I can see to get it done tomorrow.

Again, sorry for the delay, reviewing infra changes is really tricky...

Regards,
Yann E. MORIN.

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#5 lore raw

PATCH v2 1/15 package/pkg-autotools.mk: Factorize hooks.

Arnout, All,

On 2014-11-11 14:03 +0100, Arnout Vandecappelle spake thusly:

Quoted 1 line

I'm mostly going to negate Yann's comments :-)

Meh... :-)

Quoted 11 lines
Quoted 10 lines

package/pkg-autotools.mk $(2)_DEPENDENCIES += host-gettext · line 261

Quoted 7 lines

$(2)_DEPENDENCIES += host-automake host-autoconf host-libtool

package/pkg-autotools.mk +5 -0
+else
+# default values are not evaluated yet, so don't rely on this defaulting to YES
+ifneq ($$($(2)_LIBTOOL_PATCH),NO)
+$(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
+endif
 endif

I think you got the order wrong here: we want the libtool patch to be applied _before_ we autoreconf.

Quoted 7 lines

No, we don't. We want it to be done after the autoreconf, because autoreconf
generates the libtool scripts.

In the original, there was a shell condition that evaluates that AUTORECONF is
not YES in the LIBTOOL_PATCH_HOOK. So you would get the message that libtool is patched before the autoreconf, but the actual patching only happens after the reconf.

Well, both of us are partialy wrong, I think. LIBTOOL_PATCH_HOOK is a post-patch hook, while GETTEXTIZE_HOOK and AUTORECONF_HOOK are pre-configure hooks. So, the order at which they are defined is irrelevant, as it is done right now.

But I agree with Arnout, we need to rework this.

The issue I can see is that, in case we're not autoreconfiguring, we can only apply the libtool patch once, and that has to be as a post-patch. But if we do autoreconf, it only makes sense to apply it after the autoreconf.

One obvious thing to do would be to always apply it at post-patch, whether we autoreconf or not, and if we do autoreconf, also apply it after the autoreconf. After all, patching is not something that takes a lot of time, is it?

That way, the code path is a bit more obvious.

And move the 13-or-so lines that do the conditional patching out to a single function, so we can share it more easily.

Sigh, I need some more coffee...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH v2 1/15 package/pkg-autotools.mk: Factorize hooks.

Quoted 43 lines · Yann E. MORIN

Arnout, All,

On 2014-11-11 14:03 +0100, Arnout Vandecappelle spake thusly:

Quoted 1 line

I'm mostly going to negate Yann's comments :-)

Meh... :-)

Quoted 11 lines
Quoted 10 lines

package/pkg-autotools.mk $(2)_DEPENDENCIES += host-gettext · line 261

Quoted 7 lines

$(2)_DEPENDENCIES += host-automake host-autoconf host-libtool

package/pkg-autotools.mk +5 -0
+else
+# default values are not evaluated yet, so don't rely on this defaulting to YES
+ifneq ($$($(2)_LIBTOOL_PATCH),NO)
+$(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
+endif
 endif

I think you got the order wrong here: we want the libtool patch to be applied _before_ we autoreconf.

Quoted 7 lines

No, we don't. We want it to be done after the autoreconf, because autoreconf
generates the libtool scripts.

In the original, there was a shell condition that evaluates that AUTORECONF is
not YES in the LIBTOOL_PATCH_HOOK. So you would get the message that libtool is patched before the autoreconf, but the actual patching only happens after the reconf.

Well, both of us are partialy wrong, I think. LIBTOOL_PATCH_HOOK is a post-patch hook, while GETTEXTIZE_HOOK and AUTORECONF_HOOK are pre-configure hooks. So, the order at which they are defined is irrelevant, as it is done right now.

But I agree with Arnout, we need to rework this.

The issue I can see is that, in case we're not autoreconfiguring, we can only apply the libtool patch once, and that has to be as a post-patch. But if we do autoreconf, it only makes sense to apply it after the autoreconf.

One obvious thing to do would be to always apply it at post-patch, whether we autoreconf or not, and if we do autoreconf, also apply it after the autoreconf. After all, patching is not something that takes a lot of time, is it?

Quoted 4 lines

That way, the code path is a bit more obvious.

And move the 13-or-so lines that do the conditional patching out to a single function, so we can share it more easily.

All this makes it pretty clear that reworking the call should be done in a
separate patch :-)

Regards,
Arnout

Quoted 6 lines

Sigh, I need some more coffee...

Regards,
Yann E. MORIN.

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#7 lore raw

PATCH v2 1/15 package/pkg-autotools.mk: Factorize hooks.

Arnout, Johan, All,

On 2014-11-11 14:33 +0100, Arnout Vandecappelle spake thusly:

Quoted 1 line · Yann E. MORIN

[--SNIP--]

Quoted 6 lines
Quoted 6 lines

Well, both of us are partialy wrong, I think. LIBTOOL_PATCH_HOOK is a post-patch hook, while GETTEXTIZE_HOOK and AUTORECONF_HOOK are pre-configure hooks. So, the order at which they are defined is irrelevant, as it is done right now.

But I agree with Arnout, we need to rework this.

[--SNIP--]

Quoted 2 lines

All this makes it pretty clear that reworking the call should be done in a
separate patch :-)

I'm mostly done with just the autotools rework. It's no longer a single patch, and not even two. It's a 7-patch series, now:

db9396b pkg-autotools: move common macros
aaecaca pkg-autotools: re-order cleaning up the host dependencies aaf7f5a pkg-autotools: commonalise the libtool patching code 54e296d pkg-autotools: move the libtool patching call out of the autoreconf hook 541764e pkg-autotools: remove redundant shell conditional
120fc9c pkg-autotools: fold the libtool patching code directly into the hook 77feedc pkg-autotools: only apply libtool patch at the right moment

I'll post those later tonight. I still hope to have time to rework the pkg-rebar patch today...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH v2 2/15 package/pkg-rebar.mk: new infrastructure.

In reply to Johan Oudinet

Ease the development of packages that use the erlang rebar tool as their build system.

---
 docs/manual/adding-packages-rebar.txt | 157 +++++++++++++++++++++++
 docs/manual/adding-packages.txt       |   2 +
 package/Makefile.in                   |   1 +
 package/erlang-rebar/erlang-rebar.mk  |  20 +++
 package/pkg-rebar.mk                  | 229 ++++++++++++++++++++++++++++++++++
 support/scripts/erlang-ei-vsn         |  19 +++
 6 files changed, 428 insertions(+)
 create mode 100644 docs/manual/adding-packages-rebar.txt
 create mode 100644 package/erlang-rebar/erlang-rebar.mk
 create mode 100644 package/pkg-rebar.mk
 create mode 100755 support/scripts/erlang-ei-vsn
docs/manual/adding-packages-rebar.txt new file +157 -0
new file mode 100644
index 0000000..c132a4a
@@ -0,0 +1,157 @@
+// -*- mode:doc; -*-
+// vim: set syntax=asciidoc:
+
+=== Infrastructure for rebar-based packages
+
+[[rebar-package-tutorial]]
+
+==== +rebar-package+ tutorial
+
+First, let's see how to write a +.mk+ file for a rebar-based package,
+with an example :
+
+------------------------------
+01: ################################################################################
+02: #
+03: # erlang-foobar
+04: #
+05: ################################################################################
+06:
+07: ERLANG_FOOBAR_VERSION = 1.0
+08: ERLANG_FOOBAR_SOURCE = erlang-foobar-$(ERLANG_FOOBAR_VERSION).tar.gz
+09: ERLANG_FOOBAR_SITE = http://www.foosoftware.org/download
+10: ERLANG_FOOBAR_INSTALL_STAGING = YES
+11: ERLANG_FOOBAR_CONF_OPTS = --enable-bar
+12: ERLANG_FOOBAR_DEPENDENCIES = host-libaaa libbbb
+13:
+14: $(eval $(rebar-package))
+--------------------------------
+
+On line 7, we declare the version of the package.
+
+On line 8 and 9, we declare the name of the tarball (xz-ed tarball recommended)
+and the location of the tarball on the Web. Buildroot will automatically
+download the tarball from this location.
+
+On line 10, we tell Buildroot to install the package to the staging
+directory. The staging directory, located in +output/staging/+
+is the directory where all the packages are installed, including their
+development files, etc. By default, packages are not installed to the
+staging directory, since usually, only libraries need to be installed in
+the staging directory: their development files are needed to compile
+other libraries or applications depending on them.
+
+On line 11, we tell Buildroot to pass a custom configure option, that
+will be passed to the +./configure+ script before configuring
+and building the package.
+
+On line 12, we declare our dependencies, so that they are built
+before the build process of our package starts.
+
+Finally, on line line 14, we invoke the +rebar-package+
+macro that generates all the Makefile rules that actually allows the
+package to be built.
+
+[[rebar-package-reference]]
+
+==== +rebar-package+ reference
+
+The main macro of the rebar package infrastructure is
++rebar-package+. It is similar to the +generic-package+ macro. The
+ability to have target and host packages is also available, with the
++host-rebar-package+ macro.
+
+Just like the generic infrastructure, the rebar infrastructure works
+by defining a number of variables before calling the +rebar-package+
+macro.
+
+First, all the package metadata information variables that exist in
+the generic infrastructure also exist in the rebar infrastructure:
++ERLANG_FOOBAR_VERSION+, +ERLANG_FOOBAR_SOURCE+,
++ERLANG_FOOBAR_PATCH+, +ERLANG_FOOBAR_SITE+,
++ERLANG_FOOBAR_SUBDIR+, +ERLANG_FOOBAR_DEPENDENCIES+,
++ERLANG_FOOBAR_INSTALL_STAGING+, +ERLANG_FOOBAR_INSTALL_TARGET+.
+
+Note that the rebar infrastructure does not expect a configure script,
+but does call such a script when it exists.  When a package uses both
+the Autotools and rebar, it should use the rebar infrastructure.  In
+this case however, the build commands do not call make, but only
++rebar compile+; this avoids triggering the download of dependencies
+(as most Makefile's do when combined with rebar).  Also, note that the
+install commands never call +make install+.  Instead, they install
+Erlang's application directories (ebin, priv, etc.)  into a proper
+location.  If this is not what you want, add custom hooks or override
+rebar commands (see below).
+
+A few additional variables, specific to the rebar infrastructure,
+can also be defined. Many of them are only useful in very specific
+cases, typical packages will therefore only use a few of them.
+
+* +ERLANG_FOOBAR_CONF_ENV+, to specify additional environment
+  variables to pass to the configure script. By default, empty.
+
+* +ERLANG_FOOBAR_CONF_OPTS+, to specify additional configure options
+  to pass to the configure script. By default, empty.
+
+* +ERLANG_FOOBAR_AUTORECONF+, tells whether the package should be
+  autoreconfigured or not (i.e. if the configure script and
+  Makefile.in files should be re-generated by re-running autoconf,
+  automake, libtool, etc.). Valid values are +YES+ and +NO+. By
+  default, the value is +NO+
+
+* +ERLANG_FOOBAR_AUTORECONF_ENV+, to specify additional environment
+  variables to pass to the 'autoreconf' program if
+  +ERLANG_FOOBAR_AUTORECONF=YES+. These are passed in the environment
+  of the 'autoreconf' command. By default, empty.
+
+* +ERLANG_FOOBAR_AUTORECONF_OPTS+ to specify additional options passed
+  to the 'autoreconf' program if +ERLANG_FOOBAR_AUTORECONF=YES+. By
+  default, empty.
+
+* +ERLANG_FOOBAR_REBAR_ENV+, to specify additional environment
+  variables to pass to rebar.  By default, the value sets a minimal
+  PATH that only includes +HOST_DIR/bin+, +HOST_DIR/usr/bin+, and
+  +/bin+.
+
+* +ERLANG_FOOBAR_REBAR_FLAGS+, to specify rebar flags. By default, the
+  value is +deps_dir=ERLANG_FOOBAR_REBAR_DEPS_DIR+.
+
+* +ERLANG_FOOBAR_REBAR_DEPS_DIR+, to specify where to look for the
+  package's dependencies.  By default, the value is
+  +output/build/erlang-rebar-deps/target+, or
+  +output/build/erlang-rebar-deps/host+ for host packages.  Note that
+  if the package installs to staging as well, the rebar infrastructure
+  then creates a symbolic link in this directory to
+  +ERLANG_FOOBAR_ERLANG_LIBDIR+ so other packages may use it as
+  a dependency.
+
+* +ERLANG_FOOBAR_ERLANG_LIBDIR+, to specify where to install the
+  Erlang application.  By default, the value is
+  +/usr/lib/erlang/lib/ERLANG_FOOBAR_ERLANG_APP-ERLANG_FOOBAR_VERSION+.
+
+* +ERLANG_FOOBAR_ERLANG_APP+, to specify the name of the Erlang
+  application to be installed.  This modifies where the application is
+  installed (e.g., +/usr/lib/erlang/lib/ERLANG_FOOBAR_ERLANG_APP-ERLANG_FOOBAR_VERSION+)
+  and the name of the symbolic link in +ERLANG_FOOBAR_REBAR_DEPS_DIR+,
+  if any (e.g., +output/build/erlang-rebar-deps/target/ERLANG_FOOBAR_ERLANG_APP+.
+  By default, the value is the lowercase package name stripped from
+  any +erlang-+ prefix, and with dashes converted to underscores.
+
+* +ERLANG_FOOBAR_ENV+, to specify additional environment variables to
+  pass both to the configure script and rebar.  By default, sets CC,
+  CFLAGS, LDFLAGS, ERL_COMPILER_OPTIONS, and ERL_EI_LIBDIR.
+
+With the rebar infrastructure, all the steps required to build
+and install the packages are already defined, and they generally work
+well for most rebar-based packages. However, when required, it is
+still possible to customize what is done in any particular step:
+
+* By adding a post-operation hook (after extract, patch, configure,
+  build or install). See xref:hooks[] for details.
+
+* By overriding one of the steps. For example, even if the rebar
+  infrastructure is used, if the package +.mk+ file defines its
+  own +ERLANG_FOOBAR_CONFIGURE_CMDS+ variable, it will be used
+  instead of the default rebar one. However, using this method
+  should be restricted to very specific cases. Do not use it in the
+  general case.
docs/manual/adding-packages.txt +2 -0
index feb0d13..b8674f8 100644
@@ -27,6 +27,8 @@ include::adding-packages-virtual.txt[]
 
 include::adding-packages-kconfig.txt[]
 
+include::adding-packages-rebar.txt[]
+
 include::adding-packages-asciidoc.txt[]
 
 include::adding-packages-hooks.txt[]
package/Makefile.in +1 -0
index df39afd..077851c 100644
@@ -407,3 +407,4 @@ include package/pkg-python.mk
 include package/pkg-virtual.mk
 include package/pkg-generic.mk
 include package/pkg-kconfig.mk
+include package/pkg-rebar.mk
package/erlang-rebar/erlang-rebar.mk new file +20 -0
new file mode 100644
index 0000000..917114b
@@ -0,0 +1,20 @@
+################################################################################
+#
+# erlang-rebar
+#
+################################################################################
+
+ERLANG_REBAR_VERSION = 2.5.1
+ERLANG_REBAR_SOURCE = $(ERLANG_REBAR_VERSION).tar.gz
+ERLANG_REBAR_SITE = https://github.com/rebar/rebar/archive
+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) -D $(@D)/rebar $(HOST_DIR)/usr/bin/rebar
+endef
+
+$(eval $(host-generic-package))
package/pkg-rebar.mk new file +229 -0

229 lines not on this page · raw message

support/scripts/erlang-ei-vsn new file +19 -0
new file mode 100755
index 0000000..cdab8e9
@@ -0,0 +1,19 @@
+#! /bin/sh
+# Extract and print the version of Erlang's erl_interface module.
+#
+# Exit non-zero and print nothing if Erlang has not been extracted in
+# output/build.
+
+S=[:space:]
+
+# Extract the BAR part from all lines matching "$2 = BAR" in file $1.
+get_make_variable() {
+    local file="$1" name="$2"
+
+    sed "s/^[$S]*$name[$S]*=[$S]*\\([^$S]*\\)[$S]*\$/\\1/; t; d" "$file"
+}
+
+ERLANG_VSN=$(get_make_variable package/erlang/erlang.mk ERLANG_VERSION)
+EI_VSN_FILE=output/build/erlang-$ERLANG_VSN/lib/erl_interface/vsn.mk
+
+[ -f "$EI_VSN_FILE" ] && get_make_variable "$EI_VSN_FILE" EI_VSN
Signature · 1 line
2.1.0
#9 lore raw

PATCH v2 2/15 package/pkg-rebar.mk: new infrastructure.

Johan, Thomas, All,

Thomas, there is a question for you later in the mail, just search for your first name. ;-)

On 2014-11-07 14:28 +0100, Johan Oudinet spake thusly:

Quoted 2 lines

Ease the development of packages that use the erlang rebar tool as their build system.

This patch is huge. You should split it into three different patches:
- add the host-rebar package
- add the new pkg-rebar infra
- add the manual part

I won't review the manual part for now, and will concentrate on the package infra.

Quoted 13 lines
---
 docs/manual/adding-packages-rebar.txt | 157 +++++++++++++++++++++++
 docs/manual/adding-packages.txt       |   2 +
 package/Makefile.in                   |   1 +
 package/erlang-rebar/erlang-rebar.mk  |  20 +++
 package/pkg-rebar.mk                  | 229 ++++++++++++++++++++++++++++++++++
 support/scripts/erlang-ei-vsn         |  19 +++
 6 files changed, 428 insertions(+)
 create mode 100644 docs/manual/adding-packages-rebar.txt
 create mode 100644 package/erlang-rebar/erlang-rebar.mk
 create mode 100644 package/pkg-rebar.mk
 create mode 100755 support/scripts/erlang-ei-vsn

[--SNIP--]

package/erlang-rebar/erlang-rebar.mk line 3

Quoted 9 lines
package/erlang-rebar/erlang-rebar.mk new file +3 -0
new file mode 100644
index 0000000..917114b
@@ -0,0 +1,20 @@
+################################################################################
+#
+# erlang-rebar

For other pkg infras, we prefix the language type for packages that actually use that infra (e.g. PYTHON_FOO_SOURCE for a Python package, but we do not prefix the Python package itself, like: PYTHON_PYTHON_SOURCE)

So, I think 'rebar' should just be 'rebar'.

package/erlang-rebar/erlang-rebar.mk line 9

Quoted 6 lines
package/erlang-rebar/erlang-rebar.mk new file +6 -0
+#
+################################################################################
+
+ERLANG_REBAR_VERSION = 2.5.1
+ERLANG_REBAR_SOURCE = $(ERLANG_REBAR_VERSION).tar.gz
+ERLANG_REBAR_SITE = https://github.com/rebar/rebar/archive

Hmm... The Erlang folks really can't do anything like the others...

There are two ways to get packages from github:
- the github helper in Buildroot
- the direct 'released' tarballs

So, rebar does do releases on GitHub. Except what they release is not the source code, but the actual generated rebar executable. Sigh...

So, in your case, you have no choice, but to use the github helper, as described in the manual:

    http://nightly.buildroot.org/#_tips_and_tricks

    REBAR_SITE = $(call github,rebar,rebar,$(REBAR_VERSION))

package/erlang-rebar/erlang-rebar.mk line 10

Quoted 1 line
package/erlang-rebar/erlang-rebar.mk new file +1 -0
+ERLANG_REBAR_DEPENDENCIES = host-erlang

Also, missing REBAR_LICENSE and REBAR_LICENSE_FILES.

(Hint: you also need to document ERLANG_FOOBAR_LICENSE and ERLANG_FOOBAR_LICENSE_FILES in the manual.)

Quoted 28 lines
package/erlang-rebar/erlang-rebar.mk new file +9 -0
+define HOST_ERLANG_REBAR_BUILD_CMDS
+	cd $(@D) && $(HOST_MAKE_ENV) $(MAKE)
+endef
+
+define HOST_ERLANG_REBAR_INSTALL_CMDS
+	$(INSTALL) -D $(@D)/rebar $(HOST_DIR)/usr/bin/rebar
+endef
+
+$(eval $(host-generic-package))
package/pkg-rebar.mk new file +13 -0
new file mode 100644
index 0000000..9dbd42d
@@ -0,0 +1,229 @@
+################################################################################
+# rebar package infrastructure
+#
+# This file implements an infrastructure that eases development of
+# package .mk files for rebar packages.  It should be used for all
+# packages that use rebar as their build system.
+#
+# In terms of implementation, this rebar infrastructure requires the
+# .mk file to only specify metadata information about the package:
+# name, version, download URL, etc.
+#
+# We still allow the package .mk file to override what the different
+# steps are doing, if needed. For example, if <PKG>_BUILD_CMDS is

package/pkg-rebar.mk line 23

Quoted 10 lines
package/pkg-rebar.mk new file +10 -0
+# already defined, it is used as the list of commands to perform to
+# build the package, instead of the default rebar behaviour. The
+# package can also define some post operation hooks.
+#
+################################################################################
+
+# Version of Erlang's erl_interface module.  One needs this to setup
+# proper linker flags when building Erlang modules written in C.
+#
+ERLANG_EI_VSN = $(shell support/scripts/erlang-ei-vsn)

See at the end my comments about that variable: it should be set from the erlang.mk (or so I think).

package/pkg-rebar.mk line 34

Quoted 10 lines
package/pkg-rebar.mk new file +10 -0
+# Directories to store rebar dependencies in.
+#
+# These directories actually only contain symbolic links to Erlang
+# applications in either $(HOST_DIR) or $(STAGING_DIR).  One needs
+# them to avoid rebar complaining about missing dependencies, as this
+# infrastructure does NOT tell rebar to download dependencies during
+# the build stage.
+#
+REBAR_HOST_DEPS_DIR = $(BUILD_DIR)/erlang-rebar-deps/host
+REBAR_TARGET_DEPS_DIR = $(BUILD_DIR)/erlang-rebar-deps/target

Well, I would prefer those directories not be stored in the build dir, but somewhere like:

    $(HOST_DIR)/usr/share/rebar/deps-host
    $(HOST_DIR)/usr/share/rebar/deps-target

We do not have a location for that kind of information for now in Buildroot. I believe it belongs somewhere into $(HOST_DIR), but I would accept to be contradicted on that one.

Quoted 135 lines
package/pkg-rebar.mk new file +135 -0
+################################################################################
+# Helper functions
+################################################################################
+
+# Install an Erlang application from $(@D).
+#
+# i.e., define a recipe that installs the "ebin priv $(2)" directories
+# from $(@D) to $(1)$($(PKG)_ERLANG_LIBDIR).
+#
+#  argument 1 should typically be $(HOST_DIR), $(TARGET_DIR),
+#	      or $(STAGING_DIR).
+#  argument 2 is typically empty when installing in $(TARGET_DIR) and
+#             "include" when installing in $(HOST_DIR) or
+#             $(STAGING_DIR).
+#
+define install-erlang-directories
+	$$(INSTALL) --directory '$(1)$$($$(PKG)_ERLANG_LIBDIR)'
+	for dir in ebin priv $(2); do					\
+		if test -d "$$(@D)/$$$$dir"; then			\
+			cp -r	"$$(@D)/$$$$dir"			\
+				'$(1)$$($$(PKG)_ERLANG_LIBDIR)';	\
+		fi;							\
+	done
+endef
+
+# Setup a symbolic link in rebar's deps_dir to the actual location
+# where an Erlang application is installed.
+#
+# i.e., define a recipe that creates a symbolic link
+# from $($(PKG)_REBAR_DEPS_DIR)/$($(PKG)_ERLANG_APP)
+# to $(1)$($(PKG)_ERLANG_LIBDIR).
+#
+# One typically uses this to setup symbolic links from
+# $(BUILD_DIR)/rebar-deps/<HOST_OR_TARGET>/<ERLANG_APP> to the
+# appropriate application directory in $(HOST_DIR) or $(STAGING_DIR).
+# This avoids rebar complaining about missing dependencies, as this
+# infrastructure does NOT tell rebar to download dependencies during
+# the build stage.
+#
+# Therefore,
+#  argument 1 is $$(HOST_DIR) (for host packages) or
+#	      $$(STAGING_DIR) (for target packages).
+#
+define install-rebar-deps
+	$$(INSTALL) --directory '$$($$(PKG)_REBAR_DEPS_DIR)'
+	ln -f -s							\
+		'$(1)$$($$(PKG)_ERLANG_LIBDIR)'				\
+		'$$($$(PKG)_REBAR_DEPS_DIR)/$$($$(PKG)_ERLANG_APP)'
+endef
+
+################################################################################
+# inner-rebar-package -- defines how the configuration, compilation
+# and installation of a rebar package should be done, implements a few
+# hooks to tune the build process according to rebar specifities, and
+# calls the generic package infrastructure to generate the necessary
+# make targets.
+#
+#  argument 1 is the lowercase package name
+#  argument 2 is the uppercase package name, including a HOST_ prefix
+#             for host packages
+#  argument 3 is the uppercase package name, without the HOST_ prefix
+#             for host packages
+#  argument 4 is the type (target or host)
+#
+################################################################################
+
+define inner-rebar-package
+
+$(2)_ERLANG_APP ?= $(subst -,_,$(call LOWERCASE,$(patsubst ERLANG_%,%,$(3))))
+$(2)_ERLANG_LIBDIR ?= \
+	/usr/lib/erlang/lib/$$($$(PKG)_ERLANG_APP)-$$($$(PKG)_VERSION)
+$(2)_ENV ?=								\
+	CC='$$($(call UPPERCASE,$(4))_CC)'				\
+	CFLAGS='$$($(call UPPERCASE,$(4))_CFLAGS)'			\
+	LDFLAGS='$$($(call UPPERCASE,$(4))_LDFLAGS)'			\
+	ERL_COMPILER_OPTIONS='{i, "$$($$(PKG)_REBAR_DEPS_DIR)"}'	\
+	ERL_EI_LIBDIR='$$($(call UPPERCASE,$(4))_DIR)/usr/lib/erlang/lib/erl_interface-$$(ERLANG_EI_VSN)/lib'
+
+$(2)_REBAR_DEPS_DIR ?= $$(REBAR_$(call UPPERCASE,$(4))_DEPS_DIR)
+$(2)_REBAR_FLAGS ?= deps_dir='$$($$(PKG)_REBAR_DEPS_DIR)'
+$(2)_REBAR_ENV ?= PATH='$$(BR_PATH)'
+
+ifndef $(2)_AUTORECONF
+ ifdef $(3)_AUTORECONF
+  $(2)_AUTORECONF = $$($(3)_AUTORECONF)
+ else
+  $(2)_AUTORECONF ?= NO
+ endif
+endif
+
+$(2)_INTERNAL_CONF_ENV =			\
+	CONFIG_SITE=/dev/null			\
+	PATH='$$(BR_PATH)'			\
+	$$($$(PKG)_ENV)				\
+	$$($$(PKG)_CONF_ENV)
+
+ifeq ($(4),target)
+$(2)_INTERNAL_CONF_FLAGS =			\
+	--target=$$(GNU_TARGET_NAME)		\
+	--host=$$(GNU_TARGET_NAME)		\
+	--build=$$(GNU_HOST_NAME)		\
+	--prefix=/usr				\
+	--exec-prefix=/usr			\
+	--sysconfdir=/etc			\
+	--localstatedir=/var			\
+	--program-prefix=			\
+	$$(DISABLE_NLS)				\
+	$$(DISABLE_LARGEFILE)			\
+	$$(DISABLE_IPV6)			\
+	$$(ENABLE_DEBUG)			\
+	$$(SHARED_STATIC_LIBS_OPTS)		\
+	$$($$(PKG)_CONF_OPTS)
+else
+$(2)_INTERNAL_CONF_FLAGS =			\
+	--prefix='$$(HOST_DIR)/usr'		\
+	--sysconfdir='$$(HOST_DIR)/etc'		\
+	--localstatedir='$$(HOST_DIR)/var'	\
+	--enable-shared --disable-static	\
+	--disable-debug				\
+	$$($$(PKG)_CONF_OPTS)
+endif
+
+ifeq ($$($(2)_AUTORECONF),YES)
+$(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK
+$(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
+endif
+
+ifndef $(2)_CONFIGURE_CMDS
+define $(2)_CONFIGURE_CMDS
+	if [ -f '$$(@D)/configure' ]; then				\
+		cd '$$(@D)' &&						\
+		rm -rf config.cache &&					\
+		$$($$(PKG)_INTERNAL_CONF_ENV)				\
+		./configure						\
+			--disable-gtk-doc				\

package/pkg-rebar.mk line 180

Quoted 10 lines
package/pkg-rebar.mk new file +10 -0
+			--disable-doc					\
+			--disable-docs					\
+			--disable-documentation				\
+			--with-xmlto=no					\
+			--with-fop=no					\
+			--disable-dependency-tracking			\
+			$$(QUIET) $$($$(PKG)_INTERNAL_CONF_FLAGS);	\
+	fi
+endef
+endif

Hmm... It looks like you're borrowing a lot from pkg-autotools. I do not like this duplication, especially in the pkg infras, since fixing something would imply hunting down all over the place...

What if you would call to inner-autotools-package instead of calling to inner-generic-package ?

The only problem is that pkg-autotools always calls ./configure, while in the rebar case, you only want to call it conditionally.

Except the only Erlang package that has a ./configure is ejabberd itself, and you're introducing complexity for just one package.

And ejabberd is not even a complete autotools package: it only uses autoconf (via configure.ac) but not automake (no Makefile.am).

And you need to autoreconf ejabberd because:
- you get it from the git tree. There is a release tarball, though:

      http://www.process-one.net/downloads/ejabberd/14.07/ejabberd-14.07.tgz

- you do not want to run the version check in patch 0004-disable-version-check.patch, but you could well use the configure switch --disable-erlang-version-check

The only problem I could foresee is that it tries to run the target Erlang compiler, right? If so, just patch the configure script directly (ugly, but that's better than trying to get complexity in the rebar infra just for this sucker^Wsingle package. ;-)

So, in the end, just make it a generic package (like you did here), do not provide any _CONFIGURE_CMDS, and delegate to ejabberd the responsibility to provide its own EJABBERD_CONFIGURE_CMDS

Hmmm... Looking further, it seems a few others (all from ProcessOne?) also uses ./configure . What about adding a new variable, like:

ERLANG_FOO_CONFIGURE = YES

which would tell whether running configure is needed?

I'd like input from Thomas P. on all the above, because we get into really tricky-icky stuff... Thomas?

And by the way, since ejabberd is using the rebar infra, then maybe it makes sense to call that package erlang-ejabberd? I know it sounds strange, but that what's you did for all other rebar-using packages, so I don't see why this would be different for that one.

Quoted 4 lines
package/pkg-rebar.mk new file +4 -0
+ifndef $(2)_BUILD_CMDS
+define $(2)_BUILD_CMDS
+	cd '$$(@D)' &&							\
+	if [ -f ./rebar ]; then						\

package/pkg-rebar.mk line 195

Quoted 10 lines
package/pkg-rebar.mk new file +10 -0
+		$$($$(PKG)_ENV)						\
+		$$($$(PKG)_REBAR_ENV)					\
+			./rebar $$($$(PKG)_REBAR_FLAGS) compile;	\
+	else								\
+		$$($$(PKG)_ENV)						\
+		$$($$(PKG)_REBAR_ENV)					\
+			rebar $$($$(PKG)_REBAR_FLAGS) compile;		\
+	fi
+endef
+endif

Hmm... Do we want to trust the package's own rebar? Shouldn't we always use our own version of rebar instead?

What would be the reason to 'trust' the package's rebar more than our?

Quoted 24 lines
package/pkg-rebar.mk new file +24 -0
+
+ifeq ($(4),host) # Install host files.
+
+ifndef $(2)_INSTALL_CMDS
+define $(2)_INSTALL_CMDS
+	$(call install-erlang-directories,$$(HOST_DIR),include)
+	$(call install-rebar-deps,$$(HOST_DIR))
+endef
+endif
+
+else # Install staging/target files.
+
+ifndef $(2)_INSTALL_STAGING_CMDS
+define $(2)_INSTALL_STAGING_CMDS
+	$(call install-erlang-directories,$$(STAGING_DIR),include)
+	$(call install-rebar-deps,$$(STAGING_DIR))
+endef
+endif
+
+ifndef $(2)_INSTALL_TARGET_CMDS
+define $(2)_INSTALL_TARGET_CMDS
+	$(call install-erlang-directories,$$(TARGET_DIR))
+endef
+endif

package/pkg-rebar.mk line 229

Quoted 10 lines
package/pkg-rebar.mk new file +10 -0
+
+endif
+
+$(call inner-generic-package,$(1),$(2),$(3),$(4))
+
+endef # inner-rebar-package
+
+rebar-package = $(call inner-rebar-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
+
+host-rebar-package = $(call inner-rebar-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)

No empty lines between the target and host variants.

Quoted 13 lines
support/scripts/erlang-ei-vsn new file +7 -0
new file mode 100755
index 0000000..cdab8e9
@@ -0,0 +1,19 @@
+#! /bin/sh
+# Extract and print the version of Erlang's erl_interface module.
+#
+# Exit non-zero and print nothing if Erlang has not been extracted in
+# output/build.
+
+S=[:space:]

support/scripts/erlang-ei-vsn line 17

Quoted 10 lines
support/scripts/erlang-ei-vsn new file +10 -0
+
+# Extract the BAR part from all lines matching "$2 = BAR" in file $1.
+get_make_variable() {
+    local file="$1" name="$2"
+
+    sed "s/^[$S]*$name[$S]*=[$S]*\\([^$S]*\\)[$S]*\$/\\1/; t; d" "$file"
+}
+
+ERLANG_VSN=$(get_make_variable package/erlang/erlang.mk ERLANG_VERSION)
+EI_VSN_FILE=output/build/erlang-$ERLANG_VSN/lib/erl_interface/vsn.mk

That does not work for out-of-tree builds. You should use something like:

    EI_VSN_FILE="${O}/build/erlang-$ERLANG_VSN/lib/erl_interface/vsn.mk"

However, rather than poke in the erlang sources, could you modify our erlang.mk and add a post-install hook that just extract this value and installs it in (for example) $(HOST_DIR)/usr/share/erlang/EI_VSN .

But if you have ERLANG_EI_VSN set from the erlang.mk package itself, you do not need to have that script.

support/scripts/erlang-ei-vsn line 19

Quoted 1 line
support/scripts/erlang-ei-vsn new file +1 -0
+[ -f "$EI_VSN_FILE" ] && get_make_variable "$EI_VSN_FILE" EI_VSN

OK, I'm definitely not done reviewing that series. ;-)

But it looks very, *very* promising! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#10 lore raw

PATCH v2 2/15 package/pkg-rebar.mk: new infrastructure.

Quoted 5 lines · Yann E. MORIN

Johan, Thomas, All,

Thomas, there is a question for you later in the mail, just search for your first name. ;-)

Quoted 8 lines

On 2014-11-07 14:28 +0100, Johan Oudinet spake thusly:

Quoted 2 lines

Ease the development of packages that use the erlang rebar tool as their build system.

This patch is huge. You should split it into three different patches:
- add the host-rebar package
- add the new pkg-rebar infra
- add the manual part

+1 to that!

The addition of the erlang-ei-vsn script + variable could also be a separate patch.

Quoted 18 lines

I won't review the manual part for now, and will concentrate on the package infra.

Quoted 13 lines
---
 docs/manual/adding-packages-rebar.txt | 157 +++++++++++++++++++++++
 docs/manual/adding-packages.txt       |   2 +
 package/Makefile.in                   |   1 +
 package/erlang-rebar/erlang-rebar.mk  |  20 +++
 package/pkg-rebar.mk                  | 229 ++++++++++++++++++++++++++++++++++
 support/scripts/erlang-ei-vsn         |  19 +++
 6 files changed, 428 insertions(+)
 create mode 100644 docs/manual/adding-packages-rebar.txt
 create mode 100644 package/erlang-rebar/erlang-rebar.mk
 create mode 100644 package/pkg-rebar.mk
 create mode 100755 support/scripts/erlang-ei-vsn

[--SNIP--]

Quoted 13 lines

package/erlang-rebar/erlang-rebar.mk line 3

Quoted 9 lines
package/erlang-rebar/erlang-rebar.mk new file +3 -0
new file mode 100644
index 0000000..917114b
@@ -0,0 +1,20 @@
+################################################################################
+#
+# erlang-rebar

For other pkg infras, we prefix the language type for packages that actually use that infra (e.g. PYTHON_FOO_SOURCE for a Python package, but we do not prefix the Python package itself, like: PYTHON_PYTHON_SOURCE)

Err, we do exactly the same for python-setuptools, so how is this different?

You could say that the package infrastructure should be named pkg-erlang
instead of pkg-rebar, but I don't think so. The situation is a bit similar to qmake - qmake is the canonical build tool for Qt packages, but if we would have qmake infrastructure, it would be called pkg-qmake and not pkg-qt.

So I vote for erlang-rebar and pkg-rebar, exactly as it is now.

Quoted 12 lines

So, I think 'rebar' should just be 'rebar'.

package/erlang-rebar/erlang-rebar.mk line 9

Quoted 6 lines
package/erlang-rebar/erlang-rebar.mk new file +6 -0
+#
+################################################################################
+
+ERLANG_REBAR_VERSION = 2.5.1
+ERLANG_REBAR_SOURCE = $(ERLANG_REBAR_VERSION).tar.gz
+ERLANG_REBAR_SITE = https://github.com/rebar/rebar/archive

Hmm... The Erlang folks really can't do anything like the others...

Quoted 6 lines

There are two ways to get packages from github:
- the github helper in Buildroot
- the direct 'released' tarballs

So, rebar does do releases on GitHub. Except what they release is not the source code, but the actual generated rebar executable. Sigh...

Err, when I download https://github.com/rebar/rebar/archive/2.5.1.tar.gz I get
exactly the same files as what is in the 2.5.1 tag, I don't get any executable...

Quoted 8 lines

So, in your case, you have no choice, but to use the github helper, as described in the manual:

    http://nightly.buildroot.org/#_tips_and_tricks

    REBAR_SITE = $(call github,rebar,rebar,$(REBAR_VERSION))
Quoted 1 line
package/erlang-rebar/erlang-rebar.mk new file +1 -0
+ERLANG_REBAR_DEPENDENCIES = host-erlang

If there would be a target rebar package, it would depend on target erlang,
right? So this should be either

HOST_ERLANG_REBAR_DEPENDENCIES = host-erlang

or

ERLANG_REBAR_DEPENDENCIES = erlang

Quoted 39 lines

Also, missing REBAR_LICENSE and REBAR_LICENSE_FILES.

(Hint: you also need to document ERLANG_FOOBAR_LICENSE and ERLANG_FOOBAR_LICENSE_FILES in the manual.)

Quoted 33 lines
package/erlang-rebar/erlang-rebar.mk new file +9 -0
+define HOST_ERLANG_REBAR_BUILD_CMDS
+	cd $(@D) && $(HOST_MAKE_ENV) $(MAKE)
+endef
+
+define HOST_ERLANG_REBAR_INSTALL_CMDS
+	$(INSTALL) -D $(@D)/rebar $(HOST_DIR)/usr/bin/rebar
+endef
+
+$(eval $(host-generic-package))
package/pkg-rebar.mk new file +18 -0
new file mode 100644
index 0000000..9dbd42d
@@ -0,0 +1,229 @@
+################################################################################
+# rebar package infrastructure
+#
+# This file implements an infrastructure that eases development of
+# package .mk files for rebar packages.  It should be used for all
+# packages that use rebar as their build system.
+#
+# In terms of implementation, this rebar infrastructure requires the
+# .mk file to only specify metadata information about the package:
+# name, version, download URL, etc.
+#
+# We still allow the package .mk file to override what the different
+# steps are doing, if needed. For example, if <PKG>_BUILD_CMDS is
+# already defined, it is used as the list of commands to perform to
+# build the package, instead of the default rebar behaviour. The
+# package can also define some post operation hooks.
+#
+################################################################################
Quoted 8 lines

package/pkg-rebar.mk line 23

Quoted 5 lines
package/pkg-rebar.mk new file +5 -0
+
+# Version of Erlang's erl_interface module.  One needs this to setup
+# proper linker flags when building Erlang modules written in C.
+#
+ERLANG_EI_VSN = $(shell support/scripts/erlang-ei-vsn)

See at the end my comments about that variable: it should be set from the erlang.mk (or so I think).

+1

Quoted 7 lines

package/pkg-rebar.mk line 30

Quoted 7 lines
package/pkg-rebar.mk new file +6 -0
+# Directories to store rebar dependencies in.
+#
+# These directories actually only contain symbolic links to Erlang
+# applications in either $(HOST_DIR) or $(STAGING_DIR).  One needs
+# them to avoid rebar complaining about missing dependencies, as this
+# infrastructure does NOT tell rebar to download dependencies during

... as this infrastructure tells rebar NOT to download dependencies ...

Quoted 9 lines

package/pkg-rebar.mk line 34

Quoted 4 lines
package/pkg-rebar.mk new file +4 -0
+# the build stage.
+#
+REBAR_HOST_DEPS_DIR = $(BUILD_DIR)/erlang-rebar-deps/host
+REBAR_TARGET_DEPS_DIR = $(BUILD_DIR)/erlang-rebar-deps/target

Well, I would prefer those directories not be stored in the build dir, but somewhere like:

    $(HOST_DIR)/usr/share/rebar/deps-host
    $(HOST_DIR)/usr/share/rebar/deps-target

+1, but I'd say

$(HOST_DIR)/usr/share/rebar/deps
$(STAGING_DIR)/usr/share/rebar/deps

Note on the naming: even though the package is called erlang-rebar for
buildroot, anything it installs will just be rebar (without erlang-) because that's how upstream identifies itself.

Quoted 4 lines

We do not have a location for that kind of information for now in Buildroot. I believe it belongs somewhere into $(HOST_DIR), but I would accept to be contradicted on that one.

I agree with Yann. Subdirectories of $(BUILD_DIR) should always be
<pkg>-<version>. There are very few exceptions (e.g. build-time.log) but they should stay exceptions.

Quoted 10 lines
Quoted 10 lines
package/pkg-rebar.mk new file +9 -0
+################################################################################
+# Helper functions
+################################################################################
+
+# Install an Erlang application from $(@D).
+#
+# i.e., define a recipe that installs the "ebin priv $(2)" directories
+# from $(@D) to $(1)$($(PKG)_ERLANG_LIBDIR).
+#
Quoted 8 lines

package/pkg-rebar.mk line 52

Quoted 8 lines
package/pkg-rebar.mk new file +8 -0
+#  argument 1 should typically be $(HOST_DIR), $(TARGET_DIR),
+#	      or $(STAGING_DIR).
+#  argument 2 is typically empty when installing in $(TARGET_DIR) and
+#             "include" when installing in $(HOST_DIR) or
+#             $(STAGING_DIR).
+#
+define install-erlang-directories
+	$$(INSTALL) --directory '$(1)$$($$(PKG)_ERLANG_LIBDIR)'

We generally use -d instead of --directory.

We generally don't quote the paths. I'm not sure if we should, but we generally
don't.

Quoted 7 lines

package/pkg-rebar.mk line 59

Quoted 7 lines
package/pkg-rebar.mk new file +7 -0
+	for dir in ebin priv $(2); do					\
+		if test -d "$$(@D)/$$$$dir"; then			\
+			cp -r	"$$(@D)/$$$$dir"			\
+				'$(1)$$($$(PKG)_ERLANG_LIBDIR)';	\
+		fi;							\
+	done
+endef

Ah, double-$ mess :-)

The double-$ is needed only because it is called from inner-rebar-package,
which means that this function cannot be called from custom package commands. That's not very nice.

Fortunately, the solution is very simple: use single $ here, and put a double $
at the $$(call install-erlang-directories,...) site.

(Of course I haven't tested this, so YMMV.)

Same for all other functions defined below
.

Quoted 22 lines
Quoted 22 lines
package/pkg-rebar.mk new file +22 -0
+
+# Setup a symbolic link in rebar's deps_dir to the actual location
+# where an Erlang application is installed.
+#
+# i.e., define a recipe that creates a symbolic link
+# from $($(PKG)_REBAR_DEPS_DIR)/$($(PKG)_ERLANG_APP)
+# to $(1)$($(PKG)_ERLANG_LIBDIR).
+#
+# One typically uses this to setup symbolic links from
+# $(BUILD_DIR)/rebar-deps/<HOST_OR_TARGET>/<ERLANG_APP> to the
+# appropriate application directory in $(HOST_DIR) or $(STAGING_DIR).
+# This avoids rebar complaining about missing dependencies, as this
+# infrastructure does NOT tell rebar to download dependencies during
+# the build stage.
+#
+# Therefore,
+#  argument 1 is $$(HOST_DIR) (for host packages) or
+#	      $$(STAGING_DIR) (for target packages).
+#
+define install-rebar-deps
+	$$(INSTALL) --directory '$$($$(PKG)_REBAR_DEPS_DIR)'
+	ln -f -s							\
Quoted 8 lines

package/pkg-rebar.mk line 89

Quoted 8 lines
package/pkg-rebar.mk new file +8 -0
+		'$(1)$$($$(PKG)_ERLANG_LIBDIR)'				\
+		'$$($$(PKG)_REBAR_DEPS_DIR)/$$($$(PKG)_ERLANG_APP)'
+endef
+
+################################################################################
+# inner-rebar-package -- defines how the configuration, compilation
+# and installation of a rebar package should be done, implements a few
+# hooks to tune the build process according to rebar specifities, and

specificities

Quoted 7 lines
Quoted 7 lines
package/pkg-rebar.mk new file +7 -0
+# calls the generic package infrastructure to generate the necessary
+# make targets.
+#
+#  argument 1 is the lowercase package name
+#  argument 2 is the uppercase package name, including a HOST_ prefix
+#             for host packages
+#  argument 3 is the uppercase package name, without the HOST_ prefix
Quoted 8 lines

package/pkg-rebar.mk line 104

Quoted 8 lines
package/pkg-rebar.mk new file +8 -0
+#             for host packages
+#  argument 4 is the type (target or host)
+#
+################################################################################
+
+define inner-rebar-package
+
+$(2)_ERLANG_APP ?= $(subst -,_,$(call LOWERCASE,$(patsubst ERLANG_%,%,$(3))))

It would make more sense to me to do

$(subst -,_,$(patsubst erlang-%,%,$(patsubst host-%,%,$(1))))

Quoted 2 lines

package/pkg-rebar.mk line 106

Quoted 2 lines
package/pkg-rebar.mk new file +2 -0
+$(2)_ERLANG_LIBDIR ?= \
+	/usr/lib/erlang/lib/$$($$(PKG)_ERLANG_APP)-$$($$(PKG)_VERSION)

Does it make sense to make this configurable? I.e., wouldn't it be better to
just expand this in the two places where it's used? It would certainly be clearer that way.

Quoted 4 lines

package/pkg-rebar.mk line 110

Quoted 4 lines
package/pkg-rebar.mk new file +4 -0
+$(2)_ENV ?=								\
+	CC='$$($(call UPPERCASE,$(4))_CC)'				\
+	CFLAGS='$$($(call UPPERCASE,$(4))_CFLAGS)'			\
+	LDFLAGS='$$($(call UPPERCASE,$(4))_LDFLAGS)'			\

I don't like this way of distinguishing host and target very much. It avoids
code duplication, but it's a lot harder to read. So I'd prefer

ifeq ($(4),host)

$(2)_ENV ?= \
	CC='$$(TARGET_CC)' \
	CFLAGS='$$(TARGET_CFLAGS)' \
	...

Also, it would be nice to cater for custom CFLAGS, i.e.

	CFLAGS='$$(TARGET_CFLAGS) $$($$(PKG)_CFLAGS)'
Quoted 6 lines
Quoted 6 lines
package/pkg-rebar.mk new file +6 -0
+	ERL_COMPILER_OPTIONS='{i, "$$($$(PKG)_REBAR_DEPS_DIR)"}'	\
+	ERL_EI_LIBDIR='$$($(call UPPERCASE,$(4))_DIR)/usr/lib/erlang/lib/erl_interface-$$(ERLANG_EI_VSN)/lib'
+
+$(2)_REBAR_DEPS_DIR ?= $$(REBAR_$(call UPPERCASE,$(4))_DEPS_DIR)
+$(2)_REBAR_FLAGS ?= deps_dir='$$($$(PKG)_REBAR_DEPS_DIR)'
+$(2)_REBAR_ENV ?= PATH='$$(BR_PATH)'
Quoted 8 lines

package/pkg-rebar.mk line 124

Quoted 8 lines
package/pkg-rebar.mk new file +8 -0
+
+ifndef $(2)_AUTORECONF
+ ifdef $(3)_AUTORECONF
+  $(2)_AUTORECONF = $$($(3)_AUTORECONF)
+ else
+  $(2)_AUTORECONF ?= NO
+ endif
+endif

Fortunately Yann already did a review and explains things below, otherwise I'd
have big question marks about this one. Something that surprises the casual reader should really carry an explanatory comment.

Quoted 70 lines
Quoted 46 lines
package/pkg-rebar.mk new file +46 -0
+
+$(2)_INTERNAL_CONF_ENV =			\
+	CONFIG_SITE=/dev/null			\
+	PATH='$$(BR_PATH)'			\
+	$$($$(PKG)_ENV)				\
+	$$($$(PKG)_CONF_ENV)
+
+ifeq ($(4),target)
+$(2)_INTERNAL_CONF_FLAGS =			\
+	--target=$$(GNU_TARGET_NAME)		\
+	--host=$$(GNU_TARGET_NAME)		\
+	--build=$$(GNU_HOST_NAME)		\
+	--prefix=/usr				\
+	--exec-prefix=/usr			\
+	--sysconfdir=/etc			\
+	--localstatedir=/var			\
+	--program-prefix=			\
+	$$(DISABLE_NLS)				\
+	$$(DISABLE_LARGEFILE)			\
+	$$(DISABLE_IPV6)			\
+	$$(ENABLE_DEBUG)			\
+	$$(SHARED_STATIC_LIBS_OPTS)		\
+	$$($$(PKG)_CONF_OPTS)
+else
+$(2)_INTERNAL_CONF_FLAGS =			\
+	--prefix='$$(HOST_DIR)/usr'		\
+	--sysconfdir='$$(HOST_DIR)/etc'		\
+	--localstatedir='$$(HOST_DIR)/var'	\
+	--enable-shared --disable-static	\
+	--disable-debug				\
+	$$($$(PKG)_CONF_OPTS)
+endif
+
+ifeq ($$($(2)_AUTORECONF),YES)
+$(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK
+$(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
+endif
+
+ifndef $(2)_CONFIGURE_CMDS
+define $(2)_CONFIGURE_CMDS
+	if [ -f '$$(@D)/configure' ]; then				\
+		cd '$$(@D)' &&						\
+		rm -rf config.cache &&					\
+		$$($$(PKG)_INTERNAL_CONF_ENV)				\
+		./configure						\
+			--disable-gtk-doc				\

package/pkg-rebar.mk line 180

Quoted 10 lines
package/pkg-rebar.mk new file +10 -0
+			--disable-doc					\
+			--disable-docs					\
+			--disable-documentation				\
+			--with-xmlto=no					\
+			--with-fop=no					\
+			--disable-dependency-tracking			\
+			$$(QUIET) $$($$(PKG)_INTERNAL_CONF_FLAGS);	\
+	fi
+endef
+endif

Hmm... It looks like you're borrowing a lot from pkg-autotools. I do not like this duplication, especially in the pkg infras, since fixing something would imply hunting down all over the place...

What if you would call to inner-autotools-package instead of calling to inner-generic-package ?

The only problem is that pkg-autotools always calls ./configure, while in the rebar case, you only want to call it conditionally.

Except the only Erlang package that has a ./configure is ejabberd itself, and you're introducing complexity for just one package.

Quoted 6 lines

And ejabberd is not even a complete autotools package: it only uses autoconf (via configure.ac) but not automake (no Makefile.am).

And you need to autoreconf ejabberd because:
- you get it from the git tree. There is a release tarball, though:

      http://www.process-one.net/downloads/ejabberd/14.07/ejabberd-14.07.tgz

That's of course definitely a good idea, but it should still be _possible_ to
use a git version.

Quoted 14 lines

- you do not want to run the version check in patch 0004-disable-version-check.patch, but you could well use the configure switch --disable-erlang-version-check

The only problem I could foresee is that it tries to run the target Erlang compiler, right? If so, just patch the configure script directly (ugly, but that's better than trying to get complexity in the rebar infra just for this sucker^Wsingle package. ;-)

So, in the end, just make it a generic package (like you did here), do not provide any _CONFIGURE_CMDS, and delegate to ejabberd the responsibility to provide its own EJABBERD_CONFIGURE_CMDS

Quoted 6 lines

Hmmm... Looking further, it seems a few others (all from ProcessOne?) also uses ./configure . What about adding a new variable, like:

ERLANG_FOO_CONFIGURE = YES

which would tell whether running configure is needed?

I have the feeling we'll need a rebar-package and rebar-autotools-package.

But starting with FOO_CONFIGURE isn't a bad idea either.

Quoted 8 lines

I'd like input from Thomas P. on all the above, because we get into really tricky-icky stuff... Thomas?

And by the way, since ejabberd is using the rebar infra, then maybe it makes sense to call that package erlang-ejabberd? I know it sounds strange, but that what's you did for all other rebar-using packages, so I don't see why this would be different for that one.

No, the convention is that library-type packages should be called
<language>-<package>, while program-type packages should be called just <package> (and should select the programming language rather than depending on it).

Quoted 19 lines
Quoted 5 lines
package/pkg-rebar.mk new file +4 -0
+ifndef $(2)_BUILD_CMDS
+define $(2)_BUILD_CMDS
+	cd '$$(@D)' &&							\
+	if [ -f ./rebar ]; then						\

package/pkg-rebar.mk line 195

Quoted 10 lines
package/pkg-rebar.mk new file +10 -0
+		$$($$(PKG)_ENV)						\
+		$$($$(PKG)_REBAR_ENV)					\
+			./rebar $$($$(PKG)_REBAR_FLAGS) compile;	\
+	else								\
+		$$($$(PKG)_ENV)						\
+		$$($$(PKG)_REBAR_ENV)					\
+			rebar $$($$(PKG)_REBAR_FLAGS) compile;		\
+	fi
+endef
+endif

Hmm... Do we want to trust the package's own rebar? Shouldn't we always use our own version of rebar instead?

Quoted 1 line

What would be the reason to 'trust' the package's rebar more than our?

Because the package's rebar may be more up-to-date or may be modified. As long
as we don't apply cross-compilation patches to our rebar, there is no reason to prefer that one.

Ideally, however, the package should only depend on host-rebar if it will
actually use it. It's not a showstopper for me, just a preference.

Also, I have a slight preference for the buildroot package to specify which one
should be used rather than autodiscovering it. But again, not a showstopper for me.

Quoted 7 lines

package/pkg-rebar.mk line 201

Quoted 7 lines
package/pkg-rebar.mk new file +6 -0
+
+ifeq ($(4),host) # Install host files.
+
+ifndef $(2)_INSTALL_CMDS
+define $(2)_INSTALL_CMDS
+	$(call install-erlang-directories,$$(HOST_DIR),include)

Personally, I'd find it slightly more readable to put all the directories here
(ebin priv include) rather than automagically installing ebin and priv.

I'm running out of time so I have to stop my review here...

Regards,
Arnout

Quoted 75 lines
Quoted 18 lines
package/pkg-rebar.mk new file +18 -0
+	$(call install-rebar-deps,$$(HOST_DIR))
+endef
+endif
+
+else # Install staging/target files.
+
+ifndef $(2)_INSTALL_STAGING_CMDS
+define $(2)_INSTALL_STAGING_CMDS
+	$(call install-erlang-directories,$$(STAGING_DIR),include)
+	$(call install-rebar-deps,$$(STAGING_DIR))
+endef
+endif
+
+ifndef $(2)_INSTALL_TARGET_CMDS
+define $(2)_INSTALL_TARGET_CMDS
+	$(call install-erlang-directories,$$(TARGET_DIR))
+endef
+endif

package/pkg-rebar.mk line 229

Quoted 10 lines
package/pkg-rebar.mk new file +10 -0
+
+endif
+
+$(call inner-generic-package,$(1),$(2),$(3),$(4))
+
+endef # inner-rebar-package
+
+rebar-package = $(call inner-rebar-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
+
+host-rebar-package = $(call inner-rebar-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)

No empty lines between the target and host variants.

Quoted 13 lines
support/scripts/erlang-ei-vsn new file +7 -0
new file mode 100755
index 0000000..cdab8e9
@@ -0,0 +1,19 @@
+#! /bin/sh
+# Extract and print the version of Erlang's erl_interface module.
+#
+# Exit non-zero and print nothing if Erlang has not been extracted in
+# output/build.
+
+S=[:space:]

support/scripts/erlang-ei-vsn line 17

Quoted 10 lines
support/scripts/erlang-ei-vsn new file +10 -0
+
+# Extract the BAR part from all lines matching "$2 = BAR" in file $1.
+get_make_variable() {
+    local file="$1" name="$2"
+
+    sed "s/^[$S]*$name[$S]*=[$S]*\\([^$S]*\\)[$S]*\$/\\1/; t; d" "$file"
+}
+
+ERLANG_VSN=$(get_make_variable package/erlang/erlang.mk ERLANG_VERSION)
+EI_VSN_FILE=output/build/erlang-$ERLANG_VSN/lib/erl_interface/vsn.mk

That does not work for out-of-tree builds. You should use something like:

    EI_VSN_FILE="${O}/build/erlang-$ERLANG_VSN/lib/erl_interface/vsn.mk"

However, rather than poke in the erlang sources, could you modify our erlang.mk and add a post-install hook that just extract this value and installs it in (for example) $(HOST_DIR)/usr/share/erlang/EI_VSN .

But if you have ERLANG_EI_VSN set from the erlang.mk package itself, you do not need to have that script.

support/scripts/erlang-ei-vsn line 19

Quoted 1 line
support/scripts/erlang-ei-vsn new file +1 -0
+[ -f "$EI_VSN_FILE" ] && get_make_variable "$EI_VSN_FILE" EI_VSN

OK, I'm definitely not done reviewing that series. ;-)

But it looks very, *very* promising! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#11 lore raw

PATCH v2 2/15 package/pkg-rebar.mk: new infrastructure.

Arnout, All,

On 2014-11-11 15:55 +0100, Arnout Vandecappelle spake thusly:

Quoted 9 lines · Yann E. MORIN
Quoted 8 lines

Johan, Thomas, All,

Thomas, there is a question for you later in the mail, just search for your first name. ;-)

On 2014-11-07 14:28 +0100, Johan Oudinet spake thusly:

Quoted 2 lines

Ease the development of packages that use the erlang rebar tool as their build system.

[--SNIP--]

Quoted 4 lines
Quoted 3 lines

For other pkg infras, we prefix the language type for packages that actually use that infra (e.g. PYTHON_FOO_SOURCE for a Python package, but we do not prefix the Python package itself, like: PYTHON_PYTHON_SOURCE)

Quoted 8 lines

Err, we do exactly the same for python-setuptools, so how is this different?

You could say that the package infrastructure should be named pkg-erlang
instead of pkg-rebar, but I don't think so. The situation is a bit similar to qmake - qmake is the canonical build tool for Qt packages, but if we would have qmake infrastructure, it would be called pkg-qmake and not pkg-qt.

So I vote for erlang-rebar and pkg-rebar, exactly as it is now.

OK.

Quoted 15 lines
Quoted 15 lines

So, I think 'rebar' should just be 'rebar'.

package/erlang-rebar/erlang-rebar.mk line 9

Quoted 6 lines
package/erlang-rebar/erlang-rebar.mk new file +6 -0
+#
+################################################################################
+
+ERLANG_REBAR_VERSION = 2.5.1
+ERLANG_REBAR_SOURCE = $(ERLANG_REBAR_VERSION).tar.gz
+ERLANG_REBAR_SITE = https://github.com/rebar/rebar/archive

Hmm... The Erlang folks really can't do anything like the others...

There are two ways to get packages from github:
- the github helper in Buildroot
- the direct 'released' tarballs

Quoted 5 lines
Quoted 2 lines

So, rebar does do releases on GitHub. Except what they release is not the source code, but the actual generated rebar executable. Sigh...

Err, when I download https://github.com/rebar/rebar/archive/2.5.1.tar.gz I get
exactly the same files as what is in the 2.5.1 tag, I don't get any executable...

That's because you did not follow the recent discussion about the github helper, which came to be written in the manual (which is broken formatting-wise, and I'll send a patch to fix the formatting soon):
http://nightly.buildroot.org/#_tips_and_tricks

---8<---
- If there is a green download button, like mongrel2, then it was uploaded by the maintainer and you should use the link of that button to specify FOO_SITE.
- If there is grey download button, like xbmc, then it?s an automatically generated tarball and you should use the github helper function.
---8<---

And in the case of rebar, there *is* a green button meaning the maintainers did upload a release. Except when Buildroot expects a source release, they did a binary release.

Hence all my explanations above.

[--SNIP--]

Quoted 9 lines
Quoted 8 lines

package/pkg-rebar.mk line 34

Quoted 3 lines
package/pkg-rebar.mk new file +3 -0
+#
+REBAR_HOST_DEPS_DIR = $(BUILD_DIR)/erlang-rebar-deps/host
+REBAR_TARGET_DEPS_DIR = $(BUILD_DIR)/erlang-rebar-deps/target

Well, I would prefer those directories not be stored in the build dir, but somewhere like:

    $(HOST_DIR)/usr/share/rebar/deps-host
    $(HOST_DIR)/usr/share/rebar/deps-target
Quoted 4 lines

+1, but I'd say

$(HOST_DIR)/usr/share/rebar/deps
$(STAGING_DIR)/usr/share/rebar/deps

Works for me too.

Quoted 3 lines

Note on the naming: even though the package is called erlang-rebar for
buildroot, anything it installs will just be rebar (without erlang-) because that's how upstream identifies itself.

Yup.

[--SNIP--]

Quoted 14 lines
Quoted 7 lines

package/pkg-rebar.mk line 59

Quoted 7 lines
package/pkg-rebar.mk new file +7 -0
+	for dir in ebin priv $(2); do					\
+		if test -d "$$(@D)/$$$$dir"; then			\
+			cp -r	"$$(@D)/$$$$dir"			\
+				'$(1)$$($$(PKG)_ERLANG_LIBDIR)';	\
+		fi;							\
+	done
+endef

Ah, double-$ mess :-)

The double-$ is needed only because it is called from inner-rebar-package,
which means that this function cannot be called from custom package commands. That's not very nice.

Quoted 6 lines

Fortunately, the solution is very simple: use single $ here, and put a double $
at the $$(call install-erlang-directories,...) site.

(Of course I haven't tested this, so YMMV.)

Same for all other functions defined below

I'll be looking into that double-$ [nm]ess. ;-]

[--SNIP--]

Quoted 11 lines
Quoted 3 lines

package/pkg-rebar.mk line 104

Quoted 3 lines
package/pkg-rebar.mk new file +3 -0
+define inner-rebar-package
+
+$(2)_ERLANG_APP ?= $(subst -,_,$(call LOWERCASE,$(patsubst ERLANG_%,%,$(3))))

It would make more sense to me to do

$(subst -,_,$(patsubst erlang-%,%,$(patsubst host-%,%,$(1))))

Quoted 2 lines

package/pkg-rebar.mk line 106

Quoted 2 lines

+$(2)_ERLANG_LIBDIR ?= \

package/pkg-rebar.mk new file +1 -0
+	/usr/lib/erlang/lib/$$($$(PKG)_ERLANG_APP)-$$($$(PKG)_VERSION)

Hey, here, it's "/usr/lib/erlang/lib/" while my build error was about "/usr/lib/erlang/usr/lib/" (notice the extra "/usr" after "erlang/").

Quoted 3 lines

Does it make sense to make this configurable? I.e., wouldn't it be better to
just expand this in the two places where it's used? It would certainly be clearer that way.

Well, I like it that it's a variable, so we can tweak the paths in a single location. But surely, that should not be configurable by the package.

Quoted 8 lines
Quoted 4 lines

package/pkg-rebar.mk line 110

Quoted 4 lines

+$(2)_ENV ?= \

package/pkg-rebar.mk new file +3 -0
+	CC='$$($(call UPPERCASE,$(4))_CC)'				\
+	CFLAGS='$$($(call UPPERCASE,$(4))_CFLAGS)'			\
+	LDFLAGS='$$($(call UPPERCASE,$(4))_LDFLAGS)'			\

I don't like this way of distinguishing host and target very much. It avoids
code duplication, but it's a lot harder to read. So I'd prefer

Quoted 5 lines

ifeq ($(4),host)

$(2)_ENV ?= \
	CC='$$(TARGET_CC)' \
	CFLAGS='$$(TARGET_CFLAGS)' \
	...

Agreed.

Quoted 3 lines

Also, it would be nice to cater for custom CFLAGS, i.e.

	CFLAGS='$$(TARGET_CFLAGS) $$($$(PKG)_CFLAGS)'

Agreed.

[--SNIP--]

Quoted 6 lines
Quoted 3 lines

And you need to autoreconf ejabberd because:
- you get it from the git tree. There is a release tarball, though:

      http://www.process-one.net/downloads/ejabberd/14.07/ejabberd-14.07.tgz

That's of course definitely a good idea, but it should still be _possible_ to
use a git version.

But please let's start simple, as this is already complex stuff.

[--SNIP--]

Quoted 10 lines
Quoted 6 lines

Hmmm... Looking further, it seems a few others (all from ProcessOne?) also uses ./configure . What about adding a new variable, like:

ERLANG_FOO_CONFIGURE = YES

which would tell whether running configure is needed?

I have the feeling we'll need a rebar-package and rebar-autotools-package.

But starting with FOO_CONFIGURE isn't a bad idea either.

Yes, I was wondering if we should go with:

    ERLANG_FOO_TYPE = {autotools,generic}
Quoted 11 lines
Quoted 7 lines

I'd like input from Thomas P. on all the above, because we get into really tricky-icky stuff... Thomas?

And by the way, since ejabberd is using the rebar infra, then maybe it makes sense to call that package erlang-ejabberd? I know it sounds strange, but that what's you did for all other rebar-using packages, so I don't see why this would be different for that one.

No, the convention is that library-type packages should be called
<language>-<package>, while program-type packages should be called just <package> (and should select the programming language rather than depending on it).

I'm fine with that.

Quoted 18 lines
Quoted 18 lines
Quoted 4 lines
package/pkg-rebar.mk new file +4 -0
+ifndef $(2)_BUILD_CMDS
+define $(2)_BUILD_CMDS
+	cd '$$(@D)' &&							\
+	if [ -f ./rebar ]; then						\

package/pkg-rebar.mk line 195

Quoted 10 lines
package/pkg-rebar.mk new file +10 -0
+		$$($$(PKG)_ENV)						\
+		$$($$(PKG)_REBAR_ENV)					\
+			./rebar $$($$(PKG)_REBAR_FLAGS) compile;	\
+	else								\
+		$$($$(PKG)_ENV)						\
+		$$($$(PKG)_REBAR_ENV)					\
+			rebar $$($$(PKG)_REBAR_FLAGS) compile;		\
+	fi
+endef
+endif

Hmm... Do we want to trust the package's own rebar? Shouldn't we always use our own version of rebar instead?

Quoted 8 lines
Quoted 1 line

What would be the reason to 'trust' the package's rebar more than our?

Because the package's rebar may be more up-to-date or may be modified. As long
as we don't apply cross-compilation patches to our rebar, there is no reason to prefer that one.

Ideally, however, the package should only depend on host-rebar if it will
actually use it. It's not a showstopper for me, just a preference.

But as Johan said, some packages' rebar may break the compilation, like I could observe in my testing.

Johan, care to investigate why would we use the package's rebar instead of our own?

Quoted 2 lines

Also, I have a slight preference for the buildroot package to specify which one
should be used rather than autodiscovering it. But again, not a showstopper for me.

Agreed.

Quoted 8 lines
Quoted 5 lines

package/pkg-rebar.mk line 201

Quoted 5 lines
package/pkg-rebar.mk new file +5 -0
+ifeq ($(4),host) # Install host files.
+
+ifndef $(2)_INSTALL_CMDS
+define $(2)_INSTALL_CMDS
+	$(call install-erlang-directories,$$(HOST_DIR),include)

Personally, I'd find it slightly more readable to put all the directories here
(ebin priv include) rather than automagically installing ebin and priv.

I'm not too fond of that. The things we always want to install should not be configurable, even from inside the pkg-infra itself.

But I won't be pedantic about that one. ;-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#12 lore raw

PATCH v2 2/15 package/pkg-rebar.mk: new infrastructure.

Yann, All,

Quoted 24 lines · Yann E. MORIN
Quoted 24 lines
Quoted 18 lines
Quoted 4 lines
package/pkg-rebar.mk new file +4 -0
+ifndef $(2)_BUILD_CMDS
+define $(2)_BUILD_CMDS
+  cd '$$(@D)' &&                                                  \
+  if [ -f ./rebar ]; then                                         \

package/pkg-rebar.mk line 195

Quoted 10 lines
package/pkg-rebar.mk new file +10 -0
+          $$($$(PKG)_ENV)                                         \
+          $$($$(PKG)_REBAR_ENV)                                   \
+                  ./rebar $$($$(PKG)_REBAR_FLAGS) compile;        \
+  else                                                            \
+          $$($$(PKG)_ENV)                                         \
+          $$($$(PKG)_REBAR_ENV)                                   \
+                  rebar $$($$(PKG)_REBAR_FLAGS) compile;          \
+  fi
+endef
+endif

Hmm... Do we want to trust the package's own rebar? Shouldn't we always use our own version of rebar instead?

Quoted 1 line

What would be the reason to 'trust' the package's rebar more than our?

Because the package's rebar may be more up-to-date or may be modified. As long
as we don't apply cross-compilation patches to our rebar, there is no reason to prefer that one.

Quoted 8 lines
Quoted 2 lines

Ideally, however, the package should only depend on host-rebar if it will
actually use it. It's not a showstopper for me, just a preference.

But as Johan said, some packages' rebar may break the compilation, like I could observe in my testing.

Johan, care to investigate why would we use the package's rebar instead of our own?

That's because packages distribute a rebar.config{,.script} file and its syntax may differ from the rebar version packaged in buildroot. Anyway, if I find out some packages' rebar break the compilation, the solution is probably to use our own rebar and patch the rebar configuration file of packages that distribute an old version.

Signature · 1 line
Johan
#13 lore raw

PATCH v2 2/15 package/pkg-rebar.mk: new infrastructure.

Johan, All,

On 2014-11-11 17:55 +0100, Johan Oudinet spake thusly:

Quoted 7 lines · Yann E. MORIN
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
package/pkg-rebar.mk new file +6 -0
+ifndef $(2)_BUILD_CMDS
+define $(2)_BUILD_CMDS
+  cd '$$(@D)' &&                                                  \
+  if [ -f ./rebar ]; then                                         \
+          $$($$(PKG)_ENV)                                         \
+          $$($$(PKG)_REBAR_ENV)                                   \
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

package/pkg-rebar.mk line 195

Quoted 8 lines
package/pkg-rebar.mk new file +8 -0
+                  ./rebar $$($$(PKG)_REBAR_FLAGS) compile;        \
+  else                                                            \
+          $$($$(PKG)_ENV)                                         \
+          $$($$(PKG)_REBAR_ENV)                                   \
+                  rebar $$($$(PKG)_REBAR_FLAGS) compile;          \
+  fi
+endef
+endif

[--SNIP--]

Quoted 8 lines
Quoted 2 lines

Johan, care to investigate why would we use the package's rebar instead of our own?

That's because packages distribute a rebar.config{,.script} file and its syntax may differ from the rebar version packaged in buildroot. Anyway, if I find out some packages' rebar break the compilation, the solution is probably to use our own rebar and patch the rebar configuration file of packages that distribute an old version.

OK, I see. Thanks for the explanations.

I think we should use our own rebar whenever possible, and revert to using the package's rebar only when necessary, by way of a config option, something like (name to be discussed):

ERLANG_FOO_USE_PKG_REBAR = YES

However, I wonder how much the configuration changes are intrusive.

Surely, if it is trivial, then I'd prefer we do the patching rather than use the package's rebar. however, if the patching turns out to be very intrusive, then it's OK to use the package's rebar.

But in that second case, I think we should delegate to the package to override its _CONFIGURE_CMDS and.or _BUILD_CMDS. Thoughts?

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#14 lore raw

PATCH v2 3/15 erlang-goldrush: new package.

In reply to Johan Oudinet
---
 package/Config.in                          |  5 +++++
 package/erlang-goldrush/Config.in          |  6 ++++++
 package/erlang-goldrush/erlang-goldrush.mk | 14 ++++++++++++++
 3 files changed, 25 insertions(+)
 create mode 100644 package/erlang-goldrush/Config.in
 create mode 100644 package/erlang-goldrush/erlang-goldrush.mk
package/Config.in +5 -0
index 28cf703..b4eaf14 100644
@@ -391,6 +391,11 @@ endmenu
 menu "Interpreter languages and scripting"
 	source "package/enscript/Config.in"
 	source "package/erlang/Config.in"
+if BR2_PACKAGE_ERLANG
+menu "Erlang libraries/modules"
+	source "package/erlang-goldrush/Config.in"
+endmenu
+endif
 	source "package/haserl/Config.in"
 	source "package/jamvm/Config.in"
 	source "package/jimtcl/Config.in"
package/erlang-goldrush/Config.in new file +6 -0
new file mode 100644
index 0000000..685a887
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_ERLANG_GOLDRUSH
+	bool "erlang-goldrush"
+	depends on BR2_PACKAGE_ERLANG
+	help
+	  Goldrush is a small Erlang app that provides fast event
+	  stream processing.
package/erlang-goldrush/erlang-goldrush.mk new file +14 -0
new file mode 100644
index 0000000..7537e76
@@ -0,0 +1,14 @@
+################################################################################
+#
+# erlang-goldrush
+#
+################################################################################
+
+ERLANG_GOLDRUSH_VERSION = 0.1.6
+ERLANG_GOLDRUSH_SITE = $(call github,DeadZen,goldrush,$(ERLANG_GOLDRUSH_VERSION))
+ERLANG_GOLDRUSH_LICENSE_FILES = LICENSE
+ERLANG_GOLDRUSH_DEPENDENCIES = erlang host-erlang-rebar
+ERLANG_GOLDRUSH_INSTALL_STAGING = YES
+
+$(eval $(rebar-package))
+$(eval $(host-rebar-package))
Signature · 1 line
2.1.0
#15 lore raw

PATCH v2 4/15 erlang-lager: new package.

In reply to Johan Oudinet
---
 package/Config.in                    |  1 +
 package/erlang-lager/Config.in       | 12 ++++++++++++
 package/erlang-lager/erlang-lager.mk | 14 ++++++++++++++
 3 files changed, 27 insertions(+)
 create mode 100644 package/erlang-lager/Config.in
 create mode 100644 package/erlang-lager/erlang-lager.mk
package/Config.in +1 -0
index b4eaf14..c2c0381 100644
@@ -394,6 +394,7 @@ menu "Interpreter languages and scripting"
 if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
+	source "package/erlang-lager/Config.in"
 endmenu
 endif
 	source "package/haserl/Config.in"
package/erlang-lager/Config.in new file +12 -0
new file mode 100644
index 0000000..f83239e
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_ERLANG_LAGER
+	bool "erlang-lager"
+	depends on BR2_PACKAGE_ERLANG
+	select BR2_PACKAGE_ERLANG_GOLDRUSH
+	help
+	  Logging framework for Erlang.
+	  
+	  Lager (as in the beer) is a logging framework for
+	  Erlang. Its purpose is to provide a more traditional way to
+	  perform logging in an erlang application that plays nicely
+	  with traditional UNIX logging tools like logrotate and
+	  syslog.
package/erlang-lager/erlang-lager.mk new file +14 -0
new file mode 100644
index 0000000..b530c8e
@@ -0,0 +1,14 @@
+################################################################################
+#
+# erlang-lager
+#
+################################################################################
+
+ERLANG_LAGER_VERSION = 2.0.3
+ERLANG_LAGER_SITE = $(call github,basho,lager,$(ERLANG_LAGER_VERSION))
+ERLANG_LAGER_LICENSE = Apache-2.0
+ERLANG_LAGER_LICENSE_FILES = LICENSE
+ERLANG_LAGER_DEPENDENCIES = erlang erlang-goldrush
+
+$(eval $(rebar-package))
+$(eval $(host-rebar-package))
Signature · 1 line
2.1.0
#16 lore raw

PATCH v2 5/15 erlang-p1-zlib: new package.

In reply to Johan Oudinet
---
 package/Config.in                        |  1 +
 package/erlang-p1-zlib/Config.in         |  5 +++++
 package/erlang-p1-zlib/erlang-p1-zlib.mk | 13 +++++++++++++
 3 files changed, 19 insertions(+)
 create mode 100644 package/erlang-p1-zlib/Config.in
 create mode 100644 package/erlang-p1-zlib/erlang-p1-zlib.mk
package/Config.in +1 -0
index c2c0381..f394e7d 100644
@@ -395,6 +395,7 @@ if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
 	source "package/erlang-lager/Config.in"
+	source "package/erlang-p1-zlib/Config.in"
 endmenu
 endif
 	source "package/haserl/Config.in"
package/erlang-p1-zlib/Config.in new file +5 -0
new file mode 100644
index 0000000..3d4f455
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_ERLANG_P1_ZLIB
+	bool "erlang-p1-zlib"
+	depends on BR2_PACKAGE_ERLANG
+	help
+	  Erlang interface to zlib
package/erlang-p1-zlib/erlang-p1-zlib.mk new file +13 -0
new file mode 100644
index 0000000..84ecb35
@@ -0,0 +1,13 @@
+################################################################################
+#
+# erlang-p1-zlib
+#
+################################################################################
+
+ERLANG_P1_ZLIB_VERSION = 52e82bb
+ERLANG_P1_ZLIB_SITE = $(call github,processone,zlib,$(ERLANG_P1_ZLIB_VERSION))
+ERLANG_P1_ZLIB_LICENSE = GPLv2+
+ERLANG_P1_ZLIB_LICENSE_FILES = COPYING
+ERLANG_P1_ZLIB_DEPENDENCIES = erlang
+
+$(eval $(rebar-package))
Signature · 1 line
2.1.0
#17 lore raw

PATCH v2 6/15 erlang-p1-yaml: new package.

In reply to Johan Oudinet
---
 package/Config.in                        |  1 +
 package/erlang-p1-yaml/Config.in         |  6 ++++++
 package/erlang-p1-yaml/erlang-p1-yaml.mk | 13 +++++++++++++
 3 files changed, 20 insertions(+)
 create mode 100644 package/erlang-p1-yaml/Config.in
 create mode 100644 package/erlang-p1-yaml/erlang-p1-yaml.mk
package/Config.in +1 -0
index f394e7d..bd82388 100644
@@ -395,6 +395,7 @@ if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
 	source "package/erlang-lager/Config.in"
+	source "package/erlang-p1-yaml/Config.in"
 	source "package/erlang-p1-zlib/Config.in"
 endmenu
 endif
package/erlang-p1-yaml/Config.in new file +6 -0
new file mode 100644
index 0000000..423ef3f
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_ERLANG_P1_YAML
+	bool "erlang-p1-yaml"
+	depends on BR2_PACKAGE_ERLANG
+	select BR2_PACKAGE_LIBYAML
+	help
+	  Erlang wrapper for libyaml C library
package/erlang-p1-yaml/erlang-p1-yaml.mk new file +13 -0
new file mode 100644
index 0000000..990c3a7
@@ -0,0 +1,13 @@
+################################################################################
+#
+# erlang-p1-yaml
+#
+################################################################################
+
+ERLANG_P1_YAML_VERSION = 236b943
+ERLANG_P1_YAML_SITE = $(call github,processone,p1_yaml,$(ERLANG_P1_YAML_VERSION))
+ERLANG_P1_YAML_LICENSE = Apache-2.0
+ERLANG_P1_YAML_LICENSE_FILES = COPYING
+ERLANG_P1_YAML_DEPENDENCIES = erlang libyaml
+
+$(eval $(rebar-package))
Signature · 1 line
2.1.0
#18 lore raw

PATCH v2 7/15 erlang-p1-xml: new package.

In reply to Johan Oudinet
---
 package/Config.in                      |  1 +
 package/erlang-p1-xml/Config.in        |  6 ++++++
 package/erlang-p1-xml/erlang-p1-xml.mk | 14 ++++++++++++++
 3 files changed, 21 insertions(+)
 create mode 100644 package/erlang-p1-xml/Config.in
 create mode 100644 package/erlang-p1-xml/erlang-p1-xml.mk
package/Config.in +1 -0
index bd82388..da13e8b 100644
@@ -395,6 +395,7 @@ if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
 	source "package/erlang-lager/Config.in"
+	source "package/erlang-p1-xml/Config.in"
 	source "package/erlang-p1-yaml/Config.in"
 	source "package/erlang-p1-zlib/Config.in"
 endmenu
package/erlang-p1-xml/Config.in new file +6 -0
new file mode 100644
index 0000000..85fe02f
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_ERLANG_P1_XML
+	bool "erlang-p1-xml"
+	depends on BR2_PACKAGE_ERLANG
+	select BR2_PACKAGE_EXPAT
+	help
+	  XML utilities for Erlang
package/erlang-p1-xml/erlang-p1-xml.mk new file +14 -0
new file mode 100644
index 0000000..5f43ccb
@@ -0,0 +1,14 @@
+################################################################################
+#
+# erlang-p1-xml
+#
+################################################################################
+
+ERLANG_P1_XML_VERSION = b530983
+ERLANG_P1_XML_SITE = $(call github,processone,xml,$(ERLANG_P1_XML_VERSION))
+ERLANG_P1_XML_LICENSE = GPLv2
+ERLANG_P1_XML_LICENSE_FILES = COPYING
+ERLANG_P1_XML_DEPENDENCIES = erlang expat
+ERLANG_P1_XML_INSTALL_STAGING = YES
+
+$(eval $(rebar-package))
Signature · 1 line
2.1.0
#19 lore raw

PATCH v2 8/15 erlang-p1-utils: new package.

In reply to Johan Oudinet
---
 package/Config.in                          |  1 +
 package/erlang-p1-utils/Config.in          |  5 +++++
 package/erlang-p1-utils/erlang-p1-utils.mk | 14 ++++++++++++++
 3 files changed, 20 insertions(+)
 create mode 100644 package/erlang-p1-utils/Config.in
 create mode 100644 package/erlang-p1-utils/erlang-p1-utils.mk
package/Config.in +1 -0
index da13e8b..7f6fee9 100644
@@ -395,6 +395,7 @@ if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
 	source "package/erlang-lager/Config.in"
+	source "package/erlang-p1-utils/Config.in"
 	source "package/erlang-p1-xml/Config.in"
 	source "package/erlang-p1-yaml/Config.in"
 	source "package/erlang-p1-zlib/Config.in"
package/erlang-p1-utils/Config.in new file +5 -0
new file mode 100644
index 0000000..a544eed
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_ERLANG_P1_UTILS
+	bool "erlang-p1-utils"
+	depends on BR2_PACKAGE_ERLANG
+	help
+	  Set of small Erlang libraries
package/erlang-p1-utils/erlang-p1-utils.mk new file +14 -0
new file mode 100644
index 0000000..23e2c63
@@ -0,0 +1,14 @@
+################################################################################
+#
+# erlang-p1-utils
+#
+################################################################################
+
+ERLANG_P1_UTILS_VERSION = 940f42d
+ERLANG_P1_UTILS_SITE = $(call github,processone,p1_utils,$(ERLANG_P1_UTILS_VERSION))
+ERLANG_P1_UTILS_LICENSE = GPLv2+
+ERLANG_P1_UTILS_LICENSE_FILES = COPYING
+ERLANG_P1_UTILS_DEPENDENCIES = erlang
+ERLANG_P1_UTILS_INSTALL_STAGING = YES
+
+$(eval $(rebar-package))
Signature · 1 line
2.1.0
#20 lore raw

PATCH v2 9/15 erlang-p1-tls: new package.

In reply to Johan Oudinet
---
 package/Config.in                      |  1 +
 package/erlang-p1-tls/Config.in        |  5 +++++
 package/erlang-p1-tls/erlang-p1-tls.mk | 14 ++++++++++++++
 3 files changed, 20 insertions(+)
 create mode 100644 package/erlang-p1-tls/Config.in
 create mode 100644 package/erlang-p1-tls/erlang-p1-tls.mk
package/Config.in +1 -0
index 7f6fee9..21c4071 100644
@@ -395,6 +395,7 @@ if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
 	source "package/erlang-lager/Config.in"
+	source "package/erlang-p1-tls/Config.in"
 	source "package/erlang-p1-utils/Config.in"
 	source "package/erlang-p1-xml/Config.in"
 	source "package/erlang-p1-yaml/Config.in"
package/erlang-p1-tls/Config.in new file +5 -0
new file mode 100644
index 0000000..1aa53bc
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_ERLANG_P1_TLS
+	bool "erlang-p1-tls"
+	depends on BR2_PACKAGE_ERLANG
+	help
+	  Erlang interface to OpenSSL
package/erlang-p1-tls/erlang-p1-tls.mk new file +14 -0
new file mode 100644
index 0000000..a884377
@@ -0,0 +1,14 @@
+################################################################################
+#
+# erlang-p1-tls
+#
+################################################################################
+
+ERLANG_P1_TLS_VERSION = 53f0478
+ERLANG_P1_TLS_SITE = $(call github,processone,tls,$(ERLANG_P1_TLS_VERSION))
+ERLANG_P1_TLS_LICENSE = GPLv2+
+ERLANG_P1_TLS_LICENSE_FILES = COPYING
+ERLANG_P1_TLS_DEPENDENCIES = erlang
+ERLANG_P1_TLS_INSTALL_STAGING = YES
+
+$(eval $(rebar-package))
Signature · 1 line
2.1.0
#21 lore raw

PATCH v2 10/15 erlang-p1-stun: new package.

In reply to Johan Oudinet
---
 package/Config.in                        |  1 +
 package/erlang-p1-stun/Config.in         |  7 +++++++
 package/erlang-p1-stun/erlang-p1-stun.mk | 14 ++++++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 package/erlang-p1-stun/Config.in
 create mode 100644 package/erlang-p1-stun/erlang-p1-stun.mk
package/Config.in +1 -0
index 21c4071..52c597a 100644
@@ -395,6 +395,7 @@ if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
 	source "package/erlang-lager/Config.in"
+	source "package/erlang-p1-stun/Config.in"
 	source "package/erlang-p1-tls/Config.in"
 	source "package/erlang-p1-utils/Config.in"
 	source "package/erlang-p1-xml/Config.in"
package/erlang-p1-stun/Config.in new file +7 -0
new file mode 100644
index 0000000..bbe6bae
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_ERLANG_P1_STUN
+	bool "erlang-p1-stun"
+	depends on BR2_PACKAGE_ERLANG
+	select BR2_PACKAGE_ERLANG_P1_TLS
+	select BR2_PACKAGE_ERLANG_P1_UTILS
+	help
+	  STUN library for Erlang
package/erlang-p1-stun/erlang-p1-stun.mk new file +14 -0
new file mode 100644
index 0000000..d963caa
@@ -0,0 +1,14 @@
+################################################################################
+#
+# erlang-p1-stun
+#
+################################################################################
+
+ERLANG_P1_STUN_VERSION = a7c07b6
+ERLANG_P1_STUN_SITE = $(call github,processone,stun,$(ERLANG_P1_STUN_VERSION))
+ERLANG_P1_STUN_LICENSE = GPLv2+
+ERLANG_P1_STUN_LICENSE_FILES = COPYING
+ERLANG_P1_STUN_DEPENDENCIES = erlang host-erlang-rebar erlang-p1-tls erlang-p1-utils
+ERLANG_P1_STUN_INSTALL_STAGING = YES
+
+$(eval $(rebar-package))
Signature · 1 line
2.1.0
#22 lore raw

PATCH v2 11/15 erlang-p1-stringprep: new package.

In reply to Johan Oudinet
---
 package/Config.in                                    |  1 +
 package/erlang-p1-stringprep/Config.in               |  5 +++++
 package/erlang-p1-stringprep/erlang-p1-stringprep.mk | 13 +++++++++++++
 3 files changed, 19 insertions(+)
 create mode 100644 package/erlang-p1-stringprep/Config.in
 create mode 100644 package/erlang-p1-stringprep/erlang-p1-stringprep.mk
package/Config.in +1 -0
index 52c597a..5656a1a 100644
@@ -395,6 +395,7 @@ if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
 	source "package/erlang-lager/Config.in"
+	source "package/erlang-p1-stringprep/Config.in"
 	source "package/erlang-p1-stun/Config.in"
 	source "package/erlang-p1-tls/Config.in"
 	source "package/erlang-p1-utils/Config.in"
package/erlang-p1-stringprep/Config.in new file +5 -0
new file mode 100644
index 0000000..eaaa59e
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_ERLANG_P1_STRINGPREP
+	bool "erlang-p1-stringprep"
+	depends on BR2_PACKAGE_ERLANG
+	help
+	  Erlang interface to stringprep
package/erlang-p1-stringprep/erlang-p1-stringprep.mk new file +13 -0
new file mode 100644
index 0000000..b83e106
@@ -0,0 +1,13 @@
+################################################################################
+#
+# erlang-p1-stringprep
+#
+################################################################################
+
+ERLANG_P1_STRINGPREP_VERSION = 9e9e0f8
+ERLANG_P1_STRINGPREP_SITE = $(call github,processone,stringprep,$(ERLANG_P1_STRINGPREP_VERSION))
+ERLANG_P1_STRINGPREP_LICENSE = GPLv2+
+ERLANG_P1_STRINGPREP_LICENSE_FILES = LICENSE.TCL
+ERLANG_P1_STRINGPREP_DEPENDENCIES = erlang
+
+$(eval $(rebar-package))
Signature · 1 line
2.1.0
#23 lore raw

PATCH v2 12/15 erlang-p1-sip: new package.

In reply to Johan Oudinet
---
 package/Config.in                                     |  1 +
 package/erlang-p1-sip/Config.in                       |  8 ++++++++
 .../erlang-p1-sip/erlang-p1-sip-01-fix-includes.patch | 19 +++++++++++++++++++
 package/erlang-p1-sip/erlang-p1-sip.mk                | 14 ++++++++++++++
 4 files changed, 42 insertions(+)
 create mode 100644 package/erlang-p1-sip/Config.in
 create mode 100644 package/erlang-p1-sip/erlang-p1-sip-01-fix-includes.patch
 create mode 100644 package/erlang-p1-sip/erlang-p1-sip.mk
package/Config.in +1 -0
index 5656a1a..8abd6a6 100644
@@ -395,6 +395,7 @@ if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
 	source "package/erlang-lager/Config.in"
+	source "package/erlang-p1-sip/Config.in"
 	source "package/erlang-p1-stringprep/Config.in"
 	source "package/erlang-p1-stun/Config.in"
 	source "package/erlang-p1-tls/Config.in"
package/erlang-p1-sip/Config.in new file +8 -0
new file mode 100644
index 0000000..64a12b1
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_ERLANG_P1_SIP
+	bool "erlang-p1-sip"
+	depends on BR2_PACKAGE_ERLANG
+	select BR2_PACKAGE_ERLANG_P1_STUN
+	select BR2_PACKAGE_ERLANG_P1_TLS
+	select BR2_PACKAGE_ERLANG_P1_UTILS
+	help
+	  SIP library for Erlang
package/erlang-p1-sip/erlang-p1-sip-01-fix-includes.patch new file +19 -0
new file mode 100644
index 0000000..80e2ab3
@@ -0,0 +1,19 @@
+Description: correct include
+ This part of the code was moved into it's own project and was packaged
+ separately by me. To make the build process work, this small fix is
+ necessary.
+Author: Philipp Huebner <[email protected]>
+
+Index: erlang-p1-sip/src/esip_socket.erl
+===================================================================
+--- erlang-p1-sip.orig/src/esip_socket.erl
++++ erlang-p1-sip/src/esip_socket.erl
+@@ -22,7 +22,7 @@
+ 
+ -include("esip.hrl").
+ -include("esip_lib.hrl").
+--include("stun.hrl").
++-include_lib("p1_stun/include/stun.hrl").
+ 
+ -define(TCP_SEND_TIMEOUT, 15000).
+ -define(CONNECT_TIMEOUT, 20000).
package/erlang-p1-sip/erlang-p1-sip.mk new file +14 -0
new file mode 100644
index 0000000..d38ff2b
@@ -0,0 +1,14 @@
+################################################################################
+#
+# erlang-p1-sip
+#
+################################################################################
+
+ERLANG_P1_SIP_VERSION = bba4459
+ERLANG_P1_SIP_SITE = $(call github,processone,p1_sip,$(ERLANG_P1_SIP_VERSION))
+ERLANG_P1_SIP_LICENSE = GPLv2
+ERLANG_P1_SIP_LICENSE_FILES = COPYING
+ERLANG_P1_SIP_DEPENDENCIES = erlang erlang-p1-stun erlang-p1-tls erlang-p1-utils
+ERLANG_P1_SIP_INSTALL_STAGING = YES
+
+$(eval $(rebar-package))
Signature · 1 line
2.1.0
#24 lore raw

PATCH v2 13/15 erlang-p1-iconv: new package.

In reply to Johan Oudinet
---
 package/Config.in                          |  1 +
 package/erlang-p1-iconv/Config.in          |  6 ++++++
 package/erlang-p1-iconv/erlang-p1-iconv.mk | 17 +++++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 package/erlang-p1-iconv/Config.in
 create mode 100644 package/erlang-p1-iconv/erlang-p1-iconv.mk
package/Config.in +1 -0
index 8abd6a6..bda3674 100644
@@ -395,6 +395,7 @@ if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
 	source "package/erlang-lager/Config.in"
+	source "package/erlang-p1-iconv/Config.in"
 	source "package/erlang-p1-sip/Config.in"
 	source "package/erlang-p1-stringprep/Config.in"
 	source "package/erlang-p1-stun/Config.in"
package/erlang-p1-iconv/Config.in new file +6 -0
new file mode 100644
index 0000000..53876bf
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_ERLANG_P1_ICONV
+	bool "erlang-p1-iconv"
+	depends on BR2_PACKAGE_ERLANG
+	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
+	help
+	  Erlang interface to libiconv
package/erlang-p1-iconv/erlang-p1-iconv.mk new file +17 -0
new file mode 100644
index 0000000..e810a9d
@@ -0,0 +1,17 @@
+################################################################################
+#
+# erlang-p1-iconv
+#
+################################################################################
+
+ERLANG_P1_ICONV_VERSION = dff5ee5
+ERLANG_P1_ICONV_SITE = $(call github,processone,eiconv,$(ERLANG_P1_ICONV_VERSION))
+ERLANG_P1_ICONV_LICENSE = GPLv2+
+ERLANG_P1_ICONV_LICENSE_FILES = COPYING
+ERLANG_P1_ICONV_DEPENDENCIES = erlang
+
+ifeq ($(BR2_PACKAGE_LIBICONV),y)
+ERLANG_P1_ICONV_DEPENDENCIES += libiconv
+endif
+
+$(eval $(rebar-package))
Signature · 1 line
2.1.0
#25 lore raw

PATCH v2 13/15 erlang-p1-iconv: new package.

Johan, All,

On 2014-11-07 14:28 +0100, Johan Oudinet spake thusly:

Quoted 8 lines
---
 package/Config.in                          |  1 +
 package/erlang-p1-iconv/Config.in          |  6 ++++++
 package/erlang-p1-iconv/erlang-p1-iconv.mk | 17 +++++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 package/erlang-p1-iconv/Config.in
 create mode 100644 package/erlang-p1-iconv/erlang-p1-iconv.mk

[--SNIP--]

While I was reviewing the other patches, I got a build failure with this package (long lines may have got split in the copy-paste):

Compiling c_src/iconv.c /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei
collect2: error: ld returned 1 exit status
ERROR: sh(/home/ymorin/dev/buildroot/O/host/usr/bin/armv6-rpi-linux-gnueabihf-gcc
c_src/iconv.o
-L/home/ymorin/dev/buildroot/O/target/usr/lib/erlang/lib/erl_interface-/lib
-lerl_interface -lei -shared
-L/home/ymorin/dev/buildroot/O/target/usr/lib/erlang/lib/erl_interface-/lib
-lerl_interface -lei -o priv/lib/iconv.so)
failed with return code 1 and the following output:
/home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei
collect2: error: ld returned 1 exit status

ERROR: compile failed while processing /home/ymorin/dev/buildroot/O/build/erlang-p1-iconv-dff5ee5: rebar_abort

Here is my defconfig file:

BR2_armeb=y
BR2_arm1176jzf_s=y
BR2_ARM_EABIHF=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_PATH="/home/ymorin/x-tools/armv6-rpi-linux-gnueabihf" BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="armv6-rpi-linux-gnueabihf" BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_12=y BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_PACKAGE_ERLANG=y
BR2_PACKAGE_EJABBERD=y

Since I'm using a local toolchain, you won't be able to reproduce. I'll try to use one of the pre-built toolchains.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#26 lore raw

PATCH v2 13/15 erlang-p1-iconv: new package.

Johan, All,

On 2014-11-10 17:37 +0100, Yann E. MORIN spake thusly:

Quoted 46 lines

On 2014-11-07 14:28 +0100, Johan Oudinet spake thusly:

Quoted 8 lines
---
 package/Config.in                          |  1 +
 package/erlang-p1-iconv/Config.in          |  6 ++++++
 package/erlang-p1-iconv/erlang-p1-iconv.mk | 17 +++++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 package/erlang-p1-iconv/Config.in
 create mode 100644 package/erlang-p1-iconv/erlang-p1-iconv.mk

[--SNIP--]

While I was reviewing the other patches, I got a build failure with this package (long lines may have got split in the copy-paste):

Compiling c_src/iconv.c /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei
collect2: error: ld returned 1 exit status
ERROR: sh(/home/ymorin/dev/buildroot/O/host/usr/bin/armv6-rpi-linux-gnueabihf-gcc
c_src/iconv.o

(quoted diff) +0 -4
-L/home/ymorin/dev/buildroot/O/target/usr/lib/erlang/lib/erl_interface-/lib
-lerl_interface -lei  -shared
-L/home/ymorin/dev/buildroot/O/target/usr/lib/erlang/lib/erl_interface-/lib
-lerl_interface -lei -o priv/lib/iconv.so)

failed with return code 1 and the following output:
/home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei
collect2: error: ld returned 1 exit status

ERROR: compile failed while processing /home/ymorin/dev/buildroot/O/build/erlang-p1-iconv-dff5ee5: rebar_abort

Here is my defconfig file:

Quoted 12 lines

BR2_armeb=y
BR2_arm1176jzf_s=y
BR2_ARM_EABIHF=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_PATH="/home/ymorin/x-tools/armv6-rpi-linux-gnueabihf" BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="armv6-rpi-linux-gnueabihf" BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_12=y BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_PACKAGE_ERLANG=y
BR2_PACKAGE_EJABBERD=y

I still get the same error with this defconfig:

BR2_armeb=y
BR2_cortex_a9=y
BR2_ARM_EABIHF=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_ERLANG=y
BR2_PACKAGE_EJABBERD=y

But I can see the missing libs to be present, except the path to them is not specified in the compile line:
staging/usr/lib/erlang/usr/lib/liberl_interface.a staging/usr/lib/erlang/usr/lib/libei.a

Except it seems weird to have ".../erlang/usr/lib/..." to begin with.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#27 lore raw

PATCH v2 13/15 erlang-p1-iconv: new package.

Yann, All,

Quoted 18 lines · Yann E. MORIN
Quoted 18 lines

Compiling c_src/iconv.c /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei
collect2: error: ld returned 1 exit status
ERROR: sh(/home/ymorin/dev/buildroot/O/host/usr/bin/armv6-rpi-linux-gnueabihf-gcc
c_src/iconv.o

(quoted diff) +0 -4
-L/home/ymorin/dev/buildroot/O/target/usr/lib/erlang/lib/erl_interface-/lib
-lerl_interface -lei  -shared
-L/home/ymorin/dev/buildroot/O/target/usr/lib/erlang/lib/erl_interface-/lib
-lerl_interface -lei -o priv/lib/iconv.so)

failed with return code 1 and the following output:
/home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:

Quoted 8 lines
Quoted 8 lines

cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei
collect2: error: ld returned 1 exit status

I've seen this error few times when compiling several rebar packages. As a workaround, I run `make erlang-dirclean'.
I'm not 100% sure of the reason for this error but I suspect that old versions of rebar remove such libraries after compiling, which leads to an error on the next compilation.

Signature · 1 line
Johan
#28 lore raw

PATCH v2 13/15 erlang-p1-iconv: new package.

On 2014-11-11 04:30 +0100, Johan Oudinet spake thusly:

Quoted 27 lines

Yann, All,

Quoted 24 lines · Yann E. MORIN
Quoted 24 lines

Compiling c_src/iconv.c /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei
collect2: error: ld returned 1 exit status
ERROR: sh(/home/ymorin/dev/buildroot/O/host/usr/bin/armv6-rpi-linux-gnueabihf-gcc
c_src/iconv.o

(quoted diff) +0 -4
-L/home/ymorin/dev/buildroot/O/target/usr/lib/erlang/lib/erl_interface-/lib
-lerl_interface -lei  -shared
-L/home/ymorin/dev/buildroot/O/target/usr/lib/erlang/lib/erl_interface-/lib
-lerl_interface -lei -o priv/lib/iconv.so)

failed with return code 1 and the following output:
/home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lei /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:
cannot find -lerl_interface /home/ymorin/x-tools/armv6-rpi-linux-gnueabihf/lib/gcc/armv6-rpi-linux-gnueabihf/4.9.1/../../../../armv6-rpi-linux-gnueabihf/bin/ld.bfd:

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

cannot find -lei
collect2: error: ld returned 1 exit status

I've seen this error few times when compiling several rebar packages. As a workaround, I run `make erlang-dirclean'.
I'm not 100% sure of the reason for this error but I suspect that old versions of rebar remove such libraries after compiling, which leads to an error on the next compilation.

Well, that error happened from a completely clean build dir, so it is not OK do have to rebuild erlang in this case (it might have been OK when doing rebuilds, but even so, we'd prefer to avoid that).

And now I suspect I know why it hapenned: I am building out-of-tree, so the comment I made on your patch 2/2 might be kicking in:

    ---8<---
    > +EI_VSN_FILE=output/build/erlang-$ERLANG_VSN/lib/erl_interface/vsn.mk

    That does not work for out-of-tree builds. You should use something
    like:
        EI_VSN_FILE="${O}/build/erlang-$ERLANG_VSN/lib/erl_interface/vsn.mk"
    ---8<---

Anyway, I'll continue investigating this series.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#29 lore raw

PATCH v2 14/15 erlang-p1-cache-tab: new package.

In reply to Johan Oudinet
---
 package/Config.in                                  |  1 +
 package/erlang-p1-cache-tab/Config.in              |  6 ++++++
 package/erlang-p1-cache-tab/erlang-p1-cache-tab.mk | 13 +++++++++++++
 3 files changed, 20 insertions(+)
 create mode 100644 package/erlang-p1-cache-tab/Config.in
 create mode 100644 package/erlang-p1-cache-tab/erlang-p1-cache-tab.mk
package/Config.in +1 -0
index bda3674..84f919a 100644
@@ -395,6 +395,7 @@ if BR2_PACKAGE_ERLANG
 menu "Erlang libraries/modules"
 	source "package/erlang-goldrush/Config.in"
 	source "package/erlang-lager/Config.in"
+	source "package/erlang-p1-cache-tab/Config.in"
 	source "package/erlang-p1-iconv/Config.in"
 	source "package/erlang-p1-sip/Config.in"
 	source "package/erlang-p1-stringprep/Config.in"
package/erlang-p1-cache-tab/Config.in new file +6 -0
new file mode 100644
index 0000000..6d1f889
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_ERLANG_P1_CACHE_TAB
+	bool "erlang-p1-cache-tab"
+	depends on BR2_PACKAGE_ERLANG
+	select BR2_PACKAGE_ERLANG_P1_UTILS
+	help
+	  Erlang library implementing cache tables
package/erlang-p1-cache-tab/erlang-p1-cache-tab.mk new file +13 -0
new file mode 100644
index 0000000..0f0b637
@@ -0,0 +1,13 @@
+################################################################################
+#
+# erlang-p1-cache-tab
+#
+################################################################################
+
+ERLANG_P1_CACHE_TAB_VERSION = 7b89d6a
+ERLANG_P1_CACHE_TAB_SITE = $(call github,processone,cache_tab,$(ERLANG_P1_CACHE_TAB_VERSION))
+ERLANG_P1_CACHE_TAB_LICENSE = GPLv2+
+ERLANG_P1_CACHE_TAB_LICENSE_FILES = COPYING
+ERLANG_P1_CACHE_TAB_DEPENDENCIES = erlang erlang-p1-utils
+
+$(eval $(rebar-package))
Signature · 1 line
2.1.0
#30 lore raw

PATCH v2 15/15 ejabberd: new package.

In reply to Johan Oudinet
---
 package/Config.in                                  |  1 +
 package/ejabberd/0001-remove-deps.patch            | 20 +++++
 package/ejabberd/0002-disable-rebar-deps.patch     | 70 +++++++++++++++
 package/ejabberd/0003-disable-test.patch           | 21 +++++
 package/ejabberd/0004-disable-version-check.patch  | 20 +++++
 package/ejabberd/0005-fix-includes.patch           | 45 ++++++++++
 package/ejabberd/0006-remove-doc.patch             | 26 ++++++
 package/ejabberd/0007-fix-init.patch               | 99 ++++++++++++++++++++++
 .../ejabberd/0008-fix-install-permissions.patch    | 76 +++++++++++++++++
 package/ejabberd/Config.in                         | 21 +++++
 package/ejabberd/S50ejabberd                       | 35 ++++++++
 package/ejabberd/check-erlang-lib                  | 55 ++++++++++++
 package/ejabberd/ejabberd.mk                       | 51 +++++++++++
 13 files changed, 540 insertions(+)
 create mode 100644 package/ejabberd/0001-remove-deps.patch
 create mode 100644 package/ejabberd/0002-disable-rebar-deps.patch
 create mode 100644 package/ejabberd/0003-disable-test.patch
 create mode 100644 package/ejabberd/0004-disable-version-check.patch
 create mode 100644 package/ejabberd/0005-fix-includes.patch
 create mode 100644 package/ejabberd/0006-remove-doc.patch
 create mode 100644 package/ejabberd/0007-fix-init.patch
 create mode 100644 package/ejabberd/0008-fix-install-permissions.patch
 create mode 100644 package/ejabberd/Config.in
 create mode 100644 package/ejabberd/S50ejabberd
 create mode 100755 package/ejabberd/check-erlang-lib
 create mode 100644 package/ejabberd/ejabberd.mk
package/Config.in +1 -0
index 84f919a..1695cbe 100644
@@ -1015,6 +1015,7 @@ endif
 	source "package/dnsmasq/Config.in"
 	source "package/dropbear/Config.in"
 	source "package/ebtables/Config.in"
+	source "package/ejabberd/Config.in"
 	source "package/ethtool/Config.in"
 	source "package/faifa/Config.in"
 	source "package/fmc/Config.in"
package/ejabberd/0001-remove-deps.patch new file +20 -0
new file mode 100644
index 0000000..1982ca8
@@ -0,0 +1,20 @@
+Description: remove make targets for deps
+ Without this patch, dependencies would be downloaded and compiled
+ using rebar at build time.
+Author: Philipp Huebner <[email protected]>
+
+Index: ejabberd/rebar.config.script
+===================================================================
+--- ejabberd.orig/rebar.config.script
++++ ejabberd/rebar.config.script
+@@ -126,9 +126,7 @@ Config = [{erl_opts, Macros ++ HiPE ++ D
+           {sub_dirs, ["rel"]},
+           {keep_build_info, true},
+           {ct_extra_params, "-include "
+-           ++ filename:join([Cwd, "tools"])},
+-          {post_hooks, PostHooks ++ CfgPostHooks},
+-          {deps, Deps ++ CfgDeps}],
++           ++ filename:join([Cwd, "tools"])}],
+ %%io:format("ejabberd configuration:~n  ~p~n", [Config]),
+ Config.
+ 
package/ejabberd/0002-disable-rebar-deps.patch new file +70 -0

70 lines not on this page · raw message

package/ejabberd/0003-disable-test.patch new file +21 -0
new file mode 100644
index 0000000..4354ab6
@@ -0,0 +1,21 @@
+Description: remove testing with MySQL and PostgreSQL
+ Without this patch a test would be initiated after building ejabberd that
+ requires specially configured instances of MySQL and PostgreSQL to be up
+ and running.
+Author: Philipp Huebner <[email protected]>
+
+Index: ejabberd/Makefile.in
+===================================================================
+--- ejabberd.orig/Makefile.in
++++ ejabberd/Makefile.in
+@@ -260,10 +260,6 @@ dialyzer: erlang_plt deps_plt ejabberd_p
+ 	status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
+ 
+ test:
+-	@echo "************************** NOTICE ***************************************"
+-	@cat test/README
+-	@echo "*************************************************************************"
+-	$(REBAR) skip_deps=true ct
+ 
+ .PHONY: src doc edoc dialyzer Makefile TAGS clean clean-rel distclean rel \
+ 	install uninstall uninstall-binary uninstall-all translations deps test spec \
package/ejabberd/0004-disable-version-check.patch new file +20 -0
new file mode 100644
index 0000000..f2f1e81
@@ -0,0 +1,20 @@
+Description: remove checking erlang version
+ Without this patch, the configure will try to run erlang to simply check if
+ the version is supported by ejabberd. Instead, we do this test statically.
+Author: Johan Oudinet <[email protected]>
+
+Index: ejabberd/configure.ac
+===================================================================
+--- ejabberd.orig/configure.ac	2014-10-20 11:04:14.751256865 +0200
++++ ejabberd/configure.ac	2014-10-20 11:03:47.983578623 +0200
+@@ -37,10 +37,8 @@ AC_ARG_ENABLE(erlang-version-check,
+ 	[Check Erlang/OTP version @<:@default=yes@:>@])])
+ case "$enable_erlang_version_check" in
+ 	yes|'')
+-		ERLANG_VERSION_CHECK([$REQUIRE_ERLANG_MIN],[$REQUIRE_ERLANG_MAX])
+ 		;;
+ 	no)
+-		ERLANG_VERSION_CHECK([$REQUIRE_ERLANG_MIN],[$REQUIRE_ERLANG_MAX],[warn])
+ 		;;
+ esac
+ 
package/ejabberd/0005-fix-includes.patch new file +45 -0

45 lines not on this page · raw message

package/ejabberd/0006-remove-doc.patch new file +26 -0
new file mode 100644
index 0000000..0c0a21b
@@ -0,0 +1,26 @@
+Description: remove installing documentation
+ Without this patch, the Makefile will try to install ejabberd
+ documentation even if it is not generated, which will fail.
+Author: Johan Oudinet <[email protected]>
+
+Index: ejabberd/Makefile.in
+===================================================================
+--- ejabberd.orig/Makefile.in	2014-10-21 16:43:42.604972005 +0200
++++ ejabberd/Makefile.in	2014-10-21 16:45:12.419989667 +0200
+@@ -156,16 +156,6 @@ install: all
+ 	$(INSTALL) -d -m 750 $(O_USER) $(LOGDIR)
+ 	$(CHOWN_COMMAND) -R @INSTALLUSER@ $(LOGDIR) >$(CHOWN_OUTPUT)
+ 	chmod -R 750 $(LOGDIR)
+-	#
+-	# Documentation
+-	$(INSTALL) -d $(DOCDIR)
+-	$(INSTALL) -m 644 doc/dev.html $(DOCDIR)
+-	$(INSTALL) -m 644 doc/guide.html $(DOCDIR)
+-	$(INSTALL) -m 644 doc/*.png $(DOCDIR)
+-	[ -f doc/guide.pdf ] \
+-		&& $(INSTALL) -m 644 doc/guide.pdf $(DOCDIR) \
+-		|| echo "No doc/guide.pdf was built"
+-	$(INSTALL) -m 644 COPYING $(DOCDIR)
+ 
+ uninstall: uninstall-binary
+ 
package/ejabberd/0007-fix-init.patch new file +99 -0

99 lines not on this page · raw message

package/ejabberd/0008-fix-install-permissions.patch new file +76 -0

76 lines not on this page · raw message

package/ejabberd/Config.in new file +21 -0
new file mode 100644
index 0000000..2a8d274
@@ -0,0 +1,21 @@
+config BR2_PACKAGE_EJABBERD
+	bool "ejabberd"
+	depends on BR2_PACKAGE_ERLANG
+	select BR2_PACKAGE_ERLANG_LAGER
+	select BR2_PACKAGE_ERLANG_P1_CACHE_TAB
+	select BR2_PACKAGE_ERLANG_P1_ICONV
+	select BR2_PACKAGE_ERLANG_P1_SIP
+	select BR2_PACKAGE_ERLANG_P1_STRINGPREP
+	select BR2_PACKAGE_ERLANG_P1_XML
+	select BR2_PACKAGE_ERLANG_P1_YAML
+	select BR2_PACKAGE_ERLANG_P1_ZLIB
+	select BR2_PACKAGE_OPENSSL
+	help
+	  Ejabberd is a Jabber/XMPP instant messaging server, written
+	  in Erlang/OTP. Among other features, ejabberd is
+	  cross-platform, fault-tolerant, clusterable and modular.
+
+	  http://www.ejabberd.im
+
+comment "Ejabberd needs a toolchain w/ Erlang"
+	depends on !BR2_PACKAGE_ERLANG
package/ejabberd/S50ejabberd new file +35 -0
new file mode 100644
index 0000000..2656307
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Start/stop ejabberd
+#
+
+USER=ejabberd
+RUNDIR=/var/run/ejabberd
+
+mkrundir() {
+    install -d -o $USER -g $USER $RUNDIR
+}
+
+case "$1" in
+    start)
+	mkrundir
+        echo "Starting ejabberd..."
+        ejabberdctl start
+        ;;
+    stop)
+        echo -n "Stopping ejabberd... "
+        ejabberdctl stop > /dev/null
+        if [ $? -eq 3 ] || ejabberdctl stopped; then
+            echo "OK"
+        else
+            echo "failed"
+        fi
+        ;;
+    restart|reload)
+        "$0" stop
+        "$0" start
+        ;;
+    *)
+        echo "Usage: $0 {start|stop|restart}"
+        exit 1
+esac
package/ejabberd/check-erlang-lib new file +55 -0

55 lines not on this page · raw message

package/ejabberd/ejabberd.mk new file +51 -0

51 lines not on this page · raw message

Signature · 1 line
2.1.0
#31 lore raw

v2 cover ejabberd: XMPP server

In reply to Johan Oudinet

Johan, All,

On 2014-11-07 14:28 +0100, Johan Oudinet spake thusly:

Quoted 11 lines

Since ejabberd build system relies on rebar to download its dependencies, we've packaged all of them separately and modified ejabberd makefile to not download any dependency.

Actually, every erlang package that is introduced here rely on the rebar software. Thus, we also introduce a new infrastructure to simplify the development of such packages in buildroot.

Changes v1 -> v2:
- use BR_PATH instead of an hard-coded path in pkg-rebar.mk.
- update erlang-p1-iconv version to fix a link error with libiconv.

I'll review that series now, but first and foremost: Woot, you've done quite some work! :-)

I'll spin an ejabberd build right now, and do the review in parallel.

Thanks for the huge effort in that series! :-)

Regards,
Yann E. MORIN.

Quoted 112 lines

Johan Oudinet (15):
package/pkg-autotools.mk: Factorize hooks.
package/pkg-rebar.mk: new infrastructure.
erlang-goldrush: new package.
erlang-lager: new package.
erlang-p1-zlib: new package.
erlang-p1-yaml: new package.
erlang-p1-xml: new package.
erlang-p1-utils: new package.
erlang-p1-tls: new package.
erlang-p1-stun: new package.
erlang-p1-stringprep: new package.
erlang-p1-sip: new package.
erlang-p1-iconv: new package.
erlang-p1-cache-tab: new package.
ejabberd: new package.

 docs/manual/adding-packages-rebar.txt              | 157 ++++++++++++++
 docs/manual/adding-packages.txt                    |   2 +
 package/Config.in                                  |  17 ++
 package/Makefile.in                                |   1 +
 package/ejabberd/0001-remove-deps.patch            |  20 ++
 package/ejabberd/0002-disable-rebar-deps.patch     |  70 +++++++
 package/ejabberd/0003-disable-test.patch           |  21 ++
 package/ejabberd/0004-disable-version-check.patch  |  20 ++
 package/ejabberd/0005-fix-includes.patch           |  45 ++++
 package/ejabberd/0006-remove-doc.patch             |  26 +++
 package/ejabberd/0007-fix-init.patch               |  99 +++++++++
 .../ejabberd/0008-fix-install-permissions.patch    |  76 +++++++
 package/ejabberd/Config.in                         |  21 ++
 package/ejabberd/S50ejabberd                       |  35 ++++
 package/ejabberd/check-erlang-lib                  |  55 +++++
 package/ejabberd/ejabberd.mk                       |  51 +++++
 package/erlang-goldrush/Config.in                  |   6 +
 package/erlang-goldrush/erlang-goldrush.mk         |  14 ++
 package/erlang-lager/Config.in                     |  12 ++
 package/erlang-lager/erlang-lager.mk               |  14 ++
 package/erlang-p1-cache-tab/Config.in              |   6 +
 package/erlang-p1-cache-tab/erlang-p1-cache-tab.mk |  13 ++
 package/erlang-p1-iconv/Config.in                  |   6 +
 package/erlang-p1-iconv/erlang-p1-iconv.mk         |  17 ++
 package/erlang-p1-sip/Config.in                    |   8 +
 .../erlang-p1-sip-01-fix-includes.patch            |  19 ++
 package/erlang-p1-sip/erlang-p1-sip.mk             |  14 ++
 package/erlang-p1-stringprep/Config.in             |   5 +
 .../erlang-p1-stringprep/erlang-p1-stringprep.mk   |  13 ++
 package/erlang-p1-stun/Config.in                   |   7 +
 package/erlang-p1-stun/erlang-p1-stun.mk           |  14 ++
 package/erlang-p1-tls/Config.in                    |   5 +
 package/erlang-p1-tls/erlang-p1-tls.mk             |  14 ++
 package/erlang-p1-utils/Config.in                  |   5 +
 package/erlang-p1-utils/erlang-p1-utils.mk         |  14 ++
 package/erlang-p1-xml/Config.in                    |   6 +
 package/erlang-p1-xml/erlang-p1-xml.mk             |  14 ++
 package/erlang-p1-yaml/Config.in                   |   6 +
 package/erlang-p1-yaml/erlang-p1-yaml.mk           |  13 ++
 package/erlang-p1-zlib/Config.in                   |   5 +
 package/erlang-p1-zlib/erlang-p1-zlib.mk           |  13 ++
 package/erlang-rebar/erlang-rebar.mk               |  20 ++
 package/pkg-autotools.mk                           | 119 +++++------
 package/pkg-rebar.mk                               | 229 +++++++++++++++++++++
 support/scripts/erlang-ei-vsn                      |  19 ++
 45 files changed, 1303 insertions(+), 63 deletions(-)
 create mode 100644 docs/manual/adding-packages-rebar.txt
 create mode 100644 package/ejabberd/0001-remove-deps.patch
 create mode 100644 package/ejabberd/0002-disable-rebar-deps.patch
 create mode 100644 package/ejabberd/0003-disable-test.patch
 create mode 100644 package/ejabberd/0004-disable-version-check.patch
 create mode 100644 package/ejabberd/0005-fix-includes.patch
 create mode 100644 package/ejabberd/0006-remove-doc.patch
 create mode 100644 package/ejabberd/0007-fix-init.patch
 create mode 100644 package/ejabberd/0008-fix-install-permissions.patch
 create mode 100644 package/ejabberd/Config.in
 create mode 100644 package/ejabberd/S50ejabberd
 create mode 100755 package/ejabberd/check-erlang-lib
 create mode 100644 package/ejabberd/ejabberd.mk
 create mode 100644 package/erlang-goldrush/Config.in
 create mode 100644 package/erlang-goldrush/erlang-goldrush.mk
 create mode 100644 package/erlang-lager/Config.in
 create mode 100644 package/erlang-lager/erlang-lager.mk
 create mode 100644 package/erlang-p1-cache-tab/Config.in
 create mode 100644 package/erlang-p1-cache-tab/erlang-p1-cache-tab.mk
 create mode 100644 package/erlang-p1-iconv/Config.in
 create mode 100644 package/erlang-p1-iconv/erlang-p1-iconv.mk
 create mode 100644 package/erlang-p1-sip/Config.in
 create mode 100644 package/erlang-p1-sip/erlang-p1-sip-01-fix-includes.patch
 create mode 100644 package/erlang-p1-sip/erlang-p1-sip.mk
 create mode 100644 package/erlang-p1-stringprep/Config.in
 create mode 100644 package/erlang-p1-stringprep/erlang-p1-stringprep.mk
 create mode 100644 package/erlang-p1-stun/Config.in
 create mode 100644 package/erlang-p1-stun/erlang-p1-stun.mk
 create mode 100644 package/erlang-p1-tls/Config.in
 create mode 100644 package/erlang-p1-tls/erlang-p1-tls.mk
 create mode 100644 package/erlang-p1-utils/Config.in
 create mode 100644 package/erlang-p1-utils/erlang-p1-utils.mk
 create mode 100644 package/erlang-p1-xml/Config.in
 create mode 100644 package/erlang-p1-xml/erlang-p1-xml.mk
 create mode 100644 package/erlang-p1-yaml/Config.in
 create mode 100644 package/erlang-p1-yaml/erlang-p1-yaml.mk
 create mode 100644 package/erlang-p1-zlib/Config.in
 create mode 100644 package/erlang-p1-zlib/erlang-p1-zlib.mk
 create mode 100644 package/erlang-rebar/erlang-rebar.mk
 create mode 100644 package/pkg-rebar.mk
 create mode 100755 support/scripts/erlang-ei-vsn
Signature · 6 lines
2.1.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#32 lore raw

v2 cover ejabberd: XMPP server

In reply to Johan Oudinet

Johan, All,

On 2014-11-07 14:28 +0100, Johan Oudinet spake thusly:

Quoted 3 lines

Since ejabberd build system relies on rebar to download its dependencies, we've packaged all of them separately and modified ejabberd makefile to not download any dependency.

I've pushed a new version of that series, now, so I marked this one as Superseded in Patchwork.

Thank you for the initial hard work! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'