[MacPorts] #57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it

MacPorts noreply at macports.org
Wed Apr 10 16:20:01 UTC 2019

#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
  Reporter:  ryandesign     |      Owner:  (none)
      Type:  enhancement    |     Status:  new
  Priority:  Normal         |  Milestone:
 Component:  ports          |    Version:
Resolution:                 |   Keywords:
      Port:  xcode-1.0.tcl  |

Comment (by kencu):

 So one issue is the way the xcode PortGroup works. If you look at the
 PortGroup file, it builds the software in the build{} phase, and then
 completely rebuilds the software all again in the destroot{} phase, and
 then destroots it. I presume this was so the build phase actually does
 something. I don't believe you can tell xcodebuild to separate the two. I
 haven't yet sorted out the exact extra bit the destroot{} command does to
 destroot it, but no doubt it's obvious enough with comparisons.

 The old Xcode build system allowed this. The new Xcode build system will
 not allow redundant things in the build tree, so I presume that it errors
 out on those builds that do some extra stuff, like generating symlinks or
 building man or pdf files with a script. The new build system errors.

 That is easy to fix. Just don't run the build{} phase. It does nothing
 useful to run the build{} phase anyway. I do not see a way to build in the
 build{} phase and just destroot in the destroot{} phase. AFAICT,
 xcodebuild cannot do that, although I'm not an expert on the inner
 workings of it. So this is a MacPorts' specific problem, as we do the
 double build. I do not see any Xcode fix coming for that.

 The second problem is that as Ryan pointed out, Xcode dumps it's products
 in the home directory, which is locked out on MacPorts. This is another
 MacPorts' specific problem -- homebrew would not see it (as people run as
 the current user). You CAN set the `-derivedDataPath ./DerivedData` to
 force the derived data to go somewhere writable, but that only works for
 me if you also set a `scheme`. Perhaps every (recent) Xcode project file
 has a `scheme` we can explore for and use, I don't know. If so, if you set
 a `scheme`, then xcodebuild will accept the `-derivedDataPath
 ./DerivedData`. Each will have to be investigated for such a `scheme`,
 although often I've found that the `target` also works (not always).

 For projects with no scheme, it appears you have to use the old build
 system, or accept the default `-derivedDataPath`.

Ticket URL: <https://trac.macports.org/ticket/57137#comment:25>
MacPorts <https://www.macports.org/>
Ports system for macOS

More information about the macports-tickets mailing list