Skip to content

Conversation

asavva-2016
Copy link

@asavva-2016 asavva-2016 commented Mar 8, 2025

Add Mac Catalyst support

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with the PR on cpython-apple-source-deps - nice work!

Many of the comments I made on that PR apply here as well - especially with regard to the handling of the MacCatalyst target. I suspect that with that high level structural change, a lot of the rest of this patch will become a lot simpler as well.

The other big are of feedback is the patches Python itself. Those are best handled as a PR against https://github.com/freakboy3742/cpython/tree/3.14-patched, so that they can be kept up to date over time.

Makefile Outdated
PYTHON_MICRO_VERSION=$(shell echo $(PYTHON_VERSION) | grep -Eo "\d+\.\d+\.\d+")
PYTHON_PKG_MICRO_VERSION=$(shell echo $(PYTHON_PKG_VERSION) | grep -Eo "\d+\.\d+\.\d+")
PYTHON_VER=$(basename $(PYTHON_VERSION))
PYTHON_PATCHED_VERSION=$(PYTHON_VER)-patched
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why make this change? The variable is used exactly once?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted

Makefile Outdated
TARGETS-iOS=iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64
VERSION_MIN-iOS=13.0
TARGETS-iOS=iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64 maccatalyst.x86_64 maccatalyst.arm64
VERSION_MIN-iOS=14.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with the cpython-apple-source-deps repo, this should likely be configured as a separate TARGETS-MacCatalyst et al.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the MacCatalyst target as suggested

Makefile Outdated
$$(CFLAGS-$(os))
LDFLAGS-$(target)=\
-isysroot $$(SDK_ROOT-$(target)) \
$$(CFLAGS-$(os))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these options needed? The CPython makefile should be setting all these correctly

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's required when building C++ targets in mobile-forge (e.g. numpy). Without this I wasn't able to get that to compile. However, let me double check on this and confirm once I've addressed the other comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's C++ targets that are the problem, that seems more likely due to either (a) the clang++ shims not existing, or (b) the clang++ shims not being on the path when mobile-forge is running.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you were correct, I've resolved this issue now with the correct configuration of the shims

x86_64-apple-ios*-simulator) AR=x86_64-apple-ios-simulator-ar ;;
+
+ aarch64-apple-tvos*-simulator) AR=arm64-apple-tvos-simulator-ar ;;
+ aarch64-apple-tvos*-macabi) AR=arm64-apple-tvos-macabi-ar ;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... tvos*-macabi? Does that even exist? Same for watchos*-macabi below

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

if test -z "$AR"; then
case "$host" in
aarch64-apple-ios*-simulator) AR=arm64-apple-ios-simulator-ar ;;
+ aarch64-apple-ios*-macabi) AR=arm64-apple-ios-macabi-ar ;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch for tab vs spaces indentation in the patch.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes shouldn't be needed; they're likely an artefact of how you generated the patch.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I'll update the patch as you detailed above

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a PR for the cpython patch, let me know if there is anything that needs changing in the new MacCatalyst testbed, etc

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the testbed

@asavva-2016 asavva-2016 marked this pull request as draft March 9, 2025 21:47
@freakboy3742
Copy link
Member

Acknowledging that I've seen these updates; however, I can't really review them until the CPython and dependencies PRs are ready, so I'll hold off until then for a deep review.

@asavva-2016 asavva-2016 closed this by deleting the head repository Mar 15, 2025
@freakboy3742 freakboy3742 mentioned this pull request Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants