[PATCH app-rstart 01/15] config: use a single directory variable to represent $lib/X11/rstart

Gaetan Nadon memsize at videotron.ca
Thu Jan 27 12:58:29 PST 2011


There are numerous places where the rstart lib directory is needed.
One of the 4 strings is used, all have the same value:

rstart_serverdir
$(libdir)/X11/rstart
configdir
DATA_DIR

There are no configure options to let user assign a different directory
for one of the places where the value is needed.

The patch assigns a new value called rstartdir to represent the root
dir from where files and other directories are created. Because it
ends with "dir" it can be used as a prefix to primary variables
such as PROGRAMS or DATA.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 Makefile.am  |   37 +++++++++++++++++--------------------
 configure.ac |    3 +++
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 57753e7..f620432 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,15 +19,15 @@
 #  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 #  PERFORMANCE OF THIS SOFTWARE.
 
+SUBDIRS = man
+
 # rstartd server
 
-SUBDIRS = man
-rstart_serverdir = $(libdir)/X11/rstart
-rstart_server_PROGRAMS = rstartd.real
+rstart_PROGRAMS = rstartd.real
 
 AM_CFLAGS = $(CWARNFLAGS) $(RSTART_CFLAGS)		\
 		-DSERVERNAME=\"rstart\"			\
-		-DDEFAULT_CONFIG=\"$(libdir)/X11/rstart/config\"
+		-DDEFAULT_CONFIG=\"$(rstartdir)/config\"
 
 rstartd_real_LDADD = $(RSTART_LIBS)
 
@@ -52,12 +52,11 @@ CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
 
 # config data
 
-configdir = $(libdir)/X11/rstart
-config_DATA = config
+rstart_DATA = config
 
 config: config.cpp
 	$(AM_V_GEN) $(RAWCPP) $(RAWCPPFLAGS) -DPACKAGEname=rstart \
-	  -DLIBDIR=$(configdir) -DENVPREFIX=RSTART \
+	  -DLIBDIR=$(rstartdir) -DENVPREFIX=RSTART \
 	  < ${srcdir}/config.cpp | $(CPP_SED_MAGIC) > $@
 
 # wrapper scripts
@@ -69,8 +68,8 @@ rstart: client.cpp
 	  -DSERVERNAME=rstartd < ${srcdir}/client.cpp | $(CPP_SED_MAGIC) > $@
 
 rstartd: server.cpp
-	$(AM_V_GEN) $(RAWCPP) $(RAWCPPFLAGS) -DBINDIR=$(rstart_serverdir) \
-	  -DLIBDIR=$(configdir) -DSERVERNAME=rstartd < ${srcdir}/server.cpp | \
+	$(AM_V_GEN) $(RAWCPP) $(RAWCPPFLAGS) -DBINDIR=$(rstartdir) \
+	  -DLIBDIR=$(rstartdir) -DSERVERNAME=rstartd < ${srcdir}/server.cpp | \
 	  $(CPP_SED_MAGIC) > $@
 
 EXTRA_DIST = client.cpp server.cpp config.cpp
@@ -85,24 +84,22 @@ CLEANFILES = rstart rstartd config
 # FIXME: Someone who cares about rstart may want to look into sanitizing
 # the stuff below.
 
-DATA_DIR = $(libdir)/X11/rstart
-
 install-data-hook:
 	(cd ${srcdir};							\
 	for name in `find ./commands -print | grep -v CVS` ; do		\
 	    if test -f $$name; then					\
 	        sed							\
 		    -e 's,ENVPREFIX,RSTART,g'				\
-		        < $$name > $(DESTDIR)$(DATA_DIR)/$$name;	\
-		case `basename $(DESTDIR)$(DATA_DIR)/$$name` in		\
+		        < $$name > $(DESTDIR)$(rstartdir)/$$name;	\
+		case `basename $(DESTDIR)$(rstartdir)/$$name` in		\
 		@*)							\
 		    ;;							\
 		*)							\
-		    chmod a+x $(DESTDIR)$(DATA_DIR)/$$name ;;		\
+		    chmod a+x $(DESTDIR)$(rstartdir)/$$name ;;		\
 		esac;							\
 	    else							\
 	        if [ -d $$name ] ; then					\
-	            mkdir -p $(DESTDIR)$(DATA_DIR)/$$name ;		\
+	            mkdir -p $(DESTDIR)$(rstartdir)/$$name ;		\
 	        fi;							\
 	    fi;								\
 	done;								\
@@ -112,23 +109,23 @@ install-data-hook:
 	        sed							\
 	            -e 's,_PATH,$(DEFAULT_USER_PATH),g'			\
 	            -e 's,_MANPATH,$(DEFAULT_X_MANPATH),g'		\
-			< $$name > $(DESTDIR)$(DATA_DIR)/$$name ;	\
+			< $$name > $(DESTDIR)$(rstartdir)/$$name ;	\
 	    else							\
 	        if [ -d $$name ] ; then					\
-	            mkdir -p $(DESTDIR)$(DATA_DIR)/$$name	;	\
+	            mkdir -p $(DESTDIR)$(rstartdir)/$$name	;	\
 	        fi ;							\
 	    fi ;							\
 	done;								\
 	);								\
 									\
-	cd $(DESTDIR)$(DATA_DIR)/contexts;				\
+	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)$(rstart_serverdir)/commands/$$i;	\
-	            $(LN) $$real $(DESTDIR)$(rstart_serverdir)/commands/$$i; \
+	            $(RM) $(DESTDIR)$(rstartdir)/commands/$$i;		\
+	            $(LN) $$real $(DESTDIR)$(rstartdir)/commands/$$i; 	\
 	        done;							\
 	    done;							\
 	$(RM) @Aliases
diff --git a/configure.ac b/configure.ac
index 94b378f..824ceee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,9 @@ AC_CHECK_PROG([LN],[ln],[ln -s])
 AC_CHECK_PROGS(RSH,[remsh rsh rcmd])
 XORG_PROG_RAWCPP
 
+# Define the root directory for client/server/config
+AC_SUBST([rstartdir],[$libdir/X11/rstart])
+
 # Checks for pkg-config packages
 PKG_CHECK_MODULES(RSTART, xproto)
 
-- 
1.6.0.4



More information about the xorg-devel mailing list