From patchwork Thu Feb 23 17:00:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 731610 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vTgXX08Yyz9s7N for ; Fri, 24 Feb 2017 04:02:51 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 11E4131521; Thu, 23 Feb 2017 17:02:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hY7eO6Hn+r1n; Thu, 23 Feb 2017 17:02:43 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 0574A314B4; Thu, 23 Feb 2017 17:02:21 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 6E8E11C01EF for ; Thu, 23 Feb 2017 17:01:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 683CD8B877 for ; Thu, 23 Feb 2017 17:01:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ifK7dDThca21 for ; Thu, 23 Feb 2017 17:01:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exchange.essensium.com (220.77.144.195.ipv4.evonet.be [195.144.77.220]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3B95C8B84F for ; Thu, 23 Feb 2017 17:01:05 +0000 (UTC) Received: from vandecaa-laptop.local.ess-mail.com (10.3.4.138) by beleexch01.local.ess-mail.com (10.3.7.8) with Microsoft SMTP Server (TLS) id 15.0.847.32; Thu, 23 Feb 2017 18:00:54 +0100 From: "Arnout Vandecappelle (Essensium/Mind)" To: Date: Thu, 23 Feb 2017 18:00:40 +0100 Message-ID: <20170223170047.24417-19-arnout@mind.be> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170223170047.24417-1-arnout@mind.be> References: <20170223170047.24417-1-arnout@mind.be> MIME-Version: 1.0 X-Originating-IP: [10.3.4.138] X-ClientProxiedBy: beleexch01.local.ess-mail.com (10.3.7.8) To beleexch01.local.ess-mail.com (10.3.7.8) Subject: [Buildroot] [PATCH 18/25] luarocks-package: introduce PKG_NAME_UPSTREAM X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Since we now require Lua package names to start with "lua", it is likely that the Buildroot name is different from the upstream LuaRocks name. Add a feature to the luarocks-package infra that makes it easier to handle this situation: the package can explicitly specify the upstream name in PKG_NAME_UPSTREAM, and that name will be used in PKG_ROCKSPEC, PKG_SOURCE and PKG_SUBDIR. Add an explanation of this feature to the manual. To make the example relevant, it is changed to lua-foo, where the upstream name is plain foo. To avoid confusion with the dependency on a native library, that dependency is renamed to bar. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- The change in the manual should perhaps have been a separate commit, but this series is already long enough as it is :-) --- docs/manual/adding-packages-luarocks.txt | 54 +++++++++++++++++++------------- package/pkg-luarocks.mk | 7 +++-- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/docs/manual/adding-packages-luarocks.txt b/docs/manual/adding-packages-luarocks.txt index 712c29e9a4..4965a209ae 100644 --- a/docs/manual/adding-packages-luarocks.txt +++ b/docs/manual/adding-packages-luarocks.txt @@ -13,34 +13,40 @@ with an example : ------------------------ 01: ################################################################################ 02: # -03: # luafoo +03: # lua-foo 04: # 05: ################################################################################ 06: -07: LUAFOO_VERSION = 1.0.2-1 -08: LUAFOO_DEPENDENCIES = foo -09: -10: LUAFOO_BUILD_OPTS += FOO_INCDIR=$(STAGING_DIR)/usr/include -11: LUAFOO_BUILD_OPTS += FOO_LIBDIR=$(STAGING_DIR)/usr/lib -12: LUAFOO_LICENSE = luaFoo license -13: LUAFOO_LICENSE_FILES = $(LUAFOO_SUBDIR)/COPYING -14: -15: $(eval $(luarocks-package)) +07: LUA_FOO_VERSION = 1.0.2-1 +08: LUA_FOO_NAME_UPSTREAM = foo +09: LUA_FOO_DEPENDENCIES = bar +10: +11: LUA_FOO_BUILD_OPTS += BAR_INCDIR=$(STAGING_DIR)/usr/include +12: LUA_FOO_BUILD_OPTS += BAR_LIBDIR=$(STAGING_DIR)/usr/lib +13: LUA_FOO_LICENSE = luaFoo license +14: LUA_FOO_LICENSE_FILES = $(LUA_FOO_SUBDIR)/COPYING +15: +16: $(eval $(luarocks-package)) ------------------------ On line 7, we declare the version of the package (the same as in the rockspec, which is the concatenation of the upstream version and the rockspec revision, separated by a hyphen '-'). -On line 8, we declare our dependencies against native libraries, so that they +On line 8, we declare that the package is called "foo" on LuaRocks. In +Buildroot, we give Lua-related packages a name that starts with "lua", so the +Buildroot name is different from the upstream name. +LUA_FOO_NAME_UPSTREAM+ +makes the link between the two names. + +On line 9, we declare our dependencies against native libraries, so that they are built before the build process of our package starts. -On lines 10-11, we tell Buildroot to pass custom options to LuaRocks when it is +On lines 11-12, we tell Buildroot to pass custom options to LuaRocks when it is building the package. -On lines 12-13, we specify the licensing terms for the package. +On lines 13-14, we specify the licensing terms for the package. -Finally, on line 15, we invoke the +luarocks-package+ +Finally, on line 16, we invoke the +luarocks-package+ macro that generates all the Makefile rules that actually allows the package to be built. @@ -67,24 +73,28 @@ macro. First, all the package metadata information variables that exist in the generic infrastructure also exist in the LuaRocks infrastructure: -+LUAFOO_VERSION+, +LUAFOO_SOURCE+, +LUAFOO_SITE+, -+LUAFOO_DEPENDENCIES+, +LUAFOO_LICENSE+, +LUAFOO_LICENSE_FILES+. ++LUA_FOO_VERSION+, +LUA_FOO_SOURCE+, +LUA_FOO_SITE+, ++LUA_FOO_DEPENDENCIES+, +LUA_FOO_LICENSE+, +LUA_FOO_LICENSE_FILES+. Two of them are populated by the LuaRocks infrastructure (for the +download+ step). If your package is not hosted on the LuaRocks mirror +$(BR2_LUAROCKS_MIRROR)+, you can override them: -* +LUAFOO_SITE+, which defaults to +$(BR2_LUAROCKS_MIRROR)+ +* +LUA_FOO_SITE+, which defaults to +$(BR2_LUAROCKS_MIRROR)+ -* +LUAFOO_SOURCE+, which defaults to +luafoo-$(LUAFOO_VERSION).src.rock+ +* +LUA_FOO_SOURCE+, which defaults to +$(LUA_FOO_NAME_UPSTREAM)-$(LUA_FOO_VERSION).src.rock+ A few additional variables, specific to the LuaRocks infrastructure, are also defined. They can be overridden in specific cases. -* +LUAFOO_ROCKSPEC+, which defaults to +luafoo-$(LUAFOO_VERSION).rockspec+ +* +LUA_FOO_NAME_UPSTREAM+, which defaults to +lua-foo+, i.e. the Buildroot + package name + +* +LUA_FOO_ROCKSPEC+, which defaults to + +$(LUA_FOO_NAME_UPSTREAM)-$(LUA_FOO_VERSION).rockspec+ -* +LUAFOO_SUBDIR+, which defaults to - +luafoo-$(LUAFOO_VERSION_WITHOUT_ROCKSPEC_REVISION)+ +* +LUA_FOO_SUBDIR+, which defaults to + +$(LUA_FOO_NAME_UPSTREAM)-$(LUA_FOO_VERSION_WITHOUT_ROCKSPEC_REVISION)+ -* +LUAFOO_BUILD_OPTS+ contains additional build options for the +* +LUA_FOO_BUILD_OPTS+ contains additional build options for the +luarocks build+ call. diff --git a/package/pkg-luarocks.mk b/package/pkg-luarocks.mk index 08ea9b801a..2689035cdc 100644 --- a/package/pkg-luarocks.mk +++ b/package/pkg-luarocks.mk @@ -34,9 +34,10 @@ define inner-luarocks-package $(2)_BUILD_OPTS ?= -$(2)_SUBDIR ?= $(1)-$$(shell echo "$$($(2)_VERSION)" | sed -e "s/-[0-9]$$$$//") -$(2)_ROCKSPEC ?= $(1)-$$($(2)_VERSION).rockspec -$(2)_SOURCE ?= $(1)-$$($(2)_VERSION).src.rock +$(2)_NAME_UPSTREAM ?= $(1) +$(2)_SUBDIR ?= $$($(2)_NAME_UPSTREAM)-$$(shell echo "$$($(2)_VERSION)" | sed -e "s/-[0-9]$$$$//") +$(2)_ROCKSPEC ?= $$($(2)_NAME_UPSTREAM)-$$($(2)_VERSION).rockspec +$(2)_SOURCE ?= $$($(2)_NAME_UPSTREAM)-$$($(2)_VERSION).src.rock $(2)_SITE ?= $$(call qstrip,$$(BR2_LUAROCKS_MIRROR)) # Since we do not support host-luarocks-package, we know this is