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

README: add MacPorts instructions #329

Closed
wants to merge 1 commit into from

Conversation

herbygillot
Copy link

No description provided.

@TheLostLambda
Copy link
Member

I'll pester @qballer who runs macOS just to be sure this is working, but this looks cool!

@qballer
Copy link
Member

qballer commented Apr 24, 2021

I'm not a macports user, to be honest. how about @5c077m4n ?

@5c077m4n
Copy link
Contributor

Sorry, I use homebrew too... @qballer

@SaintFenix
Copy link
Contributor

SaintFenix commented Apr 25, 2021

I've got a Mac Pro, I'll see if I can spin it up to test it out in real quick.

@SaintFenix
Copy link
Contributor

Alrighty, I got Macports installed, and setup, boy is it not the most straightforward thing compared to homebrew, especially on an older MacOS. I used MacOS High Sierra, and was able to install it with no issue with Macports, everything functioned as normal, and I wasn't able to get any issues in the process.

Though notably, on a fresh install of Macports, installing Zellij will have you download quite a few dependencies. I'm not versed enough in Macports to know if that is just the typical Rust toolchain being built to compile it, or if its excessive.

But all in all it works. 👍

@herbygillot
Copy link
Author

herbygillot commented Apr 26, 2021

Alrighty, I got Macports installed, and setup, boy is it not the most straightforward thing compared to homebrew, especially on an older MacOS. I used MacOS High Sierra, and was able to install it with no issue with Macports, everything functioned as normal, and I wasn't able to get any issues in the process.

Though notably, on a fresh install of Macports, installing Zellij will have you download quite a few dependencies. I'm not versed enough in Macports to know if that is just the typical Rust toolchain being built to compile it, or if its excessive.

But all in all it works. 👍

Thank you for testing, @SaintFenix. I'm curious though; what were some of things that you felt weren't straightforward while setting up MacPorts?

And dependencies will be downloaded only if a binary package of zellij wasn't in MacPorts' repo yet. That's done by MacPorts build infra. Once that's in-place, then just the zellij package gets downloaded and installed. Wondering why that wasn't the case for you.

@SaintFenix
Copy link
Contributor

SaintFenix commented Apr 26, 2021

I'm curious though; what were some of things that you felt weren't straightforward while setting up MacPorts?

It's outside of this pull request, but,

Homebrew is a one liner install, whereas Macports needs Xcode, which you have to download from the Mac App store. Not a huge issue, but if you are on the older version of the OS, you can't do it from the Mac App Store, you have to get (or already have) a developer account at apple to download an older version for your OS with the Command line pack seperate. So that's a bit of googling and setting up, and downloading. Once setup, you accept the licenses, and find the right package, install Macports, and then update the ports, and then you are ready to install.

This took me around 10-15 minutes, whereas homebrews install is 2-3.

It's not really a showstopper, but I'm just used to Homebrew's one line.

That aside, I'm still quite happy that Zellij is being included in Macports. I appreciate your Pull Request on it.

@herbygillot
Copy link
Author

It's outside of this pull request, but,

Homebrew is a one liner install, whereas Macports needs Xcode, which you have to download from the Mac App store. Not a huge issue, but if you are on the older version of the OS, you can't do it from the Mac App Store, you have to get (or already have) a developer account at apple to download an older version for your OS with the Command line pack seperate. So that's a bit of googling and setting up, and downloading. Once setup, you accept the licenses, and find the right package, install Macports, and then update the ports, and then you are ready to install.

This took me around 10-15 minutes, whereas homebrews install is 2-3.

It's not really a showstopper, but I'm just used to Homebrew's one line.

That aside, I'm still quite happy that Zellij is being included in Macports. I appreciate your Pull Request on it.

Thank you and much appreciated, @SaintFenix

@5c077m4n
Copy link
Contributor

5c077m4n commented Apr 26, 2021

@SaintFenix According to https://docs.brew.sh/Installation#macos-requirements homebrew needs Xcode too

@SaintFenix
Copy link
Contributor

@SaintFenix According to https://docs.brew.sh/Installation#macos-requirements homebrew needs Xcode too

Ah so that is the case, Macports gets a pass.

@qballer
Copy link
Member

qballer commented Apr 26, 2021

@herbygillot thanks a lot for creating this. This seems very cool. I'm sorry I'm taking my time with merging this, but IMO the portfile currently poses some kind of a security threat as you aren't using the cargo.toml in this repo to fetch crates nor the binaries published.

Now, I know very little about macports, if there is something I'm missing do let me know because the last thing I want to do is gatekeeping.

@qballer qballer self-requested a review April 26, 2021 17:06
@herbygillot
Copy link
Author

herbygillot commented Apr 26, 2021

No worries @qballer, that's a 100% valid concern, you're absolutely in the right to call that out.

So to start, all software in MacPorts are ports that are defined by their Portfiles.

A Portfile defines:

  1. project info (name, description, version, homepage, license, supported architectures, etc.)
  2. the names of the downloadable source files (distname)
  3. how to verify the source files (checksums)
  4. how to build it
  5. how to install it into the MacPorts prefix (/opt/local)

Note 1: Many of these options are implicit and/or default, so they aren't always going to be defined in a Portfile.

Note 2: any downloadable source files defined are automatically uploaded to MacPorts mirrors so that the software can still be built even if the original upstream repo disappears.

A Portfile by default wants to build things in the typical ./configure, make, make install way, but through the use of Portgoups (or by explicitly providing build commands), we support different packaging methods and programming languages. For zellij, the cargo Portgroup will have MacPorts build zellij using Rust & cargo. The cargo Portgroup exposes cargo.crates.

cargo.crates is like a macro that defines Crate dependencies as MacPorts distfiles so that MacPorts can download and mirror the crates. In this way as mentioned above, MacPorts can still build zellij even if crates cannot be downloaded from upstream.

The cargo.crates section is defined directly from zellij's Cargo.lock, and will pull crates directly from crates.io.

You can see this here:
https://github.com/macports/macports-ports/blob/master/_resources/port1.0/group/cargo_fetch-1.0.tcl#L79

Additionally, the SHA256 checksum you see there is the checksum of the crate exactly as it is downloaded from https://crates.io

You can test this yourself:

If you put together the URL pattern for zellij's first dep, addr2line, you'll get the following URL:

https://crates.io/api/v1/crates/addr2line/0.14.1/download?dummy=:crate-addr2line-a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7

After downloading the crate from that URL, its checksum should match what you see in zellij's Portfile:

❯ wget -O addr2line-crate 'https://crates.io/api/v1/crates/addr2line/0.14.1/download?dummy=:crate-addr2line-a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7'
--2021-04-26 15:10:51--  https://crates.io/api/v1/crates/addr2line/0.14.1/download?dummy=:crate-addr2line-a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7
Resolving crates.io (crates.io)... 13.226.29.81, 13.226.29.57, 13.226.29.69, ...
Connecting to crates.io (crates.io)|13.226.29.81|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://static.crates.io/crates/addr2line/addr2line-0.14.1.crate [following]
--2021-04-26 15:10:52--  https://static.crates.io/crates/addr2line/addr2line-0.14.1.crate
Resolving static.crates.io (static.crates.io)... 54.192.100.97, 54.192.100.107, 54.192.100.42, ...
Connecting to static.crates.io (static.crates.io)|54.192.100.97|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 31201 (30K) [application/x-tar]
Saving to: ‘addr2line-crate’

addr2line-crate                              100%[============================================================================================>]  30.47K  --.-KB/s    in 0.009s

2021-04-26 15:10:52 (3.29 MB/s) - ‘addr2line-crate’ saved [31201/31201]

~ 
❯ shasum -a 256 addr2line-crate
a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7  addr2line-crate
~ 
❯ grep a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7 ~/Source/ports/sysutils/zellij/Portfile
    addr2line                       0.14.1  a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7 \

A Portfile has a maintainer, which is the typical model for most 3rd-party package repos (like the one for Archlinux or Ubuntu), and is responsible for updating the Portfile on software updates and and reviewing any changes proposed to the same.

@herbygillot
Copy link
Author

herbygillot commented Apr 27, 2021

Sorry, that was a lot but:

TLDR:

  • cargo.crates in a Portfile is generated directly from a project's Cargo.lock
  • cargo.crates exists so that crates can be specified in a MacPorts-visible way, and MacPorts can mirror them
  • crates in cargo.crates are downloaded rom https://crates.io
  • so checksums for crates in the Portfile will verify assets coming from https://crates.io

@qballer
Copy link
Member

qballer commented Apr 27, 2021

After discussing this with some of the maintainers of Zellijs and going through all the information your provided we decided we are going to do a community maintained packages area in our website docs where people can add links/instruction to all sorts of packages (nix, arch, MacPorts... etc)

Adding this to the readme won't be possible at this time. If are willing to create another PR to our docs with this I will be more than happy to accept that.

@herbygillot
Copy link
Author

Sure, that's fine. If you can link me to the docs in question, I'll get a PR up at some point.

@a-kenji
Copy link
Contributor

a-kenji commented Apr 27, 2021

@a-kenji
Copy link
Contributor

a-kenji commented Nov 15, 2021

@herbygillot,
Thank you for this pr.
We now have settled on a way to display third party repositories.
There is already a section about mac ports in there,
but maybe you want to add something to it?
#857
https://github.com/zellij-org/zellij/blob/main/THIRD_PARTY_INSTALL.md

@a-kenji a-kenji closed this Nov 15, 2021
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.

6 participants