1
0
Fork 0

Refactoring (and fix #1)

This commit is contained in:
Anton Batenev 2013-05-23 21:30:14 +04:00
parent 03fa07e6a8
commit c04d7308e2
2 changed files with 20 additions and 24 deletions

View file

@ -118,29 +118,33 @@ fi
PDO_SQLITE="${PHP_SRC}/ext/pdo_sqlite" PDO_SQLITE="${PHP_SRC}/ext/pdo_sqlite"
cp "${PDO_SQLITE}/"*.c "${PDO_SQLITE}"/*.h "${BUILD_DIR}/" cp "${PDO_SQLITE}/"*.c "${PDO_SQLITE}"/*.h "${BUILD_DIR}/"
if [ $? -ne 0 ]; then
exit $?
fi
cp "${SQLCIPHER_SRC}/sqlite3.c" "${BUILD_DIR}/sqlite3.c"
if [ $? -ne 0 ]; then
exit $?
fi
cp "${SQLCIPHER_SRC}/sqlite3.h" "${BUILD_DIR}/sqlite3.h"
if [ $? -ne 0 ]; then
exit $?
fi
# magic :) # magic :)
for FILE in "${BUILD_DIR}"/* for FILE in "${BUILD_DIR}"/*
do do
cat "${FILE}" | \ cat "${FILE}" | \
sed -e 's/<sqlite3.h>/"sqlite3.h"/g' | \ sed -e 's/sqlite/sqlcipher/g' | \
sed -e 's/pdo_sqlite/pdo_sqlcipher/g' | \ sed -e 's/SQLite/SQLCipher/g' | \
sed -e 's/php_sqlite3/php_sqlcipher/g' | \ sed -e 's/SQLITE/SQLCIPHER/g' > \
sed -e 's/sqlite_handle_/sqlcipher_handle_/g' | \
sed -e 's/sqlite_stmt_methods/sqlcipher_stmt_methods/g' | \
sed -e 's/sqlite_methods/sqlcipher_methods/g' | \
sed -e 's/SQLite/SQLCipher/g' | \
sed -e 's/sqliteCreate/sqlcipherCreate/g' | \
sed -e 's/PDO_SQLITE/PDO_SQLCIPHER/g' | \
sed -e 's/HEADER(sqlite)/HEADER(sqlcipher)/g' | \
sed -e 's/PDO Driver for SQLite 3.x/PDO Driver for SQLCipher/g' | \
sed -e 's/SQLite Library/SQLCipher Library/g' > \
"${FILE}.tmp" "${FILE}.tmp"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit $? exit $?
fi fi
NEW_FILE=$(echo ${FILE} | sed 's/pdo_sqlite/pdo_sqlcipher/') NEW_FILE=$(echo ${FILE} | sed 's/sqlite/sqlcipher/')
mv "${FILE}.tmp" "${NEW_FILE}" mv "${FILE}.tmp" "${NEW_FILE}"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -159,16 +163,6 @@ done
# Build pdo_sqlcipher # Build pdo_sqlcipher
# #
cp "${SQLCIPHER_SRC}/sqlite3.c" "${BUILD_DIR}/sqlite3.c"
if [ $? -ne 0 ]; then
exit $?
fi
cp "${SQLCIPHER_SRC}/sqlite3.h" "${BUILD_DIR}/sqlite3.h"
if [ $? -ne 0 ]; then
exit $?
fi
cp "config.m4" "${BUILD_DIR}/config.m4" cp "config.m4" "${BUILD_DIR}/config.m4"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit $? exit $?
@ -186,6 +180,8 @@ if [ $? -ne 0 ]; then
exit $? exit $?
fi fi
CFLAGS=$(echo "${CFLAGS}" | sed -e 's/SQLITE/SQLCIPHER/g')
./configure \ ./configure \
CFLAGS="${CFLAGS}" \ CFLAGS="${CFLAGS}" \
LDFLAGS="${LDFLAGS}" LDFLAGS="${LDFLAGS}"

View file

@ -25,7 +25,7 @@ if test "$PHP_PDO_SQLCIPHER" != "no"; then
fi fi
AC_MSG_RESULT($pdo_inc_path) AC_MSG_RESULT($pdo_inc_path)
php_pdo_sqlcipher_sources_core="pdo_sqlcipher.c sqlite_driver.c sqlite_statement.c sqlite3.c" php_pdo_sqlcipher_sources_core="pdo_sqlcipher.c sqlcipher_driver.c sqlcipher_statement.c sqlcipher3.c"
PHP_NEW_EXTENSION(pdo_sqlcipher, $php_pdo_sqlcipher_sources_core, $ext_shared,,-I$pdo_inc_path) PHP_NEW_EXTENSION(pdo_sqlcipher, $php_pdo_sqlcipher_sources_core, $ext_shared,,-I$pdo_inc_path)