Skip to content

Commit b3803ce

Browse files
committed
Separated DEB packaging for PHP versions
1 parent b38416a commit b3803ce

File tree

17 files changed

+156
-109
lines changed

17 files changed

+156
-109
lines changed

ext/packaging/build_deb.sh

+17-13
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,27 @@ check_command "dch" "debhelper"
5656
check_command "lsb_release" "lsb-release"
5757

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

66-
echo "Building version $version"
6765

68-
libuv_version=$(dpkg -s libuv | grep 'Version' | awk '{ print $2 }')
66+
if [[ -z $1 ]]; then
67+
php_version=$(php-config --version | sed -rn 's/^([0-9]+)\.([0-9]+)(.*)/\1.\2/p')
68+
else
69+
php_version=$1
70+
fi
71+
72+
debian_dir="debian-php$php_version"
6973

70-
if [[ -e $libuv_version ]]; then
71-
echo "'libuv' required, but not installed"
72-
exit 1
74+
if [[ ! -e $debian_dir ]]; then
75+
echo "PHP $php_version not supported"
76+
exit -1
7377
fi
7478

75-
echo "Using libuv version $libuv_version"
79+
echo "Building version $version with PHP $php_version"
7680

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

8690
echo "Copying files"
87-
mkdir -p "build/$base/$pecl_name-$pecl_version"
8891
cp ../package.xml "build/$base"
8992
for file in $files; do
90-
cp -r "../$file" "build/$base/$pecl_name-$pecl_version/$file"
93+
cp -r "../$file" "build/$base/$file"
9194
done
92-
cp -r debian "build/$base"
95+
96+
cp -r $debian_dir "build/$base/debian"
9397

9498
pushd "build/$base"
9599
echo "Updating changlog"
96-
dch -m -v "$version-$release" -D $dist "Version $version"
97-
100+
dch -M --create --package "php$php_version-cassandra-driver" -v "$version-$release" -D $dist "Version $version"
98101
echo "Building package:"
99102
nprocs=$(grep -e '^processor' -c /proc/cpuinfo)
100-
DEB_BUILD_OPTIONS="parallel=$nprocs" debuild -i -b -uc -us
103+
DEB_BUILD_OPTIONS="parallel=$nprocs" debuild -e PHP_VERSION="$php_version" -i -b -uc -us
104+
101105
popd
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
Source: php-cassandra-driver
1+
Source: php5.6-cassandra-driver
22
Section: php
33
Priority: optional
44
Maintainer: Michael Penick <[email protected]>
55
Build-Depends: debhelper (>= 9~),
66
dh-php (>= 0.10~),
7-
php5.6-dev,
8-
php7.0-dev,
7+
php-all-dev,
98
pkg-config,
10-
cassandra-cpp-driver-dev (>= 2.6.0)
9+
cassandra-cpp-driver-dev (>= 2.7.0)
1110
Homepage: http://datastax.github.io/php-driver/
1211

13-
Package: php-cassandra-driver
12+
Package: php5.6-cassandra-driver
1413
Architecture: any
1514
Depends: ${misc:Depends},
1615
${php:Depends},
1716
${shlibs:Depends},
18-
cassandra-cpp-driver (>= 2.6.0)
17+
cassandra-cpp-driver (>= 2.7.0)
1918
Provides: ${php:Provides}
20-
Description: A modern, feature-rich and highly tunable PHP client library for
19+
Description: Modern, feature-rich and highly tunable PHP client library for
2120
Apache Cassandra (1.2+) and DataStax Enterprise (3.1+) using exclusively
2221
Cassandra's binary protocol and Cassandra Query Language v3.

ext/packaging/debian/copyright renamed to ext/packaging/debian-php5.6/copyright

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Format: http://dep.debian.net/deps/dep5
2-
Upstream-Name: php-cassandra-driver
2+
Upstream-Name: php5.6-cassandra-driver
33
Source: https://github.com/datastax/php-driver
44

55
Files: *

ext/packaging/debian-php5.6/rules

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/make -f
2+
3+
# Copied from dh-php: /usr/share/dh-php/pkg-pecl.mk
4+
5+
# See debhelper(7) (uncomment to enable)
6+
# output every command that modifies files on the build system.
7+
#DH_VERBOSE = 1
8+
9+
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
10+
DPKG_EXPORT_BUILDFLAGS = 1
11+
include /usr/share/dpkg/default.mk
12+
13+
# see FEATURE AREAS in dpkg-buildflags(1)
14+
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
15+
16+
# see ENVIRONMENT in dpkg-buildflags(1)
17+
# package maintainers to append CFLAGS
18+
export DEB_CFLAGS_MAINT_APPEND = -Wall
19+
# package maintainers to append LDFLAGS
20+
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
21+
22+
# Don't ever use RPATH on Debian
23+
export PHP_RPATH=no
24+
25+
export DH_PHP_VERSIONS = $(PHP_VERSION)
26+
27+
PECL_NAME := cassandra-driver
28+
INSTALL_ROOT = $(CURDIR)/debian/php$(PHP_VERSION)-cassandra-driver
29+
30+
%:
31+
dh $@ --with php
32+
33+
override_dh_auto_configure:
34+
phpize$(PHP_VERSION)
35+
dh_auto_configure -- --with-cassandra --with-php-config=/usr/bin/php-config$(PHP_VERSION) $(PECL_CONFIGURE_MAINT_APPEND)
36+
37+
override_dh_auto_build:
38+
dh_auto_build -- -j$(NUMJOBS)
39+
40+
override_dh_auto_install:
41+
dh_auto_install -- INSTALL_ROOT=$(INSTALL_ROOT)
42+
43+
override_dh_gencontrol: ,:=,
44+
override_dh_gencontrol:
45+
dh_gencontrol -- "-Vphp:Provides=$(addprefix php,$(addsuffix -$(PECL_NAME)$(,) ,$(PHP_VERSION)))"
46+
47+
override_dh_php:
48+
dh_php -p php$(PHP_VERSION)-$(PECL_NAME)
49+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension=cassandra.so

ext/packaging/debian-php7.0/compat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9

ext/packaging/debian-php7.0/control

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Source: php7.0-cassandra-driver
2+
Section: php
3+
Priority: optional
4+
Maintainer: Michael Penick <[email protected]>
5+
Build-Depends: debhelper (>= 9~),
6+
dh-php (>= 0.10~),
7+
php-all-dev,
8+
pkg-config,
9+
cassandra-cpp-driver-dev (>= 2.7.0)
10+
Homepage: http://datastax.github.io/php-driver/
11+
12+
Package: php7.0-cassandra-driver
13+
Architecture: any
14+
Depends: ${misc:Depends},
15+
${php:Depends},
16+
${shlibs:Depends},
17+
cassandra-cpp-driver (>= 2.7.0)
18+
Provides: ${php:Provides}
19+
Description: Modern, feature-rich and highly tunable PHP client library for
20+
Apache Cassandra (1.2+) and DataStax Enterprise (3.1+) using exclusively
21+
Cassandra's binary protocol and Cassandra Query Language v3.

ext/packaging/debian-php7.0/copyright

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Format: http://dep.debian.net/deps/dep5
2+
Upstream-Name: php7.0-cassandra-driver
3+
Source: https://github.com/datastax/php-driver
4+
5+
Files: *
6+
Copyright: Copyright 2014-2017 DataStax
7+
License: Apache-2.0
8+
On Debian systems, the complete text of the Apache License Version 2.0
9+
can be found in `/usr/share/common-licenses/Apache-2.0'.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mod debian/cassandra.ini

ext/packaging/debian-php7.0/rules

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/make -f
2+
3+
# Copied from dh-php: /usr/share/dh-php/pkg-pecl.mk
4+
5+
# See debhelper(7) (uncomment to enable)
6+
# output every command that modifies files on the build system.
7+
#DH_VERBOSE = 1
8+
9+
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
10+
DPKG_EXPORT_BUILDFLAGS = 1
11+
include /usr/share/dpkg/default.mk
12+
13+
# see FEATURE AREAS in dpkg-buildflags(1)
14+
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
15+
16+
# see ENVIRONMENT in dpkg-buildflags(1)
17+
# package maintainers to append CFLAGS
18+
export DEB_CFLAGS_MAINT_APPEND = -Wall
19+
# package maintainers to append LDFLAGS
20+
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
21+
22+
# Don't ever use RPATH on Debian
23+
export PHP_RPATH=no
24+
25+
export DH_PHP_VERSIONS = $(PHP_VERSION)
26+
27+
PECL_NAME := cassandra-driver
28+
INSTALL_ROOT = $(CURDIR)/debian/php$(PHP_VERSION)-cassandra-driver
29+
30+
%:
31+
dh $@ --with php
32+
33+
override_dh_auto_configure:
34+
phpize$(PHP_VERSION)
35+
dh_auto_configure -- --with-cassandra --with-php-config=/usr/bin/php-config$(PHP_VERSION) $(PECL_CONFIGURE_MAINT_APPEND)
36+
37+
override_dh_auto_build:
38+
dh_auto_build -- -j$(NUMJOBS)
39+
40+
override_dh_auto_install:
41+
dh_auto_install -- INSTALL_ROOT=$(INSTALL_ROOT)
42+
43+
override_dh_gencontrol: ,:=,
44+
override_dh_gencontrol:
45+
dh_gencontrol -- "-Vphp:Provides=$(addprefix php,$(addsuffix -$(PECL_NAME)$(,) ,$(PHP_VERSION)))"
46+
47+
override_dh_php:
48+
dh_php -p php$(PHP_VERSION)-$(PECL_NAME)
49+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (quilt)

ext/packaging/debian/changelog

-5
This file was deleted.

ext/packaging/debian/rules

-83
This file was deleted.

0 commit comments

Comments
 (0)