Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sad-worms-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wine": major
---

feat: update wine to latest 11.0
49 changes: 49 additions & 0 deletions .github/workflows/build-wine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build Wine

on:
workflow_call:
workflow_dispatch:

concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true # for the love of all that is holy, cancel in progress runs on new pushes. linux builds take forever

jobs:
mac:
runs-on: macos-15
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Build for macOS
run: bash ./build.sh
shell: bash
working-directory: ./packages/wine

- name: Upload appimage artifact
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
with:
name: wine-macos
path: packages/wine/out/**/*.tar.gz
if-no-files-found: error
retention-days: 1
linux:
runs-on: ubuntu-latest
timeout-minutes: 120 # holy moly docker builds take forever
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Build for Linux
run: bash ./build.sh
shell: bash
working-directory: ./packages/wine

- name: Upload appimage artifact
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
with:
name: wine-linux
path: packages/wine/out/**/*.tar.gz
if-no-files-found: error
retention-days: 1
8 changes: 7 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ jobs:
uses: ./.github/workflows/build-squirrel.yaml
needs: detect

wine:
if: contains(needs.detect.outputs.matrix, '"wine"')
uses: ./.github/workflows/build-wine.yaml
needs: detect

combine:
runs-on: macos-latest
needs: [
Expand All @@ -89,7 +94,8 @@ jobs:
ran,
nsis,
dmg-builder,
squirrel
squirrel,
wine
]
if: |
always() &&
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ artifacts
artifacts-staging
**/build
.buildx-cache

packages/**/*.zip
packages/**/*.tar.gz
packages/**/*.7z
150 changes: 150 additions & 0 deletions packages/wine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Wine Portable Bundle Builder

Compile Wine from source to create portable, self-contained bundles.

**Simple approach:** Builds for current architecture only, uses Rosetta when needed.

## Quick Start

```bash
./build.sh
```

Builds Wine for your current architecture (30-60 minutes).

## Prerequisites

```bash
# Install Xcode Command Line Tools
xcode-select --install
```

**That's it.** No Homebrew, no dependencies, nothing.

Builds Wine **without FreeType** (fonts work via macOS fallback).

## Architecture Strategy

**Always builds x86_64 Wine** (works on both Intel and ARM):
- **Intel Mac** → Builds x86_64 natively
- **ARM Mac** → Builds x86_64 via Rosetta (uses x86_64 Homebrew at `/usr/local`)

**Why x86_64 on ARM?**
- ✅ Much simpler (no PE cross-compilation tools needed)
- ✅ Works perfectly via Rosetta
- ✅ Same binary works on both Intel and ARM Macs
- ✅ Avoids ARM64 Wine complications

**Native ARM64 Wine is not worth it:**
- ❌ Requires llvm-mingw cross-compilation setup
- ❌ Much more complex to build
- ❌ Limited benefit (Rosetta works great)

## Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `WINE_VERSION` | Wine version to build | `11.0` |
| `BUILD_DIR` | Build output directory | `./build` |

## Examples

```bash
# Build Wine 9.0 (default)
./build.sh

# Build Wine 8.0
WINE_VERSION=8.0 ./build.sh

# Build for Linux (requires Docker)
OS_TARGET=linux ./build.sh
```

## GitHub Actions Usage

Perfect for CI/CD with separate runners:

```yaml
jobs:
build-intel:
runs-on: macos-15-intel # Intel runner
steps:
- run: ./build.sh
# Produces: wine-11.0-darwin-x86_64.tar.gz

build-arm:
runs-on: macos-15 # ARM runner
steps:
- run: ./build.sh
# Produces: wine-11.0-darwin-x86_64.tar.gz (via Rosetta)
```

Both produce x86_64 binaries that work everywhere!

## What You Get

A **portable Wine bundle**:
- Latest Wine version (not stuck on 4.0.3!)
- Pre-initialized Wine prefix
- Cleaned up (~60% smaller)
- Self-contained, no dependencies
- Works on both Intel and ARM Macs

## Output Structure

```
wine-9.0-darwin-x86_64/
├── bin/wine64 # Wine binary
├── lib/ # Libraries
├── share/wine/ # Data files
├── wine-home/ # Pre-initialized prefix
│ ├── dosdevices/
│ │ ├── c: -> ../drive_c
│ │ └── z: -> /
│ ├── drive_c/
│ └── *.reg
├── wine-launcher.sh # Launcher
└── README.md
```

## Using the Bundle

```bash
tar -xzf wine-9.0-darwin-x86_64.tar.gz
cd wine-9.0-darwin-x86_64
./wine-launcher.sh notepad
```

## Build Time

- **30-60 minutes** depending on your machine
- First build downloads dependencies (~5-10 min extra)
- Subsequent builds reuse cached dependencies

## Cleanup

```bash
# Remove build artifacts but keep dependencies (for faster rebuilds)
rm -rf build/wine-* build/downloads

# Remove everything
rm -rf build/
```

## Available Wine Versions

- **9.0** (latest stable, recommended)
- **8.0**
- **7.0**

Source: https://dl.winehq.org/wine/source/

## Why Not Use Homebrew?

Homebrew installs to system directories with external dependencies. Not portable!

This creates **self-contained bundles** you can distribute.

## License

Wine is free software released under the GNU LGPL.
19 changes: 19 additions & 0 deletions packages/wine/assets/Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@



# AUTO-GENERATED – DO NOT EDIT
# Build helpers
# Generated from Wine config.log
# Toolchain
# Wine dependencies
brew "autoconf"
brew "automake"
brew "bison"
brew "flex"
brew "gettext"
brew "gnutls"
brew "libtool"
brew "make"
brew "mingw-w64"
brew "pkg-config"
brew "xz"
64 changes: 64 additions & 0 deletions packages/wine/assets/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Dockerfile for building Wine for Linux x86_64
# Can be built on ARM64 macOS using Docker Desktop with --platform flag

FROM --platform=linux/amd64 ubuntu:22.04

# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
flex \
bison \
gcc-mingw-w64 \
libc6-dev \
libfreetype6-dev \
libgnutls28-dev \
libpng-dev \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libncurses-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libvulkan-dev \
libudev-dev \
libsdl2-dev \
libcups2-dev \
libdbus-1-dev \
libfontconfig1-dev \
libfreetype6-dev \
libgphoto2-dev \
liblcms2-dev \
libldap2-dev \
libpulse-dev \
libsane-dev \
libtiff-dev \
libunwind-dev \
libusb-1.0-0-dev \
libx11-dev \
libxcomposite-dev \
libxcursor-dev \
libxext-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev \
libxrender-dev \
libxxf86vm-dev \
xz-utils \
&& rm -rf /var/lib/apt/lists/*

# Create build directory
WORKDIR /build

# Script will be mounted or copied
COPY build-in-docker.sh /build/build-in-docker.sh
COPY generate-trace-exes.sh /build/generate-trace-exes.sh
RUN chmod +x /build/build-in-docker.sh /build/generate-trace-exes.sh

# Output directory
VOLUME /output

CMD ["/build/build-in-docker.sh"]
Loading
Loading