Workarounds for cross compiling to Windows?

Ces VLC cesarillovlc at
Tue Aug 4 16:33:33 UTC 2020

On Fri, Jul 10, 2020 at 10:41 AM Ryan Schmidt <ryandesign at>
> [...]
> Ports should ideally segregate Mac-specific instructions and patches into
> a "platform darwin" block, but many many ports don't do that and almost
> tries to use MacPorts in any way on other platforms, though there has
been a
> little interest from a couple people recently in using it in a very
minimal way on
> Linux.
> Even though our ports collection is intended for use on macOS, MacPorts
> should compile and run on other operating systems. We used to generate
> PortIndex files on a Linux server and we also had a buildbot task that
verified that
> every MacPorts base commit built successfully on Linux. But near the end
of 2016
> we moved to new servers and phased out those Linux parts so it's possible
> some Linux incompatibilities have crept into base since then.
> [...]
> It's certainly feasible to make your own private ports collection for
your own purposes.
> I for example have a collection of ports that manage the configuration of
all the ports
> used to drive the buildbot system. There are a few common things I do in
each port
> so I make a new portgroup that I include in each of my ports that does
those things.
> So it might be doable to define a new cross-compile-for-Windows portgroup
that you
> could include into each of your custom ports, and the portgroup could
take care of
> setting the compiler variables and flags properly, for example.
> The software you want to build will probably also have dependencies on
> that get run at build time, and those would need to be compiled normally
for macOS
> so that they can run on your Mac.
> You might be able to set up your custom portgroup to install all your
Windows software
> to a different location, like /opt/windows (maybe setting up a new
variable like $wprefix
> with that value so that you can use it in your portfiles) while leaving
$prefix to be the
> compiled-for-Mac prefix for build dependencies.
> Or perhaps Wine figures into your build process, in case you need to run
> compiled-for-Windows programs on your Mac as part of the build.

Thanks a lot for such detailed information, Ryan. It's going to be very
helpful. Yes, I'm going to do a private ports collection for just the
packages I need to cross-compile to Windows. I believe it can be a bit
difficult at the beginning, while I figure out how to do the plumbing, but
it will pay off in the long run, and it's exactly the approach I need.

By the way, I'm sorry for the delay in my reply: your message got into the
spam filter and I hadn't seen it :-(

Kind regards and thanks a lot,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-users mailing list