1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
From: Hilko Bengen <bengen@debian.org>
Date: Sat, 14 May 2016 13:34:07 +0200
Subject: Make php buildable with builddir != srcdir
---
php/Makefile.am | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/php/Makefile.am b/php/Makefile.am
index c635abf..6dacc4d 100644
--- a/php/Makefile.am
+++ b/php/Makefile.am
@@ -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 -I$(abs_srcdir)/../include" \
- 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
+ if [ $(srcdir) != $(builddir) ]; then cp -rsft $(builddir)/extension $(abs_srcdir)/extension/.; fi
+ cd extension && $(PHPIZE)
cd extension && ./configure --prefix=$(prefix) --libdir=$(libdir)
test -f "$@" && touch -- $@
@@ -75,8 +65,13 @@ clean-local:
rm -f extension/tests/*.out
rm -f extension/tests/*.php
rm -f extension/tests/*.sh
+ if [ $(srcdir) != $(builddir) ]; then rm -rf extension; fi
install-data-hook:
- $(MAKE) -C extension INSTALL_ROOT=$(DESTDIR) install
+ $(MAKE) -C extension \
+ EXTRA_INCLUDES="-I$(abs_srcdir)/../common/utils -I$(abs_srcdir)/../lib" \
+ EXTRA_LDFLAGS="-L$(abs_builddir)/../lib/.libs -lguestfs" \
+ EXTRA_CFLAGS="-DGUESTFS_PRIVATE=1" \
+ INSTALL_ROOT=$(DESTDIR) install
endif
|