Opened 4 years ago

Closed 4 years ago

#59815 closed request (fixed)

php: add php74 subports

Reported by: elcheco (Miroslav Koula) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: claudepache (Claude Pache), chrisminett (Chris Minett), ianthrive (Ian Timothy)
Port: php

Description

Hi all,

a new PHP 7.4 was released about a week ago and there's still no port available. When PHP 7.3 was coming there was a port already from RC1 :-)

Could I help somebody somehow? I have checked the GitHub Portfile and there's already some section with PHP 7.4 saying it should be uncommented.

Thank you ;-)

Change History (25)

comment:1 Changed 4 years ago by elcheco (Miroslav Koula)

Summary: php 7.4 is relesed over a weekphp 7.4 is released over a week

comment:2 Changed 4 years ago by mf2k (Frank Schima)

Cc: ryandesign removed
Keywords: php74 removed
Owner: set to ryandesign
Status: newassigned
Type: requestupdate
Version: 2.6.2

Note that a "request" ticket type is only for requesting a new port.

comment:3 Changed 4 years ago by elcheco (Miroslav Koula)

Well, the major language versions of PHP here in DB as different ports -> php56, php70, php 71, php72, php73 and there's no php74 -> that's why I am requesting...

comment:4 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Status: assignedaccepted
Summary: php 7.4 is released over a weekphp: add php74 subports
Type: updaterequest

Yes, I'm aware php 7.4.0 is out. I did try during its alpha/beta/rc cycle to add it, but it is not as simple as just adding the 7.4 version block to the Portfile, because several configure options changed their names. When I have time, I will try to get this done.

comment:5 Changed 4 years ago by elcheco (Miroslav Koula)

Thank you. Primarily I wanted to know if it's in some state or not touched yet ;-)

comment:6 Changed 4 years ago by mf2k (Frank Schima)

Perhaps a better way to put it is that a request is for a new "Portfile" which is not the case here. No legwork about building the project needs to be done here. So perhaps a better type is "enchancement" in this case.

comment:7 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

I don't really care what the ticket is classified as, but the user is requesting a new port that can be installed. The fact that it will actually be a subport inside an existing Portfile is an implementation detail that I would not expect users to know about.

comment:8 Changed 4 years ago by claudepache (Claude Pache)

Cc: claudepache added

comment:9 Changed 4 years ago by elcheco (Miroslav Koula)

Dear Santa,

I wish I'd get a new php74 as my Christmas present :-D

Now seriously, could I help with something @ryandesign? Test, prepare?

Have a nice last advent wekend ;-)

comment:10 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

I don't have any status updates for you right now.

comment:11 Changed 4 years ago by chrisminett (Chris Minett)

Cc: chrisminett added

comment:12 Changed 4 years ago by ianthrive (Ian Timothy)

Cc: ianthrive added

comment:13 Changed 4 years ago by chrisminett (Chris Minett)

@ryandesign I've got a working build of php74 on a branch here:

https://github.com/macports/macports-ports/compare/master...chrisminett:php74

It installs and appears to work OK. I've installed all the core extensions that needed updates for the changed configure args, and compared the output of php -i to php73 to make sure that the correct versions are installed via pkg-config (rather than in some cases using the macOS library).

Outside this branch I've also updated a bunch of non-core extensions like xdebug, memcached, zip, etc. as some of those need changes, but I guess those would be done separately to adding the core PHP version.

I haven't gone the whole way to creating a PR, as I'm still not entirely confident in Tcl or whether some of these changes are even the correct way to add a new PHP version, but hoping that you could make some suggestions so that it might get there!

ChrisM

comment:14 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Thanks! That looks like a lot of the changes I had already found, plus many I hadn't gotten to yet.

As you found, the PHP developers changed a lot of the configure args. I believe the idea is that now it uses pkg-config to find things rather than being told what the prefix for that dependency is. Did you verify that you've got all the dependencies right (specifically, that you've added the port:pkgconfig dependency where needed) by installing each subport with trace mode?

comment:15 Changed 4 years ago by chrisminett (Chris Minett)

I went through the PHP migration docs and changed those that were listed. The only one that appeared to require pkg-config as a build dependency was php-imap. Every one that I changed from standard I installed in trace mode without issue. I haven't installed every single core extension, but I'll do that now!

comment:16 Changed 4 years ago by chrisminett (Chris Minett)

You're correct, there are a few I've missed - I'll update the branch once I've got them all.

I'm not sure about this one: for php-fpm, does the following warning (rather than error) mean that libxml2 needs adding as a build dependency?

Warning: The following files inside the MacPorts prefix not installed by a port were accessed:
  /opt/local/include/libxml2/unicode/localpointer.h
  /opt/local/include/libxml2/unicode/platform.h
  /opt/local/include/libxml2/unicode/ptypes.h
  /opt/local/include/libxml2/unicode/ucnv_err.h
  /opt/local/include/libxml2/unicode/uconfig.h
  /opt/local/include/libxml2/unicode/uenum.h
  /opt/local/include/libxml2/unicode/umachine.h
  /opt/local/include/libxml2/unicode/urename.h
  /opt/local/include/libxml2/unicode/utf.h
  /opt/local/include/libxml2/unicode/utf16.h
  /opt/local/include/libxml2/unicode/utf8.h
  /opt/local/include/libxml2/unicode/utf_old.h
  /opt/local/include/libxml2/unicode/utypes.h
  /opt/local/include/libxml2/unicode/uvernum.h
  /opt/local/include/libxml2/unicode/uversion.h

comment:17 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

libxml2 should already be a library dependency of all the SAPIs, which includes FPM. ("library dependency" means "build and runtime dependency")

comment:18 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

MacPorts is saying that on your system, those files exist but were not installed by a MacPorts port. That's weird. On my system, they were installed by the icu port, which is a dependency of the libxml2 port.

comment:19 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Oh right. /opt/local/include/libxml2/unicode is a symlink to /opt/local/include/unicode and trace mode apparently doesn't recursively resolve symlinks. So you can ignore those messages.

comment:20 Changed 4 years ago by chrisminett (Chris Minett)

OK, so having run them all in trace mode (I must have not done it properly before) they all need pkgconfig except php-dba. Given that PHP is moving to using pkg-config, it seems it might be sensible to add it as a general build dependency in the PHP portfile when the branch is gteq php74. I'm not sure how best to achieve this though, as the SAPI block uses depends_build port:pkgconfig. Is it possible to just put the following above the SAPI if block, or should it be with -append ?

if {[vercmp ${branch} 7.4] >= 0} {
    depends_build    port:pkgconfig
}

comment:21 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Let's make sure that the pkgconfig dependency does not appear on subports that don't need it, so maybe:

if {${subport} ne ${name} && ${php.rootname} ne "dba" && [vercmp ${branch} 7.4] >= 0} {
    ...
}

Let's also make sure that the dependency only gets added once. Adding it more than once looks untidy in port info. One way this could be done is to do it near the end of the subport, after all of the module subports have been defined, maybe in the else part of the existing if {${name} eq ${subport}} block, and to first delete the dependency and then add it. Deleting a nonexistent dependency is permitted (it just does nothing).

if {${name} eq ${subport}} {
    ...
} else {
    if {${php.rootname} ne "dba" && [vercmp ${branch} 7.4] >= 0} {
        depends_build-delete port:pkgconfig
        depends_build-append port:pkgconfig
    }
    ...
}

This way all of the existing dependencies on pkgconfig that appear in some subports can remain as they are and we can handle the additional dependency for php 7.4 in just one place.

comment:22 Changed 4 years ago by chrisminett (Chris Minett)

Thanks @ryandesign!

Modified as you suggested, although I've removed the exception for php74-dba: when I ran the install for all of them again in trace mode, that one now also showed reliance on pkg-config. Makes much more sense that they all need it!

Branch updated with these changes. Do you want me to do a PR from it?

comment:23 in reply to:  22 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to chrisminett:

Do you want me to do a PR from it?

Yes please, then I can test it and add some changes I've got here, and I'll merge it.

comment:24 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

comment:25 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added
Resolution: fixed
Status: acceptedclosed

Oops, I removed the ticket reference when I rewrote the commit message.

Merged in [630fbd12af5faba8636eda9874aac6fd0f83a410/macports-ports].

Thanks very much Chris for doing all the heavy lifting on this update.

Note: See TracTickets for help on using tickets.