Call for testing: snap Windows apps with sommelier-core

sommelier-core is an attempt to create a universal script for snapping Windows applications. It merges the original sommelier script from @Wimpress, @popey and @lucyllewy with the work @mmtrt is doing to create platform snaps for Wine. The goal of this script is that “everything just works”.

Features:

  • Uses Wine from the wine-platform snaps to reduce the size of your snap.
  • Uses the gnome-3-28 extension for initializing all the generic desktop stuff.
  • Includes the “Modern” theme from ReactOS so Windows applications look less ugly. [optional]
  • Updates the Wine prefix every time Wine changes. Can upgrade a 32-bit Wine prefix to 64-bit.
  • Reinstalls the Windows app every time the snap version changes.
  • Reconfigures Wine every time the snap revision or the Wine version changes.
  • Users can run myapp.wine to run arbitrary applications inside this snap.
  • Users can run myapp.winetricks to modify the Wine environment.

Cons:

  • The script is not 100% compatible with the original sommelier. If you need something which is not present, let me know.

I’ve built a bunch of snaps based on this script:

The rest of this post is a small tutorial. See the sommelier-core repository for a complete reference.

Snapping Windows Applications

You use sommelier-core by including the script as a part. I use branches for having a stable version and to allow for backwards-incompatible changes in the future.

parts:
  sommelier:
    plugin: make
    source: https://github.com/snapcrafters/sommelier-core.git
    source-branch: 1.0

You include the wine platform snaps. These are maintained by @mmtrt and are now auto-connected by default. Wine devel and Wine staging are also supported; run snap search wine-platform to see all available snaps.

plugs:
  # This contains all the dependencies Wine needs
  wine-runtime:
    interface: content
    target: $SNAP/wine-runtime
    default-provider: wine-platform-runtime
  # This contains the Wine binaries themselves
  wine-5-stable:
    interface: content
    target: $SNAP/wine-platform
    default-provider: wine-platform-5-stable

Finally, add the apps themselves. sommelier-core uses environment variables for configuration.

environment:
  WINEDLLOVERRIDES: "$WINEDLLOVERRIDES;mscoree,mshtml="    # Prevent pop-ups about Wine Mono and Wine Gecko

apps:
  tmnationsforever:
    extensions: [ gnome-3-28 ]
    command: bin/sommelier run-exe
    environment:
      RUN_EXE: "C:/Program Files (x86)/TmNationsForever/TmForever.exe"
      INSTALL_URL: "http://files.trackmaniaforever.com/tmnationsforever_setup.exe"
      INSTALL_FLAGS: "/silent"
    plugs:
      - home
      - network
      - network-bind
      - opengl
      - audio-playback
      - joystick
  # The wine command can be used to run applications inside the wine
  # environment that this snap uses.
  #
  # For example, users can configure the wine environment of this snap
  # by running `myapp.wine winecfg`.
  wine:
    extensions: [ gnome-3-28 ]
    command: bin/sommelier
    plugs:
      - home
      - network
  # The winetricks command can be used to run winetricks inside the wine
  # environment that this snap uses.
  winetricks:
    extensions: [ gnome-3-28 ]
    command: bin/sommelier winetricks
    plugs:
      - network
13 Likes

Hey, if I need things like dotnet2 and dotnet45 inside the snap, how should I proceed? Is there a standard way of using wine tricks?

1 Like

You can set the TRICKS environment variable. Example:

apps:
  tmnationsforever:
    extensions: [ gnome-3-28 ]
    command: bin/sommelier run-exe
    environment:
      RUN_EXE: "C:/Program Files (x86)/TmNationsForever/TmForever.exe"
      INSTALL_URL: "http://files.trackmaniaforever.com/tmnationsforever_setup.exe"
      INSTALL_FLAGS: "/silent"
      TRICKS: "dotnet2 dotnet45"

This will run the requested winetricks before installing the app.

2 Likes

Thank you, this is all pretty magical, I wanted something exciting to get back at using snapcraft, this will be cool to try on the weekend! Awesome work!

1 Like

Feel free to ping me if you have any more questions, I’m happy there’s interest for this :slight_smile:

Hey, I have one more question, how do I make the prefix use wine x86 (32 bits) or amd64 (64 bits) ? The app I wanted to package is 32 bits only (at least for now).

1 Like

Wine will start an 64-bit environment by default. This runs both 32-bit and 64-bit Windows binaries.

A small number of 32-bit Windows applications, however, have issues when you run them in 64-bit Wine. For these applications, set WINEARCH to win32 to use a 32-bit-only environment. So only use this environment variable when you’re sure it doesn’t work on 64-bit Wine.

2 Likes