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