Because the man page references some stuff that are dependant on the configure options, it is a good idea to update the man page accordingly, so the user will not be puzzled later.
There is now a script which takes care of replacing '@var@' in the same way autoconf does, but also which can handle conditional '@def@' removal (for the case of feature dependant command line options). The man page for Window Maker is now processed this way so user will always see accurate information. Signed-off-by: Christophe CURIS <[email protected]> --- Makefile.am | 3 +- doc/Makefile.am | 19 ++++- doc/wmaker.1x | 163 ----------------------------------------- doc/wmaker.in | 166 +++++++++++++++++++++++++++++++++++++++++ script/replace-ac-keywords.sh | 167 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 350 insertions(+), 168 deletions(-) delete mode 100644 doc/wmaker.1x create mode 100644 doc/wmaker.in create mode 100755 script/replace-ac-keywords.sh diff --git a/Makefile.am b/Makefile.am index 071d13f..84493cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,7 +43,8 @@ EXTRA_DIST = TODO BUGS BUGFORM FAQ INSTALL \ script/generate-mapfile-from-header.sh \ script/generate-po-from-template.sh \ script/generate-txt-from-texi.sh \ - script/nested-func-to-macro.sh + script/nested-func-to-macro.sh \ + script/replace-ac-keywords.sh .PHONY: coverage-reset coverage diff --git a/doc/Makefile.am b/doc/Makefile.am index db69f90..d667153 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = build sk cs ru -man_MANS = \ +dist_man_MANS = \ geticonset.1x \ getstyle.1x \ get-wings-flags.1 \ @@ -15,7 +15,6 @@ man_MANS = \ wdwrite.1x \ WindowMaker.1x \ wmagnify.1x \ - wmaker.1x \ wmgenmenu.1 \ wmmenugen.1 \ wmsetbg.1x \ @@ -23,7 +22,19 @@ man_MANS = \ wxcopy.1x \ wxpaste.1x -EXTRA_DIST = $(man_MANS) +man_MANS = \ + wmaker.1x + +MOSTLYCLEANFILES = wmaker.1x + +EXTRA_DIST = wmaker.in + +wmaker.1x: wmaker.in Makefile $(top_builddir)/config.h + $(AM_V_GEN)$(top_srcdir)/script/replace-ac-keywords.sh \ + --header "$(top_builddir)/config.h" --filter "HAVE_INOTIFY" \ + -D"sysconfdir=$(sysconfdir)" --replace "sysconfdir" \ + -D"pkgdatadir=$(pkgdatadir)" --replace "pkgdatadir" \ + -o "wmaker.1x" "$(srcdir)/wmaker.in" # Create a 'silent rule' for our make check the same way automake does AM_V_CHKOPTS = $(am__v_CHKOPTS_$(V)) @@ -35,6 +46,6 @@ check-local: wmaker-args wmaker-args: $(AM_V_CHKOPTS)$(top_srcdir)/script/check-cmdline-options-doc.sh \ - --program "$(top_builddir)/src/wmaker" --man-page "$(top_srcdir)/doc/wmaker.1x" + --program "$(top_builddir)/src/wmaker" --man-page "wmaker.1x" .PHONY: wmaker-args diff --git a/doc/wmaker.1x b/doc/wmaker.1x deleted file mode 100644 index bf2320e..0000000 --- a/doc/wmaker.1x +++ /dev/null @@ -1,163 +0,0 @@ -.\" Hey, Emacs! This is an -*- nroff -*- source file. -.TH "Window Maker" 1x "February 2015" -.SH NAME -wmaker \- X11 window manager with a NEXTSTEP look -.SH SYNOPSIS -.B wmaker -.I "[-options]" -.SH "DESCRIPTION" -Window Maker is a X11 window manager with a NEXTSTEP look. It tries to -emulate NeXT's look as much as possible, but it deviates from it as -necessary. -.SH "OPTIONS" -.TP -.BI \-display " host:display.screen" -specify display to use. -On multiheaded machines, Window Maker will automatically manage all screens. -If you want Window Maker to manage only a specific screen, you must supply -the screen number you want to have managed with the -.B \-display -command line argument. For example, if you want Window Maker to manage only -screen 1, start it as: -.EX -wmaker -display :0.1 -.EE -.TP -.B \-\-dont\-restore -do not restore saved session -.TP -.B \-\-global_defaults_path -print the path where the files for the default configuration are installed and exit -.TP -.B \-\-help -print the list of command line options supported, one per line, and exit -.TP -.BI \-\-locale " locale" -specify the locale (i18n language) to use; Window Maker will also set the variable -.B LANG -which will be inherited by all applications started from Window Maker -.TP -.B \-\-no\-autolaunch -do not launch at start-up the applications that were marked in the configuration as autolanched -.TP -.B \-\-no\-clip -do not show the workspace Clip -.TP -.B \-\-no\-dock -do not show the application Dock -.TP -.B \-\-no\-drawer -disable the Drawers in the Dock -.TP -.B \-\-static -do not update or save automatically the configuration -.TP -.B \-\-version -display Window Maker's version number and exit -.TP -.B \-\-visual\-id -specify the ID of the visual to use; see -.BR xdpyinfo (1x) -for a list of visuals available in your display -.PP -.SH FILES -.TP -.B ~/GNUstep/Defaults/WindowMaker -general Window Maker defaults. -.TP -.B ~/GNUstep/Defaults/WMState -information about the Dock and Clip. DON'T edit this while running -Window Maker. It will be overwritten. -.TP -.B ~/GNUstep/Defaults/WMRootMenu -Contains the name of the file to read the root menu from or the -menu itself, in property list format. -.TP -.B ~/GNUstep/Defaults/WMWindowAttributes -Attributes for different application classes and instances. Use the -Attribute Editor (right drag the application's title bar, select -Attributes) instead of modifying this file directly. There are just a -few options not available using the Attributes Editor. -.TP -.B /usr/share/WindowMaker/Defaults/ -All the above-mentioned files are READ from here if not found except -for WMState, which is COPIED from here. No matter where they are read -from, if it's necessary to write configuration changes back into this -files, user's files will be written to. -.TP -.B ~/GNUstep/Library/WindowMaker/autostart -This script is automatically executed when Window Maker is started. -.TP -.B ~/GNUstep/Library/WindowMaker/exitscript -This script is automatically executed immediately before Window Maker is -exited. -.B Note: -If you need to run something that requires the X server to be running -from this script, make sure you do not use the -.I SHUTDOWN -command from the root menu to exit Window Maker. Otherwise, the X server -might be shut down before the script is executed. -.TP -.B ~/GNUstep/Library/WindowMaker/ -The menu file indicated in WMRootMenu is looked for here... -.TP -.B /etc/X11/WindowMaker/ -and here, in that order. Unless, the indicated path is an absolute path. -.TP -.B ~/GNUstep/Library/WindowMaker/Pixmaps/ -Window Maker looks for \fBpixmaps\fP here -.TP -.B ~/GNUstep/Library/WindowMaker/Backgrounds/ -Window Maker looks for backgrounds here -.TP -.B ~/GNUstep/Library/WindowMaker/Styles/ -Window Maker looks for style files here (not true... it looks like it -does, but you have to specify the full path anyway, it's just a place -to keep things nicely ordered) -.TP -.B ~/GNUstep/Library/WindowMaker/Themes/ -Window Maker looks for theme files here (ibid) -.TP -.B /usr/share/WindowMaker/Pixmaps/ -System-wide (Window Maker-specific) pixmaps are located here -.TP -.B /usr/share/WindowMaker/Styles/ -System wide styles are here -.TP -.B /usr/share/WindowMaker/Themes/ -Guess... ;-) -.SH ENVIRONMENT -.IP GNUSTEP_USER_ROOT -specifies the initial path for the Defaults directory. "Defaults/" is -appended to this variable to determine the actual location of the -databases. If the variable is not set, it defaults to "~/GNUstep" -.IP GNUSTEP_LOCAL_ROOT -specifies the location of the system-wide \fBlocal\fP GNUstep -directory (this is useful, for example, in those cases where the -system-wide location is really a network wide location). If this -variable is empty, GNUSTEP_SYSTEM_ROOT is looked for. -.IP GNUSTEP_SYSTEM_ROOT -specifies the location of the system-wide GNUstep directory. If this -variable is empty, it defaults to /etc/GNUstep -.SH SEE ALSO -The Window Maker User Guide -.PP -The Window Maker FAQ -.PP -.BR X (1x), -.BR wdwrite (1x), -.BR wxcopy (1x), -.BR geticonset (1x), -.BR seticons (1x), -.BR wmaker (1x), -.BR wxpaste (1x), -.BR getstyle (1x), -.BR setstyle (1x), -.BR wmsetbg (1x) -.SH AUTHOR -Window Maker was written by Alfredo K. Kojima <[email protected]>, -Dan Pascu <[email protected]> with contributions from many people around -the Internet. -.PP -This manual page was created by Marcelo E. Magallon, <[email protected]> -and is maintained by the Window Maker team. diff --git a/doc/wmaker.in b/doc/wmaker.in new file mode 100644 index 0000000..dc09ce0 --- /dev/null +++ b/doc/wmaker.in @@ -0,0 +1,166 @@ +.\" Hey, Emacs! This is an -*- nroff -*- source file. +.TH "Window Maker" 1x "February 2015" +.SH NAME +wmaker \- X11 window manager with a NEXTSTEP look +.SH SYNOPSIS +.B wmaker +.I "[-options]" +.SH "DESCRIPTION" +Window Maker is a X11 window manager with a NEXTSTEP look. It tries to +emulate NeXT's look as much as possible, but it deviates from it as +necessary. +.SH "OPTIONS" +.TP +.BI \-display " host:display.screen" +specify display to use. +On multiheaded machines, Window Maker will automatically manage all screens. +If you want Window Maker to manage only a specific screen, you must supply +the screen number you want to have managed with the +.B \-display +command line argument. For example, if you want Window Maker to manage only +screen 1, start it as: +.EX +wmaker -display :0.1 +.EE +.TP +.B \-\-dont\-restore +do not restore saved session +.TP +.B \-\-global_defaults_path +print the path where the files for the default configuration are installed and exit +.TP +.B \-\-help +print the list of command line options supported, one per line, and exit +.TP +.BI \-\-locale " locale" +specify the locale (i18n language) to use; Window Maker will also set the variable +.B LANG +which will be inherited by all applications started from Window Maker +.TP +.B \-\-no\-autolaunch +do not launch at start-up the applications that were marked in the configuration as autolanched +.TP +.B \-\-no\-clip +do not show the workspace Clip +.TP +.B \-\-no\-dock +do not show the application Dock +.TP +.B \-\-no\-drawer +disable the Drawers in the Dock +@[email protected] +@[email protected] \-\-no\-polling +@!HAVE_INOTIFY@disable the periodic check on the configuration file to reload it automatically +.TP +.B \-\-static +do not update or save automatically the configuration +.TP +.B \-\-version +display Window Maker's version number and exit +.TP +.B \-\-visual\-id +specify the ID of the visual to use; see +.BR xdpyinfo (1x) +for a list of visuals available in your display +.PP +.SH FILES +.TP +.B ~/GNUstep/Defaults/WindowMaker +general Window Maker defaults. +.TP +.B ~/GNUstep/Defaults/WMState +information about the Dock and Clip. DON'T edit this while running +Window Maker. It will be overwritten. +.TP +.B ~/GNUstep/Defaults/WMRootMenu +Contains the name of the file to read the root menu from or the +menu itself, in property list format. +.TP +.B ~/GNUstep/Defaults/WMWindowAttributes +Attributes for different application classes and instances. Use the +Attribute Editor (right drag the application's title bar, select +Attributes) instead of modifying this file directly. There are just a +few options not available using the Attributes Editor. +.TP +.B @sysconfdir@/WindowMaker/Defaults/ +All the above-mentioned files are READ from here if not found except +for WMState, which is COPIED from here. No matter where they are read +from, if it's necessary to write configuration changes back into this +files, user's files will be written to. +.TP +.B ~/GNUstep/Library/WindowMaker/autostart +This script is automatically executed when Window Maker is started. +.TP +.B ~/GNUstep/Library/WindowMaker/exitscript +This script is automatically executed immediately before Window Maker is +exited. +.B Note: +If you need to run something that requires the X server to be running +from this script, make sure you do not use the +.I SHUTDOWN +command from the root menu to exit Window Maker. Otherwise, the X server +might be shut down before the script is executed. +.TP +.B ~/GNUstep/Library/WindowMaker/ +The menu file indicated in WMRootMenu is looked for here... +.TP +.B /etc/X11/WindowMaker/ +and here, in that order. Unless, the indicated path is an absolute path. +.TP +.B ~/GNUstep/Library/WindowMaker/Pixmaps/ +Window Maker looks for \fBpixmaps\fP here +.TP +.B ~/GNUstep/Library/WindowMaker/Backgrounds/ +Window Maker looks for backgrounds here +.TP +.B ~/GNUstep/Library/WindowMaker/Styles/ +Window Maker looks for style files here (not true... it looks like it +does, but you have to specify the full path anyway, it's just a place +to keep things nicely ordered) +.TP +.B ~/GNUstep/Library/WindowMaker/Themes/ +Window Maker looks for theme files here (ibid) +.TP +.B @pkgdatadir@/Pixmaps/ +System-wide (Window Maker-specific) pixmaps are located here +.TP +.B @pkgdatadir@/Styles/ +System wide styles are here +.TP +.B @pkgdatadir@/Themes/ +Guess... ;-) +.SH ENVIRONMENT +.IP GNUSTEP_USER_ROOT +specifies the initial path for the Defaults directory. "Defaults/" is +appended to this variable to determine the actual location of the +databases. If the variable is not set, it defaults to "~/GNUstep" +.IP GNUSTEP_LOCAL_ROOT +specifies the location of the system-wide \fBlocal\fP GNUstep +directory (this is useful, for example, in those cases where the +system-wide location is really a network wide location). If this +variable is empty, GNUSTEP_SYSTEM_ROOT is looked for. +.IP GNUSTEP_SYSTEM_ROOT +specifies the location of the system-wide GNUstep directory. If this +variable is empty, it defaults to /etc/GNUstep +.SH SEE ALSO +The Window Maker User Guide +.PP +The Window Maker FAQ +.PP +.BR X (1x), +.BR wdwrite (1x), +.BR wxcopy (1x), +.BR geticonset (1x), +.BR seticons (1x), +.BR wmaker (1x), +.BR wxpaste (1x), +.BR getstyle (1x), +.BR setstyle (1x), +.BR wmsetbg (1x) +.SH AUTHOR +Window Maker was written by Alfredo K. Kojima <[email protected]>, +Dan Pascu <[email protected]> with contributions from many people around +the Internet. +.PP +This manual page was created by Marcelo E. Magallon, <[email protected]> +and is maintained by the Window Maker team. diff --git a/script/replace-ac-keywords.sh b/script/replace-ac-keywords.sh new file mode 100755 index 0000000..2fb195e --- /dev/null +++ b/script/replace-ac-keywords.sh @@ -0,0 +1,167 @@ +#!/bin/sh +########################################################################### +# +# Window Maker window manager +# +# Copyright (c) 2015 Christophe CURIS +# Copyright (c) 2015 Window Maker Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +########################################################################### +# +# replace-ac-keywords.sh: +# generate text file from a template text file, processing @keywords@ +# from configure's detected stuff +# +# This follows the principle similar to what Autoconf does for the files +# defined in AC_CONFIG_FILES; the reasons for this script are: +# +# - Autoconf recommends to only defined Makefiles in that macro and to +# process the rest (if possible) through a Make rule; +# +# - we also take the opportunity to get access to the AC_DEFINE stuff +# without needing to AC_SUBST them, which would grow unnecessarily the +# makefile; +# +# - contrary to Autoconf, we also give the possibility to completely +# remove lines from the template, where Autoconf only comments them (when +# using AM_CONDITIONAL for example) +# +########################################################################### +# +# Please note that this script is writen in sh+sed on purpose: this script +# is gonna be run on the machine of the person who is trying to compile +# WindowMaker, and as such we cannot be sure to find any scripting language +# in a known version and that works (python/ruby/tcl/perl/php/you-name-it). +# +# So for portability, we stick to the same sh+awk constraint as Autotools +# to limit the problem, see for example: +# http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Portable-Shell.html +# +########################################################################### + +# Report an error on stderr and exit with status 2 to tell make that we could +# not do what we were asked +arg_error() { + echo "$0: $@" >&2 + exit 2 +} + +# print help and exit with success status +print_help() { + echo "$0: convert a Texinfo file into a plain text file" + echo "Usage: $0 [options...] <template-file>" + echo "valid options are:" + echo " -Dkey=value : define 'key' to the value 'value'" + echo " --filter key : remove lines containing @key@ if it is undefined" + echo " --header file : C header file to parse for #define" + echo " -o file : name for the output file" + echo " --replace key : replace @key@ with its value" + exit 0 +} + +# Parse a C header file and add the defined lines to the list of known keys+values +# We explicitely excludes macros defined on multiple lines and macros with arguments +# Skip value defined to '0' to consider them as undefine +extract_vars_from_c_header () +{ + sed -n '/^#[ \t]*define[ \t][ \t]*[A-Za-z][A-Za-z_0-9]*[ \t].*[^\\]$/ { + s/^#[ \t]*define[ \t]*// + s/[ \t][ \t]*/=/ + /=0$/d + p + }' "$1" +} + +# Extract command line arguments +while [ $# -gt 0 ]; do + case $1 in + + -D*) + echo "$1" | grep '^-D[a-zA-Z][a-z_A-Z0-9]*=' > /dev/null || arg_error "syntax error for '$1', expected -Dname=value" + var_defs="$var_defs +`echo "$1" | sed -e 's/^-D//' `" + ;; + + --filter) + shift + list_filters="$list_filters $1" + ;; + + --header) + shift + [ -r "$1" ] || arg_error "header file \"$1\" is not readable" + var_defs="$var_defs +`extract_vars_from_c_header "$1" `" + ;; + + -h|-help|--help) print_help ;; + + -o) + shift + output_file="$1" + ;; + + --replace) + shift + list_replaces="$list_replaces $1" + ;; + + -*) arg_error "unknow option '$1'" ;; + + *) + [ "x$input_file" = "x" ] || arg_error "only 1 input file can be specified, not \"$input_file\" and \"$1\"" + input_file="$1" + ;; + esac + shift +done + +# Check consistency of command-line +[ "x$input_file" != "x" ] || arg_error "no input template file given" +[ "x$output_file" != "x" ] || arg_error "no output file given" + +[ "x$list_replaces$list_filters" != "x" ] || arg_error "no key to process from template" + +########################################################################### + +# Generate the SED commands to replace the requested keys +for key in $list_replaces +do + # if there are multiple possible values, keep the last + value=`echo "$var_defs" | grep "^$key=" | tail -1 ` + [ "x$value" != "x" ] || arg_error "key \"$key\" does not have a value" + sed_cmd="$sed_cmd + s#@$key@#`echo "$value" | sed -e 's/^[^=]*=//' `#" +done + +# Generate the SED commands to filter lines with the specified keys +for key in $list_filters +do + if echo "$var_defs" | grep "^$key=" > /dev/null ; then + sed_cmd="$sed_cmd + s#@$key@## + /@!$key@/d" + else + sed_cmd="$sed_cmd + s#@!$key@## + /@$key@/d" + fi +done + +########################################################################### + +sed -e "$sed_cmd" < "$input_file" > "$output_file" -- 2.1.4 -- To unsubscribe, send mail to [email protected].
