Skip to content

Instantly share code, notes, and snippets.

@Zeuh
Created June 29, 2015 13:00
Show Gist options
  • Save Zeuh/dcb24e806e68c37fbd0b to your computer and use it in GitHub Desktop.
Save Zeuh/dcb24e806e68c37fbd0b to your computer and use it in GitHub Desktop.
Make PDO-OCI debian package
#!/bin/bash
#
# Requirement : Oracle instant client MUST be installed before.
#
myfile=$(readlink -f "$0")
mypath=$(dirname $myfile)
export ORACLE_BASE=`ls /usr/lib/oracle/ | sed 's#^#/usr/lib/oracle/#'`
export ORACLE_HOME=$ORACLE_BASE/client64
if [ ! -e $ORACLE_HOME ]
then
echo "ORACLE_HOME does not exists !"
exit 1
fi
mkdir -p $mypath/php-work
cd $mypath/php-work
cat > debian-rules.patch << EOF
--- debian/rules 2014-03-24 16:28:48.474211379 +0100
+++ /home/richar_y/rules 2014-03-24 16:26:56.550209263 +0100
@@ -18,7 +18,7 @@
endif
TAR=tar
-PECL_PKG_NAME=pdo-oci
+PECL_PKG_NAME=pdo_oci
PECL_PKG_REALNAME=PDO_OCI
PECL_PKG_VERSION=1.0.1
PACKAGE_NAME=php-pdo-oci
@@ -42,6 +42,9 @@
# Add here commands to configure the package.
(cd \$(SOURCE_DIR); \\
\$(PHPIZE)\$*; \\
+ sed -e 's/prefix\/include\/php\/ext/prefix\/include\/php5\/ext/' \\
+ configure > /tmp/pdo_oci-configure; \\
+ cp /tmp/pdo_oci-configure ./configure; \\
./configure --with-php-config=\$(PHPCONFIG)\$* --prefix=/usr)
# rm -f configure-stamp-v*
touch \$@
EOF
apt-get source php5
cd php5*/ext/pdo_oci
pecl package package2.xml
dh-make-pecl PDO_OCI-1.0.1.tgz
cd php-pdo-oci-1.0.1
patch -p0 < $mypath/php-work/debian-rules.patch
dpkg-buildpackage -rfakeroot -us -uc
cd ..
mv php5-pdo-*_amd64.deb $mypath
rm -rf $mypath/php-work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment