Skip to content

Commit 8c2c304

Browse files
committed
PHPC-195: Remove mongoc/bson header file workarounds
1 parent bb02c48 commit 8c2c304

File tree

5 files changed

+45
-293
lines changed

5 files changed

+45
-293
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@ $ cd phongo
1212
$ git submodule update --init
1313
$ phpize
1414
$ ./configure
15-
$ make patch
1615
$ make -j8 all
1716
```
1817

19-
The `make patch` operation should be a one time operation, but after pulling it new
20-
changes from upstream.. There may be other patches that need to be applied, likely not.
21-
2218
Be aware that we are submoduling the `master` branch of libmongoc and libbson as
2319
during the development of phongo there are occasional things we require that simply
2420
are not yet in a release (or even finished) :)

Makefile.frag

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ help:
2525
@echo -e "\t$$ make composer"
2626
@echo -e "\t - Installs test dependencies using composer"
2727

28-
@echo ""
29-
@echo -e "\t$$ make patch"
30-
@echo -e "\t - When building phongo from VCS, you must run this once"
31-
3228
@echo ""
3329
@echo -e "\t$$ make release"
3430
@echo -e "\t - Runs the tests and creates the pecl archive on success"
@@ -123,21 +119,6 @@ docs:
123119
release-docs: docs
124120
mkdocs gh-deploy --clean
125121

126-
patch:
127-
@if ! test -e $(top_srcdir)/.patched; then \
128-
for file in `/bin/ls -1 $(top_srcdir)/patches/*.patch | sort -n`; do \
129-
patch -p0 --dry-run -f -s < $$file;\
130-
if test $$? -eq 0; then \
131-
patch -p0 -f -s < $$file;\
132-
echo "$$file patched"; \
133-
else \
134-
echo "$$file cannot be applied!"; \
135-
exit 1; \
136-
fi \
137-
done; \
138-
touch $(top_srcdir)/.patched; \
139-
fi
140-
141122
package.xml:
142123
php bin/prep-release.php $(PHONGO_VERSION)-$(PHONGO_STABILITY)
143124

config.m4

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,7 @@ PHP_ARG_WITH(openssl-dir, OpenSSL dir for phongo,
55
[ --with-openssl-dir[=DIR] openssl install prefix], yes, no)
66

77

8-
AC_DEFUN([MONGOC_DEFINE_FLUSH],[
9-
[echo "#endif" >> $srcdir/src/libmongoc/src/mongoc/mongoc-config.h]
10-
])
11-
AC_DEFUN([BSON_DEFINE_FLUSH],[
12-
[echo "#endif" >> $srcdir/src/libbson/src/bson/bson-config.h]
13-
])
14-
15-
16-
AC_DEFUN([MONGOC_DEFINE_RESET],[
17-
[echo "/* Generated by phongo */
18-
#ifndef MONGOC_CONFIG_H
19-
#define MONGOC_CONFIG_H
20-
21-
" > $srcdir/src/libmongoc/src/mongoc/mongoc-config.h]
22-
])
23-
AC_DEFUN([BSON_DEFINE_RESET],[
24-
[echo "/* Generated by phongo */
25-
#ifndef BSON_CONFIG_H
26-
#define BSON_CONFIG_H
278

28-
" > $srcdir/src/libbson/src/bson/bson-config.h]
29-
])
30-
dnl borrowed from PHP acinclude.m4
31-
AC_DEFUN([BSON_DEFINE],[
32-
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" >> $srcdir/src/libbson/src/bson/bson-config.h]
33-
])
34-
AC_DEFUN([MONGOC_DEFINE],[
35-
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" >> $srcdir/src/libmongoc/src/mongoc/mongoc-config.h]
36-
])
379
dnl borrowed from PHP acinclude.m4
3810
AC_DEFUN([PHP_BSON_BIGENDIAN],
3911
[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
@@ -55,10 +27,11 @@ int main(void)
5527
], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
5628
])
5729
if test $ac_cv_c_bigendian_php = yes; then
58-
BSON_DEFINE([BSON_BYTE_ORDER], 4321)
30+
BSON_BYTE_ORDER=4321
5931
else
60-
BSON_DEFINE([BSON_BYTE_ORDER], 1234)
32+
BSON_BYTE_ORDER=1234
6133
fi
34+
AC_SUBST(BSON_BYTE_ORDER)
6235
])
6336
dnl Borrowed from sapi/fpm/config.m4
6437
AC_DEFUN([PHP_BSON_CLOCK],
@@ -90,7 +63,8 @@ AC_DEFUN([PHP_BSON_CLOCK],
9063
fi
9164
9265
if test "$have_clock_gettime" = "yes"; then
93-
BSON_DEFINE([BSON_HAVE_CLOCK_GETTIME], 1)
66+
BSON_HAVE_CLOCK_GETTIME=1
67+
AC_SUBST(BSON_HAVE_CLOCK_GETTIME)
9468
fi
9569
])
9670

@@ -319,9 +293,9 @@ dnl libmongoc stuff {{{
319293
PHP_ADD_SOURCES_X(PHP_EXT_DIR(phongo)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SSL, [$STD_CFLAGS], shared_objects_phongo, yes)
320294

321295

322-
MONGOC_DEFINE_RESET
323296
PHP_SETUP_OPENSSL(PHONGO_SHARED_LIBADD)
324-
MONGOC_DEFINE([MONGOC_ENABLE_SSL], 1)
297+
MONGOC_ENABLE_SSL=1
298+
AC_SUBST(MONGOC_ENABLE_SSL)
325299

326300

327301
PHP_ARG_WITH(phongo-sasl, Build with Cyrus SASL support,
@@ -348,7 +322,8 @@ if test "$PHP_PHONGO_SASL" != "no"; then
348322
[
349323
PHP_ADD_INCLUDE($PHONGO_SASL_DIR)
350324
PHP_ADD_LIBRARY_WITH_PATH(sasl2, $PHONGO_SASL_DIR/$PHP_LIBDIR, PHONGO_SHARED_LIBADD)
351-
MONGOC_DEFINE(MONGOC_ENABLE_SASL, 1, [MONGO SASL support])
325+
MONGOC_ENABLE_SASL=1
326+
AC_SUBST(MONGOC_ENABLE_SASL)
352327
], [
353328
if test "$PHONGO_SASL" != "auto"; then
354329
AC_MSG_ERROR([MONGO SASL check failed. Please check config.log for more information.])
@@ -398,31 +373,57 @@ dnl }}}
398373
dnl PHONGO_SHARED_DEPENDENCIES="phongodep"
399374
dnl PHP_SUBST(PHONGO_SHARED_DEPENDENCIES)
400375

401-
BSON_DEFINE_RESET
402-
403376
PHP_BSON_BIGENDIAN
404377
AC_HEADER_STDBOOL
405378

406379
if test "$ac_cv_header_stdbool_h" = "yes"; then
407-
BSON_DEFINE([BSON_HAVE_STDBOOL_H], 1)
380+
BSON_HAVE_STDBOOL_H=1
408381
else
409-
BSON_DEFINE([BSON_HAVE_STDBOOL_H], 0)
382+
BSON_HAVE_STDBOOL_H=0
410383
fi
384+
AC_SUBST(HAVE_STDBOOL_H)
411385

412-
BSON_DEFINE([BSON_OS], 1)
386+
BSON_OS=1
387+
AC_SUBST(BSON_OS)
413388

414389
PHP_BSON_CLOCK
415390
AC_CHECK_FUNC(strnlen,ac_cv_func_strnlen=yes,ac_cv_func_strnlen=no)
416391
if test "$ac_cv_func_strnlen" = "yes"; then
417-
BSON_DEFINE([BSON_HAVE_STRNLEN], 1)
392+
BSON_HAVE_STRNLEN=1
418393
fi
394+
AC_SUBST(BSON_HAVE_STRNLEN)
419395
AC_CHECK_FUNC(snprintf,ac_cv_func_snprintf=yes,ac_cv_func_snprintf=no)
420396
if test "$ac_cv_func_snprintf" = "yes"; then
421-
BSON_DEFINE([BSON_HAVE_SNPRINTF], 1)
397+
BSON_HAVE_SNPRINTF=1
422398
fi
423-
424-
MONGOC_DEFINE_FLUSH()
425-
BSON_DEFINE_FLUSH()
399+
AC_SUBST(BSON_HAVE_SNPRINTF)
400+
401+
m4_include(src/libmongoc/build/autotools/Versions.m4)
402+
m4_include(src/libbson/build/autotools/Versions.m4)
403+
MONGOC_MAJOR_VERSION=mongoc_major_version
404+
MONGOC_MINOR_VERSION=mongoc_minor_version
405+
MONGOC_MICRO_VERSION=mongoc_micro_version
406+
MONGOC_API_VERSION=1.0
407+
MONGOC_VERSION=mongoc_version
408+
AC_SUBST(MONGOC_MAJOR_VERSION)
409+
AC_SUBST(MONGOC_MINOR_VERSION)
410+
AC_SUBST(MONGOC_MICRO_VERSION)
411+
AC_SUBST(MONGOC_API_VERSION)
412+
AC_SUBST(MONGOC_VERSION)
413+
BSON_MAJOR_VERSION=bson_major_version
414+
BSON_MINOR_VERSION=bson_minor_version
415+
BSON_MICRO_VERSION=bson_micro_version
416+
BSON_API_VERSION=1.0
417+
BSON_VERSION=bson_version
418+
AC_SUBST(BSON_MAJOR_VERSION)
419+
AC_SUBST(BSON_MINOR_VERSION)
420+
AC_SUBST(BSON_MICRO_VERSION)
421+
AC_SUBST(BSON_API_VERSION)
422+
AC_SUBST(BSON_VERSION)
423+
AC_OUTPUT($srcdir/src/libmongoc/src/mongoc/mongoc-config.h)
424+
AC_OUTPUT($srcdir/src/libmongoc/src/mongoc/mongoc-version.h)
425+
AC_OUTPUT($srcdir/src/libbson/src/bson/bson-config.h)
426+
AC_OUTPUT($srcdir/src/libbson/src/bson/bson-version.h)
426427

427428
dnl This must come after PHP_NEW_EXTENSION, otherwise the srcdir won't be set
428429
PHP_ADD_MAKEFILE_FRAGMENT

patches/0001-libbson-version.patch

Lines changed: 0 additions & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)