Configurable suffix support.
authorMarko Kreen <markokr@gmail.com>
Tue, 20 Jul 2010 14:37:25 +0000 (17:37 +0300)
committerMarko Kreen <markokr@gmail.com>
Tue, 20 Jul 2010 14:41:24 +0000 (17:41 +0300)
Apply suffix also to manpages, SQL and doc directories

Makefile
config.mak.in
configure.ac
doc/Makefile
setup_skytools.py

index 24454963eb37590e0f7bb06f16d410ba7a44e3ce..10fe5d2e579d21f86af386c4bda4f799f653fee9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,9 @@ SFX_SCRIPTS = python/londiste.py python/walmgr.py scripts/scriptmgr.py scripts/q
 # dont add
 NOSFX_SCRIPTS = python/qadmin.py
 
-SCRIPT_SUFFIX = 3
+SCRIPT_SUFFIX = $(SUFFIX)
+
+SQLDIR = $(prefix)/share/skytools$(SUFFIX)
 
 all: python-all sub-all config.mak
 
index fcef53324952e0685326faafcdd3ace2a546f02a..f330c703a0220e0e71b29484cbf1a5537c8a92cf 100644 (file)
@@ -1,24 +1,25 @@
 
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PACKAGE_STRING = @PACKAGE_STRING@
+
+SUFFIX = @SUFFIX@
+
 prefix = @prefix@
 datarootdir = @datarootdir@
 exec_prefix = @exec_prefix@
 datadir = @datadir@
-docdir = @docdir@
+docdir = @docdir@$(SUFFIX)
 mandir = @mandir@
 bindir = @bindir@
 
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-
 PYTHON = @PYTHON@
 override PG_CONFIG = @PG_CONFIG@
 
 # additional CPPFLAGS to pgxs modules
 PG_CPPFLAGS = $(filter -DHAVE%, @DEFS@)
 
-SQLDIR = $(prefix)/share/skytools
-
 PGXS = $(shell $(PG_CONFIG) --pgxs)
 
 DESTDIR = 
@@ -36,8 +37,4 @@ INSTALL = @INSTALL@
 BININSTALL = @BININSTALL@
 
 
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PACKAGE_STRING = @PACKAGE_STRING@
 
index 5ac87f792df96683093d33aacb590c22b916f3bc..6bb42eb4c5fc2a5172d107da55fd148fa6022372 100644 (file)
@@ -38,6 +38,25 @@ else
 fi
 AC_SUBST(MAKE)
 
+dnl name suffix
+default_SUFFIX=3
+SUFFIX="$default_SUFFIX"
+AC_MSG_CHECKING(whether to add suffix to script names)
+AC_ARG_WITH(suffix, [  --with-suffix[[=sfx]]  common package suffix (default: 3)],
+[ if test "$withval" = "yes"; then
+    SUFFIX="$default_SUFFIX"
+  elif test "$withval" = "no"; then
+    SUFFIX=""
+  else
+    SUFFIX="$withval"
+  fi ])
+if test "$SUFFIX" = ""; then
+  AC_MSG_RESULT(no)
+else
+  AC_MSG_RESULT([yes, "$SUFFIX"])
+fi
+AC_SUBST(SUFFIX)
+
 dnl asciidoc >= 8.2
 AC_ARG_WITH(asciidoc, [  --with-asciidoc[[=prog]]  path to asciidoc 8.2 (default: asciidoc)],
 [ if test "$withval" = "yes"; then
index a1d1fc31de055ea3f3646c35e0c2ec5becd5a881..6821f483d339bb1b194de6f81d58fd0874ba1fa3 100644 (file)
@@ -17,11 +17,14 @@ SCRIPT_TXTS = walmgr.txt queue_mover.txt queue_splitter.txt qadmin.txt \
              scriptmgr.txt skytools_upgrade.txt londiste.txt pgqadm.txt
 SCRIPT_HTMLS = $(SCRIPT_TXTS:.txt=.html)
 
-MAN1 = $(SCRIPT_TXTS:.txt=.1)
 MAN5 = 
+MAN1_SFX = londiste.1 pgqadm.1 scriptmgr.1 skytools_upgrade.1 walmgr.1 \
+          queue_splitter.1 queue_mover.1
+MAN1 = qadmin.1
 
 FQHTML = $(addprefix html/, $(HTMLS))
 FQMAN1 = $(addprefix man/, $(MAN1))
+FQMAN1_SFX = $(addprefix man/, $(MAN1_SFX))
 FQMAN5 = $(addprefix man/, $(MAN5))
 FQMAN = $(FQMAN1) $(FQMAN5)
 
@@ -43,6 +46,10 @@ install: $(FQMAN) $(FQHTML)
        mkdir -p $(DESTDIR)/$(mandir)/man1
        mkdir -p $(DESTDIR)/$(mandir)/man5
        mkdir -p $(DESTDIR)/$(docdir)
+       for m in $(FQMAN1_SFX); do \
+         xf="`basename $$m | sed 's/[.]/$(SUFFIX)./'`"; \
+         install -m 644 $$m $(DESTDIR)/$(mandir)/man1/$$xf ; \
+       done
        for m in $(FQMAN1); do \
          install -m 644 $$m $(DESTDIR)/$(mandir)/man1 ; \
        done
index 0e1628d9d342633c3e38517cd19c7f2c3dfa9a1d..1146d044f9aed77becc2fe593a198ad5d53da0e6 100755 (executable)
@@ -18,6 +18,13 @@ buf = open("configure.ac","r").read(256)
 m = re.search("AC_INIT[(][^,]*,\s+([^)]*)[)]", buf)
 ac_ver = m.group(1)
 
+def getvar(name):
+    cf = open('config.mak').read()
+    m = re.search(r'^%s\s*=\s*(.*)' % name, cf, re.M)
+    return m.group(1).strip()
+
+sfx = getvar('SUFFIX')
+
 share_dup_files = [
    'sql/pgq/pgq.sql',
    'sql/londiste/londiste.sql',
@@ -38,11 +45,11 @@ setup(
     package_dir = {'': 'python'},
     packages = ['skytools', 'londiste', 'pgq', 'pgq.cascade'],
     data_files = [
-      ('share/doc/skytools/conf', [
+      ('share/doc/skytools%s/conf' % sfx, [
         'python/conf/wal-master.ini',
         'python/conf/wal-slave.ini',
         ]),
-      ('share/skytools', share_dup_files)],
+      ('share/skytools' + sfx, share_dup_files)],
     ext_modules=[Extension("skytools._cquoting", ['python/modules/cquoting.c'])],
 )