Skip to content

Commit

Permalink
Separated DEB packaging for PHP versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenick committed May 16, 2017
1 parent b38416a commit b3803ce
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 109 deletions.
30 changes: 17 additions & 13 deletions ext/packaging/build_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,27 @@ check_command "dch" "debhelper"
check_command "lsb_release" "lsb-release"

pecl_name="cassandra"
pecl_version=$(header_version "../version.h")
version=$(header_version_full "../version.h")
release=1
dist=$(lsb_release -s -c)
base="php-driver-$version"
files="config.m4 php_driver.c php_driver.h php_driver_globals.h php_driver_types.h version.h src util"

echo "Building version $version"

libuv_version=$(dpkg -s libuv | grep 'Version' | awk '{ print $2 }')
if [[ -z $1 ]]; then
php_version=$(php-config --version | sed -rn 's/^([0-9]+)\.([0-9]+)(.*)/\1.\2/p')
else
php_version=$1
fi

debian_dir="debian-php$php_version"

if [[ -e $libuv_version ]]; then
echo "'libuv' required, but not installed"
exit 1
if [[ ! -e $debian_dir ]]; then
echo "PHP $php_version not supported"
exit -1
fi

echo "Using libuv version $libuv_version"
echo "Building version $version with PHP $php_version"

if [[ -d build ]]; then
read -p "Build directory exists, remove? [y|n] " -n 1 -r
Expand All @@ -84,18 +88,18 @@ fi
mkdir -p "build/$base"

echo "Copying files"
mkdir -p "build/$base/$pecl_name-$pecl_version"
cp ../package.xml "build/$base"
for file in $files; do
cp -r "../$file" "build/$base/$pecl_name-$pecl_version/$file"
cp -r "../$file" "build/$base/$file"
done
cp -r debian "build/$base"

cp -r $debian_dir "build/$base/debian"

pushd "build/$base"
echo "Updating changlog"
dch -m -v "$version-$release" -D $dist "Version $version"

dch -M --create --package "php$php_version-cassandra-driver" -v "$version-$release" -D $dist "Version $version"
echo "Building package:"
nprocs=$(grep -e '^processor' -c /proc/cpuinfo)
DEB_BUILD_OPTIONS="parallel=$nprocs" debuild -i -b -uc -us
DEB_BUILD_OPTIONS="parallel=$nprocs" debuild -e PHP_VERSION="$php_version" -i -b -uc -us

popd
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
Source: php-cassandra-driver
Source: php5.6-cassandra-driver
Section: php
Priority: optional
Maintainer: Michael Penick <[email protected]>
Build-Depends: debhelper (>= 9~),
dh-php (>= 0.10~),
php5.6-dev,
php7.0-dev,
php-all-dev,
pkg-config,
cassandra-cpp-driver-dev (>= 2.6.0)
cassandra-cpp-driver-dev (>= 2.7.0)
Homepage: http://datastax.github.io/php-driver/

Package: php-cassandra-driver
Package: php5.6-cassandra-driver
Architecture: any
Depends: ${misc:Depends},
${php:Depends},
${shlibs:Depends},
cassandra-cpp-driver (>= 2.6.0)
cassandra-cpp-driver (>= 2.7.0)
Provides: ${php:Provides}
Description: A modern, feature-rich and highly tunable PHP client library for
Description: Modern, feature-rich and highly tunable PHP client library for
Apache Cassandra (1.2+) and DataStax Enterprise (3.1+) using exclusively
Cassandra's binary protocol and Cassandra Query Language v3.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: php-cassandra-driver
Upstream-Name: php5.6-cassandra-driver
Source: https://github.com/datastax/php-driver

Files: *
Expand Down
49 changes: 49 additions & 0 deletions ext/packaging/debian-php5.6/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/make -f

# Copied from dh-php: /usr/share/dh-php/pkg-pecl.mk

# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
export DEB_CFLAGS_MAINT_APPEND = -Wall
# package maintainers to append LDFLAGS
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Don't ever use RPATH on Debian
export PHP_RPATH=no

export DH_PHP_VERSIONS = $(PHP_VERSION)

PECL_NAME := cassandra-driver
INSTALL_ROOT = $(CURDIR)/debian/php$(PHP_VERSION)-cassandra-driver

%:
dh $@ --with php

override_dh_auto_configure:
phpize$(PHP_VERSION)
dh_auto_configure -- --with-cassandra --with-php-config=/usr/bin/php-config$(PHP_VERSION) $(PECL_CONFIGURE_MAINT_APPEND)

override_dh_auto_build:
dh_auto_build -- -j$(NUMJOBS)

override_dh_auto_install:
dh_auto_install -- INSTALL_ROOT=$(INSTALL_ROOT)

override_dh_gencontrol: ,:=,
override_dh_gencontrol:
dh_gencontrol -- "-Vphp:Provides=$(addprefix php,$(addsuffix -$(PECL_NAME)$(,) ,$(PHP_VERSION)))"

override_dh_php:
dh_php -p php$(PHP_VERSION)-$(PECL_NAME)

File renamed without changes.
1 change: 1 addition & 0 deletions ext/packaging/debian-php7.0/cassandra.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extension=cassandra.so
1 change: 1 addition & 0 deletions ext/packaging/debian-php7.0/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
21 changes: 21 additions & 0 deletions ext/packaging/debian-php7.0/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Source: php7.0-cassandra-driver
Section: php
Priority: optional
Maintainer: Michael Penick <[email protected]>
Build-Depends: debhelper (>= 9~),
dh-php (>= 0.10~),
php-all-dev,
pkg-config,
cassandra-cpp-driver-dev (>= 2.7.0)
Homepage: http://datastax.github.io/php-driver/

Package: php7.0-cassandra-driver
Architecture: any
Depends: ${misc:Depends},
${php:Depends},
${shlibs:Depends},
cassandra-cpp-driver (>= 2.7.0)
Provides: ${php:Provides}
Description: Modern, feature-rich and highly tunable PHP client library for
Apache Cassandra (1.2+) and DataStax Enterprise (3.1+) using exclusively
Cassandra's binary protocol and Cassandra Query Language v3.
9 changes: 9 additions & 0 deletions ext/packaging/debian-php7.0/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: php7.0-cassandra-driver
Source: https://github.com/datastax/php-driver

Files: *
Copyright: Copyright 2014-2017 DataStax
License: Apache-2.0
On Debian systems, the complete text of the Apache License Version 2.0
can be found in `/usr/share/common-licenses/Apache-2.0'.
1 change: 1 addition & 0 deletions ext/packaging/debian-php7.0/php7.0-cassandra-driver.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mod debian/cassandra.ini
49 changes: 49 additions & 0 deletions ext/packaging/debian-php7.0/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/make -f

# Copied from dh-php: /usr/share/dh-php/pkg-pecl.mk

# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
export DEB_CFLAGS_MAINT_APPEND = -Wall
# package maintainers to append LDFLAGS
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Don't ever use RPATH on Debian
export PHP_RPATH=no

export DH_PHP_VERSIONS = $(PHP_VERSION)

PECL_NAME := cassandra-driver
INSTALL_ROOT = $(CURDIR)/debian/php$(PHP_VERSION)-cassandra-driver

%:
dh $@ --with php

override_dh_auto_configure:
phpize$(PHP_VERSION)
dh_auto_configure -- --with-cassandra --with-php-config=/usr/bin/php-config$(PHP_VERSION) $(PECL_CONFIGURE_MAINT_APPEND)

override_dh_auto_build:
dh_auto_build -- -j$(NUMJOBS)

override_dh_auto_install:
dh_auto_install -- INSTALL_ROOT=$(INSTALL_ROOT)

override_dh_gencontrol: ,:=,
override_dh_gencontrol:
dh_gencontrol -- "-Vphp:Provides=$(addprefix php,$(addsuffix -$(PECL_NAME)$(,) ,$(PHP_VERSION)))"

override_dh_php:
dh_php -p php$(PHP_VERSION)-$(PECL_NAME)

1 change: 1 addition & 0 deletions ext/packaging/debian-php7.0/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
5 changes: 0 additions & 5 deletions ext/packaging/debian/changelog

This file was deleted.

83 changes: 0 additions & 83 deletions ext/packaging/debian/rules

This file was deleted.

0 comments on commit b3803ce

Please sign in to comment.