7
DEBTEMPDIR=${PREFIX}/share/dh-make-php/pear.template
8
PACKAGEDOCFILES="README readme CREDITS TODO AUTHORS"
9
# if you change the examples directory make sure to adjust the
10
# regular expression to set the PACKAGEDOCFILES
11
PACKAGEEXPFILES="examples"
17
. ${PREFIX}/share/dh-make-php/dh-make-php.lib
20
# print summary of options
24
This is ${PROGNAME} Version ${PROGVERSION}
25
Copyright (c) 2004-2005 Uwe Steinmann <steinm@debian.org>
27
Usage: ${PROGNAME} [options] pear-package
29
pear-package is a tgz file as it is downloaded by 'pear download'.
31
--help | -h show this usage information
32
--version | -v show version of program
33
--maintainer maintainer of the debian package
34
--arch set architecture (defaults to 'all')
35
--depends set more depends aside php
36
--prefix set prefix for package name (default is '${DEBPACKAGEPREFIX}')
37
--templatedir set alternative directory for templates
38
(default is ${DEBTEMPDIR})
44
# command line options {{{
52
--help|-h) # print usage
56
--version|-v) # show version
60
--maintainer) # set maintainer of debian package
61
DEBMAINTAINER="$2"; shift
63
--arch) # set architecture of debian package
66
--depends) # set extra depends for debian package
69
--prefix) # set prefix for name of debian package
70
DEBPACKAGEPREFIX=", $2"; shift
72
--templatedir) # set alternative template dir
73
DEBTEMPDIR=", $2"; shift
83
do test $# -gt 0 && shift; done
86
if [ -n "${PEARPACKAGENAME}" ]; then
87
if [ -f ${PEARPACKAGENAME} ]; then
88
tar xzf ${PEARPACKAGENAME}
90
if TEMPMSG=$(pear download ${PEARPACKAGENAME} 2> /dev/null); then
92
PEARPACKAGENAME=$(echo ${TEMPMSG} | awk -F ' ' '{print $2'})
93
tar xzf ${PEARPACKAGENAME}
95
echo "Downloading pear package '${PEARPACKAGENAME}' failed!";
96
echo "Check http://pear.php.net/ for available packages.";
105
# get information about package from package.xml
108
echo "Creating debian source package: ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}"
109
echo "Upstream is: ${UPSTREAM}"
113
if [ -d ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION} ] ; then
114
echo "Directory '${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}' already exits."
117
ln -s ${PEARPACKAGENAME} ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}_${VERSION}.orig.tar.gz
118
mkdir ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}
119
mv ${PHP_PKG_NAME}-${VERSION} ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}
120
mv package.xml ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}
121
#tar czf ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}_${VERSION}.orig.tar.gz ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}
122
mkdir -p ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian
124
cp ${DEBTEMPDIR}/compat ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian
125
cp ${DEBTEMPDIR}/dirs ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian
130
PACKAGEXML=${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/package.xml
132
sed -e "s/##date##/`(LC_ALL=C; date -R)`/g" \
133
-e "s/##maintainer##/${DEBMAINTAINER}/g" \
134
-e "s/##upstream##/${UPSTREAM}/g" \
135
-e "s/##license##/${LICENSE}/g" \
136
-e "s/##pearpkgname##/${PHP_PKG_NAME}/g" \
137
${DEBTEMPDIR}/copyright > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/copyright
138
if [ -n "${LICENSEFILE}" ]; then
139
cat "${LICENSEFILE}" >> ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/copyright
141
sed -e "s/##packagename##/${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}/g" \
142
-e "s/##maintainer##/${DEBMAINTAINER}/g" \
143
-e "s�##summary##�${SUMMARY}�g" \
144
-e "s/##depends##/${DEPENDS}/g" \
145
-e "s/##architecture##/${DEPARCH}/g" \
146
${DEBTEMPDIR}/control > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/control
147
xsltproc --nonet --novalid --param Element "/*/description" ${PREFIX}/share/dh-make-php/xslt/common.xsl ${PACKAGEXML} | fold -s -w 70|sed -e "s�^[ \t]*$�.�g" -e "s�^� �g" >> ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/control
148
# sgrep -e '"<description>"__"</description>"' ${PACKAGEXML} | fold -s -w 70|sed -e "s�^[ \t]*$�.�g" -e "s�^� �g" >> ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/control
149
# changelog.xsl is copied into the source package in order to prevent
150
# a dependency on dh-make-php
151
cp ${PREFIX}/share/dh-make-php/xslt/changelog.xsl ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/
152
sed -e "s/##packagename##/${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}/g" \
153
-e "s/##version##/${VERSION}/g" \
154
-e "s/##pearpkgname##/${PHP_PKG_NAME}/g" \
155
${DEBTEMPDIR}/rules > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/rules
156
chmod 755 ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/rules
158
sed -e "s/##packagename##/${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}/g" \
159
-e "s/##date##/`(LC_ALL=C; date -R)`/g" \
160
-e "s/##maintainer##/${DEBMAINTAINER}/g" \
161
-e "s/##version##/${VERSION}/g" \
162
${DEBTEMPDIR}/changelog > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/changelog
164
sed -e "s/##packagename##/${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}/g" \
165
-e "s/##date##/`(LC_ALL=C; date -R)`/g" \
166
-e "s/##maintainer##/${DEBMAINTAINER}/g" \
167
${DEBTEMPDIR}/README.Debian > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/README.Debian
169
sed -e "s/##pearpkgname##/${PHP_PKG_NAME}/g" \
170
${DEBTEMPDIR}/prerm > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/prerm
172
sed -e "s/##pearpkgname##/${PHP_PKG_NAME}/g" \
173
${DEBTEMPDIR}/watch > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/watch