Skip to content

Commit

Permalink
[Doc] New installation with autoconf and meson
Browse files Browse the repository at this point in the history
- autoconf:
  * generate in source directory if pandoc found
  * install from source directory

- meson:
  * generate and install with build directory if pandoc found
  * try to install from source directory if pandoc not found
  * bail otherwise
  • Loading branch information
lbonn committed Mar 5, 2024
1 parent b22fffc commit 55fac9a
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 29 deletions.
57 changes: 39 additions & 18 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,52 @@ rofi_LDADD=\
$(LIBS)

##
# Manpage
# Manpages
##

.PHONY: generate-manpage

if FOUND_PANDOC

generate-manpage: doc/rofi.1\
doc/rofi-sensible-terminal.1\
doc/rofi-theme-selector.1\
doc/rofi-debugging.5\
doc/rofi-dmenu.5\
doc/rofi-keys.5\
doc/rofi-script.5\
doc/rofi-theme.5

doc/rofi.1: doc/rofi.1.markdown
pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$<
doc/rofi-sensible-terminal.1: doc/rofi-sensible-terminal.1.markdown
pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$<
doc/rofi-theme-selector.1: doc/rofi-theme-selector.1.markdown
pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$<
doc/rofi-debugging.5: doc/rofi-debugging.5.markdown
pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$<
doc/rofi-dmenu.5: doc/rofi-dmenu.5.markdown
pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$<
doc/rofi-keys.5: doc/rofi-keys.5.markdown
pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$<
doc/rofi-script.5: doc/rofi-script.5.markdown
pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$<
doc/rofi-theme.5: doc/rofi-theme.5.markdown
pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$<

endif

dist_man1_MANS=\
doc/rofi.1\
doc/rofi-theme-selector.1\
doc/rofi-sensible-terminal.1
doc/rofi-sensible-terminal.1\
doc/rofi-theme-selector.1

dist_man5_MANS=\
doc/rofi-theme.5\
doc/rofi-debugging.5\
doc/rofi-keys.5\
doc/rofi-dmenu.5\
doc/rofi-script.5
doc/rofi-keys.5\
doc/rofi-script.5\
doc/rofi-theme.5

EXTRA_DIST += \
doc/rofi-theme.5.markdown \
Expand Down Expand Up @@ -254,19 +287,7 @@ EXTRA_DIST+=\
doc/default_configuration.rasi\
doc/default_theme.rasi\
Changelog
##
# Indent
##

generate-manpage: $(top_srcdir)/doc/rofi-theme-selector.1.markdown $(top_srcdir)/doc/rofi.1.markdown $(top_srcdir)/doc/rofi-theme.5.markdown $(top_srcdir)/doc/rofi-script.5.markdown ${top_srcdir}/doc/rofi-sensible-terminal.1.markdown ${top_srcdir}/doc/rofi-keys.5.markdown ${top_srcdir}/doc/rofi-dmenu.5.markdown $(top_srcdir)/doc/rofi-debugging.5.markdown
pandoc --standalone --to=man -f markdown-tedxt_math_dollars $(top_srcdir)/doc/rofi.1.markdown -o $(top_srcdir)/doc/rofi.1
pandoc --standalone --to=man -f markdown-tedxt_math_dollars $(top_srcdir)/doc/rofi-theme-selector.1.markdown -o $(top_srcdir)/doc/rofi-theme-selector.1
pandoc --standalone --to=man -f markdown-tedxt_math_dollars $(top_srcdir)/doc/rofi-theme.5.markdown -o $(top_srcdir)/doc/rofi-theme.5
pandoc --standalone --to=man -f markdown-tedxt_math_dollars $(top_srcdir)/doc/rofi-debugging.5.markdown -o $(top_srcdir)/doc/rofi-debugging.5
pandoc --standalone --to=man -f markdown-tedxt_math_dollars $(top_srcdir)/doc/rofi-keys.5.markdown -o $(top_srcdir)/doc/rofi-keys.5
pandoc --standalone --to=man -f markdown-tedxt_math_dollars $(top_srcdir)/doc/rofi-script.5.markdown -o $(top_srcdir)/doc/rofi-script.5
pandoc --standalone --to=man -f markdown-tedxt_math_dollars $(top_srcdir)/doc/rofi-dmenu.5.markdown -o $(top_srcdir)/doc/rofi-dmenu.5
pandoc --standalone --to=man -f markdown-tedxt_math_dollars $(top_srcdir)/doc/rofi-sensible-terminal.1.markdown -o $(top_srcdir)/doc/rofi-sensible-terminal.1

##
# Rofi test program
Expand Down
14 changes: 14 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ AC_ARG_ENABLE([check], AS_HELP_STRING([--disable-check], [Build with checks usin
AS_IF([test "x${enable_check}" != "xno"], [ PKG_CHECK_MODULES([check],[check >= 0.11.0], [HAVE_CHECK=1]) ])
AM_CONDITIONAL([USE_CHECK], [test "x${enable_check}" != "xno" && test "$HAVE_CHECK" -eq 1])

dnl ---------------------------------------------------------------------
dnl Build man pages
dnl ---------------------------------------------------------------------
AC_ARG_ENABLE([man], AS_HELP_STRING([--disable-man], [Build man pages (default: enabled)]))

pandoc_min_version="2.17"
AS_IF([test "x$enable_man" != "xno" ], [ AC_CHECK_PROG([pandoc], [pandoc >= ${pandoc_min_version}], [yes])])
AM_CONDITIONAL([FOUND_PANDOC], [test "x$pandoc" = xyes])


dnl ---------------------------------------------------------------------
dnl Gets the resource compile tool path.
Expand Down Expand Up @@ -210,6 +219,11 @@ echo "Check based tests Enabled"
else
echo "Check based tests Disabled"
fi
if test "x${enable_man}" != "xno" && test "x$pandoc" = "xyes"; then
echo "Build man pages Enabled"
else
echo "Build man pages Disabled"
fi
echo "-------------------------------------"
echo "Now type 'make' to build"
echo ""
42 changes: 31 additions & 11 deletions doc/meson.build
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
pandoc = find_program('pandoc', required: false)
man_files = [
'rofi.1',
'rofi-sensible-terminal.1',
'rofi-theme-selector.1',
'rofi-debugging.5',
'rofi-dmenu.5',
'rofi-keys.5',
'rofi-script.5',
'rofi-theme.5',
]

fs = import('fs')

pandoc = find_program('pandoc', required: false, version: '>=2.17')

if pandoc.found()
man_targets = []
foreach f: [
'rofi.1',
'rofi-sensible-terminal.1',
'rofi-debugging.5',
'rofi-dmenu.5',
'rofi-keys.5',
'rofi-script.5',
'rofi-theme-selector.1',
'rofi-theme.5',
]
cp_cmds = []
foreach f: man_files
section_number = f.split('.')[1]
install_dest = join_paths(get_option('prefix'), get_option('mandir'), 'man' + section_number)

Expand All @@ -26,7 +32,21 @@ if pandoc.found()
build_by_default: true,
)
endforeach

run_target('generate-manpage', command: ['true'], depends: man_targets)
else
man_missing = false
foreach f: man_files
if not fs.is_file(f)
man_missing = true
endif
endforeach

if man_missing
warning('Man files cannot be generated and not present in source directory, they will not be installed')
else
install_man(man_files)
endif
endif

doxy_conf = configuration_data()
Expand Down
16 changes: 16 additions & 0 deletions meson-dist-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -eu

cd "${MESON_DIST_ROOT}"

# deploy docs
mkdir build
meson setup build -Dprefix=/usr
ninja -C build
cp build/doc/*.1 doc
cp build/doc/*.5 doc
rm -rf build

# configure script
autoreconf -i
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ add_project_arguments(
language: 'c'
)

meson.add_dist_script('meson-dist-script')

flags = [
'-Wparentheses',
'-Winline',
Expand Down

0 comments on commit 55fac9a

Please sign in to comment.