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

php: add imagick + mailparse support #42363

Closed

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Jun 22, 2018

Motivation for this change

I have project in which I use the php PECL extensions imagick and mailparse.

Even though these are already available as packages phpPackages.imagick and phpPackages.mailparse, they cannot be used yet, because they require php to be compiled with the --enable-imagick and --enable-mailparse flags.

This PR adds those flags.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@caugner
Copy link
Contributor Author

caugner commented Jun 22, 2018

Okay, since nix-shell -p nox --run "nox-review wip" is still running (for over an hour now), I tried to recreate this in my /etc/nixos/configuration.nix:

# ...

nixpkgs.config.packageOverrides = pkgs: {
  phpCustom = (pkgs.php.merge ({
    name = "php-custom";
    configurateFlags = ["--enable-imagick" "--enable-mailparse"];
  }));

# ...
}

Unfortunately, this did not yield the expected result, i.e. php -m still doesn't list imagick and mailparse as PHP extensions. I suppose I have to add those to the php.ini somehow, but I'm not quite sure yet how that works.

Update:

This did the trick:

# ...

environment.etc."php.d/custom.ini".text = ''
  extension = ${pkgs.phpPackages.imagick}/lib/php/extensions/imagick.so
  extension = ${pkgs.phpPackages.mailparse}/lib/php/extensions/mailparse.so
'';

# ...

So I think this can be considered tested now.

@caugner
Copy link
Contributor Author

caugner commented Jun 22, 2018

Actually the nix-shell -p nox --run "nox-review wip" command failed, but for an unrelated reason as far as I can tell:

/...
[ 83%] Building CXX object hphp/runtime/ext/CMakeFiles/hphp_runtime_ext.dir/domdocument/ext_domdocument.cpp.o
/build/hhvm/hphp/runtime/ext/domdocument/ext_domdocument.cpp: In function 'xmlNode* HPHP::php_dom_libxml_hash_iter(xmlHashTable*, int)':
/build/hhvm/hphp/runtime/ext/domdocument/ext_domdocument.cpp:1471:43: error: invalid conversion from 'void (*)(void*, void*, xmlChar*) {aka void (*)(void*, void*, unsigned char*)}' to 'xmlHashScanner {aka void (*)(void*, void*, const unsigned char*)}' [-fpermissive]
     xmlHashScan(ht, itemHashScanner, &iter);
                                           ^
In file included from /nix/store/p5bfhdm58hgm7wl1f9sgv25i9b9ifw1i-libxml2-2.9.8-dev/include/libxml2/libxml/parser.h:18:0,
                 from /build/hhvm/hphp/runtime/ext/domdocument/ext_domdocument_includes.h:23,
                 from /build/hhvm/hphp/runtime/ext/domdocument/ext_domdocument.h:26,
                 from /build/hhvm/hphp/runtime/ext/domdocument/ext_domdocument.cpp:18:
/nix/store/p5bfhdm58hgm7wl1f9sgv25i9b9ifw1i-libxml2-2.9.8-dev/include/libxml2/libxml/hash.h:212:4: note:   initializing argument 2 of 'void xmlHashScan(xmlHashTablePtr, xmlHashScanner, void*)'
    xmlHashScan (xmlHashTablePtr table,
    ^~~~~~~~~~~
/build/hhvm/hphp/runtime/ext/domdocument/ext_domdocument.cpp: In function 'xmlNode* HPHP::php_dom_libxml_notation_iter(xmlHashTable*, int)':
/build/hhvm/hphp/runtime/ext/domdocument/ext_domdocument.cpp:1484:43: error: invalid conversion from 'void (*)(void*, void*, xmlChar*) {aka void (*)(void*, void*, unsigned char*)}' to 'xmlHashScanner {aka void (*)(void*, void*, const unsigned char*)}' [-fpermissive]
     xmlHashScan(ht, itemHashScanner, &iter);
                                           ^
In file included from /nix/store/p5bfhdm58hgm7wl1f9sgv25i9b9ifw1i-libxml2-2.9.8-dev/include/libxml2/libxml/parser.h:18:0,
                 from /build/hhvm/hphp/runtime/ext/domdocument/ext_domdocument_includes.h:23,
                 from /build/hhvm/hphp/runtime/ext/domdocument/ext_domdocument.h:26,
                 from /build/hhvm/hphp/runtime/ext/domdocument/ext_domdocument.cpp:18:
/nix/store/p5bfhdm58hgm7wl1f9sgv25i9b9ifw1i-libxml2-2.9.8-dev/include/libxml2/libxml/hash.h:212:4: note:   initializing argument 2 of 'void xmlHashScan(xmlHashTablePtr, xmlHashScanner, void*)'
    xmlHashScan (xmlHashTablePtr table,
    ^~~~~~~~~~~
make[2]: *** [hphp/runtime/ext/CMakeFiles/hphp_runtime_ext.dir/build.make:648: hphp/runtime/ext/CMakeFiles/hphp_runtime_ext.dir/domdocument/ext_domdocument.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2136: hphp/runtime/ext/CMakeFiles/hphp_runtime_ext.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
builder for '/nix/store/cb1nk9gk6varvqn38rjcaf5f21zs8y04-hhvm-3.23.2.drv' failed with exit code 2
error: build of '/nix/store/cb1nk9gk6varvqn38rjcaf5f21zs8y04-hhvm-3.23.2.drv' failed
The invocation of "nix-build -A php70Packages.box -A php70Packages.redis -A php70Packages.mailparse -A qcachegrind -A php72Packages.apcu -A php70Packages.ast -A php72Packages.mailparse -A hhvm -A php71Packages.igbinary -A php56Packages.composer -A php56Packages.igbinary -A php71 -A php71Packages.zmq -A piwik -A php72Packages.ast -A php72Packages.imagick -A php72Packages.box -A php56Packages.xcache -A php70Packages.couchbase -A php -A php71Packages.yaml -A php72Packages.composer -A php70Packages.php-cs-fixer -A kcachegrind -A php70Packages.yaml -A nagios -A matomo -A php56Packages.pcs -A php70Packages.v8 -A php56Packages.redis -A php56Packages.memcache -A php56Packages.yaml -A php56Packages.geoip -A php56Packages.phpcbf -A php72Packages.xdebug -A php72Packages.php-parallel-lint -A php72Packages.couchbase -A php56Packages.box -A arcanist -A php72Packages.v8js -A php70Packages.apcu -A limesurvey -A php72Packages.igbinary -A php56Packages.spidermonkey -A php72Packages.v8 -A php71Packages.phpcbf -A php70Packages.xdebug -A php70Packages.v8js -A php71Packages.couchbase -A php72Packages.phpcbf -A php71Packages.php-cs-fixer -A php71-embed -A php70Packages.igbinary -A php70Packages.pcs -A php72Packages.memcached -A php72Packages.php-cs-fixer -A php72Packages.redis -A php71Packages.phpcs -A php71Packages.composer -A php71Packages.redis -A php56Packages.couchbase -A php56Packages.memcached -A php70Packages.phpcbf -A php71Packages.v8js -A php56Packages.zmq -A php70Packages.imagick -A php72Packages.yaml -A php70Packages.composer -A php71Packages.mailparse -A php71Packages.apcu -A php70Packages.zmq -A php71Packages.imagick -A php72Packages.phpcs -A php56Packages.php-cs-fixer -A php71Packages.xdebug -A php71Packages.ast -A php70Packages.memcached -A php72Packages.pcs -A php56Packages.phpcs -A php70 -A php71Packages.v8 -A php56 -A php72Packages.zmq -A php56Packages.imagick -A php71Packages.box -A php71Packages.memcached -A php56Packages.xdebug -A php71Packages.pcs -A php-embed -A php56Packages.apcu -A php56Packages.php-parallel-lint -A php70Packages.phpcs -A nextcloud-news-updater -A yle-dl -A drush -A wp-cli -A php71Packages.php-parallel-lint -A php70Packages.php-parallel-lint /path/to/my/nixpkgs" failed

@caugner caugner force-pushed the php-add-imagick-mailparse-support branch from d1e94f3 to ef3d068 Compare June 22, 2018 13:56
@fpletz
Copy link
Member

fpletz commented Jun 26, 2018

Are you sure this is needed?

The configure script outputs the following:

configure: WARNING: unrecognized options: --enable-imagick, --enable-mailparse, --with-mcrypt

@caugner
Copy link
Contributor Author

caugner commented Aug 30, 2018

Thanks, @fpletz. Looks like it is indeed not needed. :-)

@caugner caugner closed this Aug 30, 2018
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.

None yet

3 participants