Skip to content

Commit 9d9d39a

Browse files
author
Sascha Schumann
committed
Please welcome the new build system.
If you encounter any problems, please make sure to email sas@php.net directly. An introduction can be found on http://schumann.cx/buildv5.txt
1 parent 0e17eea commit 9d9d39a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+796
-1010
lines changed

Makefile.frag

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
$(builddir)/zend_language_scanner.lo: $(builddir)/zend_language_parser.h
2+
$(builddir)/zend_ini_scanner.lo: $(builddir)/zend_ini_parser.h
3+
4+
$(builddir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
5+
$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
6+
7+
$(builddir)/zend_language_parser.h: $(builddir)/zend_language_parser.c
8+
$(builddir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
9+
$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
10+
11+
$(builddir)/zend_ini_parser.h: $(builddir)/zend_ini_parser.c
12+
$(builddir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
13+
$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
14+
15+
$(builddir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
16+
$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l

Makefile.global

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
2+
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
3+
INSTALL = $(top_srcdir)/build/shtool install -c
4+
INSTALL_DATA = $(INSTALL) -m 644
5+
6+
DEFS = -I$(top_builddir)/main -I$(top_srcdir)
7+
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS)
8+
9+
10+
all: $(all_targets)
11+
12+
build-modules: $(PHP_MODULES)
13+
14+
libphp4.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
15+
$(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) -o $@
16+
17+
php: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
18+
$(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) -o $@
19+
20+
sapi/cli/php: $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS)
21+
$(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS) $(EXTRA_LIBS) -o $@
22+
23+
install: $(install_targets)
24+
25+
26+
install-cli:
27+
$(INSTALL_CLI)
28+
29+
install-sapi:
30+
-@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
31+
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
32+
-@if test ! -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); then \
33+
for i in 0.0.0 0.0 0; do \
34+
if test -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i; then \
35+
$(LN_S) $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); \
36+
break; \
37+
fi; \
38+
done; \
39+
fi
40+
$(INSTALL_IT)
41+
42+
install-modules:
43+
@test -d modules && \
44+
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) && \
45+
echo "installing shared modules into $(EXTENSION_DIR)" && \
46+
rm -f modules/*.la && \
47+
cp modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) >/dev/null 2>&1 || true
48+
49+
install-tester:
50+
@echo "Installing regression tester"
51+
@$(mkinstalldirs) $(PEAR_INSTALLDIR)
52+
@$(INSTALL) -m 755 $(top_srcdir)/run-tests.php $(INSTALL_ROOT)$(PEAR_INSTALLDIR)
53+
54+
install-su: install-pear install-tester
55+
56+
test: php
57+
TOP_BUILDDIR=$(top_builddir) TOP_SRCDIR=$(top_srcdir) \
58+
$(top_builddir)/php -C -q $(top_srcdir)/run-tests.php \
59+
$(top_srcdir)
60+
61+
clean:
62+
find . -name \*.lo -o -name \*.o -o -name \*.la -o -name \*.a| xargs rm -f
63+
find . -name .libs -a -type d|xargs rm -rf
64+
rm -f libphp4.la php sapi/cli/php modules/* libs/*
65+
66+
distclean: clean
67+
rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php4.spec sapi/apache/libphp4.module buildmk.stamp
68+
find . -name Makefile | xargs rm -f
69+
70+
.PHONY: all clean install distclean test
71+
.NOEXPORT:

Makefile.in

Lines changed: 0 additions & 63 deletions
This file was deleted.

README.SELF-CONTAINED-EXTENSIONS

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ HOW TO CREATE A SELF-CONTAINED PHP EXTENSION
77
the PHP source. To create such an extension, three things are
88
required:
99

10-
- Makefile template (Makefile.in)
1110
- Configuration file (config.m4)
1211
- Source code for your module
1312

@@ -74,28 +73,9 @@ DEFINING THE NEW EXTENSION
7473
need to specify anything).
7574

7675

77-
CREATING THE MAKEFILE TEMPLATE
78-
79-
The Makefile Template (Makefile.in) contains three lines:
80-
81-
------------------------------------------------------------------------------
82-
LTLIBRARY_SHARED_NAME = foobar.la
83-
LTLIBRARY_SOURCES = foo.c bar.c
84-
85-
include $(top_srcdir)/build/dynlib.mk
86-
------------------------------------------------------------------------------
87-
88-
LTLIBRARY_SHARED_NAME specifies the name of the extension.
89-
It must be of the form `ext-name.la'.
90-
9176
LTLIBRARY_SOURCES specifies the names of the sources files. You can
9277
name an arbitrary number of source files here.
9378

94-
The final include directive includes the build rules (you usually
95-
don't need to care about what happens there). rules.mk and other
96-
files are installed by phpize which we will cover later.
97-
98-
9979
CREATING THE M4 CONFIGURATION FILE
10080

10181
The m4 configuration can perform additional checks. For a
@@ -107,13 +87,17 @@ PHP_ARG_ENABLE(foobar,whether to enable foobar,
10787
[ --enable-foobar Enable foobar])
10888

10989
if test "$PHP_FOOBAR" != "no"; then
110-
PHP_EXTENSION(foobar, $ext_shared)
90+
PHP_NEW_EXTENSION(foobar, foo.c bar.c, $ext_shared)
11191
fi
11292
------------------------------------------------------------------------------
11393

11494
PHP_ARG_ENABLE will automatically set the correct variables, so
115-
that the extension will be enabled by PHP_EXTENSION in shared mode.
95+
that the extension will be enabled by PHP_NEW_EXTENSION in shared mode.
11696

97+
The first argument of PHP_NEW_EXTENSION describes the name of the
98+
extension. The second names the source-code files. The third passes
99+
$ext_shared which is set by PHP_ARG_ENABLE/WITH to PHP_NEW_EXTENSION.
100+
117101
Please use always PHP_ARG_ENABLE or PHP_ARG_WITH. Even if you do not
118102
plan to distribute your module with PHP, these facilities allow you
119103
to integrate your module easily into the main PHP module framework.
@@ -131,8 +115,8 @@ CREATING SOURCE FILES
131115

132116
CREATING THE SELF-CONTAINED EXTENSION
133117

134-
Put Makefile.in, config.m4 and the source files into one directory.
135-
Then run phpize (this is installed during make install by PHP 4.0).
118+
Put config.m4 and the source files into one directory. Afterwards,
119+
run phpize (this is installed during make install by PHP 4.0).
136120
For example, if you configured PHP with --prefix=/php, you would run
137121

138122
$ /php/bin/phpize
@@ -157,17 +141,13 @@ ADDING SHARED MODULE SUPPORT TO A MODULE
157141
support to an existing module called foo.
158142

159143
1. In config.m4, use PHP_ARG_WITH/PHP_ARG_ENABLE. Then you will
160-
automatically be able to use --with-foo=shared or
161-
--enable-foo=shared.
144+
automatically be able to use --with-foo=shared[,..] or
145+
--enable-foo=shared[,..].
162146

163-
2. In config.m4, use PHP_EXTENSION(foo, $ext_shared) to enable
147+
2. In config.m4, use PHP_NEW_EXTENSION(foo,.., $ext_shared) to enable
164148
building the extension.
165149

166-
3. Add the following line to Makefile.in:
167-
168-
LTLIBRARY_SHARED_NAME = foo.la
169-
170-
4. Add the following lines to your C source file:
150+
3. Add the following lines to your C source file:
171151

172152
#ifdef COMPILE_DL_FOO
173153
ZEND_GET_MODULE(foo)

TODO.BUILDv5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- fix phpize
2+
- clean up .cvsignores
3+
- purge Makefile.ins and replace PHP_EXTENSION in config.m4s
4+
with appropiate calls to PHP_NEW_EXTENSION

0 commit comments

Comments
 (0)