submitting additional work on iOS cross-compiling support
bayoubengal at mac.com
Wed Feb 16 19:33:07 PST 2011
I have added additional functionality to macports. The following ports now build: icu, zlib, bzip2, expat and boost. These ports build universal and non-universal for MacOSX (ppc, ppc64, i386, x86_64) and iPhoneOS (armv6, armv7) as well as non-universal for the iPhoneSimulator (only i386 exists on this one). They build with the default compilers for each platform as well as clang 2.8 for MacOSX.
I think this experiment is successful. I've made only minor adjustments to the design on macports. Most of the work is simply logically existing the design that is already present to handle additional functionality needed for complicated projects (such as boost). The changes to ports files are reasonable. Boost required significant alteration due to the nature of the boost build system and the desire to use "combined" architecture when possible to speed up builds. Ports for MacOSX should keep building without modification. Ports can be updated to handle iOS on an as-needed basis. The change can be as simple as adding the muniversal PortGroup if autoconf is used as the build system for the projects as configure scripts break on multiple architecture flags on the preprocessor check.
I have tested the changes against clang and while using the 10.5 sdk. The 5 ports I've handled are certainly diverse. I can't imagine any project having more complicated needs than boost.
There is certainly a need in the mac developer community to provide for iOS development, and I have proven that macports can be cleanly extended to handle the job. Given my results, I am requesting macports accept the work. I'm sure additional changes will be required to make the work complete, and I'm certainly willing to cooperate on providing the developer resources to get the work done.
link to zip file of /iopt: https://files.me.com/bayoubengal/5eosrz
The following files have been changed:
portfiles for the projects listed above.
The following functionality has been implemented:
1) I have extended the muniversal portgroup to add pre- and post- callbacks on configure, destroot and build such that a portfile can be called for configuring, building and destrooting each architecture being built. These callbacks are simple flat functions. There is probably a way more consistent with the overall design to handle these callbacks, but no one answered my request for guidance on the point, so I just set it up the best way I could figure out on my own. Certainly, the design is good enough to prove the concept works.
2) corrected flaw in the setting of the configure CPPFLAGS such that the preprocessor gets the correct sdk and arch flags.
3) hard-coded support for clang 2.x. see 'macports-clang-2.0' in the code. added entries for apple's clang with cxx and cpp.
4) added parallel build functionality back to boost portfile
5) added the following variables:
configure.target_uses_host_option (overrides adding --host to configure.cmd invocation)
6) added the following callbacks:
7) I broke the assumption that xcode must in $developer_dir since it isn't there in the case of an iOS cross-compile.
changes to boost portfile:
1) the boost build system offers a "combined" architecture setting for building universal binaries on MacOSX. If the desired configuration can be handled by the combined architecture mechanism, then use it. If it can't, then fall back to using muniversal portgroup to build universal binaries.
2) program_options does not build on iOS due to sdk header differences. There is a patch coming in a future version of boost. program_options is disabled.
3) only static libs are generated for iOS.
NOTE: I have not tested the variants.
changes to icu portfile:
1) minor modifications and cleanup.
changes to zlib portfile:
1) added muniversal portgroup.
changes to bzip2 portfile:
1) added sdk flags to build args.
2) patch makefile in post-destroot to disable tests for a cross-compile.
changes to expat portfile:
1) added muniversal portgroup.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the macports-dev