douyan6742 2010-01-20 08:43
浏览 26
已采纳

你能用scons来构建PHP扩展吗?

The standard way of writing PHP extensions is to use autoconf/automake alongside a script called phpize, which seems to generate your autoconf configuration based on a template that's specific to your PHP environment. This let's it build the PHP extension for the right version of PHP, etc.

autoconf and the m4 language that is used to configure it is arcane, and people have written alternatives, such as scons. I want to be able to use one of these when building a PHP extension.

In principle, you should be able to use scons or similar tools to build PHP extensions. However, I can't see how you would replace the phpize step.

Has anyone had any success in building PHP extensions with scons, or another more modern build tool?

  • 写回答

2条回答 默认 最新

  • drq22639 2010-01-24 08:26
    关注

    The path of least resistance would be to have SCons run autoconf, phpize and whatever else is needed for your PHP extension. You may be able to extract the compiler configuration out of there and let SCons do the actual building, or you can simply have SCons run "make".

    Declaring shell command targets from SCons is easy, but getting dependencies right is always tricky.

    Basically you will have to let SCons know of any intermediate file produced by these external tools. This way it can not only properly clean them, but it can also cache the whole series of steps based on the content signature of each intermediate result (MD5 checksum).

    Proper caching will significantly reduce the number of times these external tools will actually need to be invoked as the code base changes.

    While I don't think somebody has written a specific solution for PHP, there are lots of custom builders on the SCons wiki that do similar things.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统