+PKGNAME = pgfincore
+PKGVERS = $(shell dpkg-parsechangelog | awk -F '[:-]' '/^Version:/ { print substr($$2, 2) }')
+
+DEBDIR = /tmp/$(PKGNAME)
+EXPORT = $(DEBDIR)/export/$(PKGNAME)-$(PKGVERS)
+ORIG = $(DEBDIR)/export/$(PKGNAME)_$(PKGVERS).orig.tar.gz
+ARCHIVE= $(DEBDIR)/export/$(PKGNAME)-$(PKGVERS).tar.gz
+DEBEXTS= {gz,changes,build,dsc}
+
MODULES = pgfincore
DATA_built = pgfincore.sql uninstall_pgfincore.sql
DOCS = README.pgfincore
-ifdef USE_PGXS
-PG_CONFIG = pg_config
-PGXS := $(shell $(PG_CONFIG) --pgxs)
+PG_CONFIG ?= pg_config
+PGXS = $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
-else
-subdir = contrib/pgfincore
-top_builddir = ../..
-include $(top_builddir)/src/Makefile.global
-include $(top_srcdir)/contrib/contrib-global.mk
-endif
+
+deb:
+ # working copy from where to make the .orig archive
+ rm -rf $(DEBDIR)
+ mkdir -p $(DEBDIR)/$(PKGNAME)-$(PKGVERS)
+ mkdir -p $(EXPORT)
+ rsync -Ca . $(EXPORT)
+
+ # get rid of temp and build files
+ for n in ".#*" "*~" "build-stamp" "configure-stamp" "prefix.sql" "prefix.so"; do \
+ find $(EXPORT) -name "$$n" -print0|xargs -0 rm -f; \
+ done
+
+ # prepare the .orig without the debian/ packaging stuff
+ rsync -Ca $(EXPORT) $(DEBDIR)
+ rm -rf $(DEBDIR)/$(PKGNAME)-$(PKGVERS)/debian
+ (cd $(DEBDIR) && tar czf $(ORIG) $(PKGNAME)-$(PKGVERS))
+
+ # have a copy of the $$ORIG file named $$ARCHIVE for non-debian packagers
+ cp $(ORIG) $(ARCHIVE)
+
+ # build the debian package and copy them to ..
+ (cd $(EXPORT) && make -f debian/rules debian/control && debuild)
+
+ cp $(EXPORT)/debian/control debian
+ find $(DEBDIR)/export -maxdepth 1 -type f -name "*$(PGGVERS)*" -exec cp {} .. \;
+
+.PHONY: deb
--- /dev/null
+pgfincore (0.3-1) unstable; urgency=low
+
+ * Initial packaging
+
+ -- Dimitri Fontaine <dim@tapoueh.org> Tue, 30 Nov 2010 15:27:25 +0100
+
--- /dev/null
+Source: pgfincore
+Section: database
+Priority: extra
+Maintainer: Dimitri Fontaine <dim@tapoueh.org>
+Build-Depends: debhelper (>= 7), postgresql-server-dev-all, postgresql-server-dev-8.4
+Standards-Version: 3.9.1
+Homepage: http://villemain.org/projects/pgfincore
+
+Package: postgresql-PGVERSION-pgfincore
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, postgresql-PGVERSION
+Description: set of PostgreSQL functions to manage blocks in memory
+ Those functions let you know which and how many disk block from a relation
+ are in the page cache of the operating system, and eventually write the
+ result to a file. Then using this file, it is possible to restore the page
+ cache state for each block of the relation.
--- /dev/null
+This package was debianized by Dimitri Fontaine <dim@tapoueh.org> on
+Tue, 30 Nov 2010 15:27:25 +0100.
+
+It was downloaded from http://pgfoundry.org/projects/pgfincore/
+
+Copyright Holders:
+
+ Copyright (c) 2009 - CΓ©dric Villemain <cedric@villemain.org>
+
+License:
+/*
+ * Copyright (c) 2009 CΓ©dric Villemain <cedric@villemain.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
--- /dev/null
+usr/lib/postgresql/8.4/lib
+usr/share/postgresql/8.4/contrib
--- /dev/null
+README.pgfincore
--- /dev/null
+debian/pgfincore-8.4/pgfincore.so usr/lib/postgresql/8.4/lib
+debian/pgfincore-8.4/pgfincore.sql usr/share/postgresql/8.4/contrib
+debian/pgfincore-8.4/uninstall_pgfincore.sql usr/share/postgresql/8.4/contrib
--- /dev/null
+#!/usr/bin/make -f
+
+include /usr/share/postgresql-common/pgxs_debian_control.mk
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+SRCDIR = $(CURDIR)
+TARGET = $(CURDIR)/debian/pgfincore-%v
+
+build: debian/control
+
+clean:
+ dh_testdir
+ dh_testroot
+ pg_buildext clean $(SRCDIR) $(TARGET) "$(CFLAGS)"
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_prep
+ dh_installdirs
+
+ # build all supported version
+ pg_buildext build $(SRCDIR) $(TARGET) "$(CFLAGS)"
+
+ # then install each of them
+ for v in `pg_buildext supported-versions $(SRCDIR)`; do \
+ dh_install -ppostgresql-$$v-pgfincore ;\
+ done
+
+binary-indep: build install
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install debian/control