Skip to content
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

Is there a way to modify config.m4 and config.w32? #2150

Closed
andrewdalpino opened this issue Feb 18, 2021 · 6 comments · Fixed by #2170
Closed

Is there a way to modify config.m4 and config.w32? #2150

andrewdalpino opened this issue Feb 18, 2021 · 6 comments · Fixed by #2170
Labels
bug nfr New Feature Request
Milestone

Comments

@andrewdalpino
Copy link

andrewdalpino commented Feb 18, 2021

Is there a way to add code to the config.m4 or config.w32 files through Zephir? Or, if we add something manually will it ever get overwritten by Zephir? Here's the issue we're facing RubixML/Tensor#11.

Thank you!

@AlexNDRmac
Copy link
Member

You can add additional flags for compiler with config.json as described in documentation
Any changes (if you add it manually) in config.m4 and config.w32 will be overwritten by zephir generate

@andrewdalpino
Copy link
Author

andrewdalpino commented Feb 23, 2021

Hi @AlexNDRmac, we are now facing two issues related to this. One of the ideas that we have floating around is to run a patch script as part of our build process. Is there anything in the language (Zephir) besides additional compiler flags that would help us in this situation?

RubixML/Tensor#11

RubixML/Tensor#14

Thank you!

@AlexNDRmac
Copy link
Member

AlexNDRmac commented Feb 24, 2021

Hi @andrewdalpino, current version of Zephir does not support template overrides. We will be able to implement this feature in the next version.
As a workaround, I can suggest using the Zephir sources with modified ./templates/ZendEngine3/config.* files, which you will be able to reuse after implementing the feature with template overriding.

@andrewdalpino
Copy link
Author

andrewdalpino commented Feb 25, 2021

That's pretty sweet! Looking forward to it

I did this for now https://github.com/RubixML/Tensor/blob/master/extension-config-patch.php. It runs after calling our custom $ composer compile command.

It looks like we may not need it once we make the switch to the new version of Zephir in the next major release, see RubixML/Tensor#13 (comment).

Thanks again, you guys are the best

@AlexNDRmac AlexNDRmac added the nfr New Feature Request label Feb 25, 2021
@mlocati
Copy link
Contributor

mlocati commented Mar 5, 2021

The docs say that

  • the generate command generates the C source code from the zephir source files
  • the compile command compiles the C source code into the binary extension file(s)
  • the install command install the binary extension file(s).
  • the build command is like calling in sequence generate, compile and install

So, if we need to to patch the config.m4 file, logic suggests that we could adopt this approach:

  • use the generate command
  • patch the config.m4 file
  • use the compile command
  • use the install command

BTW at the moment:

  • calling the compile command also calls the generate command
  • calling the install command also calls the compile command

Which is counter intuitive:

  1. calling the build command is the same as calling the install command (because it calls the compile command, and it also calls the generate command)
  2. we can't do anything (like patching config.m4) between the generate command and the compile command
  3. we can't do anything between the compile command and the install command

@Jeckerson Jeckerson added this to the 0.12.x milestone Mar 5, 2021
@Jeckerson Jeckerson added the bug label Mar 5, 2021
@Jeckerson
Copy link
Member

Related #1733

@Jeckerson Jeckerson modified the milestones: 0.12.x, 0.13.x Mar 21, 2021
Jeckerson added a commit that referenced this issue Mar 23, 2021
Jeckerson added a commit that referenced this issue Mar 23, 2021
Jeckerson added a commit that referenced this issue Mar 23, 2021
Jeckerson added a commit that referenced this issue Mar 23, 2021
AlexNDRmac added a commit that referenced this issue Mar 24, 2021
@Jeckerson Jeckerson linked a pull request Mar 24, 2021 that will close this issue
3 tasks
@Jeckerson Jeckerson modified the milestones: 0.13.x, 0.13.0 Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug nfr New Feature Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants