aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2024-09-01 08:00:00 +0000
committerDmitry V. Levin <ldv@strace.io>2024-09-10 08:00:00 +0000
commit7fb6beed01bc1a59438b8b2a9b34b2dba296e553 (patch)
tree2f6ae951c4d94d331e29e348e6ffd9846687be33 /doc
parentaa3e91322cbc651bb130ec8636b28d676979d4fe (diff)
downloadpam-7fb6beed01bc1a59438b8b2a9b34b2dba296e553.tar.gz
pam-7fb6beed01bc1a59438b8b2a9b34b2dba296e553.tar.bz2
pam-7fb6beed01bc1a59438b8b2a9b34b2dba296e553.zip
meson: build Linux-PAM using meson
On my non-representative hardware, the full build using autotools (./autogen.sh && CFLAGS=-O2 ./configure && make -j`nproc` && make -j`nproc` install) takes about 45 seconds. On the same hardware, the full build using meson (meson setup -Doptimization=2 dir && meson compile -C dir && meson install -C dir) takes just about 7.5 seconds.
Diffstat (limited to 'doc')
-rw-r--r--doc/.gitignore2
l---------doc/adg/html/meson.build1
l---------doc/adg/meson.build1
-rw-r--r--doc/guide-html-meson.build32
-rw-r--r--doc/guide-meson.build90
-rwxr-xr-xdoc/install-html.sh7
-rw-r--r--doc/man/meson.build67
-rw-r--r--doc/meson.build26
l---------doc/mwg/html/meson.build1
l---------doc/mwg/meson.build1
l---------doc/sag/html/meson.build1
l---------doc/sag/meson.build1
-rw-r--r--doc/specs/meson.build42
13 files changed, 271 insertions, 1 deletions
diff --git a/doc/.gitignore b/doc/.gitignore
index 589288a9..cbfabdd7 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -1,5 +1,5 @@
pam.sgml
MODULES-SGML
/*/*.txt
-/*/html/
+/*/html/*.html
custom-man.xsl
diff --git a/doc/adg/html/meson.build b/doc/adg/html/meson.build
new file mode 120000
index 00000000..d6d90eaa
--- /dev/null
+++ b/doc/adg/html/meson.build
@@ -0,0 +1 @@
+../../guide-html-meson.build \ No newline at end of file
diff --git a/doc/adg/meson.build b/doc/adg/meson.build
new file mode 120000
index 00000000..2e19d830
--- /dev/null
+++ b/doc/adg/meson.build
@@ -0,0 +1 @@
+../guide-meson.build \ No newline at end of file
diff --git a/doc/guide-html-meson.build b/doc/guide-html-meson.build
new file mode 100644
index 00000000..e5c90812
--- /dev/null
+++ b/doc/guide-html-meson.build
@@ -0,0 +1,32 @@
+# -*- mode: meson -*-
+
+html = custom_target(
+ input: xml,
+ output: name + '.html',
+ command: [
+ prog_xsltproc,
+ '--nonet',
+ '--xinclude',
+ '--stringparam', 'base.dir', meson.current_build_dir(),
+ '--stringparam', 'root.filename', name,
+ '--stringparam', 'use.id.as.filename', '1',
+ '--stringparam', 'chunk.first.sections', '1',
+ '--stringparam', 'section.autolabel', '1',
+ '--stringparam', 'section.label.includes.component.label', '1',
+ '--stringparam', 'toc.max.depth', toc_max_depth,
+ '--stringparam', 'chunker.output.encoding', 'UTF-8',
+ html_stylesheet,
+ '@INPUT@',
+ ],
+ install: true,
+ install_dir: htmldir,
+ install_tag: 'doc',
+)
+
+meson.add_install_script(
+ install_html,
+ meson.current_build_dir(),
+ htmldir,
+ html,
+ install_tag: 'doc',
+)
diff --git a/doc/guide-meson.build b/doc/guide-meson.build
new file mode 100644
index 00000000..e29d16e2
--- /dev/null
+++ b/doc/guide-meson.build
@@ -0,0 +1,90 @@
+# -*- mode: meson -*-
+
+guide = fs.name(meson.current_source_dir()).to_upper()
+name = 'Linux-PAM_' + guide
+
+xml = files(name + '.xml')
+
+if guide == 'SAG'
+ toc_max_depth = '2'
+else
+ toc_max_depth = '3'
+endif
+
+
+run_command(
+ [prog_xmllint,
+ '--noent',
+ '--nonet',
+ '--noout',
+ '--xinclude',
+ '--relaxng', docbook_rng,
+ xml],
+ check: true,
+)
+
+
+html = custom_target(
+ input: xml,
+ output: name + '.html',
+ command: [
+ prog_xsltproc,
+ '-o', '@OUTPUT@',
+ '--nonet',
+ '--xinclude',
+ '--stringparam', 'generate.toc', 'book toc',
+ '--stringparam', 'section.autolabel', '1',
+ '--stringparam', 'section.label.includes.component.label', '1',
+ '--stringparam', 'toc.max.depth', toc_max_depth,
+ txt_stylesheet,
+ '@INPUT@',
+ ],
+)
+
+custom_target(
+ input: html,
+ output: name + '.txt',
+ command: [
+ redir_exe,
+ '@INPUT@',
+ '@OUTPUT@',
+ browser,
+ ],
+ install: true,
+ install_dir: docdir,
+ install_tag: 'doc',
+)
+
+
+fop = custom_target(
+ input: xml,
+ output: name + '.fop',
+ command: [
+ prog_xsltproc,
+ '-o', '@OUTPUT@',
+ '--nonet',
+ '--xinclude',
+ '--stringparam', 'generate.toc', 'book toc',
+ '--stringparam', 'section.autolabel', '1',
+ '--stringparam', 'section.label.includes.component.label', '1',
+ '--stringparam', 'toc.max.depth', toc_max_depth,
+ pdf_stylesheet,
+ '@INPUT@',
+ ],
+)
+
+custom_target(
+ input: fop,
+ output: name + '.pdf',
+ command: [
+ prog_fop,
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: pdfdir,
+ install_tag: 'doc',
+)
+
+
+subdir('html')
diff --git a/doc/install-html.sh b/doc/install-html.sh
new file mode 100755
index 00000000..884fc27c
--- /dev/null
+++ b/doc/install-html.sh
@@ -0,0 +1,7 @@
+#!/bin/sh -eu
+
+cd "$1"; shift
+MESON_INSTALL_DESTDIR=${MESON_INSTALL_DESTDIR_PREFIX%$MESON_INSTALL_PREFIX}
+dest="$MESON_INSTALL_DESTDIR$1"; shift
+
+install -p -m644 -t "$dest" -- *.html
diff --git a/doc/man/meson.build b/doc/man/meson.build
new file mode 100644
index 00000000..b90b1578
--- /dev/null
+++ b/doc/man/meson.build
@@ -0,0 +1,67 @@
+foreach man: [['misc_conv.3', []],
+ ['pam.3', []],
+ ['pam_acct_mgmt.3', []],
+ ['pam_authenticate.3', []],
+ ['pam_chauthtok.3', []],
+ ['pam_close_session.3', []],
+ ['pam_conv.3', []],
+ ['pam_end.3', []],
+ ['pam_error.3', ['pam_verror.3']],
+ ['pam_fail_delay.3', []],
+ ['pam_get_authtok.3', ['pam_get_authtok_noverify.3', 'pam_get_authtok_verify.3']],
+ ['pam_get_data.3', []],
+ ['pam_get_item.3', []],
+ ['pam_get_user.3', []],
+ ['pam_getenv.3', []],
+ ['pam_getenvlist.3', []],
+ ['pam_info.3', ['pam_vinfo.3']],
+ ['pam_misc_drop_env.3', []],
+ ['pam_misc_paste_env.3', []],
+ ['pam_misc_setenv.3', []],
+ ['pam_open_session.3', []],
+ ['pam_prompt.3', ['pam_vprompt.3']],
+ ['pam_putenv.3', []],
+ ['pam_set_data.3', []],
+ ['pam_set_item.3', []],
+ ['pam_setcred.3', []],
+ ['pam_sm_acct_mgmt.3', []],
+ ['pam_sm_authenticate.3', []],
+ ['pam_sm_chauthtok.3', []],
+ ['pam_sm_close_session.3', []],
+ ['pam_sm_open_session.3', []],
+ ['pam_sm_setcred.3', []],
+ ['pam_start.3', []],
+ ['pam_strerror.3', []],
+ ['pam_syslog.3', ['pam_vsyslog.3']],
+ ['pam_xauth_data.3', []],
+ ['pam.conf.5', ['pam.d.5']],
+ ['pam.8', ['PAM.8']],
+ ]
+ xml = man[0] + '.xml'
+
+ run_command([prog_xmllint,
+ '--nonet',
+ '--noout',
+ '--xinclude',
+ '--relaxng', docbook_rng,
+ xml],
+ check: true)
+
+ custom_target(man[0],
+ input: xml,
+ output: man,
+ depends: custom_man_xsl,
+ command: [prog_xsltproc,
+ '-o', '@OUTPUT0@',
+ '--nonet',
+ '--xinclude',
+ '--path', meson.current_source_dir(),
+ stringparam_vendordir,
+ stringparam_profileconditions,
+ custom_man_xsl,
+ '@INPUT@'],
+ install: true,
+ install_dir: mandir / 'man' + man[0].substring(-1),
+ install_tag: 'man',
+ )
+endforeach
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 00000000..afe15851
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,26 @@
+custom_man_xsl = custom_target(
+ 'custom-man.xsl',
+ input: 'custom-man.xsl.in',
+ output: ['custom-man.xsl'],
+ command: [
+ redir_exe,
+ '@INPUT@',
+ '@OUTPUT@',
+ 'sed',
+ 's+MAN_STYLESHEET+' + man_stylesheet + '+g'
+ ]
+)
+
+install_data(
+ 'index.html',
+ install_dir: htmldir,
+ install_tag: 'doc',
+)
+
+install_html = files('install-html.sh')
+
+subdir('man')
+subdir('specs')
+subdir('sag')
+subdir('adg')
+subdir('mwg')
diff --git a/doc/mwg/html/meson.build b/doc/mwg/html/meson.build
new file mode 120000
index 00000000..d6d90eaa
--- /dev/null
+++ b/doc/mwg/html/meson.build
@@ -0,0 +1 @@
+../../guide-html-meson.build \ No newline at end of file
diff --git a/doc/mwg/meson.build b/doc/mwg/meson.build
new file mode 120000
index 00000000..2e19d830
--- /dev/null
+++ b/doc/mwg/meson.build
@@ -0,0 +1 @@
+../guide-meson.build \ No newline at end of file
diff --git a/doc/sag/html/meson.build b/doc/sag/html/meson.build
new file mode 120000
index 00000000..d6d90eaa
--- /dev/null
+++ b/doc/sag/html/meson.build
@@ -0,0 +1 @@
+../../guide-html-meson.build \ No newline at end of file
diff --git a/doc/sag/meson.build b/doc/sag/meson.build
new file mode 120000
index 00000000..2e19d830
--- /dev/null
+++ b/doc/sag/meson.build
@@ -0,0 +1 @@
+../guide-meson.build \ No newline at end of file
diff --git a/doc/specs/meson.build b/doc/specs/meson.build
new file mode 100644
index 00000000..4ddeef84
--- /dev/null
+++ b/doc/specs/meson.build
@@ -0,0 +1,42 @@
+parse_y = custom_target(
+ 'parse_y.[ch]',
+ input: 'parse_y.y',
+ output: ['parse_y.c', 'parse_y.h'],
+ command: yacc_cmd,
+)
+
+parse_l = custom_target(
+ 'parse_l.c',
+ input: 'parse_l.l',
+ output: 'parse_l.c',
+ depends: parse_y,
+ command: [prog_flex, '-o', '@OUTPUT@', '@INPUT@'],
+)
+
+padout = executable(
+ 'padout',
+ sources: [parse_l, parse_y],
+ include_directories: [libpam_inc],
+ c_args: [
+ '-Wno-unused-function',
+ '-Wno-sign-compare',
+ ],
+ link_args: exe_link_args,
+)
+
+custom_target(
+ 'draft-morgan-pam-current.txt',
+ input: 'draft-morgan-pam.raw',
+ output: 'draft-morgan-pam-current.txt',
+ command: [redir_exe, '@INPUT@', '@OUTPUT@', padout],
+ depends: padout,
+ install: true,
+ install_dir: docdir,
+ install_tag: 'doc',
+)
+
+install_data(
+ 'rfc86.0.txt',
+ install_dir: docdir,
+ install_tag: 'doc',
+)