fix build step
[m6w6/travis-pecl] / Makefile
index 201d530f8d9b1256c6862311c80c6d8ff62445ff..33c6a740a4d6ff94941d2605a831ab05c8ca9cfb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,14 @@
 export
 
-PHP = 5.6
+PHP ?= 5.6
 JOBS ?= 2
 PHP_MIRROR ?= http://us1.php.net/distributions/
 
+ifdef TRAVIS_JOB_NUMBER
+prefix ?= $(HOME)/job-$(TRAVIS_JOB_NUMBER)
+else
 prefix ?= $(HOME)
+endif
 exec_prefix ?= $(prefix)
 bindir = $(exec_prefix)/bin
 srcdir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
@@ -23,49 +27,66 @@ PECL_SONAME ?= $(if $(shell echo $(PECL) | cut -d: -f2),$(shell echo $(PECL) | c
 PECL_VERSION ?= $(shell echo $(PECL) | cut -d: -f3 -s)
 PECL_INI = $(with_config_file_scan_dir)/pecl.ini
 
-PHP_VERSION ?= $(shell test -e $(srcdir)/php-versions.json && cat $(srcdir)/php-versions.json | /usr/bin/php $(srcdir)/php-version.php $(PHP))
+PHP_VERSION ?= $(shell test -e $(srcdir)/php-versions.json && cat $(srcdir)/php-versions.json | $(srcdir)/php-version.php $(PHP))
 
-.PHONY: all php check clean reconf pecl ext test
 .SUFFIXES:
 
+.PHONY: all
 all: php
 
 ## -- PHP
 
+.PHONY: clean
 clean:
-       @if test -d $(srcdir)/php-$(PHP_VERSION); then cd $(srcdir)/php-$(PHP_VERSION); make distclean || true; done
+       @if test -d $(srcdir)/php-$(PHP_VERSION); then cd $(srcdir)/php-$(PHP_VERSION); make distclean || true; fi
 
+.PHONY: check
 check: $(srcdir)/php-versions.json
        @if test -z "$(PHP)"; then echo "No php version specified, e.g. PHP=5.6"; exit 1; fi
 
+.PHONY: reconf
 reconf: check $(srcdir)/php-$(PHP_VERSION)/configure
        cd $(srcdir)/php-$(PHP_VERSION) && ./configure -C --prefix=$(prefix)
 
+.PHONY: php
 php: check $(bindir)/php
 
 $(srcdir)/php-versions.json: $(srcdir)/php-version.php
-       curl -Sso $@ http://php.net/releases/active.php
+       curl -Sso $@ "http://php.net/releases/index.php?json&version=5&max=-1"
 
 $(srcdir)/php-$(PHP_VERSION)/configure: | $(srcdir)/php-versions.json
-       curl -Ss $(PHP_MIRROR)/php-$(PHP_VERSION).tar.bz2 | tar xj -C $(srcdir)
+       if test $(PHP_VERSION) = "master"; then \
+               cd $(srcdir) && git clone --depth 1 -b master https://github.com/php/php-src php-master && cd php-master && ./buildconf; \
+       else \
+               curl -Ss $(PHP_MIRROR)/php-$(PHP_VERSION).tar.bz2 | tar xj -C $(srcdir); \
+       fi
 
 $(srcdir)/php-$(PHP_VERSION)/Makefile: $(srcdir)/php-$(PHP_VERSION)/configure | $(srcdir)/php-versions.json
        cd $(srcdir)/php-$(PHP_VERSION) && ./configure -C --prefix=$(prefix)
 
 $(srcdir)/php-$(PHP_VERSION)/sapi/cli/php: $(srcdir)/php-$(PHP_VERSION)/Makefile | $(srcdir)/php-versions.json
-       cd $(srcdir)/php-$(PHP_VERSION) && make -s -j $(JOBS) V=0 || make
+       cd $(srcdir)/php-$(PHP_VERSION) && make -j $(JOBS) || make
 
 $(bindir)/php: $(srcdir)/php-$(PHP_VERSION)/sapi/cli/php | $(srcdir)/php-versions.json
-       cd $(srcdir)/php-$(PHP_VERSION) && make -s install V=0
+       cd $(srcdir)/php-$(PHP_VERSION) && make install
 
 $(with_config_file_scan_dir):
        mkdir -p $@
 
 ## -- PECL
 
+.PHONY: pecl-check
 pecl-check:
        @if test -z "$(PECL)"; then echo "No pecl extension specified, e.g. PECL=pecl_http:http"; exit 1; fi
 
+.PHONY: pecl-clean
+pecl-clean:
+       @if test -d $(srcdir)/pecl-$(PECL_EXTENSION); then cd $(srcdir)/pecl-$(PECL_EXTENSION); make distclean || true; fi
+
+.PHONY: pecl-rm
+pecl-rm:
+       rm -f $(extdir)/$(PECL_SONAME).so
+
 $(PECL_INI): | $(with_config_file_scan_dir)
        touch $@
 
@@ -83,15 +104,25 @@ $(srcdir)/pecl-$(PECL_EXTENSION)/Makefile: $(srcdir)/pecl-$(PECL_EXTENSION)/conf
        cd $(srcdir)/pecl-$(PECL_EXTENSION) && ./configure -C
 
 $(srcdir)/pecl-$(PECL_EXTENSION)/.libs/$(PECL_SONAME).so: $(srcdir)/pecl-$(PECL_EXTENSION)/Makefile
-       cd $(srcdir)/pecl-$(PECL_EXTENSION) && make -s -j $(JOBS) V=0 || make
+       cd $(srcdir)/pecl-$(PECL_EXTENSION) && make -j $(JOBS) || make
        
 $(extdir)/$(PECL_SONAME).so: $(srcdir)/pecl-$(PECL_EXTENSION)/.libs/$(PECL_SONAME).so
-       cd $(srcdir)/pecl-$(PECL_EXTENSION) && make -s install V=0
-               
+       cd $(srcdir)/pecl-$(PECL_EXTENSION) && make install
+
+.PHONY: pecl
 pecl: pecl-check php $(extdir)/$(PECL_SONAME).so | $(PECL_INI)
        grep -q extension=$(PECL_SONAME).so $(PECL_INI) || echo extension=$(PECL_SONAME).so >> $(PECL_INI)
 
+.PHONY: ext-clean
+ext-clean: pecl-clean
+
+.PHONY: ext-rm
+ext-rm: pecl-rm
+
+.PHONY: ext
 ext: pecl-check $(srcdir)/pecl-$(PECL_EXTENSION) pecl
+       $(srcdir)/check-packagexml.php package.xml
 
+.PHONY: php
 test: php
-       REPORT_EXIT_STATUS=1 NO_INTERACTION=1 $(bindir)/php run-tests.php -p $(bindir)/php --show-diff tests
+       REPORT_EXIT_STATUS=1 $(bindir)/php run-tests.php -q -p $(bindir)/php --set-timeout 300 --show-diff tests