<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dotdeb &#187; extension</title>
	<atom:link href="http://www.dotdeb.org/tag/extension/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotdeb.org</link>
	<description>The repository for Debian-based LAMP servers</description>
	<lastBuildDate>Mon, 02 Aug 2010 15:59:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to package PHP extensions by yourself</title>
		<link>http://www.dotdeb.org/2008/09/25/how-to-package-php-extensions-by-yourself/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-package-php-extensions-by-yourself</link>
		<comments>http://www.dotdeb.org/2008/09/25/how-to-package-php-extensions-by-yourself/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 12:52:56 +0000</pubDate>
		<dc:creator>Guillaume Plessis</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[pecl]]></category>

		<guid isPermaLink="false">http://www.dotdeb.org/?p=116</guid>
		<description><![CDATA[I often receive emails telling me that Dotdeb is a grea [...]]]></description>
			<content:encoded><![CDATA[<p>I often receive emails telling me that Dotdeb is a great tool, but that some useful packages are missing, such as some <a href="http://pecl.php.net/">PECL</a> extensions. I wish I could maintain many and many packages, but I don&#8217;t think it&#8217;s a good idea for the Dotdeb&#8217;s overall quality and for my free time <img src='http://www.dotdeb.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Sorry for that.</p>
<p>Then, this article will show you how to build packages from your favorite PECL extensions in a strict Debian way, using the <a href="http://packages.debian.org/stable/dh-make-php">dh-make-php</a> package.</p>
<p><span id="more-116"></span>Imagine we want to package the <a href="http://pecl.php.net/package/Fileinfo">Fileinfo</a> extension for PHP5&#8230;</p>
<p>First, install all the needed packages (libmagic-dev is only needed here to build Fileinfo) :</p>
<pre><strong># apt-get install dh-make-php php5-dev build-essential libmagic-dev</strong></pre>
<p>Then, export some needed environment variables, download the package</p>
<pre><strong># export DEBFULLNAME="Guillaume Plessis"
# export DEBEMAIL="gui@php.net"
# pecl download fileinfo</strong>
downloading Fileinfo-1.0.4.tgz ...
Starting to download Fileinfo-1.0.4.tgz (5,835 bytes)
.....done: 5,835 bytes
File /tmp/Fileinfo-1.0.4.tgz downloaded</pre>
<p>Ok, let&#8217;s summon the magical <em>dh-make-pecl</em> command with the appropriate arguments :</p>
<pre><strong># dh-make-pecl --only 5 Fileinfo-1.0.4.tgz</strong>
Creating debian source package: php-fileinfo-1.0.4
Upstream is: Ilia Alshanetsky
Guessing Maintainer: Guillaume Plessis</pre>
<p>No error message&#8230; Great! <em>dh-make-pecl</em> did its job, e.g. unarchived the tarball and created the <em>php-fileinfo-1.0.4/debian/</em> subdirectory that contains all the packaging stuff.<br />
&#8220;<em>&#8211;only 5</em>&#8221; restricts the building process to PHP5 packages (PHP4 is obsolete!)</p>
<p>Let&#8217;s build the package!</p>
<pre><strong># cd php-fileinfo-1.0.4/
# ./debian/rules binary</strong>
xsltproc --nonet --novalid debian/changelog.xsl package.xml &gt; debian/Changelog
touch build-stamp
dh_testdir
...
dh_md5sums
dh_builddeb
dpkg-deb: building package `php5-fileinfo' in `../php5-fileinfo_1.0.4-1_i386.deb'.</pre>
<p>That&#8217;s it! Let&#8217;s take a look at the content of the package&#8230;</p>
<pre><strong># dpkg -c ../php5-fileinfo_1.0.4-1_i386.deb</strong>
drwxr-xr-x root/root         0 2008-09-20 10:10 ./
drwxr-xr-x root/root         0 2008-09-20 10:10 ./usr/
drwxr-xr-x root/root         0 2008-09-20 10:10 ./usr/lib/
drwxr-xr-x root/root         0 2008-09-20 10:10 ./usr/lib/php5/
drwxr-xr-x root/root         0 2008-09-20 10:10 ./usr/lib/php5/20060613+lfs/
-rw-r--r-- root/root     10296 2008-09-20 10:10 ./usr/lib/php5/20060613+lfs/fileinfo.so
drwxr-xr-x root/root         0 2008-09-20 10:10 ./usr/share/
drwxr-xr-x root/root         0 2008-09-20 10:10 ./usr/share/doc/
drwxr-xr-x root/root         0 2008-09-20 10:10 ./usr/share/doc/php5-fileinfo/
-rw-r--r-- root/root       202 2008-09-20 10:09 ./usr/share/doc/php5-fileinfo/README.Debian
-rw-r--r-- root/root        26 2004-02-13 01:06 ./usr/share/doc/php5-fileinfo/CREDITS
-rw-r--r-- root/root      3466 2008-09-20 10:09 ./usr/share/doc/php5-fileinfo/copyright
-rw-r--r-- root/root       159 2008-09-20 10:09 ./usr/share/doc/php5-fileinfo/changelog.Debian.gz
-rw-r--r-- root/root       865 2005-11-24 23:07 ./usr/share/doc/php5-fileinfo/fileinfo.php
-rw-r--r-- root/root       149 2008-09-20 10:10 ./usr/share/doc/php5-fileinfo/changelog.gz</pre>
<p>and its metadata :</p>
<pre><strong># dpkg -I ../php5-fileinfo_1.0.4-1_i386.deb</strong>
 new debian package, version 2.0.
 size 12740 bytes: control archive= 4848 bytes.
     940 bytes,    31 lines   *  config               #!/bin/sh
     607 bytes,    20 lines      control
     522 bytes,     7 lines      md5sums
    1218 bytes,    58 lines   *  postinst             #!/bin/sh
     206 bytes,     8 lines   *  postrm               #!/bin/sh
    1773 bytes,    63 lines   *  prerm                #!/bin/sh
    8758 bytes,    67 lines      templates
 Package: php5-fileinfo
 Version: 1.0.4-1
 Section: web
 Priority: optional
 Architecture: i386
 Depends: libc6 (&gt;= 2.3.6-6), libmagic1, debconf (&gt;= 0.5) | debconf-2.0, php5 | php5-cli
 Installed-Size: 100
 Maintainer: Guillaume Plessis
 Source: php-fileinfo
 Description: Fileinfo module for PHP 5
  libmagic bindings
  .
  This extension allows retrieval of information regarding vast
  majority of file.
  This information may include dimensions, quality, length etc...
  .
  Additionally it can also be used to retrieve the mime type for a
  particular
  file and for text files proper language encoding.
  .</pre>
<p>Great job! Now install the package and enjoy&#8230;</p>
<p>For more information and specific needs, take a look at &#8220;<em>dh-make-pecl</em>&#8221; and &#8220;<em>man dh-make-pecl</em>&#8220;.</p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://www.dotdeb.org/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p><div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.dotdeb.org/2008/09/25/how-to-package-php-extensions-by-yourself/&via=dotdeb&text=How to package PHP extensions by yourself&related=w_a_s_t_e:Dotdeb's maintainer&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.dotdeb.org/2008/09/25/how-to-package-php-extensions-by-yourself/&via=dotdeb&text=How to package PHP extensions by yourself&related=w_a_s_t_e:Dotdeb's maintainer&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.dotdeb.org/2008/09/25/how-to-package-php-extensions-by-yourself/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
	</channel>
</rss>
