dosbox-staging icon indicating copy to clipboard operation
dosbox-staging copied to clipboard

Offer "DOSBox Staging.app" stable and DEV bundles via Homebrew casks

Open Burrito78 opened this issue 1 year ago β€’ 27 comments

Are you using the latest Dosbox-Staging Version?

  • [X] I have checked releases and am using the latest release.

Different version than latest?

No response

What Operating System are you using?

None

If Other OS, please describe

No response

Is your feature request related to a problem? Please describe.

I'd like to be able to install DOSBox Staging latest stable and DEV .app bundles through the homebrew "brew" command.

It's much faster than downloading and installing manually. Also homebrew has integrated "check for new versions".

John Novak's helper files could be supplied in a subdirectory.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Add any other context or screenshots about the feature request here.

No response

Code of Conduct & Contributing Guidelines

  • [X] Yes, I agree.

Burrito78 avatar Apr 22 '23 07:04 Burrito78

I agree with this sentiment. We should probably offer a DEV nixpkg as well.

However, right now both are being maintained by people outside the project.

ThomasEricB avatar Apr 22 '23 08:04 ThomasEricB

Reference to info from Discord chat:

https://discord.com/channels/514567252864008206/626653390830698516/1095086227495063612

kklobe: no, we would need to supply a Cask formula, refer to e.g. ScummVM

Burrito78 avatar Apr 22 '23 09:04 Burrito78

It's in Homebrew, but not an .app or cask?

Install stable

$ brew install dosbox-staging

Install latest main

$ brew install dosbox-staging --HEAD

we would need to supply a Cask formula, refer to e.g. ScummVM

This file, https://formulae.brew.sh/api/cask/scummvm.json? I can't it in ScummVM's repo though:

[scummvm] (master) git grep 'homebrew/cask'
(empty)

[scummvm] (master) find . | grep -i cask
(empty)

[scummvm] (master) find . | grep -i scummvm.json
(empty)

Given this cask/scummvm.json lives in Homebrew's repo, I suspect it has to be created (and maintained) by the Homebrew team. Is there a way to request a Cask from them?

kcgen avatar Apr 22 '23 16:04 kcgen

Yes, it's in homebrew but only the CLI version. A cask is needed for Linux/Mac GUI apps.

Documentation is here: https://docs.brew.sh/Adding-Software-to-Homebrew#casks https://docs.brew.sh/Cask-Cookbook

Alex@MacBook-Alex ~ % brew info homebrew/cask/scummvm
==> scummvm: 2.7.0
https://www.scummvm.org/
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/scummvm.rb
==> Name
ScummVM
==> Description
Run classic graphical adventure and role-playing games
==> Artifacts
ScummVM.app (App)
==> Analytics
install: 0 (30 days), 23 (90 days), 324 (365 days)
Alex@MacBook-Alex ~ % 

Burrito78 avatar Apr 22 '23 17:04 Burrito78

Thanks @Burrito78 ; tagging w/ help-wanted :+1:

kcgen avatar Apr 22 '23 17:04 kcgen

OK, i have no idea what i'm doing here but i will just do it now. πŸ₯‡

ScummVM template:

cask "scummvm" do
  version "2.7.0"
  sha256 "9c977ed6612733a46b2733e0cdb103dc39f4cd0c6c208defa19d13d6468a76bb"

  url "https://downloads.scummvm.org/frs/scummvm/#{version}/scummvm-#{version}-macosx.dmg"
  name "ScummVM"
  desc "Run classic graphical adventure and role-playing games"
  homepage "https://www.scummvm.org/"

  livecheck do
    url "https://www.scummvm.org/downloads/"
    regex(%r{href=.*?/scummvm[._-]v?(\d+(?:\.\d+)+)[._-]macosx\.dmg}i)
  end

  app "ScummVM.app"

  zap trash: [
    "~/Documents/ScummVM Savegames",
    "~/Library/Caches/org.scummvm.scummvm",
    "~/Library/Logs/scummvm.log",
    "~/Library/Preferences/org.scummvm.scummvm.plist",
    "~/Library/Preferences/ScummVM Preferences",
    "~/Library/Saved Application State/org.scummvm.scummvm.savedState",
  ]
end

DOSBox Staging

cask "dosbox-staging" do
  version "0.81.0"
  sha256 "**********************************"

  url "https://github.com/dosbox-staging/dosbox-staging/releases/download/v#{version}/dosbox-staging-macOS-v#{version}.dmg"
  name "DOSBox Staging"
  desc "A modern continuation of DOSBox to run DOS games on current operating systems"
  homepage "https://dosbox-staging.github.io/"

  livecheck do
    url "https://dosbox-staging.github.io/downloads/macos/"
    regex(????????????????????????????????????????????????????)
  end

  app "DOSBox Staging.app"

  zap trash: [
    "~/Library/Preferences/DOSBox",
  ]
end

Burrito78 avatar Apr 28 '23 08:04 Burrito78

I believe it will be %r{href=.*/dosbox-staging-macOS-v(\d+\.\d+\.\d+)\.dmg}i, but @Burrito78 - fix version in line 2 to 0.80.1.

ScummVM regex matches several links (with href=" prefix), I guess they put the version in group to compare against the version field in line 2.

For ScummVM:

$ curl https://www.scummvm.org/downloads/ 2> /dev/null | grep --only-matching --perl-regexp 'href=.*?/scummvm[._-]v?(\d+(?:\.\d+)+)[._-]macosx\.dmg'
href="https://downloads.scummvm.org/frs/scummvm/2.7.0/scummvm-2.7.0-macosx.dmg
href="https://downloads.scummvm.org/frs/scummvm/2.7.0/scummvm-2.7.0-macosx.dmg
href="https://downloads.scummvm.org/frs/scummvm/1.6.0/scummvm-1.6.0-macosx.dmg
href="https://downloads.scummvm.org/frs/scummvm/1.6.0/scummvm-1.6.0-macosx.dmg

For DOSBox Staging:

$ curl https://dosbox-staging.github.io/downloads/macos/ 2> /dev/null | grep --only-matching --perl-regexp 'href=.*/dosbox-staging-macOS-v(\d+\.\d+\.\d+)\.dmg'
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.80.1/dosbox-staging-macOS-v0.80.1.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.80.0/dosbox-staging-macOS-v0.80.0.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.79.1/dosbox-staging-macOS-v0.79.1.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.79.0/dosbox-staging-macOS-v0.79.0.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.78.1/dosbox-staging-macOS-v0.78.1.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.78.0/dosbox-staging-macOS-v0.78.0.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.77.1/dosbox-staging-macOS-v0.77.1.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.77.0/dosbox-staging-macOS-v0.77.0.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.76.0/dosbox-staging-macOS-v0.76.0.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.75.2/dosbox-staging-macOS-v0.75.2.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.75.1/dosbox-staging-macOS-v0.75.1.dmg
href="https://github.com/dosbox-staging/dosbox-staging/releases/download/v0.75.0/dosbox-staging-macOS-v0.75.0.dmg

dreamer avatar Apr 28 '23 20:04 dreamer

cask "dosbox-staging" do
  version "0.80.1"
  sha256 "46a256645255e8345981ea357f1416b8ce4bc60a2aba9a86b5122d5075aa7fa"

  url "https://github.com/dosbox-staging/dosbox-staging/releases/download/v#{version}/dosbox-staging-macOS-v#{version}.dmg",
      verified: "github.com/dosbox-staging/dosbox-staging"
  name "DOSBox Staging"
  desc "A modern continuation of DOSBox to run DOS games on current operating systems"
  homepage "https://dosbox-staging.github.io/"

  livecheck do
    url "https://dosbox-staging.github.io/downloads/macos/"
    regex(%r{href=.*/dosbox-staging-macOS-v(\d+\.\d+\.\d+)\.dmg}i)
  end

  app "DOSBox Staging.app"

  zap trash: [
    "~/Library/Preferences/DOSBox",
  ]
end

Burrito78 avatar Apr 29 '23 09:04 Burrito78

So i followed this guide but got an error while trying to generate a token. https://github.com/Homebrew/brew/blob/master/docs/Adding-Software-to-Homebrew.md#cask-token-details

Alex@MacBook-Alex ~ % $(brew --repository homebrew/cask)/developer/bin/generate_cask_token "/Applications/DOSBox Staging.app"
zsh: no such file or directory: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/developer/bin/generate_cask_token

Burrito78 avatar Apr 29 '23 10:04 Burrito78

Maybe that broke the script. Good to know anyways.

One of the reasons Homebrew has become so popular is that it just works right out of the box, and installing in /usr/local/bin is at least part of the reason why.

But if you install Homebrew on an M1 Mac running Apple Silicon, then Homebrew gets installed in /opt/homebrew/bin.

https://earthly.dev/blog/homebrew-on-m1/

Burrito78 avatar May 02 '23 11:05 Burrito78

OK, i found out that simply putting the following into a file dosbox-staging.rb is enough to have created a valid cask.

cask "dosbox-staging" do
  version "0.80.1"
  sha256 "46a256645255e8345981ea357f1416b8ce4bc60a2aba9a86b5122d5075aa7fa"

  url "https://github.com/dosbox-staging/dosbox-staging/releases/download/v#{version}/dosbox-staging-macOS-v#{version}.dmg",
      verified: "github.com/dosbox-staging/dosbox-staging"
  name "DOSBox Staging"
  desc "A modern continuation of DOSBox to run DOS games on current operating systems"
  homepage "https://dosbox-staging.github.io/"

  livecheck do
    url "https://dosbox-staging.github.io/downloads/macos/"
    regex(%r{href=.*/dosbox-staging-macOS-v(\d+\.\d+\.\d+)\.dmg}i)
  end

  app "DOSBox Staging.app"

  zap trash: [
    "~/Library/Preferences/DOSBox",
  ]
end

I'm now stuck here: https://github.com/Homebrew/brew/blob/master/docs/Adding-Software-to-Homebrew.md#testing-and-auditing-the-cask

Burrito78 avatar May 02 '23 11:05 Burrito78

Got unstuck through this guide: https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#getting-set-up-to-contribute

I stumbled through creating a fork and submitting a PR!

https://github.com/Homebrew/homebrew-cask/actions/runs/4864574267

Let's see how angry they can get...

Burrito78 avatar May 02 '23 18:05 Burrito78

It seems like CI failed because you ate the last letter of checksum :)

$ sha256sum dosbox-staging-macOS-v0.80.1.dmg 
46a256645255e8345981ea357f1416b8ce4bc60a2aba9a86b5122d5075aa7fa9  dosbox-staging-macOS-v0.80.1.dmg

dreamer avatar May 02 '23 22:05 dreamer

It seems like CI failed because you ate the last letter of checksum :)

$ sha256sum dosbox-staging-macOS-v0.80.1.dmg 
46a256645255e8345981ea357f1416b8ce4bc60a2aba9a86b5122d5075aa7fa9  dosbox-staging-macOS-v0.80.1.dmg

Typos ... one of humanity's oldest nemeses.

MasterO2 avatar May 02 '23 22:05 MasterO2

They were really friendly actually!

https://github.com/Homebrew/homebrew-cask/pull/146338#issuecomment-1532184512

Closed because we are not signed currently.

audit for dosbox-staging: failed

  • Signature verification failed: /private/tmp/d20230502-12795-g59ub7/DOSBox Staging.app: rejected

macOS on ARM requires software to be signed. Please contact the upstream developer to let them know they should sign and notarize their software.

https://github.com/dosbox-staging/dosbox-staging/issues/1901

Burrito78 avatar May 03 '23 10:05 Burrito78

It seems like CI failed because you ate the last letter of checksum :)

$ sha256sum dosbox-staging-macOS-v0.80.1.dmg 
46a256645255e8345981ea357f1416b8ce4bc60a2aba9a86b5122d5075aa7fa9  dosbox-staging-macOS-v0.80.1.dmg

I think John Novak ate it. :)

https://github.com/dosbox-staging/dosbox-staging/issues/2449

Burrito78 avatar May 03 '23 10:05 Burrito78

This depends on #1901 and will then be further worked on.

Burrito78 avatar May 13 '23 13:05 Burrito78

Hi @Burrito78

I'd like to suggest some changes to the cask code:

Since dosbox-staging installed as an ap .app can be used from the command line too, it would make it a conflict with the formula as well as provide a symlink so that it will be on PATH (this is done for many casks).

The former would be (although the cookbook says 'Note: conflicts_with formula: is a stub and is not yet functional' at the moment):

  conflicts_with formula: "dosbox-staging"

The latter:

  binary "DOSBox Staging.app/Contents/MacOS/dosbox",
         target: "/usr/local/bin/dosbox-staging"

Also, zap trash seems a bit destructive if any other DOSBox builds are installed as well.

nightuser avatar Jun 16 '23 10:06 nightuser

Hi @nightuser, thanks for the suggestions!

This is the cask code that was suggested by the homebrew guy in the last PR:

cask "dosbox-staging" do
  version "0.80.1"
  sha256 "46a256645255e8345981ea357f1416b8ce4bc60a2aba9a86b5122d5075aa7fa9"
  url "https://github.com/dosbox-staging/dosbox-staging/releases/download/v#{version}/dosbox-staging-macOS-v#{version}.dmg"
  name "DOSBox Staging"
  desc "DOS game emulator"
  homepage "https://github.com/dosbox-staging/dosbox-staging/"
  
  app "DOSBox Staging.app"

  zap trash: "~/Library/Preferences/DOSBox"
end

The folder is our app folder, other versions of DOSBox don't use it.

Bildschirmfoto 2023-06-16 um 13 54 17

Burrito78 avatar Jun 16 '23 11:06 Burrito78

Let's see how it goes this time...

https://github.com/Homebrew/homebrew-cask/pull/166740

Burrito78 avatar Feb 14 '24 15:02 Burrito78

It got rejected because it "isn't signed". Installation works properly for me, just showing the "Open" button on first try.

But this is the output of spctl:

% spctl -a -vvv -t install DOSBox\ Staging.app
DOSBox Staging.app: rejected
origin=Developer ID Application: Kirk Klobe (AQE3WD7H5H)

Which is a bit strange.

See here for more info: https://dev.to/ajpagente/how-to-check-if-a-macos-app-is-notarized-8p4#:~:text=You%20can%20check%20if%20a,source%20indicates%20Unnotarized%20Developer%20ID.

@kklobe Any idea?

Burrito78 avatar Feb 14 '24 20:02 Burrito78

I am also seeing the "rejected". Although, according to Apple, "First up, spctl is not a great techniques for evaluating whether something will pass Gatekeeper.", but if that's what we have to pass, I'll see if I can figure out what's going on.

Also, the app itself isn't notarized, only signed. The whole DMG is signed and notarized, also per Apple's recommendation, "If you’re using a nested container format, only notarise the outermost container. For example, if you have an app inside an installer package on a disk image, sign the app, sign the installer package, and sign the disk image, but only notarise the disk image."

kklobe avatar Feb 14 '24 21:02 kklobe

I'd say I'd optimise for getting the main DMG installation path so it's right and correct as per Apple's recommendations. Then let the 1% Homebrew users jump through hoops instead.

Let's optimise for the right thing πŸ˜„

johnnovak avatar Feb 14 '24 21:02 johnnovak

OK, got it figured out - the sed command in the packaging script is creating some backup files that don't belong in the bundle, most notably Info.plist-e:

CleanShot 2024-02-14 at 16 53 28@2x

When I remove this file and re-sign it, it seems to make it happy:

spctl -a -t exec -vvv /Volumes/DOSBox\ Staging/DOSBox\ Staging.app
/Volumes/DOSBox Staging/DOSBox Staging.app: accepted
source=Notarized Developer ID
origin=Developer ID Application: Kirk Klobe (AQE3WD7H5H)

whereas the current release DMG gives:

spctl -a -t exec -vvv /Volumes/DOSBox\ Staging/DOSBox\ Staging.app
/Volumes/DOSBox Staging/DOSBox Staging.app: rejected
origin=Developer ID Application: Kirk Klobe (AQE3WD7H5H)

@johnnovak I can do this locally to the existing release DMG, and also have a branch with a fix running right now.

kklobe avatar Feb 14 '24 22:02 kklobe

When I remove this file and re-sign it, it seems to make it happy:

Ah, nice find πŸ˜„ Good catch @kklobe πŸŽ‰

johnnovak avatar Feb 14 '24 23:02 johnnovak

ok @Burrito78 , @johnnovak posted the new DMG and hash on the website, maybe give it a re-submit?

kklobe avatar Feb 15 '24 01:02 kklobe

Next try, thanks @kklobe for the fix!

https://github.com/Homebrew/homebrew-cask/pull/166807

Burrito78 avatar Feb 15 '24 11:02 Burrito78

Finally, it is done!

Bildschirmfoto 2024-02-20 um 09 10 59

Thanks @kklobe for letting us use his developer account and for his persuasiveness regarding the Homebrew devs to get this finally added as a cask!

Burrito78 avatar Feb 20 '24 08:02 Burrito78