Skip to content

Commit

Permalink
First import
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Zmievski committed Dec 14, 2008
0 parents commit 79db1e4
Show file tree
Hide file tree
Showing 20 changed files with 1,004 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .cvsignore
@@ -0,0 +1,44 @@
*.lo
*.la
.deps
.libs
Makefile
Makefile.fragments
Makefile.global
Makefile.objects
acinclude.m4
aclocal.m4
autom4te.cache
build
config.cache
config.guess
config.h
config.h.in
config.log
config.nice
config.status
config.sub
configure
configure.in
conftest
conftest.c
include
install-sh
libtool
ltmain.sh
missing
mkinstalldirs
modules
scan_makefile_in.awk
*.dsw
*.plg
*.opt
*.ncb
Release
Release_inline
Debug
Release_TS
Release_TSDbg
Release_TS_inline
Debug_TS
memcached*.tgz
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
*.swp
2 changes: 2 additions & 0 deletions CREDITS
@@ -0,0 +1,2 @@
memcached
Andrei Zmievski
5 changes: 5 additions & 0 deletions EXPERIMENTAL
@@ -0,0 +1,5 @@
this extension is experimental,
its functions may change their names
or move to extension all together
so do not rely to much on them
you have been warned!
68 changes: 68 additions & 0 deletions LICENSE
@@ -0,0 +1,68 @@
--------------------------------------------------------------------
The PHP License, Version 3.0
Copyright (c) 1999 - 2003 The PHP Group. All rights reserved.
--------------------------------------------------------------------

Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.

3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact group@php.net.

4. Products derived from this software may not be called "PHP", nor
may "PHP" appear in their name, without prior written permission
from group@php.net. You may indicate that your software works in
conjunction with PHP by saying "Foo for PHP" instead of calling
it "PHP Foo" or "phpfoo"

5. The PHP Group may publish revised and/or new versions of the
license from time to time. Each version will be given a
distinguishing version number.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the terms
of that version. You may also choose to use such covered code
under the terms of any subsequent version of the license
published by the PHP Group. No one other than the PHP Group has
the right to modify the terms applicable to covered code created
under this License.

6. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP, freely available from
<http://www.php.net/>".

THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------

This software consists of voluntary contributions made by many
individuals on behalf of the PHP Group.

The PHP Group can be contacted via Email at group@php.net.

For more information on the PHP Group and the PHP project,
please see <http://www.php.net>.

This product includes the Zend Engine, freely available at
<http://www.zend.com>.
70 changes: 70 additions & 0 deletions README
@@ -0,0 +1,70 @@
This is a standalone PHP extension created using CodeGen_PECL 1.1.2

HACKING
=======

There are two ways to modify an extension created using CodeGen_PECL:

1) you can modify the generated code as with any other PHP extension

2) you can add custom code to the CodeGen_PECL XML source and re-run pecl-gen

The 2nd approach may look a bit complicated but you have be aware that any
manual changes to the generated code will be lost if you ever change the
XML specs and re-run PECL-Gen. All changes done before have to be applied
to the newly generated code again.
Adding code snippets to the XML source itself on the other hand may be a
bit more complicated but this way your custom code will always be in the
generated code no matter how often you rerun CodeGen_PECL.


BUILDING ON UNIX etc.
=====================

To compile your new extension, you will have to execute the following steps:

1. $ ./phpize
2. $ ./configure [--with-memcached=...]
3. $ make
4. $ make test
5. $ [sudo] make install



BUILDING ON WINDOWS
===================

The extension provides the VisualStudio V6 project file

memcached.dsp
To compile the extension you open this file using VisualStudio,
select the apropriate configuration for your installation
(either "Release_TS" or "Debug_TS") and create "php_memcached.dll"

After successfull compilation you have to copy the newly
created "memcached.dll" to the PHP
extension directory (default: C:\PHP\extensions).


TESTING
=======

You can now load the extension using a php.ini directive

extension="memcached.[so|dll]"

or load it at runtime using the dl() function

dl("memcached.[so|dll]");

The extension should now be available, you can test this
using the extension_loaded() function:

if (extension_loaded("memcached"))
echo "memcached loaded :)";
else
echo "something is wrong :(";

The extension will also add its own block to the output
of phpinfo();

58 changes: 58 additions & 0 deletions config.m4
@@ -0,0 +1,58 @@
dnl
dnl $ Id: $
dnl

PHP_ARG_WITH(memcached, libmemcached,[ --with-memcached[=DIR] With memcached support])


if test "$PHP_MEMCACHED" != "no"; then


if test -r "$PHP_MEMCACHED/include/libmemcached/memcached.h"; then
PHP_MEMCACHED_DIR="$PHP_MEMCACHED"
else
AC_MSG_CHECKING(for memcached in default path)
for i in /usr /usr/local; do
if test -r "$i/include/libmemcached/memcached.h"; then
PHP_MEMCACHED_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
if test "x" = "x$PHP_MEMCACHED_DIR"; then
AC_MSG_ERROR(not found)
fi
fi


export OLD_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_MEMCACHED"
export CPPFLAGS="$OLD_CPPFLAGS"

PHP_ADD_INCLUDE($PHP_MEMCACHED_DIR/include)
export OLD_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_MEMCACHED"

AC_MSG_CHECKING(PHP version)
AC_TRY_COMPILE([#include <php_version.h>], [
#if PHP_VERSION_ID < 40000
#error this extension requires at least PHP version 4.0.0
#endif
],
[AC_MSG_RESULT(ok)],
[AC_MSG_ERROR([need at least PHP 4.0.0])])

AC_CHECK_HEADER([libmemcached/memcached.h], [], AC_MSG_ERROR('libmemcached/memcached.h' header not found))
export CPPFLAGS="$OLD_CPPFLAGS"
PHP_SUBST(MEMCACHED_SHARED_LIBADD)

PHP_ADD_LIBRARY_WITH_PATH(memcached, $PHP_MEMCACHED_DIR/lib, MEMCACHED_SHARED_LIBADD)


PHP_SUBST(MEMCACHED_SHARED_LIBADD)
AC_DEFINE(HAVE_MEMCACHED, 1, [ ])

PHP_NEW_EXTENSION(memcached, memcached.c , $ext_shared)

fi

17 changes: 17 additions & 0 deletions config.w32
@@ -0,0 +1,17 @@
// $ Id: $
// vim:ft=javascript

ARG_WITH('memcached', 'libmemcached extension', 'no');

if (PHP_MEMCACHED == "yes") {

if (!CHECK_LIB("memcached.lib", "memcached", PHP_MEMCACHED)) {
ERROR("memcached: library 'memcached' not found");
}

if (!CHECK_HEADER_ADD_INCLUDE("libmemcached/memcached.h", "CFLAGS_MEMCACHED")) {
ERROR("memcached: header 'libmemcached/memcached.h' not found");
}
EXTENSION("memcached", "memcached.c");
AC_DEFINE("HAVE_MEMCACHED", 1, "memcached support");
}
24 changes: 24 additions & 0 deletions manual/Makefile
@@ -0,0 +1,24 @@
#
all: html

confcheck:
@if test "x$(PHPDOC)" = "x"; then echo PHPDOC not set; exit 3; fi

manual.xml: manual.xml.in
sed -e's:@PHPDOC@:$(PHPDOC):g' < manual.xml.in > manual.xml

html: confcheck manual.xml
rm -rf html; mkdir html
SP_ENCODING=XML SP_CHARSET_FIXED=YES openjade -D $(PHPDOC) -wno-idref -c $(PHPDOC)/docbook/docbook-dsssl/catalog -c $(PHPDOC)/phpbook/phpbook-dsssl/defaults/catalog -d $(PHPDOC)/phpbook/phpbook-dsssl/html.dsl -V use-output-dir -t sgml $(PHPDOC)/phpbook/phpbook-xml/phpdocxml.dcl manual.xml

bightml: confcheck manual.xml
rm -rf html; mkdir html
SP_ENCODING=XML SP_CHARSET_FIXED=YES openjade -D $(PHPDOC) -wno-idref -c $(PHPDOC)/docbook/docbook-dsssl/catalog -c $(PHPDOC)/phpbook/phpbook-dsssl/defaults/catalog -d $(PHPDOC)/phpbook/phpbook-dsssl/html.dsl -V nochunks -t sgml $(PHPDOC)/phpbook/phpbook-xml/phpdocxml.dcl manual.xml > manual.html

tex: manual.tex

manual.tex: confcheck manual.xml
SP_ENCODING=XML SP_CHARSET_FIXED=YES openjade -D $(PHPDOC) -wno-idref -c $(PHPDOC)/docbook/docbook-dsssl/catalog -c $(PHPDOC)/phpbook/phpbook-dsssl/defaults/catalog -d $(PHPDOC)/phpbook/phpbook-dsssl/print.dsl -t tex $(PHPDOC)/phpbook/phpbook-xml/phpdocxml.dcl manual.xml

pdf: manual.tex
pdfjadetex manual.tex && pdfjadetex manual.tex && pdfjadetex manual.tex
3 changes: 3 additions & 0 deletions manual/file-entities.ent
@@ -0,0 +1,3 @@
<!ENTITY reference.memcached.reference SYSTEM './memcached/reference.xml'>
<!ENTITY reference.memcached.configure SYSTEM './memcached/configure.xml'>
<!ENTITY reference.memcached.functions SYSTEM './functions.xml'>
Empty file added manual/functions.xml
Empty file.
37 changes: 37 additions & 0 deletions manual/manual.xml.in
@@ -0,0 +1,37 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.1.2//EN'
'@PHPDOC@/dtds/dbxml-4.1.2/docbookx.dtd' [

<!-- Add translated specific definitions and snippets -->
<!ENTITY % language-defs SYSTEM '@PHPDOC@/en/language-defs.ent'>
<!ENTITY % language-snippets SYSTEM '@PHPDOC@/en/language-snippets.ent'>

%language-defs;
%language-snippets;

<!-- Fallback to English definitions and snippets (in case of missing translation) -->
<!ENTITY % language-defs.default SYSTEM '@PHPDOC@/en/language-defs.ent'>
<!ENTITY % language-snippets.default SYSTEM '@PHPDOC@/en/language-snippets.ent'>
<!ENTITY % extensions.default SYSTEM '@PHPDOC@/en/extensions.ent'>

%language-defs.default;
%language-snippets.default;
%extensions.default;

<!-- All global entities for the XML files -->
<!ENTITY % global.entities SYSTEM '@PHPDOC@/entities/global.ent'>

<!ENTITY % file.entities SYSTEM './file-entities.ent'>

<!-- Include all external DTD parts defined previously -->
%global.entities;
%file.entities;

<!-- Autogenerated missing entites and IDs to make build work -->
<!ENTITY % missing-entities SYSTEM '@PHPDOC@/entities/missing-entities.ent'>
%missing-entities;
]>

<book id='manual' lang='en'>
&reference.memcached.reference;
</book>
43 changes: 43 additions & 0 deletions manual/memcached/configure.xml
@@ -0,0 +1,43 @@

<section id='memcached.requirements'>
&reftitle.required;
<para>This extension requires the following library: memcached</para>
<para>This extension requires the following header: libmemcached/memcached.h</para>

</section>


<section id='memcached.install'>
&reftitle.install;
<para>Requires <literal>memcached</literal></para>

</section>


<section id='memcached.configuration'>
&reftitle.runtime;
&no.config;

</section>


<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

0 comments on commit 79db1e4

Please sign in to comment.