xref: /PHP-7.0/ext/phar/Makefile.frag (revision c3d983f3)
1$(srcdir)/phar_path_check.c: $(srcdir)/phar_path_check.re
2	@(cd $(top_srcdir); $(RE2C) --no-generation-date -b -o ext/phar/phar_path_check.c ext/phar/phar_path_check.re)
3
4pharcmd: $(builddir)/phar.php $(builddir)/phar.phar
5
6PHP_PHARCMD_SETTINGS = -n -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0 -d 'safe_mode=0'
7PHP_PHARCMD_EXECUTABLE = ` \
8	if test -x "$(top_builddir)/$(SAPI_CLI_PATH)"; then \
9		$(top_srcdir)/build/shtool echo -n -- "$(top_builddir)/$(SAPI_CLI_PATH) -n"; \
10		if test "x$(PHP_MODULES)" != "x"; then \
11		$(top_srcdir)/build/shtool echo -n -- " -d extension_dir=$(top_builddir)/modules"; \
12		for i in bz2 zlib phar; do \
13			if test -f "$(top_builddir)/modules/$$i.la"; then \
14				. $(top_builddir)/modules/$$i.la; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
15			fi; \
16		done; \
17		fi; \
18	else \
19		$(top_srcdir)/build/shtool echo -n -- "$(PHP_EXECUTABLE)"; \
20	fi;`
21PHP_PHARCMD_BANG = `$(top_srcdir)/build/shtool echo -n -- "$(INSTALL_ROOT)$(bindir)/$(program_prefix)php$(program_suffix)$(EXEEXT)";`
22
23$(builddir)/phar/phar.inc: $(srcdir)/phar/phar.inc
24	-@test -d $(builddir)/phar || mkdir $(builddir)/phar
25	-@test -f $(builddir)/phar/phar.inc || cp $(srcdir)/phar/phar.inc $(builddir)/phar/phar.inc
26
27$(builddir)/phar.php: $(srcdir)/build_precommand.php $(srcdir)/phar/*.inc $(srcdir)/phar/*.php $(SAPI_CLI_PATH)
28	-@echo "Generating phar.php"
29	@$(PHP_PHARCMD_EXECUTABLE) $(PHP_PHARCMD_SETTINGS) $(srcdir)/build_precommand.php > $(builddir)/phar.php
30
31$(builddir)/phar.phar: $(builddir)/phar.php $(builddir)/phar/phar.inc $(srcdir)/phar/*.inc $(srcdir)/phar/*.php $(SAPI_CLI_PATH)
32	-@echo "Generating phar.phar"
33	-@rm -f $(builddir)/phar.phar
34	-@rm -f $(srcdir)/phar.phar
35	@$(PHP_PHARCMD_EXECUTABLE) $(PHP_PHARCMD_SETTINGS) $(builddir)/phar.php pack -f $(builddir)/phar.phar -a pharcommand -c auto -x \\.svn -p 0 -s $(srcdir)/phar/phar.php -h sha1 -b "$(PHP_PHARCMD_BANG)"  $(srcdir)/phar/
36	-@chmod +x $(builddir)/phar.phar
37
38install-pharcmd: pharcmd
39	-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
40	$(INSTALL) $(builddir)/phar.phar $(INSTALL_ROOT)$(bindir)
41	-@rm -f $(INSTALL_ROOT)$(bindir)/phar
42	$(LN_S) -f phar.phar $(INSTALL_ROOT)$(bindir)/phar
43	@$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1
44	@$(INSTALL_DATA) $(builddir)/phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.1
45	@$(INSTALL_DATA) $(builddir)/phar.phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.phar.1
46
47