Skip to content

Commit a7576aa

Browse files
committed
PHPC-1114: Add template.rc file to embed the right MongoDB version in the Windows binary
1 parent 2b87363 commit a7576aa

File tree

6 files changed

+100
-15
lines changed

6 files changed

+100
-15
lines changed

.appveyor/install.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ setlocal enableextensions enabledelayedexpansion
4848

4949
if "%APPVEYOR_REPO_TAG_NAME%"=="" (
5050
set APPVEYOR_REPO_TAG_NAME=%APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT:~0,8%
51-
for /f "delims=" %%l in (php_phongo.h) do (
51+
for /f "delims=" %%l in (phongo_version.h) do (
5252
if not "%%l"=="" (
5353
set line=%%l
54-
if "!line:~8,19!"=="PHP_MONGODB_VERSION" (
54+
if "!line:~8,20!"=="PHP_MONGODB_VERSION " (
5555
set APPVEYOR_REPO_TAG_NAME=!line:~29,-1!-%APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT:~0,8%
5656
)
5757
)

CONTRIBUTING.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,31 +150,36 @@ changes in this maintenance branch. This is important because we will later
150150
merge the ensuing release commits up to master with `--strategy=ours`, which
151151
will ignore changes from the merged commits.
152152

153-
Update the version and stability constants in `php_phongo.h`. This should entail
154-
removing the version's "-dev" suffix and changing the stability to "stable":
153+
Update the version and stability constants in `phongo_version.h`. This should
154+
entail removing the version's "-dev" suffix, changing the stability to
155+
"stable", and increasing the last digit for `PHP_MONGO_VERSION_DESC`:
155156

156157
```
157158
#define PHP_MONGODB_VERSION "1.1.8-dev"
158159
#define PHP_MONGODB_STABILITY "devel"
160+
#define PHP_MONGODB_VERSION_DESC 1,1,8,0
159161
```
160162

161163
The above would be changed to:
162164

163165
```
164166
#define PHP_MONGODB_VERSION "1.1.8"
165167
#define PHP_MONGODB_STABILITY "stable"
168+
#define PHP_MONGODB_VERSION_DESC 1,1,8,1
166169
```
167170

168171
The Makefile targets for creating the PECL package depend on these constants, so
169-
you must rebuild the extension after updating `php_phongo.h`.
172+
you must rebuild the extension after updating `phongo_version.h`.
170173

171174
> **Note:** If this is an alpha or beta release, the version string should
172175
> include the X.Y.Z version followed by the stability and an increment. For
173176
> instance, the first beta release in the 1.4.0 series would be "1.4.0beta1".
174177
> Alpha and beta releases use "alpha" and "beta" stability strings,
175178
> respectively. Release candidates (e.g. "1.4.0RC1") also use "beta" stability.
176179
> See [Documenting release stability and API stability](https://pear.php.net/manual/en/guide.developers.package2.stability.php)
177-
> for more information.
180+
> for more information. For each change to the suffixes of
181+
> `PHP_MONGODB_VERSION`, increment the last digit of
182+
> `PHP_MONGODB_VERSION_DESC`.
178183
179184
### Publish PECL package
180185

@@ -195,10 +200,10 @@ one chance to confirm the package information after uploading.
195200

196201
### Commit version update and release notes
197202

198-
Commit the modified `php_phongo.h` file as "Package X.Y.Z"
203+
Commit the modified `phongo_version.h` file as "Package X.Y.Z"
199204

200205
```
201-
$ git add php_phongo.h
206+
$ git add phongo_version.h
202207
$ git commit -m "Package X.Y.Z"
203208
```
204209

@@ -212,25 +217,27 @@ $ git tag -a -m "Release X.Y.Z" X.Y.Z
212217

213218
### Update version info back to dev
214219

215-
After tagging, the version and stability constants in `php_phongo.h` should be
220+
After tagging, the version and stability constants in `phongo_version.h` should be
216221
updated back to development status.
217222

218223
```
219224
#define PHP_MONGODB_VERSION "1.1.8"
220225
#define PHP_MONGODB_STABILITY "stable"
226+
#define PHP_MONGODB_VERSION_DESC 1,1,8,1
221227
```
222228

223229
The above would be changed to:
224230

225231
```
226232
#define PHP_MONGODB_VERSION "1.1.9-dev"
227233
#define PHP_MONGODB_STABILITY "devel"
234+
#define PHP_MONGODB_VERSION_DESC 1,1,9,0
228235
```
229236

230237
Commit this change:
231238

232239
```
233-
$ git commit -m "Back to -dev" php_phongo.h
240+
$ git commit -m "Back to -dev" phongo_version.h
234241
```
235242

236243
> **Note:** If this is an alpha, beta, or RC release, the version string should

CREDITS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
MongoDB Driver for PHP
2-
Hannes Magnusson, Jeremy Mikola, Derick Rethans
2+
Hannes Magnusson, Jeremy Mikola, Derick Rethans, Katherine Walker

phongo_version.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2014-2018 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef PHONGO_VERSION_H
18+
#define PHONGO_VERSION_H
19+
20+
#define PHP_MONGODB_VERSION "1.5.0-dev"
21+
#define PHP_MONGODB_STABILITY "devel"
22+
#define PHP_MONGODB_VERSION_DESC 1,5,0,0
23+
24+
#endif /* PHONGO_VERSION_H */

php_phongo.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@
2121
#include "bson.h"
2222
#include "mongoc.h"
2323

24+
#include "phongo_version.h"
2425
#include "phongo_compat.h"
2526
#include "php_phongo_classes.h"
2627

2728
#define phpext_mongodb_ptr &mongodb_module_entry
2829
extern zend_module_entry mongodb_module_entry;
2930

30-
/* FIXME: Its annoying to bump version. Move into phongo_version.h.in */
31-
#define PHP_MONGODB_VERSION "1.5.0-dev"
32-
#define PHP_MONGODB_STABILITY "devel"
33-
3431
/* Structure for persisted libmongoc clients. The PID is included to ensure that
3532
* processes do not destroy clients created by other processes (relevant for
3633
* forking). We avoid using pid_t for Windows compatibility. */

template.rc

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* This is a template RC file.
2+
* Do not edit with MSVC */
3+
#ifdef APSTUDIO_INVOKED
4+
# error dont edit with MSVC
5+
#endif
6+
7+
#include "winres.h"
8+
#include "main/php_version.h"
9+
#include "phongo_version.h"
10+
11+
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
12+
#pragma code_page(1252)
13+
14+
#ifndef THANKS_GUYS
15+
# define THANKS_GUYS ""
16+
#endif
17+
18+
//Version
19+
VS_VERSION_INFO VERSIONINFO
20+
FILEVERSION PHP_MONGODB_VERSION_DESC
21+
PRODUCTVERSION PHP_MONGODB_VERSION_DESC
22+
FILEFLAGSMASK 0x3fL
23+
#ifdef _DEBUG
24+
FILEFLAGS VS_FF_DEBUG
25+
#else
26+
FILEFLAGS 0x0L
27+
#endif
28+
FILEOS VOS__WINDOWS32
29+
FILETYPE VFT_DLL
30+
FILESUBTYPE VFT2_UNKNOWN
31+
BEGIN
32+
BLOCK "StringFileInfo"
33+
BEGIN
34+
BLOCK "040904b0"
35+
BEGIN
36+
VALUE "Comments", THANKS_GUYS "\0"
37+
VALUE "CompanyName", "MongoDB, Inc.\0"
38+
VALUE "FileDescription", FILE_DESCRIPTION "\0"
39+
VALUE "FileVersion", PHP_MONGODB_VERSION "\0"
40+
VALUE "InternalName", FILE_NAME "\0"
41+
VALUE "LegalCopyright", "Copyright � 2014-present MongoDB, Inc.\0"
42+
VALUE "OriginalFilename", FILE_NAME "\0"
43+
VALUE "PrivateBuild", "\0"
44+
VALUE "ProductName", "MongoDB Driver for PHP\0"
45+
VALUE "ProductVersion", PHP_MONGODB_VERSION "\0"
46+
VALUE "URL", "https://docs.mongodb.com/ecosystem/drivers/php/"
47+
END
48+
END
49+
BLOCK "VarFileInfo"
50+
BEGIN
51+
VALUE "Translation", 0x409, 1200
52+
END
53+
END
54+
55+
#ifdef MC_INCLUDE
56+
#include MC_INCLUDE
57+
#endif

0 commit comments

Comments
 (0)