This replaces the *FIXME* shell code which "generates in place"
the contexts files rather than doing a proper installation using the
$INSTALL automake specified program.

Using Automake, we can now "uninstall" the commands.

The links in @Aliases will be dealt with in following patches,
in case in turns out they are not needed.

Signed-off-by: Gaetan Nadon <[email protected]>
---
 Makefile.am                  |   45 +-----------------------------------------
 configure.ac                 |    3 +-
 contexts/.gitignore          |    1 +
 contexts/Makefile.am         |   21 +++++++++++++++++++
 contexts/{x11r6 => x11r6.in} |    4 +-
 5 files changed, 27 insertions(+), 47 deletions(-)
 create mode 100644 contexts/.gitignore
 create mode 100644 contexts/Makefile.am
 rename contexts/{x11r6 => x11r6.in} (95%)

diff --git a/Makefile.am b/Makefile.am
index 9943520..ce8db02 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@
 #  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 #  PERFORMANCE OF THIS SOFTWARE.
 
-SUBDIRS = man commands
+SUBDIRS = man commands contexts
 
 # rstartd server
 
@@ -61,52 +61,9 @@ EXTRA_DIST = rstart.in rstartd.in config.in
 MAINTAINERCLEANFILES = ChangeLog INSTALL
 CLEANFILES = rstart rstartd config
 
-#
-# commands and contexts
-#
-
-# FIXME: Someone who cares about rstart may want to look into sanitizing
-# the stuff below.
-
-install-data-hook:
-       (cd ${srcdir};                                                  \
-       for name in `find ./contexts -print | grep -v CVS` ; do         \
-           if test -f $$name; then                                     \
-               sed                                                     \
-                   -e 's,_PATH,$(DEFAULT_USER_PATH),g'                 \
-                   -e 's,_MANPATH,$(DEFAULT_X_MANPATH),g'              \
-                       < $$name > $(DESTDIR)$(rstartdir)/$$name ;      \
-           else                                                        \
-               if [ -d $$name ] ; then                                 \
-                   mkdir -p $(DESTDIR)$(rstartdir)/$$name      ;       \
-               fi ;                                                    \
-           fi ;                                                        \
-       done;                                                           \
-       );                                                              \
-                                                                       \
-       cd $(DESTDIR)$(rstartdir)/contexts;                             \
-       sed -e '/^$$/d' -e '/^#/d' @Aliases |                           \
-           while read real aliases; do                                 \
-               for i in $$aliases; do                                  \
-                   $(RM) $$i;                                          \
-                   $(LN) $$real $$i;                                   \
-                   $(RM) $(DESTDIR)$(rstartdir)/commands/$$i;          \
-                   $(LN) $$real $(DESTDIR)$(rstartdir)/commands/$$i;   \
-               done;                                                   \
-           done;                                                       \
-       $(RM) @Aliases
-
-distuninstallcheck:
-       @:
-
 EXTRA_DIST +=                                                          \
        server.os2                                                      \
                                                                        \
-       contexts/default                                                \
-       contexts/@Aliases                                               \
-       contexts/x11r6                                                  \
-       contexts/@List                                                  \
-                                                                       \
        samples/commands/openwindows2/Terminal                          \
        samples/commands/openwindows2/LoadMonitor                       \
        samples/commands/openwindows2/@List                             \
diff --git a/configure.ac b/configure.ac
index 8119a7e..bac4fbc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,5 +62,6 @@ AC_SUBST(DEFAULT_X_MANPATH)
 AC_CONFIG_FILES([
        Makefile
        man/Makefile
-       commands/Makefile])
+       commands/Makefile
+       contexts/Makefile])
 AC_OUTPUT
diff --git a/contexts/.gitignore b/contexts/.gitignore
new file mode 100644
index 0000000..06e1d88
--- /dev/null
+++ b/contexts/.gitignore
@@ -0,0 +1 @@
+x11r6
diff --git a/contexts/Makefile.am b/contexts/Makefile.am
new file mode 100644
index 0000000..f96dc15
--- /dev/null
+++ b/contexts/Makefile.am
@@ -0,0 +1,21 @@
+
+contextsdir = $(rstartdir)/contexts
+contexts_DATA =                \
+       x11r6
+
+dist_contexts_DATA =   \
+       default         \
+       @List
+
+dist_noinst_DATA =     \
+       @Aliases        \
+       x11r6.in
+
+PATH_SUBSTS = \
+       -e 's|@DEFAULT_X_MANPATH[@]|$(DEFAULT_X_MANPATH)|g' \
+       -e 's|@DEFAULT_USER_PATH[@]|$(DEFAULT_USER_PATH)|g'
+
+x11r6: x11r6.in
+       $(AM_V_GEN)$(SED) $(PATH_SUBSTS) < $< > $@
+
+CLEANFILES = $(contexts_DATA)
diff --git a/contexts/x11r6 b/contexts/x11r6.in
similarity index 95%
rename from contexts/x11r6
rename to contexts/x11r6.in
index 0bf9ffe..4d27192 100644
--- a/contexts/x11r6
+++ b/contexts/x11r6.in
@@ -22,8 +22,8 @@
 # OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT
 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-MISC X MANPATH=_MANPATH
-MISC POSIX PATH=_PATH
+MISC X MANPATH=@DEFAULT_X_MANPATH@
+MISC POSIX PATH=@DEFAULT_USER_PATH@
 INTERNAL-AUTH-PROGRAM X11 xauth xauth
 INTERNAL-AUTH-INPUT X11 add\040$1\040$2\040$3
 INTERNAL-AUTH-PROGRAM ICE iceauth iceauth
-- 
1.6.0.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to