<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thanks for your help! I opened <a href="https://github.com/macports/macports-ports/pull/11143" class="">#11143</a> based on your suggestions.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">2021. 5. 25. 오후 9:34, Andrew Udvare <<a href="mailto:audvare@gmail.com" class="">audvare@gmail.com</a>> 작성:</div><div class=""><div class=""><br class=""><blockquote type="cite" class="">On 2021-05-25, at 08:23, 조성빈 <<a href="mailto:goranmoomin@daum.net" class="">goranmoomin@daum.net</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">2021. 5. 25. 오후 3:56, Andrew Udvare <<a href="mailto:audvare@gmail.com" class="">audvare@gmail.com</a>> 작성:<br class=""><br class=""><blockquote type="cite" class="">On 2021-05-25, at 02:22, 조성빈 <<a href="mailto:goranmoomin@daum.net" class="">goranmoomin@daum.net</a>> wrote:<br class=""><br class="">Thanks for the helpful advice!<br class=""><br class="">I’ve incorporated some changes from your suggestions, e.g. adding subports.<br class="">However I’m not sure if I’m writing idiomatic port files…<br class="">Could you skim my portfile attached and check if there’s any glaring mistakes?  <br class=""><br class="">I’m guessing I should also have a swift-format54 subport.<br class="">Is there any way to do something like aliasing the main port to a specific subport?<br class="">It doesn’t feel right to have logic for Swift 5.4 outside the swift-format54 subport body…<br class=""></blockquote><br class="">I don't know if there's a way to alias, but normally the top level gets no suffix and it usually is latest. You could also make it the -devel release (latest Git HEAD), and have swift-format54 subport be the latest stable.<br class=""><br class=""><blockquote type="cite" class="">Should I also be checking the maximum version?<br class="">E.g., AFAIK swift-format53 won’t work with Xcode 12.5 or later, should I check this too?<br class=""></blockquote><br class="">Yes. Also you should add "known_fail yes" in that block. Similar to this: <a href="https://github.com/macports/macports-ports/blob/d275a24edbefe7f361f2aa6eb8f59648092058c0/graphics/Paintbrush/Portfile#L29" class="">https://github.com/macports/macports-ports/blob/d275a24edbefe7f361f2aa6eb8f59648092058c0/graphics/Paintbrush/Portfile#L29</a><br class=""></blockquote><br class="">Ok, thanks.<br class="">In fact, I just searched for known_fail and it looks like the following ui_error and return -code are enclosed in a pre-fetch block.<br class="">What is the purpose of the block? Should I be adding pre-fetch to my file?<br class=""></blockquote><br class="">They do not have to be in pre-fetch block.<br class=""><br class="">The pre-fetch block is code to run prior to the fetch phase. post-fetch runs after fetching. Most of the time you don't want to make your own fetch phase. All phases (patch, configure, build, etc) have pre- and post- versions.<br class=""><br class=""><blockquote type="cite" class="">(Unfortunately searching for it in the MacPorts docs didn’t reveal anything…)<br class=""><br class="">Also, are there any resources for me to find about constructs that I don’t know?<br class="">The only resource I know is <a href="https://guide.macports.org" class="">https://guide.macports.org</a> but it doesn’t seem like a canonical source.<br class=""></blockquote><br class="">Unfortunately the guide is the main documentation but it is out of date. Anything else has to be learned from existing ports and from reading the comments in the PortGroups. <a href="https://github.com/macports/macports-ports/tree/master/_resources/port1.0/group" class="">https://github.com/macports/macports-ports/tree/master/_resources/port1.0/group</a><br class=""><br class="">I recommend keeping a copy of the main ports and installing the_silver_searcher (provides "ag" command) to quickly search for examples. "ag query"<br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">A minor issue is that the build phase pulls in other dependencies via Git (which by the way does not add a "depends_build-append port:git" because Xcode comes with Git). You could have MacPorts handle these as separate packages (which is going to be very difficult) or you could pull in the repositories as part of the fetch (or similar) phase in MacPorts. I do this often with projects that use submodules.<br class=""></blockquote><br class="">Is this also just a minor issue (that isn’t encouraged, but not a blocker), or something that MacPorts would like to avoid?<br class="">(I guess this question is also something that would be answered if I just submitted the PR, but I’m curious now :-))<br class=""></blockquote><br class="">Yes it definitely is preferred to avoid doing network activity outside of the fetch phase. The reason is because someone may have an offline system (and must use source rather than a pre-compiled tgz) where copying the distfiles over would not be enough, so the build would fail.<br class=""><br class="">It is not a blocker, as there are other ports in the tree that do it too. This is usually because the work to unwrap the downloading from the build phase is very difficult, and users have not filed tickets about it.<br class=""><br class="">--<br class="">Andrew<br class=""></div></div></blockquote></div><br class=""></body></html>