summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Thomsen <oss@cogitri.dev>2020-05-07 12:38:21 +0200
committerTimo Teräs <timo.teras@iki.fi>2020-10-02 12:07:05 +0300
commit111835e860034fe10d7351b3056aff851057fe2b (patch)
tree96a652ccf243149fcbb494d15f5ce2556a3e31ac
parentdeeca54f644aba1d73b785b6eb36cd1d23e404cc (diff)
downloadapk-tools-111835e860034fe10d7351b3056aff851057fe2b.tar.gz
apk-tools-111835e860034fe10d7351b3056aff851057fe2b.tar.bz2
apk-tools-111835e860034fe10d7351b3056aff851057fe2b.tar.xz
apk-tools-111835e860034fe10d7351b3056aff851057fe2b.zip
build: build help.h with meson
-rw-r--r--doc/meson.build46
-rw-r--r--meson.build7
-rw-r--r--src/meson.build13
3 files changed, 39 insertions, 27 deletions
diff --git a/doc/meson.build b/doc/meson.build
index 6142884..f6d4878 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -1,8 +1,4 @@
-scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
-sh = find_program('sh', native: true)
-mandir = get_option('mandir')
-
-man_files = [
+man_files = files(
'apk.8.scd',
'apk-add.8.scd',
'apk-audit.8.scd',
@@ -25,22 +21,28 @@ man_files = [
'apk-verify.8.scd',
'apk-version.8.scd',
'apk-world.5.scd',
-]
+)
+
+if scdoc_dep.found()
+ scdoc_prog = find_program(scdoc_dep.get_pkgconfig_variable('scdoc'), native: true)
+ sh = find_program('sh', native: true)
+ mandir = get_option('mandir')
-foreach filename : man_files
- topic = filename.split('.')[-3].split('/')[-1]
- section = filename.split('.')[-2]
- output = '@0@.@1@'.format(topic, section)
+ foreach filename : man_files
+ topic = '@0@'.format(filename).split('.')[-3].split('/')[-1]
+ section = '@0@'.format(filename).split('.')[-2]
+ output = '@0@.@1@'.format(topic, section)
- custom_target(
- output,
- input: filename,
- capture: true,
- output: output,
- command: [
- sh, '-c', '@0@ < @INPUT@'.format(scdoc_prog.path())
- ],
- install: true,
- install_dir: '@0@/man@1@'.format(mandir, section)
- )
-endforeach \ No newline at end of file
+ custom_target(
+ output,
+ input: filename,
+ capture: true,
+ output: output,
+ command: [
+ sh, '-c', '@0@ < @INPUT@'.format(scdoc_prog.path())
+ ],
+ install: true,
+ install_dir: '@0@/man@1@'.format(mandir, section)
+ )
+ endforeach
+endif
diff --git a/meson.build b/meson.build
index c3fd394..d348ad5 100644
--- a/meson.build
+++ b/meson.build
@@ -13,7 +13,7 @@ apk_libdir = get_option('libdir')
zlib_dep = dependency('zlib')
openssl_dep = dependency('openssl')
lua_dep = dependency('lua' + get_option('lua_version'), required: get_option('lua'))
-scdoc = dependency('scdoc', version: '>=1.10', required: get_option('docs'))
+scdoc_dep = dependency('scdoc', version: '>=1.10', required: get_option('docs'))
add_project_arguments('-D_GNU_SOURCE', language: 'c')
@@ -23,9 +23,6 @@ if get_option('default_library') == 'static'
add_project_arguments('-DOPENSSL_NO_ENGINE', language: 'c')
endif
+subdir('doc')
subdir('libfetch')
subdir('src')
-
-if scdoc.found()
- subdir('doc')
-endif
diff --git a/src/meson.build b/src/meson.build
index 070a55b..972e4b4 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -51,8 +51,21 @@ apk_src = [
'app_stats.c',
'app_verify.c',
'app_version.c',
+ 'help.c',
]
+genhelp_script = find_program('genhelp.lua')
+
+generated_help = custom_target(
+ 'help.h',
+ capture: true,
+ output: 'help.h',
+ input: man_files,
+ command: [genhelp_script, '@INPUT@'],
+)
+
+apk_src += [ generated_help ]
+
apk_cargs = [
'-DAPK_VERSION="' + meson.project_version() + '"',
'-D_ATFILE_SOURCE',