summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorPeter Kokot <peterkokot@gmail.com>2019-03-13 20:56:51 +0100
committerPeter Kokot <peterkokot@gmail.com>2019-03-13 20:56:51 +0100
commitd349ea3ceb30b99657c0843f6ffc4ed7af619dd5 (patch)
tree751e12d877e48ada9619c8ff7e2bf80945fbde8c /ext
parent37443a6318e04ef0e6cc993aa7ee0bf1afee5394 (diff)
parenta1b7bc0c8148eaf728fccdffe147e3bc0c03f18e (diff)
downloadphp-git-d349ea3ceb30b99657c0843f6ffc4ed7af619dd5.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Integrate README.EXT_SKEL to help option
Diffstat (limited to 'ext')
-rwxr-xr-xext/ext_skel.php110
1 files changed, 89 insertions, 21 deletions
diff --git a/ext/ext_skel.php b/ext/ext_skel.php
index ff41ee8ccf..4623910ecf 100755
--- a/ext/ext_skel.php
+++ b/ext/ext_skel.php
@@ -31,23 +31,91 @@ function error($message) {
/* {{{ print_help
*/
function print_help() {
- printf('php ext_skel.php --ext <name> [--experimental] [--author <name>]%s', PHP_EOL);
- printf(' [--dir <path>] [--std] [--onlyunix]%s', PHP_EOL);
- printf(' [--onlywindows] [--help]%1$s%1$s', PHP_EOL);
- printf(' --ext <name> The name of the extension defined as <name>%s', PHP_EOL);
- printf(' --experimental Passed if this extension is experimental, this creates%s', PHP_EOL);
- printf(' the EXPERIMENTAL file in the root of the extension%s', PHP_EOL);
- printf(' --author <name> Your name, this is used if --std is passed and%s', PHP_EOL);
- printf(' for the CREDITS file%s', PHP_EOL);
- printf(' --dir <path> Path to the directory for where extension should be%s', PHP_EOL);
- printf(' created. Defaults to the directory of where this script%s', PHP_EOL);
- printf(' lives%s', PHP_EOL);
- printf(' --std If passed, the standard header used%s', PHP_EOL);
- printf(' in extensions that is included in the core, will be used%s', PHP_EOL);
- printf(' --onlyunix Only generate configure scripts for Unix%s', PHP_EOL);
- printf(' --onlywindows Only generate configure scripts for Windows%s', PHP_EOL);
- printf(' --help This help%s', PHP_EOL);
+ if (PHP_OS_FAMILY != 'Windows') {
+ $file_prefix = './';
+ $make_prefix = '';
+ } else {
+ $file_prefix = '';
+ $make_prefix = 'n';
+ }
+ echo <<<HELP
+WHAT IT IS
+
+ It's a tool for automatically creating the basic framework for a PHP extension.
+
+HOW TO USE IT
+
+ Very simple. First, change to the ext/ directory of the PHP sources. Then run
+ the following
+
+ php ext_skel.php --ext extension_name
+
+ and everything you need will be placed in directory ext/extension_name.
+
+ If you don't need to test the existence of any external header files,
+ libraries or functions in them, the extension is ready to be compiled in PHP.
+ To compile the extension run the following:
+
+ cd extension_name
+ phpize
+ {$file_prefix}configure
+ {$make_prefix}make
+
+ Don't forget to run tests once the compilation is done:
+
+ {$make_prefix}make test
+
+ Alternatively, to compile extension in the PHP:
+
+ cd /path/to/php-src
+ {$file_prefix}buildconf
+ {$file_prefix}configure --enable-extension_name
+ {$make_prefix}make
+ {$make_prefix}make test TESTS=ext/extension_name/tests
+
+ The definition of PHP_extension_NAME_VERSION will be present in the
+ php_extension_name.h and injected into the zend_extension_entry definition.
+ This is required by the PECL website for the version string conformity checks
+ against package.xml
+
+SOURCE AND HEADER FILE NAME
+
+ The ext_skel.php script generates 'extension_name.c' and 'php_extension_name.h'
+ as the main source and header files. Keep these names.
+
+ extension functions (User functions) must be named
+
+ extension_name_function()
+
+ When you need to expose extension functions to other extensions, expose
+ functions strictly needed by others. Exposed internal function must be named
+
+ php_extension_name_function()
+
+ See also CODING_STANDARDS.
+
+OPTIONS
+
+ php ext_skel.php --ext <name> [--experimental] [--author <name>]
+ [--dir <path>] [--std] [--onlyunix]
+ [--onlywindows] [--help]
+
+ --ext <name> The name of the extension defined as <name>
+ --experimental Passed if this extension is experimental, this creates
+ the EXPERIMENTAL file in the root of the extension
+ --author <name> Your name, this is used if --std is passed and for the
+ CREDITS file
+ --dir <path> Path to the directory for where extension should be
+ created. Defaults to the directory of where this script
+ lives
+ --std If passed, the standard header used in extensions that
+ is included in the core, will be used
+ --onlyunix Only generate configure scripts for Unix
+ --onlywindows Only generate configure scripts for Windows
+ --help This help
+
+HELP;
exit;
}
/* }}} */
@@ -76,14 +144,14 @@ function print_success() {
$make_prefix = 'n';
}
- printf('%1$sSuccess. The extension is now ready to be compiled into PHP. To do so, use the%s', PHP_EOL);
+ printf('%1$sSuccess. The extension is now ready to be compiled. To do so, use the%s', PHP_EOL);
printf('following steps:%1$s%1$s', PHP_EOL);
- printf('cd /path/to/php-src%s', PHP_EOL);
- printf('%sbuildconf%s', $file_prefix, PHP_EOL);
- printf('%sconfigure --enable-%s%s', $file_prefix, $options['ext'], PHP_EOL);
+ printf('cd /path/to/php-src/%s%s', $options['ext'], PHP_EOL);
+ printf('phpize%s', PHP_EOL);
+ printf('%sconfigure%s', $file_prefix, PHP_EOL);
printf('%smake%2$s%2$s', $make_prefix, PHP_EOL);
printf('Don\'t forget to run tests once the compilation is done:%s', PHP_EOL);
- printf('%smake test TESTS=ext/%s/tests%3$s%3$s', $make_prefix, $options['ext'], PHP_EOL);
+ printf('%smake test%2$s%2$s', $make_prefix, PHP_EOL);
printf('Thank you for using PHP!%s', PHP_EOL);
}
/* }}} */