[PATCH app-xinit 1/6] config: build man pages with XORG_MANPAGE_SECTIONS

Gaetan Nadon memsize at videotron.ca
Sat Mar 5 18:35:55 PST 2011


LAUNCHD is an Automake conditional which means that Automake will
traverse the privileged_startx directory when running the dist target.
http://www.gnu.org/software/automake/manual/automake.html

Use sed for text substitution.
Use SCOMAN Automake variable and groff .if for conditional text
We can therefore remove ARCHMANDEFS
Move man pages to their own directory
Remove man page related code from cpprules.in

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 Makefile.am                  |   21 +++++++--------------
 configure.ac                 |   12 ++++++------
 cpprules.in                  |   22 +---------------------
 man/Makefile.am              |   20 ++++++++++++++++++++
 startx.man => man/startx.man |   11 ++++++-----
 xinit.man => man/xinit.man   |    0
 6 files changed, 40 insertions(+), 46 deletions(-)
 create mode 100644 man/Makefile.am
 rename startx.man => man/startx.man (98%)
 rename xinit.man => man/xinit.man (100%)

diff --git a/Makefile.am b/Makefile.am
index 2b8a4eb..f47b5d7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,6 +19,11 @@
 #  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 #  PERFORMANCE OF THIS SOFTWARE.
 
+SUBDIRS = man
+if LAUNCHD
+SUBDIRS += privileged_startx
+endif
+
 bin_PROGRAMS = xinit
 bin_SCRIPTS = startx
 
@@ -29,14 +34,6 @@ xinit_LDADD = $(XINIT_LIBS)
 xinit_SOURCES =	\
         xinit.c
 
-appmandir = $(APP_MAN_DIR)
-
-appman_PRE = \
-	startx.man \
-        xinit.man
-
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-
 include $(top_srcdir)/cpprules.in
 
 xinitrcdir = $(XINITDIR)
@@ -65,18 +62,14 @@ $(launchdidprefix).startx.plist.cpp: org.x.startx.plist.cpp
 launchagents_PRE = $(launchdidprefix).startx.plist.cpp
 launchagents_DATA = $(launchagents_PRE:plist.cpp=plist)
 
-SUBDIRS = privileged_startx
 endif
 
-DIST_SUBDIRS = privileged_startx
-
 xinitrc_DATA = xinitrc
 
 MAINTAINERCLEANFILES = ChangeLog INSTALL
-CLEANFILES = xinitrc startx $(appman_DATA) $(launchagents_DATA)
+CLEANFILES = xinitrc startx $(launchagents_DATA)
 
-EXTRA_DIST = xinitrc.cpp startx.cpp org.x.startx.plist.cpp $(appman_PRE)	\
-		autogen.sh
+EXTRA_DIST = xinitrc.cpp startx.cpp org.x.startx.plist.cpp
 
 .PHONY: ChangeLog INSTALL
 
diff --git a/configure.ac b/configure.ac
index 67214cb..d493e98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,11 +161,10 @@ fi
 AC_SUBST(STARTX_COOKIE_FLAGS)
 
 # Additional substitutions in startx, xinitrc & man pages
-ARCHMANDEFS=""
 SHELL_CMD="/bin/sh"
 XSERVERNAME="Xorg"
 XCONFIGFILE="xorg.conf"
-XCONFIGFILEMAN='${XCONFIGFILE} (__filemansuffix__)'
+XCONFIGFILEMAN='${XCONFIGFILE} (${FILE_MAN_SUFFIX})'
 case $host_os in
     cygwin*)
 	XSERVERNAME="XWin"
@@ -181,11 +180,11 @@ case $host_os in
 	;;
     *sco*)
 	SHELL_CMD="/bin/ksh"
-	ARCHMANDEFS="-D__SCOMAN__"
+	SCOMAN=1
 	;;
 esac
 AC_SUBST(SHELL_CMD)
-AC_SUBST(ARCHMANDEFS)
+AC_SUBST(SCOMAN)
 AC_SUBST(XSERVERNAME)
 AC_SUBST(XCONFIGFILE)
 AC_SUBST(XCONFIGFILEMAN)
@@ -200,6 +199,7 @@ AC_SUBST(XAUTH)
 AC_SUBST(XINIT)
 AC_SUBST(XINITDIR)
 
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([privileged_startx/Makefile])
+AC_CONFIG_FILES([Makefile
+	man/Makefile
+	privileged_startx/Makefile])
 AC_OUTPUT
diff --git a/cpprules.in b/cpprules.in
index 18089de..92a987d 100644
--- a/cpprules.in
+++ b/cpprules.in
@@ -13,27 +13,7 @@ CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
                        -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
                        -e '/\@\@$$/s/\@\@$$/\\/'
 
-# Strings to replace in man pages
-XORGRELSTRING = @PACKAGE_STRING@
-  XORGMANNAME = X Version 11
-
-MANDEFS =  \
-	-D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
-	-D__appmansuffix__=$(APP_MAN_SUFFIX) \
-	-D__filemansuffix__=$(FILE_MAN_SUFFIX) \
-	-D__libmansuffix__=$(LIB_MAN_SUFFIX) \
-	-D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
-	-D__XSERVERNAME__='$(XSERVERNAME)' \
-	-D__XCONFIGFILE__='$(XCONFIGFILE)' \
-	-D__XCONFIGFILEMAN__='$(XCONFIGFILEMAN)' \
-	-D__xinitdir__=$(XINITDIR) \
-	-D__bindir__=$(bindir) \
-	-DSHELL_CMD=$(SHELL_CMD) $(ARCHMANDEFS)
-
-SUFFIXES = .$(APP_MAN_SUFFIX) .man .cpp
+SUFFIXES = .cpp
 
 .cpp:
 	$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 0000000..750a2ee
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,20 @@
+
+appmandir = $(APP_MAN_DIR)
+appman_PRE = startx.man  xinit.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+
+EXTRA_DIST = $(appman_PRE)
+CLEANFILES = $(appman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+MAN_SUBSTS+=	-e 's|__XSERVERNAME__|$(XSERVERNAME)|g' \
+		-e 's|__XCONFIGFILE__|$(XCONFIGFILE)|g' \
+		-e 's|__XCONFIGFILEMAN__|$(XCONFIGFILEMAN)|g' \
+		-e 's|__xinitdir__|$(XINITDIR)|g' \
+		-e 's|__bindir__|$(bindir)|g' \
+		-e 's|__libdir__|$(libdir)|g' \
+		-e 's|SCOMAN|$(SCOMAN)|g'
+
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/startx.man b/man/startx.man
similarity index 98%
rename from startx.man
rename to man/startx.man
index 641a631..33d5665 100644
--- a/startx.man
+++ b/man/startx.man
@@ -74,7 +74,7 @@ startx -- -dpi 100
 .PP
 startx -- -layout Multihead
 .RE
-#ifdef __SCOMAN__
+.if 'SCOMAN'' .ig
 .PP
 To determine the client to run,
 .B startx
@@ -90,7 +90,8 @@ looks for the following files, in order:
 .I __xinitdir__/xinitrc
 .RE
 .PP
-#else
+..
+.if !'x.SCOMAN'x.' .ig
 .PP
 To determine the client to run,
 .B startx
@@ -102,7 +103,7 @@ the file
 in the
 .I xinit
 library directory.
-#endif
+..
 If command line client options are given, they override this
 behavior and revert to the
 .BR xinit (__appmansuffix__)
@@ -186,7 +187,7 @@ and
 .IR Xsecurity (__miscmansuffix__)
 manual pages for more information on X client/server authentication.
 .SH FILES
-#ifdef __SCOMAN__
+.if 'SCOMAN'' .ig
 .TP 25
 .I $(HOME)/.startxrc
 Client to run.  Typically a shell script which runs many programs in
@@ -196,7 +197,7 @@ the background.
 Client to use if the user has no
 .I .startxrc
 file.
-#endif
+..
 .TP 25
 .I $(HOME)/.xinitrc
 Client to run.  Typically a shell script which runs many programs in
diff --git a/xinit.man b/man/xinit.man
similarity index 100%
rename from xinit.man
rename to man/xinit.man
-- 
1.6.0.4



More information about the xorg-devel mailing list