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

---
 contrib/Makefile                                       |  1 -
 contrib/pg_archivecleanup/Makefile                     | 18 ------------------
 doc/src/sgml/contrib.sgml                              |  1 -
 doc/src/sgml/filelist.sgml                             |  1 -
 doc/src/sgml/ref/allfiles.sgml                         |  1 +
 doc/src/sgml/{ => ref}/pgarchivecleanup.sgml           | 10 +---------
 doc/src/sgml/reference.sgml                            |  1 +
 src/bin/Makefile                                       |  1 +
 {contrib => src/bin}/pg_archivecleanup/.gitignore      |  0
 src/bin/pg_archivecleanup/Makefile                     | 14 ++++++++++++++
 .../bin}/pg_archivecleanup/pg_archivecleanup.c         |  2 +-
 11 files changed, 19 insertions(+), 31 deletions(-)
 delete mode 100644 contrib/pg_archivecleanup/Makefile
 rename doc/src/sgml/{ => ref}/pgarchivecleanup.sgml (97%)
 rename {contrib => src/bin}/pg_archivecleanup/.gitignore (100%)
 create mode 100644 src/bin/pg_archivecleanup/Makefile
 rename {contrib => src/bin}/pg_archivecleanup/pg_archivecleanup.c (99%)

diff --git a/contrib/Makefile b/contrib/Makefile
index 195d447..c56050e 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -28,7 +28,6 @@ SUBDIRS = \
 		oid2name	\
 		pageinspect	\
 		passwordcheck	\
-		pg_archivecleanup \
 		pg_buffercache	\
 		pg_freespacemap \
 		pg_prewarm	\
diff --git a/contrib/pg_archivecleanup/Makefile b/contrib/pg_archivecleanup/Makefile
deleted file mode 100644
index ab52390..0000000
--- a/contrib/pg_archivecleanup/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# contrib/pg_archivecleanup/Makefile
-
-PGFILEDESC = "pg_archivecleanup - cleans archive when used with streaming replication"
-PGAPPICON = win32
-
-PROGRAM = pg_archivecleanup
-OBJS	= pg_archivecleanup.o $(WIN32RES)
-
-ifdef USE_PGXS
-PG_CONFIG = pg_config
-PGXS := $(shell $(PG_CONFIG) --pgxs)
-include $(PGXS)
-else
-subdir = contrib/pg_archivecleanup
-top_builddir = ../..
-include $(top_builddir)/src/Makefile.global
-include $(top_srcdir)/contrib/contrib-global.mk
-endif
diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml
index a698d0f..f21fa14 100644
--- a/doc/src/sgml/contrib.sgml
+++ b/doc/src/sgml/contrib.sgml
@@ -202,7 +202,6 @@ <title>Server Applications</title>
    part of the core <productname>PostgreSQL</productname> distribution.
   </para>
 
- &pgarchivecleanup;
  &pgstandby;
  &pgtestfsync;
  &pgtesttiming;
diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index f03b72a..5e3c34b 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -125,7 +125,6 @@
 <!ENTITY pageinspect     SYSTEM "pageinspect.sgml">
 <!ENTITY passwordcheck   SYSTEM "passwordcheck.sgml">
 <!ENTITY pgbench         SYSTEM "pgbench.sgml">
-<!ENTITY pgarchivecleanup SYSTEM "pgarchivecleanup.sgml">
 <!ENTITY pgbuffercache   SYSTEM "pgbuffercache.sgml">
 <!ENTITY pgcrypto        SYSTEM "pgcrypto.sgml">
 <!ENTITY pgfreespacemap  SYSTEM "pgfreespacemap.sgml">
diff --git a/doc/src/sgml/ref/allfiles.sgml b/doc/src/sgml/ref/allfiles.sgml
index 7aa3128..cbe4611 100644
--- a/doc/src/sgml/ref/allfiles.sgml
+++ b/doc/src/sgml/ref/allfiles.sgml
@@ -179,6 +179,7 @@
 <!ENTITY dropuser           SYSTEM "dropuser.sgml">
 <!ENTITY ecpgRef            SYSTEM "ecpg-ref.sgml">
 <!ENTITY initdb             SYSTEM "initdb.sgml">
+<!ENTITY pgarchivecleanup   SYSTEM "pgarchivecleanup.sgml">
 <!ENTITY pgBasebackup       SYSTEM "pg_basebackup.sgml">
 <!ENTITY pgConfig           SYSTEM "pg_config-ref.sgml">
 <!ENTITY pgControldata      SYSTEM "pg_controldata.sgml">
diff --git a/doc/src/sgml/pgarchivecleanup.sgml b/doc/src/sgml/ref/pgarchivecleanup.sgml
similarity index 97%
rename from doc/src/sgml/pgarchivecleanup.sgml
rename to doc/src/sgml/ref/pgarchivecleanup.sgml
index fdf0cbb..779159d 100644
--- a/doc/src/sgml/pgarchivecleanup.sgml
+++ b/doc/src/sgml/ref/pgarchivecleanup.sgml
@@ -1,4 +1,4 @@
-<!-- doc/src/sgml/pgarchivecleanup.sgml -->
+<!-- doc/src/sgml/ref/pgarchivecleanup.sgml -->
 
 <refentry id="pgarchivecleanup">
  <indexterm zone="pgarchivecleanup">
@@ -194,14 +194,6 @@ <title>Examples</title>
  </refsect1>
 
  <refsect1>
-  <title>Author</title>
-
-  <para>
-   Simon Riggs <email>simon@2ndquadrant.com</email>
-  </para>
- </refsect1>
-
- <refsect1>
   <title>See Also</title>
 
   <simplelist type="inline">
diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml
index 10c9a6d..62267db 100644
--- a/doc/src/sgml/reference.sgml
+++ b/doc/src/sgml/reference.sgml
@@ -257,6 +257,7 @@ <title>PostgreSQL Server Applications</title>
   </partintro>
 
    &initdb;
+   &pgarchivecleanup;
    &pgControldata;
    &pgCtl;
    &pgResetxlog;
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 90ca1a8..2347076 100644
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -15,6 +15,7 @@ include $(top_builddir)/src/Makefile.global
 
 SUBDIRS = \
 	initdb \
+	pg_archivecleanup \
 	pg_basebackup \
 	pg_config \
 	pg_controldata \
diff --git a/contrib/pg_archivecleanup/.gitignore b/src/bin/pg_archivecleanup/.gitignore
similarity index 100%
rename from contrib/pg_archivecleanup/.gitignore
rename to src/bin/pg_archivecleanup/.gitignore
diff --git a/src/bin/pg_archivecleanup/Makefile b/src/bin/pg_archivecleanup/Makefile
new file mode 100644
index 0000000..5df86eb
--- /dev/null
+++ b/src/bin/pg_archivecleanup/Makefile
@@ -0,0 +1,14 @@
+# src/bin/pg_archivecleanup/Makefile
+
+PGFILEDESC = "pg_archivecleanup - cleans archive when used with streaming replication"
+PGAPPICON = win32
+
+subdir = src/bin/pg_archivecleanup
+top_builddir = ../../..
+include $(top_builddir)/src/Makefile.global
+
+PROGRAM = pg_archivecleanup
+OBJS	= pg_archivecleanup.o $(WIN32RES)
+
+NO_PGXS = 1
+include $(top_srcdir)/src/makefiles/pgxs.mk
diff --git a/contrib/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c
similarity index 99%
rename from contrib/pg_archivecleanup/pg_archivecleanup.c
rename to src/bin/pg_archivecleanup/pg_archivecleanup.c
index 97225a8..2ff2a27 100644
--- a/contrib/pg_archivecleanup/pg_archivecleanup.c
+++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c
@@ -1,5 +1,5 @@
 /*
- * contrib/pg_archivecleanup/pg_archivecleanup.c
+ * src/bin/pg_archivecleanup/pg_archivecleanup.c
  *
  * pg_archivecleanup.c
  *
-- 
2.3.2

