X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=Makefile;h=972be2d50d3b5ca453e30cbbffd1fb5012f1f8eb;hb=c7e08833ec313ed5b92a9ac30283e4f183480f3b;hp=201d530f8d9b1256c6862311c80c6d8ff62445ff;hpb=3f32c9f45f15e329d1751cdb58cd411a3a5adfcd;p=m6w6%2Fpecl-ci diff --git a/Makefile b/Makefile index 201d530..972be2d 100644 --- 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,28 @@ $(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 + +%.ext.phar: ../%.ext.phar $(PECL_INI) php + $< --prefix=$(prefix) --ini=$(PECL_INI)