>From abaaaa4b5a71dd34eaf255b523e3d2a12a2b93d3 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Tue, 23 Dec 2014 13:54:42 +0900
Subject: [PATCH 02/13] 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/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 +-
 8 files changed, 17 insertions(+), 21 deletions(-)
 delete mode 100644 contrib/pg_archivecleanup/Makefile
 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 @@ pages.
    part of the core <productname>PostgreSQL</productname> distribution.
   </para>
 
- &pgarchivecleanup;
  &pgstandby;
  &pgtestfsync;
  &pgtesttiming;
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 @@
   </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.2.1.212.gc5b9256

