L4 help: dusklight build for flathub

Hi there.

I’m about to build a flatpak for dusklight, a zelda twilight princess port for PC. I already am at a point where is builds, with metadata, for local builds. The problem is that it requires networking at build time to pull in a precompiled googles-dawn.

I honestly don’t know how to deal with it. It doesn’t seem that there is a prebuild flatpak of dawn, and self build is out of the question, since this is a HUGE project that will probably need days to build on my hardware.

My current source is (metainfo commented out, because not required here). Now this works, locally.

app-id: dev.twilitrealm.dusklight
runtime: org.freedesktop.Platform
runtime-version: "25.08"
sdk: org.freedesktop.Sdk
sdk-extensions:
  - org.freedesktop.Sdk.Extension.llvm22

command: dusklight

finish-args:
# Graphical output
  - --socket=wayland
  - --socket=fallback-x11
# Audio Support
  - --socket=pulseaudio
  - --filesystem=xdg-run/pipewire-0
# GPU Support
  - --device=dri
# Read ISO from downloads
  - --filesystem=xdg-download:ro
# Controller Support
  - --device=input

modules:
  - name: org.libsdl.SDL3
    buildsystem: cmake
    build-options:
      cflags: "-O3"
      cxxflags: "-O3"
      prepend-path: /usr/lib/sdk/llvm22/bin
      env:
        CC: clang
        CXX: clang++
    sources:
      - type: archive
        url: https://libsdl.org/release/SDL3-3.4.8.tar.gz
        sha256: e9fff7467fb60f037e6708da18b25560649e4c63edc2a69bb871b960d9cbfbba

  - name: dusklight
    buildsystem: simple
    build-options:
      build-args:
        # Network access at buildtime
        - --share=network
      cflags: "-O3"
      cxxflags: "-O3"
      prepend-path: /usr/lib/sdk/llvm22/bin
      env:
        CC: clang
        CXX: clang++
    build-commands:
      - cmake -S . -B build -DDUSK_ENABLE_UPDATE_CHECKER=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSDL3_DIR=/app -DCMAKE_INSTALL_PREFIX=/app
      - cmake --build build -- -j$(nproc)
      - cmake --install build --prefix /app
    post-install:
      # Correct the binary path
      ## Dusklight needs to run from /app, but flatpak wants it to be in /app/bin.
      ## Create a little helper to do this, while keeping the working directory in /app
      - mkdir -p /app/bin
      - printf '%s\n' '#!/usr/bin/env sh' 'cd /app' 'exec /app/dusklight "$@"' > /app/bin/dusklight
      - chmod +x /app/bin/dusklight
      # Install Desktop file
      - install -Dm644 platforms/freedesktop/dusklight.desktop /app/share/applications/dev.twilitrealm.dusklight.desktop
      ## Fix up icon naming
      - sed -i 's/Icon=dusklight/Icon=dev.twilitrealm.dusklight/' /app/share/applications/dev.twilitrealm.dusklight.desktop
      # Install Icons
      - install -Dm644 platforms/freedesktop/16x16/apps/dusklight.png /app/share/icons/hicolor/16x16/apps/dev.twilitrealm.dusklight.png
      - install -Dm644 platforms/freedesktop/32x32/apps/dusklight.png /app/share/icons/hicolor/32x32/apps/dev.twilitrealm.dusklight.png
      - install -Dm644 platforms/freedesktop/48x48/apps/dusklight.png /app/share/icons/hicolor/48x48/apps/dev.twilitrealm.dusklight.png
      - install -Dm644 platforms/freedesktop/64x64/apps/dusklight.png /app/share/icons/hicolor/64x64/apps/dev.twilitrealm.dusklight.png
      - install -Dm644 platforms/freedesktop/128x128/apps/dusklight.png /app/share/icons/hicolor/128x128/apps/dev.twilitrealm.dusklight.png
      - install -Dm644 platforms/freedesktop/256x256/apps/dusklight.png /app/share/icons/hicolor/256x256/apps/dev.twilitrealm.dusklight.png
      - install -Dm644 platforms/freedesktop/512x512/apps/dusklight.png /app/share/icons/hicolor/512x512/apps/dev.twilitrealm.dusklight.png
      # Install metainfo
      ##- install -Dm644 dev.twilitrealm.dusklight.metainfo.xml /app/share/metainfo/dev.twilitrealm.dusklight.metainfo.xml
    sources:
      - type: git
        url: https://github.com/TwilitRealm/dusklight.git
        tag: v1.1.1
        commit: 7a77d48954847330a5ab55f5c7f2e64cdd25d846
        disable-shallow-clone: true
#      - type: file
#        path: dev.twilitrealm.dusklight.metainfo.xml
#        dest: .

But the moment I take away

      build-args:
        # Network access at buildtime
        - --share=network

It fails at:

-- aurora: Fetching prebuilt Dawn package from https://github.com/encounter/dawn-build/releases/download/v20260423.175430/dawn-linux-x86_64.tar.gz
          --- LOG END ---
          error: downloading 'https://github.com/encounter/dawn-build/releases/download/v20260423.175430/dawn-linux-x86_64.tar.gz' failed
          status_code: 6
          status_string: "Could not resolve hostname"
          log:
          --- LOG BEGIN ---
          Could not resolve host: github.com

  shutting down connection #0

That is completely expected :slight_smile:

As I said, I can’t think of anything the workaround this.

What could work is to download the archive with Flatpak-Builder and storing it to where CMake would download the archive to.
AFAIK if CMake already finds the archive downloaded it will just use that and not try to download it again.

That being said:
If you attempt to put it up to Flathub eventually, you will need to figure out how to build it from source:

Thanks for your response. Sadly I couldn’t figure it out over the last 2 days on where to put it. It seems that cmake won’t check for it but always tries to download it. Building dawn from source is not an option for me. In that case I’d have to give up.

Just from looking at the CMake file, you probably be able to tell it to use a pre-downloaded one by using the AURORA_DAWN_PROVIDER variable to system:

So, you would create a new module that downloads and installs Dawn before dusklight, and then use that in the build.