2014-02-23 15:17:19 +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 Perl/CPAN packages
|
2014-02-23 15:17:19 +01:00
|
|
|
|
|
|
|
[[perl-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
|
|
|
==== +perl-package+ tutorial
|
2014-02-23 15:17:19 +01:00
|
|
|
|
|
|
|
First, let's see how to write a +.mk+ file for a Perl/CPAN package,
|
|
|
|
with an example :
|
|
|
|
|
|
|
|
------------------------
|
|
|
|
01: ################################################################################
|
|
|
|
02: #
|
|
|
|
03: # perl-foo-bar
|
|
|
|
04: #
|
|
|
|
05: ################################################################################
|
|
|
|
06:
|
|
|
|
07: PERL_FOO_BAR_VERSION = 0.02
|
|
|
|
08: PERL_FOO_BAR_SOURCE = Foo-Bar-$(PERL_FOO_BAR_VERSION).tar.gz
|
2014-07-31 10:46:57 +02:00
|
|
|
09: PERL_FOO_BAR_SITE = $(BR2_CPAN_MIRROR)/authors/id/M/MO/MONGER
|
2014-02-23 15:17:19 +01:00
|
|
|
10: PERL_FOO_BAR_DEPENDENCIES = perl-strictures
|
|
|
|
11: PERL_FOO_BAR_LICENSE = Artistic or GPLv1+
|
|
|
|
12: PERL_FOO_BAR_LICENSE_FILES = LICENSE
|
|
|
|
13:
|
|
|
|
14: $(eval $(perl-package))
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
On line 7, we declare the version of the package.
|
|
|
|
|
|
|
|
On line 8 and 9, we declare the name of the tarball and the location
|
|
|
|
of the tarball on a CPAN server. Buildroot will automatically download
|
|
|
|
the tarball from this location.
|
|
|
|
|
|
|
|
On line 10, we declare our dependencies, so that they are built
|
|
|
|
before the build process of our package starts.
|
|
|
|
|
|
|
|
On line 11 and 12, we give licensing details about the package (its
|
|
|
|
license on line 11, and the file containing the license text on line
|
|
|
|
12).
|
|
|
|
|
|
|
|
Finally, on line 14, we invoke the +perl-package+ macro that
|
|
|
|
generates all the Makefile rules that actually allow the package to be
|
|
|
|
built.
|
|
|
|
|
|
|
|
Most of these data can be retrieved from https://metacpan.org/.
|
|
|
|
So, this file and the Config.in can be generated by running
|
|
|
|
the script +supports/scripts/scancpan Foo-Bar+ in the Buildroot directory
|
|
|
|
(or in the +BR2_EXTERNAL+ directory).
|
|
|
|
This script creates a Config.in file and foo-bar.mk file for the
|
|
|
|
requested package, and also recursively for all dependencies specified by
|
|
|
|
CPAN. You should still manually edit the result. In particular, the
|
|
|
|
following things should be checked.
|
|
|
|
|
|
|
|
* If the perl module links with a shared library that is provided by
|
|
|
|
another (non-perl) package, this dependency is not added automatically.
|
|
|
|
It has to be added manually to +PERL_FOO_BAR_DEPENDENCIES+.
|
|
|
|
* The +package/Config.in+ file has to be updated manually to include the
|
|
|
|
generated Config.in files. As a hint, the +scancpan+ script prints out
|
|
|
|
the required +source "..."+ statements, sorted alphabetically.
|
|
|
|
|
|
|
|
[[perl-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
|
|
|
==== +perl-package+ reference
|
2014-02-23 15:17:19 +01:00
|
|
|
|
|
|
|
As a policy, packages that provide Perl/CPAN modules should all be
|
|
|
|
named +perl-<something>+ in Buildroot.
|
|
|
|
|
|
|
|
This infrastructure handles various Perl build systems :
|
|
|
|
+ExtUtils-MakeMaker+, +Module-Build+ and +Module-Build-Tiny+.
|
|
|
|
+Build.PL+ is always preferred when a package provides a +Makefile.PL+
|
|
|
|
and a +Build.PL+.
|
|
|
|
|
|
|
|
The main macro of the Perl/CPAN package infrastructure is
|
|
|
|
+perl-package+. It is similar to the +generic-package+ macro. The ability to
|
|
|
|
have target and host packages is also available, with the
|
|
|
|
+host-perl-package+ macro.
|
|
|
|
|
|
|
|
Just like the generic infrastructure, the Perl/CPAN infrastructure
|
|
|
|
works by defining a number of variables before calling the
|
|
|
|
+perl-package+ macro.
|
|
|
|
|
|
|
|
First, all the package metadata information variables that exist in the
|
|
|
|
generic infrastructure also exist in the Perl/CPAN infrastructure:
|
|
|
|
+PERL_FOO_VERSION+, +PERL_FOO_SOURCE+,
|
|
|
|
+PERL_FOO_PATCH+, +PERL_FOO_SITE+,
|
|
|
|
+PERL_FOO_SUBDIR+, +PERL_FOO_DEPENDENCIES+,
|
|
|
|
+PERL_FOO_INSTALL_TARGET+.
|
|
|
|
|
|
|
|
Note that setting +PERL_FOO_INSTALL_STAGING+ to +YES+ has no effect
|
|
|
|
unless a +PERL_FOO_INSTALL_STAGING_CMDS+ variable is defined. The perl
|
|
|
|
infrastructure doesn't define these commands since Perl modules generally
|
|
|
|
don't need to be installed to the +staging+ directory.
|
|
|
|
|
|
|
|
A few additional variables, specific to the Perl/CPAN 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.
|
|
|
|
|
2014-07-13 15:03:21 +02:00
|
|
|
* +PERL_FOO_CONF_ENV+/+HOST_PERL_FOO_CONF_ENV+, to specify additional
|
|
|
|
environment variables to pass to the +perl Makefile.PL+ or +perl Build.PL+.
|
|
|
|
By default, empty.
|
|
|
|
|
2014-02-23 15:17:19 +01:00
|
|
|
* +PERL_FOO_CONF_OPT+/+HOST_PERL_FOO_CONF_OPT+, to specify additional
|
|
|
|
configure options to pass to the +perl Makefile.PL+ or +perl Build.PL+.
|
|
|
|
By default, empty.
|
|
|
|
|
|
|
|
* +PERL_FOO_BUILD_OPT+/+HOST_PERL_FOO_BUILD_OPT+, to specify additional
|
|
|
|
options to pass to +make pure_all+ or +perl Build build+ in the build step.
|
|
|
|
By default, empty.
|
|
|
|
|
|
|
|
* +PERL_FOO_INSTALL_TARGET_OPT+, to specify additional options to
|
|
|
|
pass to +make pure_install+ or +perl Build install+ in the install step.
|
|
|
|
By default, empty.
|
|
|
|
|
|
|
|
* +HOST_PERL_FOO_INSTALL_OPT+, to specify additional options to
|
|
|
|
pass to +make pure_install+ or +perl Build install+ in the install step.
|
|
|
|
By default, empty.
|