-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
[PHP] fix PHP build system #9571
Conversation
@@ -0,0 +1,40 @@ | |||
// Protocol Buffers - Google's data interchange format | |||
// Copyright 2008 Google Inc. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Copyright 2022 Google LLC
is the new form we use here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed thanks
Could you explain more what you mean by this? I'm reluctant to add something to our repo that is only minimally supported. It seems like the kind of thing that could work differently for different PHP versions, and would need more tweaking in the future. Do other third-party PHP extensions support this? Can you point to an example? Since it's such a small amount of code, I'm inclined to think it would be better to patch via a |
@haberman This PR adds that header file. Normally, header files would include declarations such as MINIT, but we did not add them because they are not needed in this case. See the PHP extension skeleton for more information: You may be right that patches are better. |
@acozzette I fixed EXTRA_DIST, please readd |
Can you point to any other popular PHP extensions that are not distributed with PHP but include this |
# include "config.h" | ||
# endif | ||
|
||
extern zend_module_entry protobuf_module_entry; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this file get included by PHP directly? Is that why it needs to be its own file?
Is the name of this file significant? Does it need to be named php_protobuf.h
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not included. This file always exists only in the protobuf repository.
Names are important. The PHP build system automatically references header files according to the naming conventions.
php/ext/google/protobuf/protobuf.c
Outdated
@@ -33,6 +33,8 @@ | |||
#include <php.h> | |||
#include <Zend/zend_interfaces.h> | |||
|
|||
#include "php_protobuf.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be included here? Will one of the other macros reference phpext_protobuf_ptr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, Deleted. Thanks
# endif | ||
|
||
extern zend_module_entry protobuf_module_entry; | ||
# define phpext_protobuf_ptr &protobuf_module_entry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work across a wide variety of PHP versions, or will it need to be changed from version to version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mechanism has been around for a long time and should work with all supported PHP versions.
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a note that this file exists only for the purpose of in-tree builds, and is unused by normal builds of protobuf. Also it is user-supported, and we do not have tests for in-tree builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, thanks
Most PECL extensions meet that requirement. |
@acozzette sorry, i fixed Makefile, please |
This reverts commit e462966.
@acozzette |
@acozzette
|
@zeriyoshi I reran the test and it passed, so I think it must have been a temporary network timeout. |
protobuf is not compatible with the PHP core build system. If you try to build PHP built-in protobuf, you will get the following error
This PR will be minimally supported and adapted to the PHP build system.