From patchwork Sat Jan 11 15:42:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francois Perrad X-Patchwork-Id: 309518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id AC76A2C0097 for ; Sun, 12 Jan 2014 02:43:10 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6FFE593D2A; Sat, 11 Jan 2014 15:43:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LpLcg+zG4Yzz; Sat, 11 Jan 2014 15:43:01 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id A71B79399E; Sat, 11 Jan 2014 15:42:51 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id C6CCB1BF97D for ; Sat, 11 Jan 2014 15:42:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BEBCF8CDCE for ; Sat, 11 Jan 2014 15:42:44 +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 NGdlZLM6ltBm for ; Sat, 11 Jan 2014 15:42:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by whitealder.osuosl.org (Postfix) with ESMTPS id 121D68CD98 for ; Sat, 11 Jan 2014 15:42:43 +0000 (UTC) Received: by mail-we0-f171.google.com with SMTP id w61so1505726wes.2 for ; Sat, 11 Jan 2014 07:42:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=opI5Xr/YxAp6H7VoNrQ9WClIiQ09td/gABbtCzruRBk=; b=NOCloGDxIakyXUsZafotBipLW4ZhhqZI+08Pp8gY2q0aWGdLMh5slbUULSkj6nEgba mgT0lheftCp6Q7ofFLPhPo47BGXGfv+HHdNEtfo8nVTaBryp9ohF+aTg5LBrOK8ezf1F J7gXlWl+7LolnsY95yvIlXH3HXpgDtRlDcwd9JVK5M2iA/mjs4Ol6D9fut/MP0hxZ8QV +QKEmdRgnXrS0IREV6MxqvmWZuLSbgCIUhTHsqp8tY2nBUyx3wdsp5qS813wupS9Povk OoYen6k1+KD0vtB3+cv85B8ZQEvuz5ytyeDjTaTGrbTj2FlVRRG6c2NNJOU26ZwEA8/j O0iA== X-Received: by 10.194.92.7 with SMTP id ci7mr13665552wjb.58.1389454962720; Sat, 11 Jan 2014 07:42:42 -0800 (PST) Received: from ubuntu.localdomain (94.166.87.79.rev.sfr.net. [79.87.166.94]) by mx.google.com with ESMTPSA id kr10sm6852597wjc.22.2014.01.11.07.42.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 11 Jan 2014 07:42:42 -0800 (PST) From: Francois Perrad To: buildroot@busybox.net Date: Sat, 11 Jan 2014 16:42:11 +0100 Message-Id: <1389454937-13494-10-git-send-email-francois.perrad@gadz.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389454937-13494-1-git-send-email-francois.perrad@gadz.org> References: <1389454937-13494-1-git-send-email-francois.perrad@gadz.org> Cc: Thomas Petazzoni , "Yann E. MORIN" Subject: [Buildroot] [pkg-luarocks infra v7 09/15] manual: adding packages luarocks X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net From: Francois Perrad Signed-off-by: Francois Perrad [yann.morin.1998@free.fr: some cleanups and rephrasing] Signed-off-by: Yann E. MORIN Cc: Thomas Petazzoni --- docs/manual/adding-packages-luarocks.txt | 93 ++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + 2 files changed, 95 insertions(+) create mode 100644 docs/manual/adding-packages-luarocks.txt diff --git a/docs/manual/adding-packages-luarocks.txt b/docs/manual/adding-packages-luarocks.txt new file mode 100644 index 0000000..6e68852 --- /dev/null +++ b/docs/manual/adding-packages-luarocks.txt @@ -0,0 +1,93 @@ +// -*- mode:doc; -*- +// vim: set syntax=asciidoc: + +Infrastructure for LuaRocks-based packages +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +[[luarocks-package-tutorial]] + ++luarocks-package+ tutorial +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +First, let's see how to write a +.mk+ file for a LuaRocks-based package, +with an example : + +------------------------ +01: ################################################################################ +02: # +03: # luafoo +04: # +05: ################################################################################ +06: +07: LUAFOO_VERSION = 1.0.2-1 +08: LUAFOO_DEPENDENCIES = foo +09: +10: LUAFOO_BUILD_OPT += FOO_INCDIR=$(STAGING_DIR)/usr/include +11: LUAFOO_BUILD_OPT += FOO_LIBDIR=$(STAGING_DIR)/usr/lib +12: LUAFOO_LICENSE = luaFoo license +13: LUAFOO_LICENSE_FILES = COPYING +14: +15: $(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 +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 +building the package. + +On lines 12-13, we specify the licensing terms for the package. + +Finally, on line 15, we invoke the +luarocks-package+ +macro that generates all the Makefile rules that actually allows the +package to be built. + +[[luarocks-package-reference]] + ++luarocks-package+ reference +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +LuaRocks is a deployment and management system for Lua modules, and supports +various +build.type+: +builtin+, +make+ and +cmake+. In the contetx of +Buildroot, the +luarocks-package+ infrastructure only supports the +builtin+ +mode. LuaRocks packages that use the +make+ or +cmake+ build mechanisms +should instead be packaged using the +generic-package+ and +cmake-package+ +infrastructures in Buildroot, respectively. + +The main macro of the LuaRocks package infrastructure is +luarocks-package+: +like +generic-package+ it works by defining a number of variables providing +meta informations about the package, and then calling +luarocks-package+. It +is worth mentioning that building LuaRocks packages for the host is not +supported, so the macro +host-luarocks-package+ is not implemented. + +Just like the generic infrastructure, the LuaRocks infrastructure works +by defining a number of variables before calling the +luarocks-package+ +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+. + +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)+ + +* +LUAFOO_SOURCE+, which defaults to +luafoo-$(LUAFOO_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+ + +* +LUAFOO_SUBDIR+, which defaults to + +luafoo-$(LUAFOO_VERSION_WITHOUT_ROCKSPEC_REVISION)+ + +* +LUAFOO_BUILD_OPT+ contains additional build options for the + +luarocks build+ call. diff --git a/docs/manual/adding-packages.txt b/docs/manual/adding-packages.txt index 01277d8..cc86529 100644 --- a/docs/manual/adding-packages.txt +++ b/docs/manual/adding-packages.txt @@ -20,6 +20,8 @@ include::adding-packages-cmake.txt[] include::adding-packages-python.txt[] +include::adding-packages-luarocks.txt[] + include::adding-packages-hooks.txt[] include::adding-packages-gettext.txt[]