Skip to content

Commit

Permalink
Please welcome the new build system.
Browse files Browse the repository at this point in the history
If you encounter any problems, please make sure to email [email protected]
directly.

An introduction can be found on

http://schumann.cx/buildv5.txt
  • Loading branch information
Sascha Schumann committed Mar 7, 2002
1 parent 0e17eea commit 9d9d39a
Show file tree
Hide file tree
Showing 77 changed files with 796 additions and 1,010 deletions.
16 changes: 16 additions & 0 deletions Makefile.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$(builddir)/zend_language_scanner.lo: $(builddir)/zend_language_parser.h
$(builddir)/zend_ini_scanner.lo: $(builddir)/zend_ini_parser.h

$(builddir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l

$(builddir)/zend_language_parser.h: $(builddir)/zend_language_parser.c
$(builddir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@

$(builddir)/zend_ini_parser.h: $(builddir)/zend_ini_parser.c
$(builddir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@

$(builddir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
71 changes: 71 additions & 0 deletions Makefile.global
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
INSTALL = $(top_srcdir)/build/shtool install -c
INSTALL_DATA = $(INSTALL) -m 644

DEFS = -I$(top_builddir)/main -I$(top_srcdir)
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS)


all: $(all_targets)

build-modules: $(PHP_MODULES)

libphp4.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(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 $@

php: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) -o $@

sapi/cli/php: $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS)
$(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS) $(EXTRA_LIBS) -o $@

install: $(install_targets)


install-cli:
$(INSTALL_CLI)

install-sapi:
-@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
-@if test ! -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); then \
for i in 0.0.0 0.0 0; do \
if test -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i; then \
$(LN_S) $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); \
break; \
fi; \
done; \
fi
$(INSTALL_IT)

install-modules:
@test -d modules && \
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) && \
echo "installing shared modules into $(EXTENSION_DIR)" && \
rm -f modules/*.la && \
cp modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) >/dev/null 2>&1 || true

install-tester:
@echo "Installing regression tester"
@$(mkinstalldirs) $(PEAR_INSTALLDIR)
@$(INSTALL) -m 755 $(top_srcdir)/run-tests.php $(INSTALL_ROOT)$(PEAR_INSTALLDIR)

install-su: install-pear install-tester

test: php
TOP_BUILDDIR=$(top_builddir) TOP_SRCDIR=$(top_srcdir) \
$(top_builddir)/php -C -q $(top_srcdir)/run-tests.php \
$(top_srcdir)

clean:
find . -name \*.lo -o -name \*.o -o -name \*.la -o -name \*.a| xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp4.la php sapi/cli/php modules/* libs/*

distclean: clean
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
find . -name Makefile | xargs rm -f

.PHONY: all clean install distclean test
.NOEXPORT:
63 changes: 0 additions & 63 deletions Makefile.in

This file was deleted.

44 changes: 12 additions & 32 deletions README.SELF-CONTAINED-EXTENSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ HOW TO CREATE A SELF-CONTAINED PHP EXTENSION
the PHP source. To create such an extension, three things are
required:

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

Expand Down Expand Up @@ -74,28 +73,9 @@ DEFINING THE NEW EXTENSION
need to specify anything).


CREATING THE MAKEFILE TEMPLATE

The Makefile Template (Makefile.in) contains three lines:

------------------------------------------------------------------------------
LTLIBRARY_SHARED_NAME = foobar.la
LTLIBRARY_SOURCES = foo.c bar.c

include $(top_srcdir)/build/dynlib.mk
------------------------------------------------------------------------------

LTLIBRARY_SHARED_NAME specifies the name of the extension.
It must be of the form `ext-name.la'.

LTLIBRARY_SOURCES specifies the names of the sources files. You can
name an arbitrary number of source files here.

The final include directive includes the build rules (you usually
don't need to care about what happens there). rules.mk and other
files are installed by phpize which we will cover later.


CREATING THE M4 CONFIGURATION FILE

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

if test "$PHP_FOOBAR" != "no"; then
PHP_EXTENSION(foobar, $ext_shared)
PHP_NEW_EXTENSION(foobar, foo.c bar.c, $ext_shared)
fi
------------------------------------------------------------------------------

PHP_ARG_ENABLE will automatically set the correct variables, so
that the extension will be enabled by PHP_EXTENSION in shared mode.
that the extension will be enabled by PHP_NEW_EXTENSION in shared mode.

The first argument of PHP_NEW_EXTENSION describes the name of the
extension. The second names the source-code files. The third passes
$ext_shared which is set by PHP_ARG_ENABLE/WITH to PHP_NEW_EXTENSION.

Please use always PHP_ARG_ENABLE or PHP_ARG_WITH. Even if you do not
plan to distribute your module with PHP, these facilities allow you
to integrate your module easily into the main PHP module framework.
Expand All @@ -131,8 +115,8 @@ CREATING SOURCE FILES

CREATING THE SELF-CONTAINED EXTENSION

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

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

1. In config.m4, use PHP_ARG_WITH/PHP_ARG_ENABLE. Then you will
automatically be able to use --with-foo=shared or
--enable-foo=shared.
automatically be able to use --with-foo=shared[,..] or
--enable-foo=shared[,..].

2. In config.m4, use PHP_EXTENSION(foo, $ext_shared) to enable
2. In config.m4, use PHP_NEW_EXTENSION(foo,.., $ext_shared) to enable
building the extension.

3. Add the following line to Makefile.in:

LTLIBRARY_SHARED_NAME = foo.la

4. Add the following lines to your C source file:
3. Add the following lines to your C source file:

#ifdef COMPILE_DL_FOO
ZEND_GET_MODULE(foo)
Expand Down
4 changes: 4 additions & 0 deletions TODO.BUILDv5
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- fix phpize
- clean up .cvsignores
- purge Makefile.ins and replace PHP_EXTENSION in config.m4s
with appropiate calls to PHP_NEW_EXTENSION
Loading

0 comments on commit 9d9d39a

Please sign in to comment.