[MacPorts] #55471: Use separate portindexes for libc++ on older systems

classic Classic list List threaded Threaded
36 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
#55471: Use separate portindexes for libc++ on older systems
-------------------------+-----------------
 Reporter:  ryandesign   |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  Normal       |  Milestone:
Component:  base         |    Version:
 Keywords:               |       Port:
-------------------------+-----------------
 All of our portindexes are generated by `mprsyncup` on a server running a
 version of macOS that uses libc++ by default. As such, all of the
 portindexes contain information that applies to systems running libc++.
 This means the portindexes are inaccurate on default installations of 10.8
 and earlier, which use libstdc++ (but are accurate for 10.8 and earlier
 systems using the configuration in LibcxxOnOlderSystems).

 Some ports may wish to offer a newer version of software (which requires
 C++11) to libc++ users while continuing to offer an older version (which
 does not require C++11) to libstdc++ users—gnome-online-accounts and
 libomp are examples. Or a port may need a different compiler, or other
 different dependencies, depending on the C++ library—rethinkdb is an
 example.

 The result of this is that, on 10.8 and earlier systems with libstdc++
 today, `port outdated` will show that e.g. libomp 5.0.0 is available, but
 when the user tries to upgrade, nothing happens, because the user already
 has the latest version of libomp that is compatible with libstdc++.

 We need to change `portindex`, to be able to simulate an alternate C++
 standard library; `mprsyncup`, to generate separate libstdc++ and libc++
 portindexes for 10.8 and earlier systems; and `port sync`, to download the
 right portindex for the chosen C++ library.

 We would need to decide what the parent directory name should be so that
 we can make equivalent changes in all the relevant places. Currently, we
 have PortIndex files in the following directories:

 {{{
 $ rsync --no-motd
 rsync://rsync.macports.org/macports/release/ports/PortIndex*
 drwxr-xr-x          4,096 2017/11/24 13:04:06 PortIndex_darwin_10_i386
 drwxr-xr-x          4,096 2017/11/24 13:04:06 PortIndex_darwin_11_i386
 drwxr-xr-x          4,096 2017/11/24 13:04:03 PortIndex_darwin_12_i386
 drwxr-xr-x          4,096 2017/11/24 13:04:04 PortIndex_darwin_13_i386
 drwxr-xr-x          4,096 2017/11/24 13:04:06 PortIndex_darwin_14_i386
 drwxr-xr-x          4,096 2017/11/24 13:04:06 PortIndex_darwin_15_i386
 drwxr-xr-x          4,096 2017/11/24 13:04:06 PortIndex_darwin_16_i386
 drwxr-xr-x          4,096 2017/11/24 13:04:03 PortIndex_darwin_17_i386
 drwxr-xr-x          4,096 2017/11/24 13:04:03 PortIndex_darwin_8_i386
 drwxr-xr-x          4,096 2017/11/24 13:04:06 PortIndex_darwin_8_powerpc
 drwxr-xr-x          4,096 2017/11/24 13:04:06 PortIndex_darwin_9_i386
 drwxr-xr-x          4,096 2017/11/24 13:04:06 PortIndex_darwin_9_powerpc
 }}}

 It makes the most sense to me to consider the C++ library part of the
 platform, i.e. "darwin 10" (libstdc++) and "darwin 10 libc++" are two
 different platforms.

 If we agree on that, then we could put older systems' libc++ portindexes
 into e.g.:

 {{{
 PortIndex_darwin_10_libcxx_i386
 PortIndex_darwin_11_libcxx_i386
 PortIndex_darwin_12_libcxx_i386
 PortIndex_darwin_8_libcxx_i386
 PortIndex_darwin_8_libcxx_powerpc
 PortIndex_darwin_9_libcxx_i386
 PortIndex_darwin_9_libcxx_powerpc
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/55471>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+-----------------
  Reporter:  ryandesign   |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+-----------------
Changes (by ryandesign):

 * Attachment "mprsyncup.diff" added.


--
Ticket URL: <https://trac.macports.org/ticket/55471>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+-----------------
  Reporter:  ryandesign   |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+-----------------

Comment (by ryandesign):

 We need to be careful that, in simulating another C++ library, we only
 change the default C++ library, and do not disturb ports that override
 that default. For example:

 * mongodb always uses libc++, even on systems that default to libstdc++
 * giza-pp always uses libstdc++, even on systems that default to libc++

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+-----------------
  Reporter:  ryandesign   |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+-----------------
Changes (by ryandesign):

 * Attachment "portindex.tcl.diff" added.


--
Ticket URL: <https://trac.macports.org/ticket/55471>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+-----------------
  Reporter:  ryandesign   |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+-----------------
Changes (by ryandesign):

 * Attachment "macports.tcl.diff" added.


--
Ticket URL: <https://trac.macports.org/ticket/55471>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+-----------------
  Reporter:  ryandesign   |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+-----------------

Comment (by mojca):

 I would say that your proposal makes perfect sense. Name for `portindex`
 is a much less tricky issue than the binary packages.

 I would keep the default names at their current values and would change
 the one for `libcxx` (even though: doesn't `libc++` work as folder name?),
 according to your proposal, except that I don't know if it makes any sense
 whatsoever to do `libc++` on PPC.

 It would potentially make sense to support gcc's libstdc++v3 on PPC and
 that one could be called
 ```
 PortIndex_darwin_9_libstdcxx_powerpc
 ```
 where `libstdcxx` would stand for libstdc++v3. I don't know if we have any
 explicit support for that in base though.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+-----------------
  Reporter:  ryandesign   |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+-----------------

Comment (by mojca):

 Modifying the following chunk of code of `mprsyncup` seems trivial:
 {{{
 #!bash
 PLATFORMS="8_powerpc 8_i386 9_powerpc 9_i386 10_i386 11_i386 12_i386
 13_i386 14_i386 15_i386 16_i386 17_i386"
 for PLATFORM in $PLATFORMS; do
     INDEX="PortIndex_darwin_${PLATFORM}"
     ${PORTINDEX} -p "macosx_${PLATFORM}" -o "${INDEX}" \
         | ${AWK} '{ print "Updating " idx ":\t" $0 }' idx="$INDEX" \
         | expand -t 40,48,56,64,72,80 &
 done
 }}}
 Looking at the sources of `portindex`:
 {{{
 #!tcl
 } elseif {$arg eq "-p"} { # Set platform
     incr i
     set platlist [split [lindex $argv $i] _]
     set os_platform [lindex $platlist 0]
     set os_major [lindex $platlist 1]
     set os_arch [lindex $platlist 2]
     if {$os_platform eq "macosx"} {
         lappend port_options os.subplatform $os_platform
 os.universal_supported yes
         set os_platform darwin
     }
 }}}
 it kind of looks like a bad idea to try to squeeze `_libc++` into
 `10_i386` as in
 {{{
 portindex -p macosx_10_libcxx_i386
 }}}
 and break indexing. Maybe something like
 {{{
 portindex -p macosx_10_i386 -stdlib libc++
 }}}
 or (less ideal)
 {{{
 portindex -p macosx-libc++_10_i386
 }}}
 would be a better fit?

 I also wouldn't really mind having a directory structure like this one:
 {{{
     PortIndex_darwin_8_i386
     PortIndex_darwin_8_i386/libc++
     PortIndex_darwin_8_powerpc
     PortIndex_darwin_8_powerpc/libstdc++
     PortIndex_darwin_9_i386
     PortIndex_darwin_9_i386/libc++
     PortIndex_darwin_9_powerpc
     PortIndex_darwin_9_powerpc/libstdc++
 }}}
 if that doesn't bring too many additional complications for generating the
 tarballs or calling selfupdate (one can exclude folders when using rsync).

 While at it: why do we have a separate `portindex` for `powerpc`, but not
 for `x86_64`?

 One further question. While writing some `Portfiles` I remember
 experiencing problems by not being able to tell the difference between the
 globally set stdlib and the one that could have come from a PortGroup. I
 hope that won't be a problem for `Portindex`, I need to check.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+-----------------
  Reporter:  ryandesign   |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+-----------------

Comment (by ryandesign):

 Replying to [comment:2 mojca]:
 > I would keep the default names at their current values and would change
 the one for `libcxx` (even though: doesn't `libc++` work as folder name?)

 It would. But elsewhere in MacPorts, we have adopted the convention that
 "+" becomes "x" so I adopted it here. We did that in port names so that
 the "+" would not be confused with the syntax for specifying a variant;
 that reason doesn't apply here. I also wasn't sure if PortIndex files
 would ever be transferred over http; if so, the "+" would need to be
 percent-encoded to "%20", and I wasn't sure if that might introduce
 problems.

 > according to your proposal, except that I don't know if it makes any
 sense whatsoever to do `libc++` on PPC.

 As far as I know, at this time, libc++ doesn't work on PowerPC generally.
 I think Ken had found a way to make it work with some additional hacking.

 > It would potentially make sense to support gcc's libstdc++v3 on PPC and
 that one could be called
 > {{{
 > PortIndex_darwin_9_libstdcxx_powerpc
 > }}}
 > where `libstdcxx` would stand for libstdc++v3. I don't know if we have
 any explicit support for that in base though.

 I don't know; I hadn't heard of that before.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+-----------------
  Reporter:  ryandesign   |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+-----------------

Comment (by ryandesign):

 Replying to [comment:3 mojca]:
 > Modifying the following chunk of code of `mprsyncup` seems trivial:

 You did see the attached patches, where I already made the modifications?

 > it kind of looks like a bad idea to try to squeeze `_libc++` into
 `10_i386` as in
 > {{{
 > portindex -p macosx_10_libcxx_i386
 > }}}
 > and break indexing.

 What do you mean, "break indexing"?

 > Maybe something like
 > {{{
 > portindex -p macosx_10_i386 -stdlib libc++
 > }}}
 > or (less ideal)
 > {{{
 > portindex -p macosx-libc++_10_i386
 > }}}
 > would be a better fit?

 I did consider and did initially implement a `-stdlib` flag, before
 deciding that I liked it better next to the OS version number. The stdlib
 is no less a part of the PortIndex identification than the OS name,
 version, or arch; since those three don't have individual flags, I didn't
 think we should add a separate flag for stdlib.

 > I also wouldn't really mind having a directory structure like this one:
 > {{{
 >     PortIndex_darwin_8_i386
 >     PortIndex_darwin_8_i386/libc++
 >     PortIndex_darwin_8_powerpc
 >     PortIndex_darwin_8_powerpc/libstdc++
 >     PortIndex_darwin_9_i386
 >     PortIndex_darwin_9_i386/libc++
 >     PortIndex_darwin_9_powerpc
 >     PortIndex_darwin_9_powerpc/libstdc++
 > }}}
 > if that doesn't bring too many additional complications for generating
 the tarballs or calling selfupdate (one can exclude folders when using
 rsync).

 I had not considered this. But again, I see the stdlib as no less
 important to the description of the PortIndex than the other three
 components, so I would not demote one to a subdirectory.

 > While at it: why do we have a separate `portindex` for `powerpc`, but
 not for `x86_64`?

 "x86_64" is not a valid value for `os.arch`. The only valid values are
 `powerpc` (meaning any 32-bit or 64-bit PowerPC processor) and `i386`
 (meaning any 32-bit or 64-bit Intel processor).

 > One further question. While writing some `Portfiles` I remember
 experiencing problems by not being able to tell the difference between the
 globally set stdlib and the one that could have come from a PortGroup. I
 hope that won't be a problem for `Portindex`, I need to check.

 If I remember correctly, there is `cxx_stdlib` (the value set in
 macports.conf; ports and portgroups should not use this) and
 `configure.cxx_stdlib` (which defaults to `cxx_stdlib` but which ports and
 portgroups can override as needed). My patches have `portindex` change the
 value of `cxx_stdlib` when so requested, and ports like those mentioned in
 comment:1 that want to override it still can.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+-----------------
  Reporter:  ryandesign   |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+-----------------

Comment (by mojca):

 I'm sorry, I totally missed the patches. You could potentially open a Pull
 request against base to simplify some further testing, but it would be
 awesome if these patches were actually deployed, soon.

 Regarding the usage of variable in the port: in the past (before we had
 cxx11 1.1) I would switch to libc++ for some ports just because that would
 allow me to compile them and if they had no dependency on another C++11
 api, this was never a problem. I found it weird that I had to duplicate
 the code in the PortGroup just for the sake of compiler blacklisting, but
 if I only used the cxx 1.0 PortGroup, the port would not compile at all,
 so I had to duplicate the code anyway. At some point I found a workaround
 to first change `configure.cxx_stdlib` and then include the PortGroup as
 that would trick the PortGroup into believing everything was fine. But I
 could no longer distinguish whether it was the port that set that variable
 or if it was set globally. I forgot all the details and I'm not willing to
 go back to history (this was the case with root6 for sure), but just to
 give a rough idea.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+----------------------------
  Reporter:  ryandesign   |      Owner:
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:  MacPorts 2.5.0
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------------
Changes (by neverpanic):

 * milestone:   => MacPorts 2.5.0


--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+----------------------------
  Reporter:  ryandesign   |      Owner:  neverpanic
      Type:  enhancement  |     Status:  assigned
  Priority:  Normal       |  Milestone:  MacPorts 2.5.0
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------------
Changes (by neverpanic):

 * status:  new => assigned
 * owner:   => neverpanic


--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:8>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+----------------------------
  Reporter:  ryandesign   |      Owner:  neverpanic
      Type:  enhancement  |     Status:  assigned
  Priority:  Normal       |  Milestone:  MacPorts 2.5.0
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------------

Comment (by ryandesign):

 I knew I had talked about this topic before but couldn't find a ticket.
 Turns out it wasn't a ticket but a mailing list thread:

 https://lists.macports.org/pipermail/macports-dev/2016-August/033324.html

 Replying to [comment:6 mojca]:
 > I'm sorry, I totally missed the patches. You could potentially open a
 Pull request against base to simplify some further testing, but it would
 be awesome if these patches were actually deployed, soon.

 It would be two PRs, one for base and one for infrastructure. For now I
 would probably rather keep everything together in this ticket. Applying a
 few patchfiles for testing should be too difficult.

 > Regarding the usage of variable in the port: in the past (before we had
 cxx11 1.1) I would switch to libc++ for some ports just because that would
 allow me to compile them and if they had no dependency on another C++11
 api, this was never a problem. I found it weird that I had to duplicate
 the code in the PortGroup just for the sake of compiler blacklisting, but
 if I only used the cxx 1.0 PortGroup, the port would not compile at all,
 so I had to duplicate the code anyway. At some point I found a workaround
 to first change `configure.cxx_stdlib` and then include the PortGroup as
 that would trick the PortGroup into believing everything was fine.

 The ability to tell the cxx11-1.* portgroup what cxx_stdlib you want to
 use shouldn't be considered a hack or a workaround; it's the way it's
 meant to be used. The fact that you have to set that variable before you
 include the portgroup is an undesirable API quirk, the same quirk present
 in the obsolete-1.0 portgroup where you have to set `replaced_by` before
 including it. It would be great if those quirks could be fixed.

 > But I could no longer distinguish whether it was the port that set that
 variable or if it was set globally.

 I'm not sure why you would need to distinguish that. But as I said
 `${cxx_stdlib}` should be the value from macports.conf and
 `${configure.cxx_stdlib}` should be the value that the port wants to use.

 > I forgot all the details and I'm not willing to go back to history (this
 was the case with root6 for sure), but just to give a rough idea.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:9>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+----------------------------
  Reporter:  ryandesign   |      Owner:  neverpanic
      Type:  enhancement  |     Status:  assigned
  Priority:  Normal       |  Milestone:  MacPorts 2.5.0
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------------

Comment (by mojca):

 Regarding
 {{{
 #!patch
 --- mprsyncup.orig
 +++ mprsyncup
 @@ -59,7 +59,7 @@
 PATH=${PREFIX}/bin:/bin:/usr/bin:/usr/sbin:/opt/local/bin

  # Platforms we generate indexes for. This is intentionally split on
  # whitespace later.
 -PLATFORMS="8_powerpc 8_i386 9_powerpc 9_i386 10_i386 11_i386 12_i386
 13_i386 14_i386 15_i386 16_i386 17_i386"
 +PLATFORMS="8_powerpc 8_libcxx_powerpc 8_i386 8_libcxx_i386 9_powerpc
 9_libcxx_powerpc 9_i386 9_libcxx_i386 10_i386 10_libcxx_i386 11_i386
 11_libcxx_i386 12_i386 12_libcxx_i386 13_i386 14_i386 15_i386 16_i386
 17_i386"

  # Sources information:
  BASEURL=https://github.com/macports/macports-base.git
 }}}
 I would leave the `libcxx_powerpc` platforms out. I find it nearly
 impossible to use them and the chances to ever distribute the binaries
 with libc++ are super minimal. If anything, it would make sense to support
 binaries compiled with gcc7.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:10>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+----------------------------
  Reporter:  ryandesign   |      Owner:  neverpanic
      Type:  enhancement  |     Status:  assigned
  Priority:  Normal       |  Milestone:  MacPorts 2.5.0
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------------

Comment (by mojca):

 Ryan, I'm not sure if I know how to properly test this (I'm not 100% sure
 that I'm in fact patching the correct files).

 Here's the Portfile I'm testing
 {{{
 #!tcl
 PortSystem          1.0
 name                foo
 version             1.0
 categories          devel
 platforms           darwin

 if {${os.platform} eq "darwin" && ${os.major} > 10} {
     subport foo-bar {}
 }

 if {${cxx_stdlib} eq "libc++"} {
     subport foo-libcxx {}
 }
 }}}

 The result is
 {{{
 > portindex -p macosx_12_i386 -o PortIndex.12_i386
 Creating port index in /path/to/PortIndex.12_i386
 Adding port devel/foo
 Adding subport foo-bar
 Adding subport foo-libcxx
 }}}
 The second subport shouldn't have been there. But again, I might have not
 tested this correctly.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:11>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+----------------------------
  Reporter:  ryandesign   |      Owner:  neverpanic
      Type:  enhancement  |     Status:  assigned
  Priority:  Normal       |  Milestone:  MacPorts 2.5.0
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------------

Comment (by ryandesign):

 Replying to [comment:11 mojca]:
 > {{{
 > if {${cxx_stdlib} eq "libc++"} {
 > }}}

 Test `${configure.cxx_stdlib}` instead. `${cxx_stdlib}` is the value in
 macports.conf and does not represent the possibly-modified value the port
 will actually build with.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:13>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+----------------------------
  Reporter:  ryandesign   |      Owner:  neverpanic
      Type:  enhancement  |     Status:  assigned
  Priority:  Normal       |  Milestone:  MacPorts 2.5.0
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------------

Comment (by mojca):

 Still, when I run
 {{{
 portindex -p macosx_12_i386 -o PortIndex.12_i386
 }}}
 on a file containing
 {{{
 subport
 foo-${os.platform}-${os.major}-${configure.cxx_stdlib}-${cxx_stdlib} {}
 }}}
 then I get
 {{{
 Adding subport foo-darwin-12-libc++-libc++
 }}}
 so either I did not patch my MacPorts correctly (which is quite possible)
 or the code does not set/use the correct stdlib.

 One thing that still slightly bothers me (but I would not worry about it
 yet) is that we would sometimes need a conditional like
 {{{
 #!tcl
 if {c++11 is supported} {
     version 1.2
 } else {
     version 0.9
 }
 }}}
 Making the decision based on stdlib alone will not work correctly on, say,
 10.5/ppc/gcc7 configuration, nor with cxx11 1.1 PortGroup on
 10.8/libstdc++.

 Lower priority though, nothing to worry about at this very moment.

 But I would like to know whether you can reproduce the above behaviour or
 not.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:14>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+----------------------------
  Reporter:  ryandesign   |      Owner:  neverpanic
      Type:  enhancement  |     Status:  assigned
  Priority:  Normal       |  Milestone:  MacPorts 2.5.0
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------------

Comment (by mojca):

 OK, it seems to work ok with
 {{{
 portindex -p macosx_12_libstdcxx_i386
 }}}
 but I guess the idea was to use just `macosx_12`. The problem is that in
 the `else` part of
 {{{
 if {[llength $platlist] > 3} {...}
 }}}
 the `cxx_stdlib` never gets set to its default value based on OS version,
 so it stays at `libc++` when the script is executed on >= 10.9.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:15>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+----------------------------
  Reporter:  ryandesign   |      Owner:  neverpanic
      Type:  enhancement  |     Status:  assigned
  Priority:  Normal       |  Milestone:  MacPorts 2.5.0
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------------
Changes (by ryandesign):

 * cc: kencu (added)


Comment:

 Has duplicate #56155.

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:16>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #55471: Use separate portindexes for libc++ on older systems

MacPorts
In reply to this post by MacPorts
#55471: Use separate portindexes for libc++ on older systems
--------------------------+----------------------------
  Reporter:  ryandesign   |      Owner:  neverpanic
      Type:  enhancement  |     Status:  assigned
  Priority:  Normal       |  Milestone:  MacPorts 2.5.0
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+----------------------------

Comment (by ryandesign):

 Replying to [comment:14 mojca]:
 > One thing that still slightly bothers me (but I would not worry about it
 yet) is that we would sometimes need a conditional like
 > {{{
 > #!tcl
 > if {c++11 is supported} {
 >     version 1.2
 > } else {
 >     version 0.9
 > }
 > }}}

 Why does this bother you?

 > Making the decision based on stdlib alone will not work correctly on,
 say, 10.5/ppc/gcc7 configuration, nor with cxx11 1.1 PortGroup on
 10.8/libstdc++.

 Why would it not work? Doesn't it currently work, in the ports that do it?

--
Ticket URL: <https://trac.macports.org/ticket/55471#comment:17>
MacPorts <https://www.macports.org/>
Ports system for macOS
12