Squashed 'third_party/ctemplate/' content from commit 6742f62

Change-Id: I828e4e4c906f13ba19944d78a8a78652b62949af
git-subtree-dir: third_party/ctemplate
git-subtree-split: 6742f6233db12f545e90baa8f34f5c29c4eb396a
diff --git a/packages/deb.sh b/packages/deb.sh
new file mode 100755
index 0000000..31b423c
--- /dev/null
+++ b/packages/deb.sh
@@ -0,0 +1,74 @@
+#!/bin/bash -e
+
+# This takes one commandline argument, the name of the package.  If no
+# name is given, then we'll end up just using the name associated with
+# an arbitrary .tar.gz file in the rootdir.  That's fine: there's probably
+# only one.
+#
+# Run this from the 'packages' directory, just under rootdir
+
+## Set LIB to lib if exporting a library, empty-string else
+LIB=
+#LIB=lib
+
+PACKAGE="$1"
+VERSION="$2"
+
+# We can only build Debian packages, if the Debian build tools are installed
+if [ \! -x /usr/bin/debuild ]; then
+  echo "Cannot find /usr/bin/debuild. Not building Debian packages." 1>&2
+  exit 0
+fi
+
+# Double-check we're in the packages directory, just under rootdir
+if [ \! -r ../Makefile -a \! -r ../INSTALL ]; then
+  echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2
+  echo "Also, you must run \"make dist\" before running this script." 1>&2
+  exit 0
+fi
+
+# Find the top directory for this package
+topdir="${PWD%/*}"
+
+# Find the tar archive built by "make dist"
+archive="${PACKAGE}-${VERSION}"
+archive_with_underscore="${PACKAGE}_${VERSION}"
+if [ -z "${archive}" ]; then
+  echo "Cannot find ../$PACKAGE*.tar.gz. Run \"make dist\" first." 1>&2
+  exit 0
+fi
+
+# Create a pristine directory for building the Debian package files
+trap 'rm -rf '`pwd`/tmp'; exit $?' EXIT SIGHUP SIGINT SIGTERM
+
+rm -rf tmp
+mkdir -p tmp
+cd tmp
+
+# Debian has very specific requirements about the naming of build
+# directories, and tar archives. It also wants to write all generated
+# packages to the parent of the source directory. We accommodate these
+# requirements by building directly from the tar file.
+ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive}.orig.tar.gz"
+# Some version of debuilder want foo.orig.tar.gz with _ between versions.
+ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive_with_underscore}.orig.tar.gz"
+tar zfx "${LIB}${archive}.orig.tar.gz"
+[ -n "${LIB}" ] && mv "${archive}" "${LIB}${archive}"
+cd "${LIB}${archive}"
+# This is one of those 'specific requirements': where the deb control files live
+cp -a "packages/deb" "debian"
+
+# Now, we can call Debian's standard build tool
+debuild -uc -us
+cd ../..                            # get back to the original top-level dir
+
+# We'll put the result in a subdirectory that's named after the OS version
+# we've made this .deb file for.
+destdir="debian-$(cat /etc/debian_version 2>/dev/null || echo UNKNOWN)"
+
+rm -rf "$destdir"
+mkdir -p "$destdir"
+mv $(find tmp -mindepth 1 -maxdepth 1 -type f) "$destdir"
+
+echo
+echo "The Debian package files are located in $PWD/$destdir"
diff --git a/packages/deb/README b/packages/deb/README
new file mode 100644
index 0000000..57becfd
--- /dev/null
+++ b/packages/deb/README
@@ -0,0 +1,7 @@
+The list of files here isn't complete.  For a step-by-step guide on
+how to set this package up correctly, check out
+    http://www.debian.org/doc/maint-guide/
+
+Most of the files that are in this directory are boilerplate.
+However, you may need to change the list of binary-arch dependencies
+in 'rules'.
diff --git a/packages/deb/changelog b/packages/deb/changelog
new file mode 100644
index 0000000..1bfd517
--- /dev/null
+++ b/packages/deb/changelog
@@ -0,0 +1,161 @@
+ctemplate (2.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Olaf van der Spek <olafvdspek@gmail.com>  Thu, 22 Mar 2012 00:29:09 +0100
+
+ctemplate (2.0-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. and others <google-ctemplate@googlegroups.com>  Tue, 24 Jan 2012 16:00:51 -0800
+
+ctemplate (1.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Thu, 22 Dec 2011 14:03:27 -0800
+
+ctemplate (1.0-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Fri, 26 Aug 2011 13:10:46 -0700
+
+ctemplate (1.0rc2-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Fri, 29 Jul 2011 12:19:50 -0700
+
+ctemplate (1.0rc1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Fri, 22 Jul 2011 15:31:05 -0700
+
+ctemplate (0.99-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Mon, 24 Jan 2011 15:38:31 -0800
+
+ctemplate (0.98-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Fri, 24 Sep 2010 11:38:27 -0700
+
+ctemplate (0.97-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Mon, 19 Apr 2010 15:55:23 -0700
+
+ctemplate (0.96-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Mon, 19 Oct 2009 11:42:57 -0700
+
+ctemplate (0.95-2) unstable; urgency=low
+
+  * Fix the include directory in the spec files: google -> ctemplate
+
+ -- Google Inc. <opensource@google.com>  Fri, 12 Jun 2009 08:13:35 -0700
+
+ctemplate (0.95-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Fri, 12 Jun 2009 08:13:35 -0700
+
+ctemplate (0.94-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Thu, 07 May 2009 11:27:28 -0700
+
+ctemplate (0.93-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Mon, 02 Feb 2009 13:51:33 -0800
+
+ctemplate (0.92-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Wed, 12 Nov 2008 11:24:33 -0800
+
+ctemplate (0.91-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Tue, 19 Aug 2008 16:20:27 -0700
+
+ctemplate (0.90-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Sun, 27 Apr 2008 15:06:15 -0700
+
+ctemplate (0.9-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Thu, 24 Jan 2008 16:09:43 -0800
+
+ctemplate (0.8-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Thu, 16 Aug 2007 21:42:55 -0700
+
+ctemplate (0.7-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Tue, 03 Jul 2007 12:46:59 -0700
+
+ctemplate (0.6.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Thu, 21 Jun 2007 14:02:32 -0700
+
+ctemplate (0.6-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Sat, 09 Jun 2007 22:34:52 -0700
+
+ctemplate (0.5-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Mon, 14 May 2007 17:27:10 -0700
+
+ctemplate (0.4-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Mon, 15 Jan 2007 14:10:42 -0800
+	
+ctemplate (0.3-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Mon, 21 Aug 2006 17:44:32 -0700
+
+ctemplate (0.2-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Wed, 14 Jun 2006 14:56:04 -0700
+
+ctemplate (0.1-1) unstable; urgency=low
+
+  * Initial release.
+
+ -- Google Inc. <opensource@google.com>  Mon, 13 Mar 2006 22:17:14 -0800
diff --git a/packages/deb/compat b/packages/deb/compat
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/packages/deb/compat
@@ -0,0 +1 @@
+4
diff --git a/packages/deb/control b/packages/deb/control
new file mode 100644
index 0000000..6a3d574
--- /dev/null
+++ b/packages/deb/control
@@ -0,0 +1,27 @@
+Source: ctemplate
+Section: libdevel
+Priority: optional
+Maintainer: Google Inc. and others <google-ctemplate@googlegroups.com>
+Build-Depends: debhelper (>= 4.0.0)
+Standards-Version: 3.6.1
+
+Package: libctemplate-dev
+Section: libdevel
+Architecture: any
+Depends: libctemplate0 (= ${Source-Version})
+Description: This package contains a library implementing a simple but
+  powerful template language for C++.  It emphasizes separating logic
+  from presentation: it is impossible to embed application logic in this
+  template language.  The devel package contains static and debug
+  libraries and header files for developing applications that use the
+  ctemplate package.
+
+Package: libctemplate0
+Section: libs
+Architecture: any
+Description: This package contains a library implementing a simple but
+  powerful template language for C++.  It emphasizes separating logic
+  from presentation: it is impossible to embed application logic in this
+  template language.  This limits the power of the template language
+  without limiting the power of the template *system*.  Indeed, Google's
+  "main" web search uses this system exclusively for formatting output.
diff --git a/packages/deb/copyright b/packages/deb/copyright
new file mode 100644
index 0000000..72c11a2
--- /dev/null
+++ b/packages/deb/copyright
@@ -0,0 +1,35 @@
+This package was debianized by Craig Silverstein <google-ctemplate@googlegroups.com>
+on Tue, 24 Jan 2012 16:00:51 -0800.
+
+It was downloaded from http://code.google.com/p/ctemplate/downloads/list
+
+Upstream Author: google-ctemplate@googlegroups.com
+
+Copyright (c) 2006, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+    * 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.
+    * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+OWNER OR 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.
diff --git a/packages/deb/docs b/packages/deb/docs
new file mode 100644
index 0000000..25dee3a
--- /dev/null
+++ b/packages/deb/docs
@@ -0,0 +1,15 @@
+AUTHORS
+COPYING
+ChangeLog
+INSTALL
+NEWS
+README
+doc/designstyle.css
+doc/index.html
+doc/howto.html
+doc/tips.html
+doc/example.html
+doc/xss_resources.html
+contrib/README.contrib
+contrib/highlighting.vim
+contrib/tpl-mode.el
diff --git a/packages/deb/libctemplate-dev.dirs b/packages/deb/libctemplate-dev.dirs
new file mode 100644
index 0000000..ce71d19
--- /dev/null
+++ b/packages/deb/libctemplate-dev.dirs
@@ -0,0 +1,5 @@
+usr/lib
+usr/lib/pkgconfig
+usr/include
+usr/include/ctemplate
+usr/bin
diff --git a/packages/deb/libctemplate-dev.install b/packages/deb/libctemplate-dev.install
new file mode 100644
index 0000000..a4543d7
--- /dev/null
+++ b/packages/deb/libctemplate-dev.install
@@ -0,0 +1,12 @@
+usr/include/ctemplate/*
+usr/lib/lib*.so
+usr/lib/lib*.a
+usr/lib/lib*.la
+usr/bin/*
+usr/lib/pkgconfig/*
+debian/tmp/usr/include/ctemplate/*
+debian/tmp/usr/lib/lib*.so
+debian/tmp/usr/lib/lib*.a
+debian/tmp/usr/lib/lib*.la
+debian/tmp/usr/bin/*
+debian/tmp/usr/lib/pkgconfig/*
diff --git a/packages/deb/libctemplate0.dirs b/packages/deb/libctemplate0.dirs
new file mode 100644
index 0000000..6845771
--- /dev/null
+++ b/packages/deb/libctemplate0.dirs
@@ -0,0 +1 @@
+usr/lib
diff --git a/packages/deb/libctemplate0.install b/packages/deb/libctemplate0.install
new file mode 100644
index 0000000..704ea87
--- /dev/null
+++ b/packages/deb/libctemplate0.install
@@ -0,0 +1,2 @@
+usr/lib/lib*.so.*
+debian/tmp/usr/lib/lib*.so.*
diff --git a/packages/deb/rules b/packages/deb/rules
new file mode 100755
index 0000000..f520bef
--- /dev/null
+++ b/packages/deb/rules
@@ -0,0 +1,117 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	INSTALL_PROGRAM += -s
+endif
+
+# shared library versions, option 1
+#version=2.0.5
+#major=2
+# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
+version=`ls src/.libs/lib*.so.* | \
+ awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
+major=`ls src/.libs/lib*.so.* | \
+ awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
+
+config.status: configure
+	dh_testdir
+	# Add here commands to configure the package.
+	CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+
+
+build: build-stamp
+build-stamp:  config.status
+	dh_testdir
+
+	# Add here commands to compile the package.
+	$(MAKE)
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp 
+
+	# Add here commands to clean up after the build process.
+	-$(MAKE) distclean
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+	cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+	cp -f /usr/share/misc/config.guess config.guess
+endif
+
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	# Add here commands to install the package into debian/tmp
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs ChangeLog
+	dh_installdocs
+	dh_installexamples
+	dh_install --sourcedir=debian/tmp
+#	dh_installmenu
+#	dh_installdebconf	
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_installinit
+#	dh_installcron
+#	dh_installinfo
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_perl
+#	dh_python
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install 
diff --git a/packages/rpm.sh b/packages/rpm.sh
new file mode 100755
index 0000000..0454225
--- /dev/null
+++ b/packages/rpm.sh
@@ -0,0 +1,86 @@
+#!/bin/sh -e
+
+# Run this from the 'packages' directory, just under rootdir
+
+# We can only build rpm packages, if the rpm build tools are installed
+if [ \! -x /usr/bin/rpmbuild ]
+then
+  echo "Cannot find /usr/bin/rpmbuild. Not building an rpm." 1>&2
+  exit 0
+fi
+
+# Check the commandline flags
+PACKAGE="$1"
+VERSION="$2"
+fullname="${PACKAGE}-${VERSION}"
+archive=../$fullname.tar.gz
+
+if [ -z "$1" -o -z "$2" ]
+then
+  echo "Usage: $0 <package name> <package version>" 1>&2
+  exit 0
+fi
+
+# Double-check we're in the packages directory, just under rootdir
+if [ \! -r ../Makefile -a \! -r ../INSTALL ]
+then
+  echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2
+  echo "Also, you must run \"make dist\" before running this script." 1>&2
+  exit 0
+fi
+
+if [ \! -r "$archive" ]
+then
+  echo "Cannot find $archive. Run \"make dist\" first." 1>&2
+  exit 0
+fi
+
+# Create the directory where the input lives, and where the output should live
+RPM_SOURCE_DIR="/tmp/rpmsource-$fullname"
+RPM_BUILD_DIR="/tmp/rpmbuild-$fullname"
+
+trap 'rm -rf $RPM_SOURCE_DIR $RPM_BUILD_DIR; exit $?' EXIT SIGHUP SIGINT SIGTERM
+
+rm -rf "$RPM_SOURCE_DIR" "$RPM_BUILD_DIR"
+mkdir "$RPM_SOURCE_DIR"
+mkdir "$RPM_BUILD_DIR"
+
+cp "$archive" "$RPM_SOURCE_DIR"
+
+# rpmbuild -- as far as I can tell -- asks the OS what CPU it has.
+# This may differ from what kind of binaries gcc produces.  dpkg
+# does a better job of this, so if we can run 'dpkg --print-architecture'
+# to get the build CPU, we use that in preference of the rpmbuild
+# default.
+target=`dpkg --print-architecture 2>/dev/null || echo ""`
+if [ -n "$target" ]
+then
+   target=" --target $target"
+fi
+
+rpmbuild -bb rpm/rpm.spec $target \
+  --define "NAME $PACKAGE" \
+  --define "VERSION $VERSION" \
+  --define "_sourcedir $RPM_SOURCE_DIR" \
+  --define "_builddir $RPM_BUILD_DIR" \
+  --define "_rpmdir $RPM_SOURCE_DIR"
+
+# We put the output in a directory based on what system we've built for
+destdir=rpm-unknown
+if [ -r /etc/issue ]
+then
+   grep "Red Hat.*release 7" /etc/issue >/dev/null 2>&1 && destdir=rh7
+   grep "Red Hat.*release 8" /etc/issue >/dev/null 2>&1 && destdir=rh8
+   grep "Red Hat.*release 9" /etc/issue >/dev/null 2>&1 && destdir=rh9
+   if grep Fedora /etc/issue >/dev/null; then 
+	destdir=fc`grep Fedora /etc/issue | cut -d' ' -f 4`;
+   fi
+fi
+
+rm -rf "$destdir"
+mkdir -p "$destdir"
+# We want to get not only the main package but devel etc, hence the middle *
+mv "$RPM_SOURCE_DIR"/*/"${PACKAGE}"-*"${VERSION}"*.rpm "$destdir"
+
+echo
+echo "The rpm package file(s) are located in $PWD/$destdir"
diff --git a/packages/rpm/rpm.spec b/packages/rpm/rpm.spec
new file mode 100644
index 0000000..9e4453d
--- /dev/null
+++ b/packages/rpm/rpm.spec
@@ -0,0 +1,81 @@
+%define	RELEASE	1
+%define rel     %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
+%define	prefix	/usr
+
+Name: %NAME
+Summary: Simple but powerful template language for C++
+Version: %VERSION
+Release: %rel
+Group: Development/Libraries
+URL: http://code.google.com/p/ctemplate
+License: BSD
+Vendor: Google Inc. and others
+Packager: Google Inc. and others <google-ctemplate@googlegroups.com>
+Source: http://%{NAME}.googlecode.com/files/%{NAME}-%{VERSION}.tar.gz
+Distribution: Redhat 7 and above.
+Buildroot: %{_tmppath}/%{name}-root
+Prefix: %prefix
+
+%description
+The %name package contains a library implementing a simple but
+powerful template language for C++.  It emphasizes separating logic
+from presentation: it is impossible to embed application logic in this
+template language.  This limits the power of the template language
+without limiting the power of the template *system*.  Indeed, Google's
+"main" web search uses this system exclusively for formatting output.
+
+%package devel
+Summary: Simple but powerful template language for C++
+Group: Development/Libraries
+Requires: %{NAME} = %{VERSION}
+
+%description devel
+The %name-devel package contains static and debug libraries and header
+files for developing applications that use the %name package.
+
+%changelog
+	* Wed Apr 22 2009  <opensource@google.com>
+	- Change build rule to use %configure instead of ./configure
+	- Change install to use DESTDIR instead of prefix for make install
+	- Use wildcards for doc/ and lib/ directories
+        - Use {_libdir}/{_includedir}/etc instead of {prefix}/lib, etc
+
+	* Mon Mar 13 2006 <opensource@google.com>
+	- First draft
+
+%prep
+%setup
+
+%build
+# I can't use '% configure', because it defines -m32 which breaks on
+# my development environment for some reason.  But I do take
+# as much from % configure (in /usr/lib/rpm/macros) as I can.
+./configure --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir}
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+
+%docdir %{prefix}/share/doc/%{NAME}-%{VERSION}
+%{prefix}/share/doc/%{NAME}-%{VERSION}/*
+
+%{_libdir}/*.so.*
+
+%files devel
+%defattr(-,root,root)
+
+%{_includedir}/ctemplate
+%{_libdir}/*.a
+%{_libdir}/*.la
+%{_libdir}/*.so
+%{_bindir}/make_tpl_varnames_h
+%{_bindir}/template-converter
+%{_bindir}/diff_tpl_auto_escape
+%{_libdir}/pkgconfig/*.pc