Initial commit
This commit is contained in:
		
						commit
						b10e7b0f5d
					
				
					 22 changed files with 1153 additions and 0 deletions
				
			
		
							
								
								
									
										6
									
								
								debian/changelog.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								debian/changelog.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| ${PKG} (${PKG_VERSION}) ${DIST_CODENAME}; urgency=medium | ||||
| 
 | ||||
|   * Build sqlite3 and pdo_sqlite against SQLCipher. | ||||
|   * Drop-in replacement for php${PHP_VER}-sqlite3. | ||||
| 
 | ||||
|  -- ${MAINT_NAME} <${MAINT_EMAIL}>  ${DATE_RFC2822} | ||||
							
								
								
									
										45
									
								
								debian/config.m4
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								debian/config.m4
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | |||
| dnl $Id$ | ||||
| dnl config.m4 for extension pdo_sqlcipher | ||||
| dnl vim:et:sw=2:ts=2: | ||||
| PHP_ARG_ENABLE(pdo_sqlcipher, whether to enable pdo_sqlcipher support, | ||||
| [  --enable-pdo_sqlcipher  Enable pdo_sqlcipher support]) | ||||
| if test "$PHP_PDO_SQLCIPHER" != "no"; then | ||||
|     if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then | ||||
|         AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.]) | ||||
|     fi | ||||
|     AC_MSG_CHECKING([for PDO includes]) | ||||
|     if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then | ||||
|         pdo_inc_path=$abs_srcdir/ext | ||||
|     elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then | ||||
|         pdo_inc_path=$abs_srcdir/ext | ||||
|     elif test -f $phpincludedir/ext/pdo/php_pdo_driver.h; then | ||||
|         pdo_inc_path=$phpincludedir/ext | ||||
|     elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then | ||||
|         pdo_inc_path=$prefix/include/php/ext | ||||
|     elif test -f $prefix/include/php5/ext/pdo/php_pdo_driver.h; then | ||||
|         pdo_inc_path=$prefix/include/php5/ext | ||||
|     elif test -f $prefix/include/php/5.5/php/ext/pdo/php_pdo_driver.h; then | ||||
|         pdo_inc_path=$prefix/include/php/5.5/php/ext | ||||
|     elif test -f $prefix/include/php/5.6/php/ext/pdo/php_pdo_driver.h; then | ||||
|         pdo_inc_path=$prefix/include/php/5.6/php/ext | ||||
|     else | ||||
|         AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) | ||||
|     fi | ||||
|     AC_MSG_RESULT($pdo_inc_path) | ||||
|     php_pdo_sqlcipher_sources_core="pdo_sqlite.c sqlite_driver.c sqlite_statement.c sqlite3.c" | ||||
|     dnl Detect PHP 8.4’s DSN parser unit and compile it if present | ||||
|     AC_MSG_CHECKING([for sqlite_sql_parser.c (PHP 8.4 DSN parser)]) | ||||
|     if test -f "$abs_srcdir/sqlite_sql_parser.c"; then | ||||
|       AC_MSG_RESULT([yes]) | ||||
|       php_pdo_sqlcipher_sources_core="$php_pdo_sqlcipher_sources_core sqlite_sql_parser.c" | ||||
|     else | ||||
|       AC_MSG_RESULT([no]) | ||||
|     fi | ||||
| 
 | ||||
|     PHP_NEW_EXTENSION(pdo_sqlite, $php_pdo_sqlcipher_sources_core, $ext_shared,,-I$pdo_inc_path) | ||||
| 
 | ||||
|     ifdef([PHP_ADD_EXTENSION_DEP], | ||||
|     [ | ||||
|         PHP_ADD_EXTENSION_DEP(pdo_sqlite, pdo) | ||||
|     ]) | ||||
| fi | ||||
							
								
								
									
										28
									
								
								debian/control.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								debian/control.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | |||
| Source: ${PKG} | ||||
| Section: php | ||||
| Priority: optional | ||||
| Maintainer: ${MAINT_NAME} <${MAINT_EMAIL}> | ||||
| Standards-Version: 4.7.2 | ||||
| Build-Depends: | ||||
|  debhelper-compat (= 13), | ||||
|  dh-php, | ||||
|  pkg-php-tools, | ||||
|  ${PHP_BIN}-dev, | ||||
|  libssl-dev, | ||||
|  libsqlite3-dev, | ||||
|  autoconf, automake, libtool, git | ||||
| Rules-Requires-Root: no | ||||
| Homepage: https://www.zetetic.net/sqlcipher | ||||
| 
 | ||||
| Package: ${PKG} | ||||
| Architecture: any | ||||
| Depends: | ||||
|  ${misc:Depends}, | ||||
|  ${shlibs:Depends}, | ||||
|  ${php:Depends}, | ||||
| Provides: ${PHP_BIN}-sqlite3, php-sqlite3 | ||||
| Replaces: ${PHP_BIN}-sqlite3, php-sqlite3 | ||||
| Conflicts: ${PHP_BIN}-sqlite3 | ||||
| Description: SQLite3/SQLCipher module for PHP ${PHP_VER} (drop-in replacement) | ||||
|  SQLCipher-enabled build of PHP’s sqlite3 and pdo_sqlite extensions. | ||||
|  Acts as a drop-in replacement for ${PHP_BIN}-sqlite3. | ||||
							
								
								
									
										161
									
								
								debian/copyright.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										161
									
								
								debian/copyright.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,161 @@ | |||
| Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||||
| Upstream-Name: php-sqlcipher | ||||
| Source: https://github.com/mig5/php-sqlcipher | ||||
| 
 | ||||
| Files: * | ||||
| License: (SQLCipher) Copyright (c) 2025, ZETETIC LLC | ||||
|  All rights reserved. | ||||
|   | ||||
|  Redistribution and use in source and binary forms, with or without | ||||
|  modification, are permitted provided that the following conditions are met: | ||||
|      * Redistributions of source code must retain the above copyright | ||||
|        notice, this list of conditions and the following disclaimer. | ||||
|      * Redistributions in binary form must reproduce the above copyright | ||||
|        notice, this list of conditions and the following disclaimer in the | ||||
|        documentation and/or other materials provided with the distribution. | ||||
|      * Neither the name of the ZETETIC LLC nor the | ||||
|        names of its contributors may be used to endorse or promote products | ||||
|        derived from this software without specific prior written permission. | ||||
|   | ||||
|  THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY | ||||
|  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||
|  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||
|  DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY | ||||
|  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||||
|  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||||
|  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||||
|  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
|  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||||
|  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| 
 | ||||
|  Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
|  of this software and associated documentation files (the "Software"), to deal | ||||
|  in the Software without restriction, including without limitation the rights | ||||
|  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
|  copies of the Software, and to permit persons to do so, subject to the | ||||
|  following conditions: | ||||
|  . | ||||
|  The above copyright notice and this permission notice shall be included in all | ||||
|  copies or substantial portions of the Software. | ||||
|  . | ||||
|  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
|  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
|  SOFTWARE. | ||||
| 
 | ||||
| License: PHP-3.0 | ||||
|  -------------------------------------------------------------------- | ||||
|                    The PHP License, version 3.0 | ||||
|  Copyright (c) 1999 - 2006 The PHP Group. All rights reserved. | ||||
|  -------------------------------------------------------------------- | ||||
|  . | ||||
|  Redistribution and use in source and binary forms, with or without | ||||
|  modification, is permitted provided that the following conditions | ||||
|  are met: | ||||
|  . | ||||
|    1. Redistributions of source code must retain the above copyright | ||||
|       notice, this list of conditions and the following disclaimer. | ||||
|  . | ||||
|    2. Redistributions in binary form must reproduce the above copyright | ||||
|       notice, this list of conditions and the following disclaimer in | ||||
|       the documentation and/or other materials provided with the | ||||
|       distribution. | ||||
|  . | ||||
|    3. The name "PHP" must not be used to endorse or promote products | ||||
|       derived from this software without prior written permission. For | ||||
|       written permission, please contact group@php.net. | ||||
|  . | ||||
|    4. Products derived from this software may not be called "PHP", nor | ||||
|       may "PHP" appear in their name, without prior written permission | ||||
|       from group@php.net.  You may indicate that your software works in | ||||
|       conjunction with PHP by saying "Foo for PHP" instead of calling | ||||
|       it "PHP Foo" or "phpfoo" | ||||
|  . | ||||
|    5. The PHP Group may publish revised and/or new versions of the | ||||
|       license from time to time. Each version will be given a | ||||
|       distinguishing version number. | ||||
|       Once covered code has been published under a particular version | ||||
|       of the license, you may always continue to use it under the terms | ||||
|       of that version. You may also choose to use such covered code | ||||
|       under the terms of any subsequent version of the license | ||||
|       published by the PHP Group. No one other than the PHP Group has | ||||
|       the right to modify the terms applicable to covered code created | ||||
|       under this License. | ||||
|  . | ||||
|    6. Redistributions of any form whatsoever must retain the following | ||||
|       acknowledgment: | ||||
|       "This product includes PHP, freely available from | ||||
|       <http://www.php.net/>". | ||||
|  . | ||||
|  THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND | ||||
|  ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
|  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||||
|  PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PHP | ||||
|  DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||||
|  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||||
|  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||||
|  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
|  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||||
|  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
|  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||||
|  OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| 
 | ||||
| License: PHP-3.01 | ||||
|  -------------------------------------------------------------------- | ||||
|                    The PHP License, version 3.01 | ||||
|  Copyright (c) 1999 - 2015 The PHP Group. All rights reserved. | ||||
|  -------------------------------------------------------------------- | ||||
|  . | ||||
|  Redistribution and use in source and binary forms, with or without | ||||
|  modification, is permitted provided that the following conditions | ||||
|  are met: | ||||
|  . | ||||
|    1. Redistributions of source code must retain the above copyright | ||||
|       notice, this list of conditions and the following disclaimer. | ||||
|  . | ||||
|    2. Redistributions in binary form must reproduce the above copyright | ||||
|       notice, this list of conditions and the following disclaimer in | ||||
|       the documentation and/or other materials provided with the | ||||
|       distribution. | ||||
|  . | ||||
|    3. The name "PHP" must not be used to endorse or promote products | ||||
|       derived from this software without prior written permission. For | ||||
|       written permission, please contact group@php.net. | ||||
|  . | ||||
|    4. Products derived from this software may not be called "PHP", nor | ||||
|       may "PHP" appear in their name, without prior written permission | ||||
|       from group@php.net.  You may indicate that your software works in | ||||
|       conjunction with PHP by saying "Foo for PHP" instead of calling | ||||
|       it "PHP Foo" or "phpfoo" | ||||
|  . | ||||
|    5. The PHP Group may publish revised and/or new versions of the | ||||
|       license from time to time. Each version will be given a | ||||
|       distinguishing version number. | ||||
|       Once covered code has been published under a particular version | ||||
|       of the license, you may always continue to use it under the terms | ||||
|       of that version. You may also choose to use such covered code | ||||
|       under the terms of any subsequent version of the license | ||||
|       published by the PHP Group. No one other than the PHP Group has | ||||
|       the right to modify the terms applicable to covered code created | ||||
|       under this License. | ||||
|  . | ||||
|    6. Redistributions of any form whatsoever must retain the following | ||||
|       acknowledgment: | ||||
|       "This product includes PHP software, freely available from | ||||
|       <http://www.php.net/software/>". | ||||
|  . | ||||
|  THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND | ||||
|  ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||||
|  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||||
|  PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PHP | ||||
|  DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||||
|  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||||
|  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||||
|  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
|  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||||
|  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
|  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||||
|  OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
							
								
								
									
										1
									
								
								debian/pdo_sqlite.ini
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								debian/pdo_sqlite.ini
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| extension=pdo_sqlite | ||||
							
								
								
									
										1
									
								
								debian/pkg.examples.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								debian/pkg.examples.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| tests/test_sqlcipher.php | ||||
							
								
								
									
										2
									
								
								debian/pkg.php.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								debian/pkg.php.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | |||
| mod debian/sqlite3.ini | ||||
| mod debian/pdo_sqlite.ini | ||||
							
								
								
									
										126
									
								
								debian/rules
									
										
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										126
									
								
								debian/rules
									
										
									
									
										vendored
									
									
										Executable file
									
								
							|  | @ -0,0 +1,126 @@ | |||
| #!/usr/bin/make -f | ||||
| 
 | ||||
| # Keep dh defaults, but the actual builds pass explicit flags | ||||
| export DEB_BUILD_MAINT_OPTIONS = hardening=+all | ||||
| export DEB_CFLAGS_MAINT_APPEND = -O2 -fPIC | ||||
| 
 | ||||
| # Match the shell script layout: build in-tree and use .libs directly | ||||
| SQLCIPHER_SRC_DIR := $(CURDIR)/build-sqlcipher | ||||
| export SQLITE_LIBS                = $(SQLCIPHER_SRC_DIR)/.libs/ | ||||
| export SQLCIPHER_LIBDIR_ARG       = $(SQLITE_LIBS)sqlite3.o | ||||
| export STANDARD_SQLCIPHER_CFLAGS  = -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2 -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_EXTRA_INIT=sqlcipher_extra_init -DSQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown | ||||
| export STANDARD_SQLCIPHER_LDFLAGS = -lcrypto -L$(SQLITE_LIBS) | ||||
| export SQLITE_CFLAGS              = -I$(SQLCIPHER_SRC_DIR) $(STANDARD_SQLCIPHER_CFLAGS) | ||||
| 
 | ||||
| # Detect PHP version on the build host | ||||
| PHPCONFIG_CANDIDATE := $(shell \ | ||||
|   if ls -1 /usr/bin/php-config[0-9]* >/dev/null 2>&1; then \ | ||||
|     ls -1 /usr/bin/php-config[0-9]* | sed 's#.*/##' | sort -Vr | head -n1; \ | ||||
|   elif command -v php-config >/dev/null 2>&1; then echo php-config; \ | ||||
|   else echo php-config; fi) | ||||
| PHP_VER ?= $(shell $(PHPCONFIG_CANDIDATE) --version 2>/dev/null | awk -F. '{print $$1"."$$2}') | ||||
| PHPCONFIG := $(shell if command -v php-config$(PHP_VER) >/dev/null 2>&1; then echo php-config$(PHP_VER); else echo $(PHPCONFIG_CANDIDATE); fi) | ||||
| PHPIZE    := $(patsubst php-config%,phpize%,$(PHPCONFIG)) | ||||
| 
 | ||||
| # Extension API dir (e.g. 20240924) | ||||
| PHP_API   := $(shell $(PHPCONFIG) --extension-dir | awk -F/ '{print $$NF}') | ||||
| 
 | ||||
| # Binary package name (must match debian/<package>.php) | ||||
| PACKAGE   ?= php$(PHP_VER)-sqlcipher | ||||
| 
 | ||||
| # Final install path (inside package staging tree) | ||||
| EXTDIR     = debian/$(PACKAGE)/usr/lib/php/$(PHP_API) | ||||
| 
 | ||||
| # Markers to persist paths across recipe lines | ||||
| PHP_SRC_MARKER         = .php_src_dir | ||||
| SQLITE3_DIR_MARKER     = .sqlite3_dir | ||||
| PDO_SQLITE_DIR_MARKER  = .pdo_sqlite_dir | ||||
| 
 | ||||
| # Figure out the matching Debian source package from the dev tool that owns php-config | ||||
| PHP_DEV_PKG := $(shell dpkg-query -S $$(command -v $(PHPCONFIG)) 2>/dev/null | cut -d: -f1 | sed 's/:.*//' | head -n1) | ||||
| 
 | ||||
| # PDO sources and build dir | ||||
| PDO_SRC_DIR  := $(CURDIR)/pdo_sqlcipher | ||||
| PDO_BUILD_DIR := $(PDO_SRC_DIR)/build | ||||
| 
 | ||||
| %: | ||||
| 	dh $@ --with php | ||||
| 
 | ||||
| override_dh_auto_build: | ||||
| 	# 1) Build SQLCipher | ||||
| 	cd "$(SQLCIPHER_SRC_DIR)" && env -u DEB_BUILD_MAINT_OPTIONS -u DEB_CFLAGS_MAINT_APPEND \ | ||||
| 		CFLAGS="$(STANDARD_SQLCIPHER_CFLAGS)" \ | ||||
| 		LDFLAGS="-lcrypto" \ | ||||
| 		./configure --with-tempstore=yes | ||||
| 	$(MAKE) -C "$(SQLCIPHER_SRC_DIR)" | ||||
| 
 | ||||
| 	# 2) Check PHP sources are present, set string vars | ||||
| 	@set -eu; \ | ||||
| 	PHP_SRC_DIR=$$(readlink -f $$(ls -dt php-src/*/ | head -n1 | sed 's#/$$##')); \ | ||||
| 	test -d "$$PHP_SRC_DIR" || { echo "Could not locate extracted php$(PHP_VER) source dir"; ls -al php-src; exit 1; }; \ | ||||
| 	printf '%s' "$$PHP_SRC_DIR" > "$(PHP_SRC_MARKER)"; \ | ||||
| 	SQLITE3_DIR=$$(readlink -f $$(find "$$PHP_SRC_DIR" -type d -path '*/ext/sqlite3' | head -n1)); \ | ||||
| 	test -d "$$SQLITE3_DIR" || { echo "ext/sqlite3 not found under $$PHP_SRC_DIR"; find "$$PHP_SRC_DIR" -maxdepth 4 -type d -name sqlite3; exit 1; }; \ | ||||
| 	printf '%s' "$$SQLITE3_DIR" > "$(SQLITE3_DIR_MARKER)"; \ | ||||
| 	PDO_SQLITE_DIR=$$(readlink -f $$(find "$$PHP_SRC_DIR" -type d -path '*/ext/pdo_sqlite' | head -n1)); \ | ||||
| 	test -d "$$PDO_SQLITE_DIR" || { echo "ext/pdo_sqlite not found under $$PHP_SRC_DIR"; exit 1; }; \ | ||||
| 	printf '%s' "$$PDO_SQLITE_DIR" > "$(PDO_SQLITE_DIR_MARKER)" | ||||
| 
 | ||||
| 	# 2a) Prepare ext/sqlite3 (mv config0.m4, phpize, configure, make) | ||||
| 	@set -eu; \ | ||||
| 	SQLITE3_DIR=$$(cat "$(SQLITE3_DIR_MARKER)"); \ | ||||
| 	if [ -f "$$SQLITE3_DIR/config0.m4" ] && [ ! -f "$$SQLITE3_DIR/config.m4" ]; then \ | ||||
| 	  mv "$$SQLITE3_DIR/config0.m4" "$$SQLITE3_DIR/config.m4"; \ | ||||
| 	fi; \ | ||||
| 	cd "$$SQLITE3_DIR" && $(PHPIZE); \ | ||||
| 	cd "$$SQLITE3_DIR" && env -u DEB_BUILD_MAINT_OPTIONS -u DEB_CFLAGS_MAINT_APPEND \ | ||||
| 		CFLAGS="$(STANDARD_SQLCIPHER_CFLAGS)" \ | ||||
| 		LDFLAGS="$(STANDARD_SQLCIPHER_LDFLAGS)" \ | ||||
| 		./configure --libdir="$(SQLCIPHER_LIBDIR_ARG)" --with-php-config="$(PHPCONFIG)" | ||||
| 	$(MAKE) -C "$$(cat "$(SQLITE3_DIR_MARKER)")" | ||||
| 
 | ||||
| 	# Fix the pic_object in sqlite3.lo so it links to sqlcipher's sqlite3.o | ||||
| 	@set -eu; \ | ||||
| 	PHP_SRC_DIR=$$(cat "$(PHP_SRC_MARKER)"); \ | ||||
| 	sed -i "s|pic_object='.libs/sqlite3.o'|pic_object='.libs/sqlite3.o $(SQLCIPHER_SRC_DIR)/sqlite3.o'|g" \ | ||||
| 		"$$PHP_SRC_DIR/ext/sqlite3/sqlite3.lo" | ||||
| 
 | ||||
| 	# Rebuild the sqlite3 extension after the pic_object fix | ||||
| 	$(MAKE) -C "$$(cat "$(SQLITE3_DIR_MARKER)")" | ||||
| 
 | ||||
| 	# 3) Build PDO SQLCipher | ||||
| 	@set -eu; \ | ||||
| 	PDO_SQLITE_DIR=$$(cat "$(PDO_SQLITE_DIR_MARKER)"); \ | ||||
| 	mkdir -p "$(PDO_BUILD_DIR)"; \ | ||||
| 	cp "$$PDO_SQLITE_DIR"/*.c "$$PDO_SQLITE_DIR"/*.h "$(PDO_BUILD_DIR)/"; \ | ||||
| 	# Bring in sqlcipher amalgamation and config for PDO build | ||||
| 	cp "$(SQLCIPHER_SRC_DIR)/sqlite3.c" "$(PDO_BUILD_DIR)/sqlite3.c"; \ | ||||
| 	cp "$(SQLCIPHER_SRC_DIR)/sqlite3.h" "$(PDO_BUILD_DIR)/sqlite3.h"; \ | ||||
| 	cp "$(SQLCIPHER_SRC_DIR)/sqlite_cfg.h" "$(PDO_BUILD_DIR)/config.h"; \ | ||||
| 	sed -i '1i#include "config.h"' "$(PDO_BUILD_DIR)/sqlite3.c"; \ | ||||
| 	cp "$(PDO_SRC_DIR)/config.m4" "$(PDO_BUILD_DIR)/config.m4"; \ | ||||
| 	cd "$(PDO_BUILD_DIR)" && $(PHPIZE) --clean && $(PHPIZE); \ | ||||
| 	cd "$(PDO_BUILD_DIR)" && env -u DEB_BUILD_MAINT_OPTIONS -u DEB_CFLAGS_MAINT_APPEND \ | ||||
| 		CFLAGS="$(STANDARD_SQLCIPHER_CFLAGS)" \ | ||||
| 		LDFLAGS="$(STANDARD_SQLCIPHER_LDFLAGS)" \ | ||||
| 		./configure --libdir="$(SQLCIPHER_LIBDIR_ARG)" --with-php-config="$(PHPCONFIG)" | ||||
| 	$(MAKE) -C "$(PDO_BUILD_DIR)" | ||||
| 
 | ||||
| override_dh_auto_install: | ||||
| 	@set -eu; \ | ||||
| 	SQLITE3_DIR=$$(cat "$(SQLITE3_DIR_MARKER)"); \ | ||||
| 	install -D -m 0644 "$$SQLITE3_DIR/modules/sqlite3.so" "$(EXTDIR)/sqlite3.so"; \ | ||||
| 	install -D -m 0644 "$(PDO_BUILD_DIR)/modules/pdo_sqlite.so" "$(EXTDIR)/pdo_sqlite.so"; \ | ||||
| 	# Install .ini so dh-php can enable them across SAPIs | ||||
| 	install -D -m 0644 debian/sqlite3.ini    "debian/$(PACKAGE)/usr/share/$(PACKAGE)/sqlite3/sqlite3.ini"; \ | ||||
| 	install -D -m 0644 debian/pdo_sqlite.ini "debian/$(PACKAGE)/usr/share/$(PACKAGE)/sqlite3/pdo_sqlite.ini" | ||||
| 
 | ||||
| override_dh_installexamples: | ||||
| 	dh_installexamples --sourcedir=. | ||||
| 
 | ||||
| override_dh_missing: | ||||
| 	dh_missing --fail-missing | ||||
| 
 | ||||
| override_dh_auto_clean: | ||||
| 	rm -rf "$(PHP_SRC_MARKER)" "$(SQLITE3_DIR_MARKER)" "$(PDO_SQLITE_DIR_MARKER)" | ||||
| 
 | ||||
							
								
								
									
										1
									
								
								debian/source/format
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								debian/source/format
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| 3.0 (native) | ||||
							
								
								
									
										1
									
								
								debian/sqlite3.ini
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								debian/sqlite3.ini
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| extension=sqlite3 | ||||
							
								
								
									
										9
									
								
								debian/tests/basic.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								debian/tests/basic.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| #!/bin/sh | ||||
| set -eux | ||||
| 
 | ||||
| # Sanity: modules must be loaded and report info | ||||
| ${PHP_BIN} --ri sqlite3 | ||||
| ${PHP_BIN} --ri pdo_sqlite | ||||
| 
 | ||||
| # Write an encrypted DB | ||||
| ${PHP_BIN} ${DOC_DIR}/examples/test_sqlcipher.php | ||||
							
								
								
									
										3
									
								
								debian/tests/control.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								debian/tests/control.in
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | |||
| Tests: basic | ||||
| Depends: @, ${PHP_BIN}-cli | ||||
| Restrictions: allow-stderr | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue