From 38fba4b4202e8ba72eb2575f6c919080a04a61ed Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Tue, 10 Mar 2015 22:33:24 -0400
Subject: [PATCH 2/7] Move pg_xlogdump from contrib/ to src/bin/

---
 contrib/Makefile                               |  1 -
 doc/src/sgml/contrib.sgml                      |  1 -
 doc/src/sgml/filelist.sgml                     |  1 -
 doc/src/sgml/ref/allfiles.sgml                 |  1 +
 doc/src/sgml/{ => ref}/pg_xlogdump.sgml        |  0
 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 +-
 src/tools/msvc/clean.bat                       |  4 ++--
 14 files changed, 17 insertions(+), 20 deletions(-)
 rename doc/src/sgml/{ => ref}/pg_xlogdump.sgml (100%)
 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 c56050e..d9557b8 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -42,7 +42,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 f21fa14..d0e1446 100644
--- a/doc/src/sgml/contrib.sgml
+++ b/doc/src/sgml/contrib.sgml
@@ -206,6 +206,5 @@ <title>Server Applications</title>
  &pgtestfsync;
  &pgtesttiming;
  &pgupgrade;
- &pgxlogdump;
  </sect1>
 </appendix>
diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index 5e3c34b..3b26a70 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -137,7 +137,6 @@
 <!ENTITY pgtesttiming    SYSTEM "pgtesttiming.sgml">
 <!ENTITY pgtrgm          SYSTEM "pgtrgm.sgml">
 <!ENTITY pgupgrade       SYSTEM "pgupgrade.sgml">
-<!ENTITY pgxlogdump      SYSTEM "pg_xlogdump.sgml">
 <!ENTITY postgres-fdw    SYSTEM "postgres-fdw.sgml">
 <!ENTITY seg             SYSTEM "seg.sgml">
 <!ENTITY contrib-spi     SYSTEM "contrib-spi.sgml">
diff --git a/doc/src/sgml/ref/allfiles.sgml b/doc/src/sgml/ref/allfiles.sgml
index cbe4611..17260b9 100644
--- a/doc/src/sgml/ref/allfiles.sgml
+++ b/doc/src/sgml/ref/allfiles.sgml
@@ -191,6 +191,7 @@
 <!ENTITY pgRecvlogical      SYSTEM "pg_recvlogical.sgml">
 <!ENTITY pgResetxlog        SYSTEM "pg_resetxlog.sgml">
 <!ENTITY pgRestore          SYSTEM "pg_restore.sgml">
+<!ENTITY pgxlogdump         SYSTEM "pg_xlogdump.sgml">
 <!ENTITY postgres           SYSTEM "postgres-ref.sgml">
 <!ENTITY postmaster         SYSTEM "postmaster.sgml">
 <!ENTITY psqlRef            SYSTEM "psql-ref.sgml">
diff --git a/doc/src/sgml/pg_xlogdump.sgml b/doc/src/sgml/ref/pg_xlogdump.sgml
similarity index 100%
rename from doc/src/sgml/pg_xlogdump.sgml
rename to doc/src/sgml/ref/pg_xlogdump.sgml
diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml
index 62267db..07c923b 100644
--- a/doc/src/sgml/reference.sgml
+++ b/doc/src/sgml/reference.sgml
@@ -261,6 +261,7 @@ <title>PostgreSQL Server Applications</title>
    &pgControldata;
    &pgCtl;
    &pgResetxlog;
+   &pgxlogdump;
    &postgres;
    &postmaster;
 
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 2347076..469798e 100644
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -22,6 +22,7 @@ SUBDIRS = \
 	pg_ctl \
 	pg_dump \
 	pg_resetxlog \
+	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 4f5cad6..3d8ce30 100644
--- a/contrib/pg_xlogdump/compat.c
+++ b/src/bin/pg_xlogdump/compat.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 2013-2015, 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 c1bfbc2..67932af 100644
--- a/contrib/pg_xlogdump/pg_xlogdump.c
+++ b/src/bin/pg_xlogdump/pg_xlogdump.c
@@ -5,7 +5,7 @@
  * Copyright (c) 2013-2015, 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 bd3344c..2205d6e 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
diff --git a/src/tools/msvc/clean.bat b/src/tools/msvc/clean.bat
index 9c7ea42..c48fb25 100755
--- a/src/tools/msvc/clean.bat
+++ b/src/tools/msvc/clean.bat
@@ -93,8 +93,8 @@ REM cd contrib
 REM for /r %%f in (*.sql) do if exist %%f.in del %%f
 
 REM clean up files copied into contrib\pg_xlogdump
-if exist contrib\pg_xlogdump\xlogreader.c del /q contrib\pg_xlogdump\xlogreader.c
-for %%f in (contrib\pg_xlogdump\*desc.c) do if not %%f==contrib\pg_xlogdump\rmgrdesc.c del /q %%f
+if exist src\bin\pg_xlogdump\xlogreader.c del /q src\bin\pg_xlogdump\xlogreader.c
+for %%f in (src\bin\pg_xlogdump\*desc.c) do if not %%f==src\bin\pg_xlogdump\rmgrdesc.c del /q %%f
 
 
 cd %D%
-- 
2.3.2

