Skip to content

display info about system used to build #5798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

remicollet
Copy link
Member

@remicollet remicollet commented Jul 3, 2020

Notice: for now PHP_UNAME is only defined on non -Windows OS, and only used as a fallback for missing system uname function, but a new macro seems cleaner

we can imagine using on downstream build

export PHP_BUILD_SYSTEM="$(cat /etc/redhat-release)"
export PHP_BUILD_PROVIDER="$(rpm --eval %vendor)"

or

export PHP_BUILDER_SYSTEM="Debian $(cat /etc/debian_version)"
export PHP_BUILDER_PROVIDER"Another Inc."

And thus:

$ php -i

PHP Version => 8.0.0-dev

System => Linux builder.remirepo.net 5.6.19-200.fc31.x86_64 #1 SMP Wed Jun 17 16:54:35 UTC 2020 x86_64
Build Date => Jul  3 2020 10:04:32
Build System => Fedora release 31 (Thirty One)
Build Provider => Fedora Project
...

I think such information may be useful for people doing some community support.

@remicollet
Copy link
Member Author

@oerdnj does this make sense for you ?

@remicollet remicollet force-pushed the issue-build-system branch from 572d3d1 to 8682349 Compare July 3, 2020 08:33
@remicollet
Copy link
Member Author

@cmb69 perhaps can also make sense to be defined/displayed for Windows builds ?

@oerdnj
Copy link
Contributor

oerdnj commented Jul 3, 2020

Yes, it could allow Debian to perhaps drop the patching of the version.

@cmb69
Copy link
Member

cmb69 commented Jul 3, 2020

Maybe something like the following?

 win32/build/confutils.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/win32/build/confutils.js b/win32/build/confutils.js
index 5d6ba3baac..713c0ad059 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -126,6 +126,13 @@ build_dirs = new Array();
 extension_include_code = "";
 extension_module_ptrs = "";
 
+(function () {
+	var wmiservice = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2");
+	var oss = wmiservice.ExecQuery("Select * from Win32_OperatingSystem");
+	var os = oss.ItemIndex(0);
+	AC_DEFINE("PHP_BUILDER_SYSTEM", os.Caption + " [" + os.Version + "]", "Windows build system version");
+}());
+
 if (!MODE_PHPIZE) {
 	get_version_numbers();
 }

Would give Microsoft Windows Server 2012 R2 Datacenter [6.3.9600], for instance.

@remicollet
Copy link
Member Author

@oerdnj I also add PHP_BUILD_PROVIDER, to be able to check it (e.g. official debian packages vs your PPA)

@remicollet remicollet force-pushed the issue-build-system branch from 6f9ae33 to a3d90ef Compare July 3, 2020 13:21
@remicollet
Copy link
Member Author

@cmb69 thanks for the Windows scriplet (applied).

For the second macro, it really have to be defined "only" on the builder, defaut value doesn't make sense.

@cmb69
Copy link
Member

cmb69 commented Jul 6, 2020

Support for PHP_BUILD_PROVIDER on Windows:

 win32/build/confutils.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/win32/build/confutils.js b/win32/build/confutils.js
index de84ed9ae3..2f2c01e47d 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -131,6 +131,10 @@ extension_module_ptrs = "";
 	var oss = wmiservice.ExecQuery("Select * from Win32_OperatingSystem");
 	var os = oss.ItemIndex(0);
 	AC_DEFINE("PHP_BUILD_SYSTEM", os.Caption + " [" + os.Version + "]", "Windows build system version");
+	var build_provider = WshShell.Environment("Process").Item("PHP_BUILD_PROVIDER");
+	if (build_provider) {
+		AC_DEFINE("PHP_BUILD_PROVIDER", build_provider);
+	}
 }());
 
 if (!MODE_PHPIZE) {

@remicollet remicollet force-pushed the issue-build-system branch from a3d90ef to 87b1cb4 Compare July 6, 2020 08:53
@php-pulls php-pulls closed this in 8d1a112 Jul 6, 2020
@remicollet remicollet deleted the issue-build-system branch July 6, 2020 08:58
@remicollet
Copy link
Member Author

Applied as ad0d2e4 and 6cef933

@cmb69 thanks again

@cmb69
Copy link
Member

cmb69 commented Jul 6, 2020

Thank you! :)

@carusogabriel carusogabriel added this to the PHP 8.0 milestone Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants