Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d3dmetal: New Port #23886

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions devel/d3dmetal/Portfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0

name d3dmetal
version 1.1
epoch 0
categories devel
maintainers {@Gcenx gmail.com:gcenx83}
homepage https://developer.apple.com/games
platforms {darwin any >= 23}
ryandesign marked this conversation as resolved.
Show resolved Hide resolved
license Restrictive
supported_archs x86_64
description Direct3D to Metal translation layer
long_description {*}${description}
master_sites https://download.developer.apple.com/Developer_Tools/Game_Porting_Toolkit_${version}/Game_Porting_Toolkit_${version}.dmg
Copy link
Contributor

Choose a reason for hiding this comment

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

master_sites is for the URL of the directory that the distfile is in. It does not include the distfile name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This distfile can’t really be fetched directly it’s used in the pre-fetch stage.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I said is still accurate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ll deal with that in the next PR to hopefully resolve this then.

distname Game_Porting_Toolkit_${version}
use_dmg yes

checksums rmd160 0f40a2f7c4bf6a319fff915dacbceb8e473df1b1 \
sha256 2a86518d7fce89c304266654a76107d395a9a7557225096b73a834893482b7f1 \
size 27956812

pre-fetch {
if {![file isfile ${distpath}/${distfiles}]} {
ui_error "This port cannot download the needed files automatically."
ui_error "Please log in to your Apple Developer account at:"
ui_error ""
ui_error "https://developer.apple.com/download/"
ui_error ""
ui_error "Then paste this URL into your browser:"
ui_error ""
ui_error "${master_sites}"
ui_error ""
ui_error "Place the downloaded file in this directory:"
ui_error ""
ui_error "${distpath}"
ui_error ""
ui_error "Then retry installing this port."
ui_error ""
return -code error "${distfiles} missing"
}
}

use_configure no
build {}

set d3dmetal ${prefix}/libexec/d3dmetal
set docdir ${prefix}/share/doc/${subport}

destroot {
xinstall -d ${destroot}${d3dmetal}
system "ditto ${worksrcpath}/redist/lib ${destroot}${d3dmetal}"

xinstall -d ${destroot}${docdir}
xinstall -m 0644 -W ${worksrcpath} Acknowledgements.rtf License.rtf "Read Me.rtf" ${destroot}${docdir}

# Remove useless stubs
file delete ${destroot}${d3dmetal}/wine/x86_64-unix/d3d9.so
file delete ${destroot}${d3dmetal}/wine/x86_64-windows/d3d9.dll
file delete ${destroot}${d3dmetal}/wine/x86_64-unix/d3d10.so
file delete ${destroot}${d3dmetal}/wine/x86_64-windows/d3d10.dll
}

notes "
Please review the D3DMetal documentation found at ${docdir}
"

platform darwin i386 {
try {
set is_rosetta2 [exec sysctl -in sysctl.proc_translated]
if { ${is_rosetta2} != 1 } {
ui_error "${name} requires an Apple Silicon mac"
return -code error "unsupported platform"
}
}
}
Comment on lines +69 to +77
Copy link
Contributor

Choose a reason for hiding this comment

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

You CANNOT error out like this unless in a phase. By erroring out outside of a phase, you're causing unrelated pull requests to fail with the error:

Creating port index in /Users/runner/work/macports-ports/macports-ports/ports
Error: d3dmetal requires an Apple Silicon mac
Failed to parse file devel/d3dmetal/Portfile: unsupported platform

However, if this port requires arm64, then all you need to write in the port is supported_archs arm64. That's it. MacPorts handles the rest.

However, I see you've written supported_archs x86_64; I don't understand that. I don't need to understand it; it's your port and I've absolved myself of the wine-related ports. I just need other unrelated PRs not to fail because of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This port can’t be arm64 as I’d already explained, it’s x86_64 but only supports Apple Silicon.

Then how can this be handled exactly as this can’t only work on Apple Silicon systems and is only x86_64.

Copy link
Contributor

Choose a reason for hiding this comment

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

We've never encountered such a situation before so I have no idea how to handle it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Think I’ve found a solution, I’ll just set it to arm64 when it’s not rosetta2.

It’s strange but it’s not uncommon anymore, there some x86_64 macOS games now that only support Apple Silicon 🤦‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

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

All I can say is to repeat that you cannot return -code error unless you are in a phase without causing problems. A fix would be to enclose the whole bit in a pre-fetch block for example.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that, as merged, the port did not build on GitHub Actions, nor will it build on Buildbot, because:

Excluding d3dmetal because it does not support the arm64 arch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that, as merged, the port did not build on GitHub Actions, nor will it build on Buildbot, because:

Excluding d3dmetal because it does not support the arm64 arch

Are depends_run required for building a package with the buildbots?

As this dep would only be needed at install/run time not during the actual build.

Copy link
Contributor

Choose a reason for hiding this comment

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

depends_run dependencies are required to install a port (on any computer, whether under user control or automation).


livecheck.type none
Loading