X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=Makefile;h=97123171dfb4b5ec27ce5aca3ca61cde702b1b74;hb=2d7406d5c003e208d14a6a755e0971e009e57d00;hp=54ae0bb35138f374e981cf1de7ff7563d790bb07;hpb=772e821e8d7ee8ee7a8b3a4fb2e60e5e67814abe;p=m6w6%2Fpecl-ci diff --git a/Makefile b/Makefile index 54ae0bb..9712317 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,11 @@ 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,68 @@ 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 | $(srcdir)/php-version.php $(PHP)) +PHP_VERSION_MAJOR = $(firstword $(subst ., ,$(PHP))) +PHP_VERSIONS_JSON = $(srcdir)/php-versions$(PHP_VERSION_MAJOR).json +PHP_VERSION ?= $(shell test -e $(PHP_VERSIONS_JSON) && cat $(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 -check: $(srcdir)/php-versions.json +.PHONY: check +check: $(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/index.php?json&version=5&max=-1" +$(PHP_VERSIONS_JSON): $(srcdir)/php-version.php + curl -Sso $@ "http://php.net/releases/index.php?json&version=$(PHP_VERSION_MAJOR)&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,16 +106,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 + +pharext/%: $(PECL_INI) php | $(srcdir)/../%.ext.phar + for phar in $|; do $(bindir)/php $$phar --prefix=$(prefix) --ini=$(PECL_INI); done