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

Refactored, improved and optimized build script #1218

Merged
merged 3 commits into from
Sep 12, 2013
Merged

Conversation

zerkella
Copy link
Contributor

Most changes:

  • cleaned the script and configuration
  • made all build files to be synchronized to the original ones
  • made it more stable
  • optimized speed - on my laptop it became 2.5x faster - from 27s before to 11s after the changes
  • didn't change the generated file locations, so that other scripts (and local dev environments) do not need to be changed

The much more detailed descriptions are in the commits.

Please, run the script on Linux and try to build Phalcon from safe and one of optimized directories (32bits or 64bits). While I verified it on my Windows, it needs to be checked under Linux as well.

- Made all files to be generated on the fly. Previously php_phalcon.h, config.m4 and config.w32 in every build directory had to be synchronized and edited manually according to changes in Phalcon source directory
- Moved the script to "build" directory, so that it is easily located by anyone, willing to compile extension. Previously, it was located in separate "scripts" directory, so the connection of it with the generated files was very unclear.
- Made it possible to run 'gen-build.php' from any directory. Previously it was required to run the script only from Phalcon root directory.
- Cleaned the script and broke it down into a handful of PSR-compatible classes with clearly defined responsibilities. Previously all the logic was located in one big file and was harder to understand and debug.
- Moved script configuration from source file to separate files in "_resource/config". Previously configuration was mixed with the script logic.
- Made source files to be included in a sorted order, so that generated files content doesn't depend on order of walking through source directory filesystem. This is very convenient for changes tracking and comparing generated files.
- Optimized generation time by changing a number of regexps to plain string searches and replacements
- Optimized generation time by making 32-bit and 64-bit build files to be generated based on 'safe' build files. Previously, each directory was regenerated separately, making same operations on same files.
- Optimized generation time by making lines of 32-bit and 64-bit phalcon.c file to be generated based on one regexp match per source line. Previously, each 32-bit and 64-bit were doing same regexps on same lines of source code.
- Updated documentation to describe the build process
- Removed not used "win32" directory. Previously it was just misleading developers, who were working under Windows, because the directory seemed like a proper way to build extension, while it was not.
@ghost
Copy link

ghost commented Sep 12, 2013

Looks great!

phalcon pushed a commit that referenced this pull request Sep 12, 2013
Refactored, improved and optimized build script
@phalcon phalcon merged commit 67dd2b2 into phalcon:1.3.0 Sep 12, 2013
@phalcon
Copy link
Collaborator

phalcon commented Sep 12, 2013

Nice job!, thanks Andrey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants