1
0
mirror of https://github.com/php/php-src.git synced 2026-04-15 03:51:07 +02:00

Independent versioning for PECL extensions (and only PECL, for now)

This affects the RC template used to ship information with the DLL in Windows distributions - nothing else.
It will potentially affect 13 PECL modules at present (and yes I do know which ones!)
This commit is contained in:
Steph Fox
2008-03-22 09:07:59 +00:00
parent c401491ca0
commit a007d591bf
2 changed files with 89 additions and 38 deletions

View File

@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
// $Id: confutils.js,v 1.60.2.1.2.8.2.3 2008-02-17 01:26:15 pajoye Exp $
// $Id: confutils.js,v 1.60.2.1.2.8.2.4 2008-03-22 09:07:59 sfox Exp $
var STDOUT = WScript.StdOut;
var STDERR = WScript.StdErr;
@@ -835,14 +835,23 @@ function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env
/* emits rule to generate version info for a SAPI
* or extension. Returns the name of the .res file
* that will be generated */
function generate_version_info_resource(makefiletarget, creditspath)
function generate_version_info_resource(makefiletarget, basename, creditspath, sapi)
{
var resname = makefiletarget + ".res";
var res_desc = "PHP " + makefiletarget;
var res_prod_name = res_desc;
var res_desc = makefiletarget;
var credits;
var thanks = "";
var logo = "";
var debug = "";
var project_url = "http://www.php.net";
var project_header = creditspath + "/php_" + basename + ".h";
var versioning = "";
if (sapi) {
var internal_name = basename.toUpperCase() + " SAPI";
} else {
var internal_name = basename.toUpperCase() + " extension";
}
if (FSO.FileExists(creditspath + '/CREDITS')) {
credits = FSO.OpenTextFile(creditspath + '/CREDITS', 1);
@@ -860,8 +869,30 @@ function generate_version_info_resource(makefiletarget, creditspath)
credits.Close();
}
if (creditspath.match(new RegExp("pecl"))) {
project_url = "http://pecl.php.net/" + basename;
/* keep independent versioning PECL-specific for now */
if (FSO.FileExists(project_header)) {
if (header = FSO.OpenTextFile(project_header, 1)) {
contents = header.ReadAll();
/* allowed: x.x.x[-dev|-alpha|-beta][RCx] */
if (contents.match(new RegExp('PHP_' + basename.toUpperCase() + '_VERSION(\\s+)"((\\d+\.\\d+(\.\\d+)?)(\-[a-z]{3,5})?(RC\\d+)?)'))) {
project_version = RegExp.$2;
file_version = RegExp.$3.split('.');
versioning = '\\"" /d EXT_FILE_VERSION=' + file_version[0] + ',' + file_version[1] + ',' + file_version[2] + ' /d EXT_VERSION="\\"' + project_version;
}
header.Close();
}
}
}
if (makefiletarget.match(new RegExp("\\.exe$"))) {
logo = " /D WANT_LOGO ";
logo = " /d WANT_LOGO ";
}
if (PHP_DEBUG != "no") {
debug = " /d _DEBUG";
}
/**
@@ -869,20 +900,22 @@ function generate_version_info_resource(makefiletarget, creditspath)
*/
if (FSO.FileExists(creditspath + '\\template.rc')) {
MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": " + creditspath + "\\template.rc");
MFO.WriteLine("\t$(RC) /fo $(BUILD_DIR)\\" + resname + logo +
' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"' + makefiletarget +
'\\"" /d PRODUCT_NAME="\\"' + res_prod_name + '\\"" /d THANKS_GUYS="\\"' +
thanks + '\\"" ' + creditspath + '\\template.rc');
MFO.WriteLine("\t$(RC) /n /fo $(BUILD_DIR)\\" + resname + logo + debug +
' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"'
+ makefiletarget + '\\"" /d URL="\\"' + project_url
+ '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning +
'\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" ' + creditspath +
'\\template.rc');
return resname;
}
MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": win32\\build\\template.rc");
MFO.WriteLine("\t$(RC) /fo $(BUILD_DIR)\\" + resname + logo +
' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"' + makefiletarget +
'\\"" /d PRODUCT_NAME="\\"' + res_prod_name + '\\"" /d THANKS_GUYS="\\"' +
thanks + '\\"" win32\\build\\template.rc');
MFO.WriteLine("\t$(RC) /n /fo $(BUILD_DIR)\\" + resname + logo + debug +
' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"'
+ makefiletarget + '\\"" /d URL="\\"' + project_url +
'\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning +
'\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" win32\\build\\template.rc');
MFO.WriteBlankLines(1);
return resname;
}
@@ -916,7 +949,7 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
MFO.WriteBlankLines(1);
/* generate a .res file containing version information */
resname = generate_version_info_resource(makefiletarget, configure_module_dirname);
resname = generate_version_info_resource(makefiletarget, sapiname, configure_module_dirname, true);
MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget);
MFO.WriteLine("\t@echo SAPI " + sapiname_for_printing + " build complete");
@@ -1065,7 +1098,7 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
}
var libname = dllname.substring(0, dllname.length-4) + ".lib";
var resname = generate_version_info_resource(dllname, configure_module_dirname);
var resname = generate_version_info_resource(dllname, extname, configure_module_dirname, false);
var ld = "@$(CC)";
MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname);

View File

@@ -19,18 +19,32 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
0 ICON win32\build\php.ico
#endif
#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
#ifndef INTERNAL_NAME /* e.g. 'PHAR extension', 'CGI SAPI' */
# ifdef FILE_DESCRIPTION
#define INTERNAL_NAME FILE_DESCRIPTION /* e.g. 'PHP Script Interpreter', 'GD imaging' */
# else
#define INTERNAL_NAME FILE_NAME /* e.g. 'php5ts.dll', 'php_bz2.dll' */
# endif
#endif
#ifndef URL
#define URL "http://www.php.net"
#endif
#ifndef EXT_VERSION
#define EXT_VERSION PHP_VERSION
#endif
#ifndef EXT_FILE_VERSION
#define EXT_FILE_VERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION
#endif
//Version
VS_VERSION_INFO VERSIONINFO
FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
FILEVERSION EXT_FILE_VERSION
PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
FILEFLAGS (VS_FF_DEBUG|VS_FF_SPECIALBUILD)
#else
FILEFLAGS 0x0L
#endif
@@ -42,19 +56,24 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", THANKS_GUYS "\0"
VALUE "CompanyName", "The PHP Group\0"
VALUE "FileDescription", FILE_DESCRIPTION "\0"
VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
VALUE "InternalName", FILE_NAME "\0"
VALUE "LegalCopyright", "Copyright © 1997-2007 The PHP Group\0"
VALUE "LegalTrademarks", "PHP\0"
VALUE "OriginalFilename", FILE_NAME "\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", PRODUCT_NAME "\0"
VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
VALUE "URL", "http://www.php.net"
VALUE "Comments", THANKS_GUYS
VALUE "CompanyName", "The PHP Group"
#ifdef _DEBUG
VALUE "FileDescription", FILE_DESCRIPTION " (DEBUG)"
#else
VALUE "FileDescription", FILE_DESCRIPTION
#endif
VALUE "FileVersion", EXT_VERSION
VALUE "InternalName", INTERNAL_NAME
VALUE "LegalCopyright", "Copyright © 1997-2008 The PHP Group"
VALUE "LegalTrademarks", "PHP"
VALUE "OriginalFilename", FILE_NAME
VALUE "ProductName", "PHP"
VALUE "ProductVersion", PHP_VERSION
#ifdef _DEBUG
VALUE "SpecialBuild", "Debug build"
#endif
VALUE "URL", URL
END
END
BLOCK "VarFileInfo"
@@ -66,4 +85,3 @@ END
#ifdef MC_INCLUDE
#include MC_INCLUDE
#endif