Make php buildable with builddir != srcdir
authorHilko Bengen <bengen@debian.org>
Sat, 14 May 2016 11:34:07 +0000 (13:34 +0200)
committerHilko Bengen <bengen@debian.org>
Fri, 20 Oct 2017 19:08:12 +0000 (20:08 +0100)
Gbp-Pq: Name 0006-Make-php-buildable-with-builddir-srcdir.patch

php/Makefile.am

index a974cdf21046ddf601c31deda52ae8fb735bc487..de8f20d93934fb3673be5f8e0eb35ba5c17f2043 100644 (file)
@@ -36,26 +36,16 @@ php_DATA = guestfs_php.ini
 
 # In theory: EXTRA_LIBS="-lguestfs"  In fact this doesn't work
 # and we need to add the library to EXTRA_LDFLAGS.
-all: check-builddir-equals-srcdir extension/config.h
+all: extension/config.h
        $(MAKE) -C extension \
          EXTRA_INCLUDES="-I$(abs_srcdir)/../common/utils -I$(abs_srcdir)/../lib" \
-         EXTRA_LDFLAGS="-L$(abs_srcdir)/../lib/.libs -lguestfs" \
+         EXTRA_LDFLAGS="-L$(abs_builddir)/../lib/.libs -lguestfs" \
          EXTRA_CFLAGS="-DGUESTFS_PRIVATE=1" \
          all
 
-# It looks like this is going to be very hard to make work, so
-# disallow it for now.
-check-builddir-equals-srcdir:
-       @if [ $(builddir) != $(srcdir) ]; then \
-         echo "***"; \
-         echo "PHP cannot be built with builddir != srcdir"; \
-         echo "Use ./configure --disable-php"; \
-         echo "***"; \
-         exit 1; \
-       fi
-
 extension/config.h: extension/config.m4 ../config.status
-       cd extension && phpize
+       test $(srcdir) != $(builddir) && cp -rsft $(builddir)/extension $(abs_srcdir)/extension/.
+       cd extension && $(PHPIZE)
        cd extension && ./configure --prefix=$(prefix) --libdir=$(libdir)
        test -f "$@" && touch -- $@
 
@@ -70,6 +60,7 @@ TESTS = run-php-tests.sh
 # rule.  Therefore, don't die if this fails.
 clean-local:
        -$(MAKE) -C extension clean
+       test $(srcdir) != $(builddir) && cp rm -rf extension
        rm -f extension/tests/*.exp
        rm -f extension/tests/*.log
        rm -f extension/tests/*.out