oxipng icon indicating copy to clipboard operation
oxipng copied to clipboard

Winget distribution

Open Maingron opened this issue 2 years ago • 8 comments

Can we have oxipng through winget? Would be cool if oxipng could be installed by just running winget install oxipng.

Winget is Windows' native CLI Package Manager and I prefer it to install most of my programs. I tried choco and others over the year, but those always seemed to bug out eventually and they also don't integrate as well as winget into the system imo.

See: https://learn.microsoft.com/en-us/windows/package-manager/package/repository and https://github.com/microsoft/winget-pkgs

Same question goes for apt on Linux, but I don't want to flood the issues with the same question for both.

Maingron avatar Oct 15 '23 13:10 Maingron

Thanks for the suggestion, this looks like a good idea.

It appears that it requires us to provide an "installer" (MSIX, MSI, or EXE) for oxipng, not just the program itself. I don't have any experience in such matters, so I'm afraid I won't be able to action this myself. I guess we would need to create this as part of the deploy process. @AlexTMjugador do you have any knowledge here?

andrews05 avatar Oct 16 '23 04:10 andrews05

@AlexTMjugador do you have any knowledge here?

I have tried packaging Rust applications before, and I came to the conclusion that properly packaging Windows software, especially when not relying on Visual Studio-centric development environments, is hard:

  • MSIs are the old but widely compatible across Windows versions, system-integrated (which is a big plus for configuration management, as Windows tracks package state and facilitates rollbacks), intended way to make installer packages for desktop applications. Their only (but big) downside is that MSIs are known for being insanely complex and painful to work with. Did you know that .msi files are COM structured storage files, akin to stripped down SQL Server databases or Word 2003 .doc files? Yeah, me neither until I went down the rabbit hole on the topic.
    • cargo-wix is the sanest way to generate an MSI installer for an easy-to-distribute Rust project like OxiPNG, but it doesn't exempt developers from having basic knowledge of WiX, which, while more pleasant to work with than other MSI generation tools, is still complicated. (The nice WiX 3.6: A Developer's Guide to Windows Installer XML book I once skimmed through was 488 pages long, which is about 5 times the length of the PNG specification.)
  • AppX is a modern technology recommended by Microsoft for developing installers, but it only works on Windows 8 and later, and has a reputation for being UWP-centric (e.g. for apps in the Windows Store). MSIX is less UWP-centric, but only works on Windows 10 and later. For context, support for Windows 8.1 ended just this year, and it wasn't long ago that people were asking OxiPNG to support 32-bit platforms, suggesting that OxiPNG sees some niche use on devices that are remarkably out of date. If we are spending effort on proper Windows installers and distribution, it's wise to target the broadly compatible MSI format instead, to make the most people happy with the least artifacts.
  • .exe installers (as generated by NSIS, InnoSetup, IExpress, or even compression software like WinRAR) are either self-extracting files or bootstrapping downloaders that wrap another installer, simply extract the files of a program and create shortcuts, or reinvent the wheel to provide the system integration that MSIs, AppX, or MSIX have. So, despite how common they are, they are more of a roundabout or outright hacky way to install Windows software. But they are easy and broadly compatible, at least.

All in all, in order to distribute OxiPNG on winget, we first have to solve the painful problem of creating a proper installer. Frankly, I'm not too keen on introducing WiX configuration files and increasing CI times to distribute the easy-to-run, statically linked executable that is OxiPNG, which can be grabbed with the one-liner wget https://github.com/shssoichiro/oxipng/releases/download/v9.0.0/oxipng-9.0.0-x86_64-pc-windows-msvc.zip. But maybe someday someone will submit a PR for it, or I will dabble in it. Making software more user-friendly to install is a good idea, after all.

AlexTMjugador avatar Oct 16 '23 18:10 AlexTMjugador

Ooops, sorry for kicking you down into those holes. ...Hopefully one day.

Has anyone looked into the situation for apt on Linux? I'm afraid to ask

Maingron avatar Oct 16 '23 19:10 Maingron

Has anyone looked into the situation for apt on Linux? I'm afraid to ask

APT is much better in this regard. cargo-deb makes it easy to generate proper .deb files that developers can reason about if necessary. The only pain points with APT are the distribution of the .deb packages and the fact that not every Linux environment uses the APT package manager or Debian-compatible repositories (distros like Fedora or Arch Linux, for example, use different package managers).

Elaborating on the distribution of .deb packages, it is not common in the Linux world to download random .debs from the Internet and apt install them, so setting up APT repositories for easier updating and management is preferred. Fortunately, there are easy ways to turn a GitHub repository into an APT repository.

AlexTMjugador avatar Oct 18 '23 16:10 AlexTMjugador

I have tried packaging Rust applications before, and I came to the conclusion that properly packaging Windows software, especially when not relying on Visual Studio-centric development environments, is hard:

Fortunately, there are easy ways to turn a GitHub repository into an APT repository.

There seems to be something similar for WinGet, once 1 release has been allowed into that repo?

TPS avatar Oct 18 '23 18:10 TPS

There's an open request for oxipng to be adopted into Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=913285

I'm not sure creating our own apt repo is particularly helpful - it really needs to be in the defaults repos. I believe it's currently available in both Alpine and Arch Linux.

andrews05 avatar Oct 19 '23 01:10 andrews05

I'm not sure creating our own apt repo is particularly helpful - it really needs to be in the defaults repos. I believe it's currently available in both Alpine and Arch Linux.

Users can add any repository they want to their APT configuration, and software like Docker maintains custom repositories to circumvent distro politics and policies. But yes, an ideal outcome would be for OxiPNG to be adopted in the official Debian repositories, as this should provide the best experience for the end users of this distribution (as long as the package is reasonably well maintained, not shipping a years-old, subpar OxiPNG version that misleads users into thinking OxiPNG is really like that... 😅).

AlexTMjugador avatar Oct 21 '23 13:10 AlexTMjugador

May be worth it to look in to https://opensource.axo.dev/cargo-dist/ since it can produce many distribution artifacts with GitHub actions. Currently winget isn't supported, but MSI installers are. Winget (and Docker images as another issue requests) is planned so eventually it could be automated.

RossSmyth avatar Apr 23 '24 19:04 RossSmyth