internals:windows:buildv2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
internals:windows:buildv2 [2016/11/21 03:18] – created kalleinternals:windows:buildv2 [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 42: Line 42:
  +- ...  +- ...
 </code> </code>
 +
 +===== Extension Config Load Order =====
 +
 +On the Unix build system, the config.m4 files allows a numeric order to be loaded in, this is done by adding a suffix to "config" with a value of 0-9 followed by the file extension, such as "config9.m4". The Windows build system does not offer such, and there are no plans to implement such in this proposal.
  
 ===== Multi Compiler Support ===== ===== Multi Compiler Support =====
Line 294: Line 298:
 </code> </code>
  
-This makes the libraries much easier to handle and check and it provides the same flexibility as before in a more friendly interface.+This makes the libraries much easier to handle and check and it provides the same flexibility as before in a more friendly interface. Above example is just a small illustration of the API that can be used, the full API is described later in this document. 
 + 
 +==== Extension dependencies ==== 
 + 
 +It is common for extensions to depend on others, these can either be optional, required or even semi depended on others, like the ext/curl extension that can depend on ZLib depending on how it was configured. 
 + 
 +In the Extension constructor, the following methods are available for dependencies, the following example will use ext/pdo_sqlite: 
 + 
 +<code javascript> 
 +public function pdo_sqlite() 
 +
 + this.Dependencies(['pdo']); 
 +}; 
 +</code> 
 + 
 +If the 'pdo' extension was not enabled prior to this, then an exception is thrown from the Dependencies() method, stopping the configure command. 
 + 
 +An extension can also optionally depend on another, and if it is available, then an extension can take advantage of its utility: 
 + 
 +<code javascript> 
 +public function test_ext() 
 +
 + // Works for both static and shared builds 
 + if(this.getExtension('json')) 
 +
 + this.Define('HAVE_JSON_SUPPORT', 1); 
 +
 + 
 + // Or if static json is required 
 + if(this.getExtension('json', this.build_type.StaticBuild)) 
 +
 + this.Define('HAVE_STATIC_JSON_SUPPORT', 1); 
 +
 +}; 
 +</code> 
 + 
 +==== Extensions that run external programs, such as parsers ==== 
 + 
 +Some extensions, or SAPIs run external programs before compiling for generating parsers or similar, such is also possible in the new build system: 
 + 
 +<code javascript> 
 +public function json() 
 +
 + if(!this.FSO.FileExists('ext/json/json_scanner.c')) 
 +
 + PHPBuild.ExecuteBinary('re2c', '-t ext/json/php_json_scanner_defs.h --no-generation-date -bci -o ext/json/json_scanner.c ext/json/json_scanner.re'); 
 +
 + 
 + /* ... */ 
 +}; 
 +</code> 
 + 
 +==== Extensions that adds additional configure arguments ==== 
 + 
 +It is very common for extensions to provide additional configurations from arguments, by default each declared extension will be supported by either: 
 + 
 +  * --with-<ext> 
 +  * --enable-<ext> 
 + 
 +This type is defined in the Extension.arg_type property to an enum value of either ArgType.WITH or ArgType.ENABLE. However extensions may also add their own, this is done in the property called 'config_args': 
 + 
 +<code javascript> 
 +class test_ext extends Extension 
 +
 + public const name : string = 'Test Extension'; 
 + public const short_name : string = 'test_ext'; 
 + 
 + public const arg_type : ArgType = ArgType.WITH; 
 + public const config_args : object = { 
 + 'test-ext-debug': ArgType.ENABLE 
 + }; 
 + 
 + public shared : bool; 
 + 
 + public const files : array = ['php_test_ext.c']; 
 + 
 + 
 + public function test_ext() 
 +
 + if(this.GetArg('test-ext-debug').isEnabled()) 
 +
 + this.CFlag('/D HAVE_TEST_EXT_DEBUG'); 
 +
 +
 +
 + 
 +PHPBuild.AddExtension(new test_ext); 
 +</code> 
 + 
 +The GetArg() method returns an 'BuildArgument' object, that contains helper methods, such as isEnabled() to quickly determine the value was turned by a manual --enable-test-ext-debug 
 + 
 +==== Extensions that implements multiple build modess in one config file ==== 
 + 
 +There are some extensions that can be built in multiple ways, one such case is ext/pdo_dblib
  
  
 TODO TODO
   * sapis   * sapis
 +  * consider changing 'new xxx' in calls, as they are executed directly
   * improve arg api for exts   * improve arg api for exts
   * multi build args for an ext   * multi build args for an ext
   * multi extensions per config, like pdo_dblib   * multi extensions per config, like pdo_dblib
-  * configX.m4 support, priority load order 
   * talk about task size and target   * talk about task size and target
   * talk about design reasoning   * talk about design reasoning
   * API reference   * API reference
   * implementation stages(?)   * implementation stages(?)
internals/windows/buildv2.1479698332.txt.gz · Last modified: 2017/09/22 13:28 (external edit)