From 1209761baff42f462907b25b0a9c64c04399bc32 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Sun, 14 Dec 2014 20:41:58 -0500
Subject: [PATCH 4/9] Move pg_xlogdump from contrib/ to src/bin/

---
 contrib/Makefile                               |  1 -
 doc/src/sgml/contrib.sgml                      |  1 -
 doc/src/sgml/reference.sgml                    |  1 +
 src/bin/Makefile                               |  1 +
 {contrib => src/bin}/pg_xlogdump/.gitignore    |  0
 {contrib => src/bin}/pg_xlogdump/Makefile      | 19 ++++++++-----------
 {contrib => src/bin}/pg_xlogdump/compat.c      |  2 +-
 {contrib => src/bin}/pg_xlogdump/pg_xlogdump.c |  2 +-
 {contrib => src/bin}/pg_xlogdump/rmgrdesc.c    |  2 +-
 {contrib => src/bin}/pg_xlogdump/rmgrdesc.h    |  2 +-
 10 files changed, 14 insertions(+), 17 deletions(-)
 rename {contrib => src/bin}/pg_xlogdump/.gitignore (100%)
 rename {contrib => src/bin}/pg_xlogdump/Makefile (76%)
 rename {contrib => src/bin}/pg_xlogdump/compat.c (98%)
 rename {contrib => src/bin}/pg_xlogdump/pg_xlogdump.c (99%)
 rename {contrib => src/bin}/pg_xlogdump/rmgrdesc.c (96%)
 rename {contrib => src/bin}/pg_xlogdump/rmgrdesc.h (91%)

diff --git a/contrib/Makefile b/contrib/Makefile
index 1732443..8f0d926 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -41,7 +41,6 @@ SUBDIRS = \
 		pgcrypto	\
 		pgrowlocks	\
 		pgstattuple	\
-		pg_xlogdump	\
 		postgres_fdw	\
 		seg		\
 		spi		\
diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml
index 087cd9f..dbe9d0a 100644
--- a/doc/src/sgml/contrib.sgml
+++ b/doc/src/sgml/contrib.sgml
@@ -205,6 +205,5 @@ <title>Server Applications</title>
  &pgtestfsync;
  &pgtesttiming;
  &pgupgrade;
- &pgxlogdump;
  </sect1>
 </appendix>
diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml
index d47272a..de2cdff 100644
--- a/doc/src/sgml/reference.sgml
+++ b/doc/src/sgml/reference.sgml
@@ -262,6 +262,7 @@ <title>PostgreSQL Server Applications</title>
    &pgCtl;
    &pgResetxlog;
    &pgstandby;
+   &pgxlogdump;
    &postgres;
    &postmaster;
 
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 6026b83..87f5c70 100644
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -23,6 +23,7 @@ SUBDIRS = \
 	pg_dump \
 	pg_resetxlog \
 	pg_standby \
+	pg_xlogdump \
 	psql \
 	scripts
 
diff --git a/contrib/pg_xlogdump/.gitignore b/src/bin/pg_xlogdump/.gitignore
similarity index 100%
rename from contrib/pg_xlogdump/.gitignore
rename to src/bin/pg_xlogdump/.gitignore
diff --git a/contrib/pg_xlogdump/Makefile b/src/bin/pg_xlogdump/Makefile
similarity index 76%
rename from contrib/pg_xlogdump/Makefile
rename to src/bin/pg_xlogdump/Makefile
index 30a8706..ab8597b 100644
--- a/contrib/pg_xlogdump/Makefile
+++ b/src/bin/pg_xlogdump/Makefile
@@ -1,28 +1,25 @@
-# contrib/pg_xlogdump/Makefile
+# src/bin/pg_xlogdump/Makefile
 
 PGFILEDESC = "pg_xlogdump - decode and display WAL"
 PGAPPICON=win32
 
+subdir = src/bin/pg_xlogdump
+top_builddir = ../../..
+include $(top_builddir)/src/Makefile.global
+
 PROGRAM = pg_xlogdump
 OBJS = pg_xlogdump.o compat.o xlogreader.o rmgrdesc.o \
 	$(RMGRDESCOBJS) $(WIN32RES)
+override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
 
 RMGRDESCSOURCES = $(notdir $(wildcard $(top_srcdir)/src/backend/access/rmgrdesc/*desc.c))
 RMGRDESCOBJS = $(patsubst %.c,%.o,$(RMGRDESCSOURCES))
 
 EXTRA_CLEAN = $(RMGRDESCSOURCES) xlogreader.c
 
-ifdef USE_PGXS
-$(error "pg_xlogdump cannot be built with PGXS")
-endif
+NO_PGXS = 1
+include $(top_srcdir)/src/makefiles/pgxs.mk
 
-subdir = contrib/pg_xlogdump
-top_builddir = ../..
-include $(top_builddir)/src/Makefile.global
-include $(top_srcdir)/contrib/contrib-global.mk
-
-
-override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
 
 xlogreader.c: % : $(top_srcdir)/src/backend/access/transam/%
 	rm -f $@ && $(LN_S) $< .
diff --git a/contrib/pg_xlogdump/compat.c b/src/bin/pg_xlogdump/compat.c
similarity index 98%
rename from contrib/pg_xlogdump/compat.c
rename to src/bin/pg_xlogdump/compat.c
index 6ca7012..5c07e1e 100644
--- a/contrib/pg_xlogdump/compat.c
+++ b/src/bin/pg_xlogdump/compat.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 2013-2014, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		contrib/pg_xlogdump/compat.c
+ *		src/bin/pg_xlogdump/compat.c
  *
  * This file contains client-side implementations for various backend
  * functions that the rm_desc functions in *desc.c files rely on.
diff --git a/contrib/pg_xlogdump/pg_xlogdump.c b/src/bin/pg_xlogdump/pg_xlogdump.c
similarity index 99%
rename from contrib/pg_xlogdump/pg_xlogdump.c
rename to src/bin/pg_xlogdump/pg_xlogdump.c
index 9f05e25..f767a97 100644
--- a/contrib/pg_xlogdump/pg_xlogdump.c
+++ b/src/bin/pg_xlogdump/pg_xlogdump.c
@@ -5,7 +5,7 @@
  * Copyright (c) 2013-2014, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		  contrib/pg_xlogdump/pg_xlogdump.c
+ *		  src/bin/pg_xlogdump/pg_xlogdump.c
  *-------------------------------------------------------------------------
  */
 
diff --git a/contrib/pg_xlogdump/rmgrdesc.c b/src/bin/pg_xlogdump/rmgrdesc.c
similarity index 96%
rename from contrib/pg_xlogdump/rmgrdesc.c
rename to src/bin/pg_xlogdump/rmgrdesc.c
index 180818d..4fb0a00 100644
--- a/contrib/pg_xlogdump/rmgrdesc.c
+++ b/src/bin/pg_xlogdump/rmgrdesc.c
@@ -3,7 +3,7 @@
  *
  * pg_xlogdump resource managers definition
  *
- * contrib/pg_xlogdump/rmgrdesc.c
+ * src/bin/pg_xlogdump/rmgrdesc.c
  */
 #define FRONTEND 1
 #include "postgres.h"
diff --git a/contrib/pg_xlogdump/rmgrdesc.h b/src/bin/pg_xlogdump/rmgrdesc.h
similarity index 91%
rename from contrib/pg_xlogdump/rmgrdesc.h
rename to src/bin/pg_xlogdump/rmgrdesc.h
index aec4418..5440f94 100644
--- a/contrib/pg_xlogdump/rmgrdesc.h
+++ b/src/bin/pg_xlogdump/rmgrdesc.h
@@ -3,7 +3,7 @@
  *
  * pg_xlogdump resource managers declaration
  *
- * contrib/pg_xlogdump/rmgrdesc.h
+ * src/bin/pg_xlogdump/rmgrdesc.h
  */
 #ifndef RMGRDESC_H
 #define RMGRDESC_H
-- 
2.2.0

