2014-01-11 16:42:11 +01:00
|
|
|
// -*- mode:doc; -*-
|
|
|
|
// vim: set syntax=asciidoc:
|
|
|
|
|
manual: use one-line titles instead of two-line titles (trivial)
Asciidoc supports two syntaxes for section titles: two-line titles (title
plus underline consisting of a particular symbol), and one-line titles
(title prefixed with a specific number of = signs).
The two-line title underlines are:
Level 0 (top level): ======================
Level 1: ----------------------
Level 2: ~~~~~~~~~~~~~~~~~~~~~~
Level 3: ^^^^^^^^^^^^^^^^^^^^^^
Level 4 (bottom level): ++++++++++++++++++++++
and the one-line title prefixes:
= Document Title (level 0) =
== Section title (level 1) ==
=== Section title (level 2) ===
==== Section title (level 3) ====
===== Section title (level 4) =====
The buildroot manual is currenly using the two-line titles, but this has
multiple disadvantages:
- asciidoc also uses some of the underline symbols for other purposes (like
preformatted code, example blocks, ...), which makes it difficult to do
mass replacements, such as a planned follow-up patch that needs to move
all sections one level down.
- it is difficult to remember which level a given underline symbol (=-~^+)
corresponds to, while counting = signs is easy.
This patch changes all two-level titles to one-level titles in the manual.
The bulk of the change was done with the following Python script, except for
the level 1 titles (-----) as these underlines are also used for literal
code blocks.
This patch only changes the titles, no other changes. In
adding-packages-directory.txt, I did add missing newlines between some
titles and their content.
----------------------------------------------------------------------------
#!/usr/bin/env python
import sys
import mmap
import re
for input in sys.argv[1:]:
f = open(input, 'r+')
f.flush()
s = mmap.mmap(f.fileno(), 0)
# Level 0 (top level): ====================== =
# Level 1: ---------------------- ==
# Level 2: ~~~~~~~~~~~~~~~~~~~~~~ ===
# Level 3: ^^^^^^^^^^^^^^^^^^^^^^ ====
# Level 4 (bottom level): ++++++++++++++++++++++ =====
def replace_title(s, symbol, replacement):
pattern = re.compile(r'(.+\n)\%s{2,}\n' % symbol, re.MULTILINE)
return pattern.sub(r'%s \1' % replacement, s)
new = s
new = replace_title(new, '=', '=')
new = replace_title(new, '+', '=====')
new = replace_title(new, '^', '====')
new = replace_title(new, '~', '===')
#new = replace_title(new, '-', '==')
s.seek(0)
s.write(new)
s.resize(s.tell())
s.close()
f.close()
----------------------------------------------------------------------------
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-05-02 07:47:30 +02:00
|
|
|
=== Infrastructure for LuaRocks-based packages
|
2014-01-11 16:42:11 +01:00
|
|
|
|
|
|
|
[[luarocks-package-tutorial]]
|
|
|
|
|
manual: use one-line titles instead of two-line titles (trivial)
Asciidoc supports two syntaxes for section titles: two-line titles (title
plus underline consisting of a particular symbol), and one-line titles
(title prefixed with a specific number of = signs).
The two-line title underlines are:
Level 0 (top level): ======================
Level 1: ----------------------
Level 2: ~~~~~~~~~~~~~~~~~~~~~~
Level 3: ^^^^^^^^^^^^^^^^^^^^^^
Level 4 (bottom level): ++++++++++++++++++++++
and the one-line title prefixes:
= Document Title (level 0) =
== Section title (level 1) ==
=== Section title (level 2) ===
==== Section title (level 3) ====
===== Section title (level 4) =====
The buildroot manual is currenly using the two-line titles, but this has
multiple disadvantages:
- asciidoc also uses some of the underline symbols for other purposes (like
preformatted code, example blocks, ...), which makes it difficult to do
mass replacements, such as a planned follow-up patch that needs to move
all sections one level down.
- it is difficult to remember which level a given underline symbol (=-~^+)
corresponds to, while counting = signs is easy.
This patch changes all two-level titles to one-level titles in the manual.
The bulk of the change was done with the following Python script, except for
the level 1 titles (-----) as these underlines are also used for literal
code blocks.
This patch only changes the titles, no other changes. In
adding-packages-directory.txt, I did add missing newlines between some
titles and their content.
----------------------------------------------------------------------------
#!/usr/bin/env python
import sys
import mmap
import re
for input in sys.argv[1:]:
f = open(input, 'r+')
f.flush()
s = mmap.mmap(f.fileno(), 0)
# Level 0 (top level): ====================== =
# Level 1: ---------------------- ==
# Level 2: ~~~~~~~~~~~~~~~~~~~~~~ ===
# Level 3: ^^^^^^^^^^^^^^^^^^^^^^ ====
# Level 4 (bottom level): ++++++++++++++++++++++ =====
def replace_title(s, symbol, replacement):
pattern = re.compile(r'(.+\n)\%s{2,}\n' % symbol, re.MULTILINE)
return pattern.sub(r'%s \1' % replacement, s)
new = s
new = replace_title(new, '=', '=')
new = replace_title(new, '+', '=====')
new = replace_title(new, '^', '====')
new = replace_title(new, '~', '===')
#new = replace_title(new, '-', '==')
s.seek(0)
s.write(new)
s.resize(s.tell())
s.close()
f.close()
----------------------------------------------------------------------------
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-05-02 07:47:30 +02:00
|
|
|
==== +luarocks-package+ tutorial
|
2014-01-11 16:42:11 +01:00
|
|
|
|
|
|
|
First, let's see how to write a +.mk+ file for a LuaRocks-based package,
|
|
|
|
with an example :
|
|
|
|
|
|
|
|
------------------------
|
|
|
|
01: ################################################################################
|
|
|
|
02: #
|
2017-02-23 18:00:40 +01:00
|
|
|
03: # lua-foo
|
2014-01-11 16:42:11 +01:00
|
|
|
04: #
|
|
|
|
05: ################################################################################
|
|
|
|
06:
|
2017-02-23 18:00:40 +01:00
|
|
|
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))
|
2014-01-11 16:42:11 +01:00
|
|
|
------------------------
|
|
|
|
|
|
|
|
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 '-').
|
|
|
|
|
2017-02-23 18:00:40 +01:00
|
|
|
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
|
2014-01-11 16:42:11 +01:00
|
|
|
are built before the build process of our package starts.
|
|
|
|
|
2017-02-23 18:00:40 +01:00
|
|
|
On lines 11-12, we tell Buildroot to pass custom options to LuaRocks when it is
|
2014-01-11 16:42:11 +01:00
|
|
|
building the package.
|
|
|
|
|
2017-02-23 18:00:40 +01:00
|
|
|
On lines 13-14, we specify the licensing terms for the package.
|
2014-01-11 16:42:11 +01:00
|
|
|
|
2017-02-23 18:00:40 +01:00
|
|
|
Finally, on line 16, we invoke the +luarocks-package+
|
2014-01-11 16:42:11 +01:00
|
|
|
macro that generates all the Makefile rules that actually allows the
|
|
|
|
package to be built.
|
|
|
|
|
|
|
|
[[luarocks-package-reference]]
|
|
|
|
|
manual: use one-line titles instead of two-line titles (trivial)
Asciidoc supports two syntaxes for section titles: two-line titles (title
plus underline consisting of a particular symbol), and one-line titles
(title prefixed with a specific number of = signs).
The two-line title underlines are:
Level 0 (top level): ======================
Level 1: ----------------------
Level 2: ~~~~~~~~~~~~~~~~~~~~~~
Level 3: ^^^^^^^^^^^^^^^^^^^^^^
Level 4 (bottom level): ++++++++++++++++++++++
and the one-line title prefixes:
= Document Title (level 0) =
== Section title (level 1) ==
=== Section title (level 2) ===
==== Section title (level 3) ====
===== Section title (level 4) =====
The buildroot manual is currenly using the two-line titles, but this has
multiple disadvantages:
- asciidoc also uses some of the underline symbols for other purposes (like
preformatted code, example blocks, ...), which makes it difficult to do
mass replacements, such as a planned follow-up patch that needs to move
all sections one level down.
- it is difficult to remember which level a given underline symbol (=-~^+)
corresponds to, while counting = signs is easy.
This patch changes all two-level titles to one-level titles in the manual.
The bulk of the change was done with the following Python script, except for
the level 1 titles (-----) as these underlines are also used for literal
code blocks.
This patch only changes the titles, no other changes. In
adding-packages-directory.txt, I did add missing newlines between some
titles and their content.
----------------------------------------------------------------------------
#!/usr/bin/env python
import sys
import mmap
import re
for input in sys.argv[1:]:
f = open(input, 'r+')
f.flush()
s = mmap.mmap(f.fileno(), 0)
# Level 0 (top level): ====================== =
# Level 1: ---------------------- ==
# Level 2: ~~~~~~~~~~~~~~~~~~~~~~ ===
# Level 3: ^^^^^^^^^^^^^^^^^^^^^^ ====
# Level 4 (bottom level): ++++++++++++++++++++++ =====
def replace_title(s, symbol, replacement):
pattern = re.compile(r'(.+\n)\%s{2,}\n' % symbol, re.MULTILINE)
return pattern.sub(r'%s \1' % replacement, s)
new = s
new = replace_title(new, '=', '=')
new = replace_title(new, '+', '=====')
new = replace_title(new, '^', '====')
new = replace_title(new, '~', '===')
#new = replace_title(new, '-', '==')
s.seek(0)
s.write(new)
s.resize(s.tell())
s.close()
f.close()
----------------------------------------------------------------------------
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-05-02 07:47:30 +02:00
|
|
|
==== +luarocks-package+ reference
|
2014-01-11 16:42:11 +01:00
|
|
|
|
|
|
|
LuaRocks is a deployment and management system for Lua modules, and supports
|
2014-05-31 10:26:20 +02:00
|
|
|
various +build.type+: +builtin+, +make+ and +cmake+. In the context of
|
2014-01-11 16:42:11 +01:00
|
|
|
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
|
2014-06-02 18:02:45 +02:00
|
|
|
metadata information about the package, and then calling +luarocks-package+. It
|
2014-01-11 16:42:11 +01:00
|
|
|
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:
|
2017-02-23 18:00:40 +01:00
|
|
|
+LUA_FOO_VERSION+, +LUA_FOO_SOURCE+, +LUA_FOO_SITE+,
|
|
|
|
+LUA_FOO_DEPENDENCIES+, +LUA_FOO_LICENSE+, +LUA_FOO_LICENSE_FILES+.
|
2014-01-11 16:42:11 +01:00
|
|
|
|
|
|
|
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:
|
|
|
|
|
2017-02-23 18:00:40 +01:00
|
|
|
* +LUA_FOO_SITE+, which defaults to +$(BR2_LUAROCKS_MIRROR)+
|
2014-01-11 16:42:11 +01:00
|
|
|
|
2017-02-23 18:00:42 +01:00
|
|
|
* +LUA_FOO_SOURCE+, which defaults to
|
|
|
|
+$(lowercase LUA_FOO_NAME_UPSTREAM)-$(LUA_FOO_VERSION).src.rock+
|
2014-01-11 16:42:11 +01:00
|
|
|
|
|
|
|
A few additional variables, specific to the LuaRocks infrastructure, are
|
|
|
|
also defined. They can be overridden in specific cases.
|
|
|
|
|
2017-02-23 18:00:40 +01:00
|
|
|
* +LUA_FOO_NAME_UPSTREAM+, which defaults to +lua-foo+, i.e. the Buildroot
|
|
|
|
package name
|
|
|
|
|
|
|
|
* +LUA_FOO_ROCKSPEC+, which defaults to
|
2017-02-23 18:00:42 +01:00
|
|
|
+$(lowercase LUA_FOO_NAME_UPSTREAM)-$(LUA_FOO_VERSION).rockspec+
|
2014-01-11 16:42:11 +01:00
|
|
|
|
2017-02-23 18:00:40 +01:00
|
|
|
* +LUA_FOO_SUBDIR+, which defaults to
|
|
|
|
+$(LUA_FOO_NAME_UPSTREAM)-$(LUA_FOO_VERSION_WITHOUT_ROCKSPEC_REVISION)+
|
2014-01-11 16:42:11 +01:00
|
|
|
|
2017-02-23 18:00:40 +01:00
|
|
|
* +LUA_FOO_BUILD_OPTS+ contains additional build options for the
|
2014-01-11 16:42:11 +01:00
|
|
|
+luarocks build+ call.
|