remyroy / CDDA-Game-Launcher

A Cataclysm: Dark Days Ahead launcher with additional features

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make a linux build

OtakuSenpai opened this issue · comments

Please make a linux build so that linux users can use your software.

Short answer is no, it's not going to happen in the current form.

The Linux official builds are known for being difficult to run on various distributions partially because of the dependencies they need. Most Linux players already compile their own game.

I've heard people having success with using a compatibility layer like Wine or Proton to run both the launcher and the game. That could be a good alternative.

@jhagrid77 started some kind of linux launcher. That could be a good alternative as well.

Ultimately, I believe the proper linux way of doing this would be with some kind of automation with the CI server that would push the latest experimental to a Personal Package Archive (PPA) on Launchpad. This way, you could have automated updates on Ubuntu and Debian derivatives using their package manager.

I'm willing to solve the Linux execution issues for the game, possibly by adding custom compilation and/or automating the creation of distro packages.

I actually started working on a new project, coincidentally also using python and Qt, before I realized that CDDAGL also uses PyQt (I assumed it was some windows-only tech like .NET/WPF. Then I discovered this repo and realized it was in fact PyQt based. It wouldn't make much sense to re-implement everything in a separate project just for Linux.

Would you accept PRs to make this work within CDDAGL?

(I've worked on packaging DF for Linux, as well as the LNP, so this stuff isn't new to me)

Last time I checked, it was really hard to get the proper dependencies for the official linux build. If you can show me how to use the official linux builds and make it run properly on the top 4 linux distros (something like Ubuntu/Debian/Linux Mint, Arch, Fedora, Gentoo on a clean install), I'll consider adding and supporting a linux launcher.

Building in a Docker container would solve dependency issues and make it able to run cleanly on all Linux distributions.

@Djent- If you want to build, test and host those docker distributions somewhere and do so consistently with every experimental releases, let me know and we'll see how to integrate those with the launcher.

What about a CDDA mod manager? Something that you could just download to whatever folder you have CDDA mods and soundpacks installed in, and then you can run it and download mods and soundpacks?

Also, there are now cross-platform package managers for Linux such as Flatpak that will run on any distro that the package manager can be installed on. Maybe we could have some kind of CDDA installer for Flatpak?

Last time I checked, it was really hard to get the proper dependencies for the official linux build. If you can show me how to use the official linux builds and make it run properly on the top 4 linux distros (something like Ubuntu/Debian/Linux Mint, Arch, Fedora, Gentoo on a clean install), I'll consider adding and supporting a linux launcher.

I have created a bash script (see below) that can install the dependencies taken from official packages of CentOS/RHEL, Debian/Ubuntu, Fedora and OpenSUSE. Would that be workable, or would you prefer something in Python?

#!/bin/bash

KIND="${1:-tiles}"

. /etc/os-release

unsupported_os() {
  os_name=${PRETTY_NAME}
  if [[ ! -z ${os_name} ]]; then
    os_name="${NAME} ${VERSION_ID}"
  fi
  echo "OS ${os_name} is not supported" >&2
}

if [[ ${KIND} = "curses" ]]; then
  case ${ID} in
  centos|rhel)
  # Adapted from https://fedora.pkgs.org/32/fedora-updates-x86_64/cataclysm-dda-0.E.2-1.fc32.x86_64.rpm.html
  if [[ ${VERSION_ID} -gt 7 ]]; then
    dnf install libc.so.6\(\)\(64bit\) libgcc_s.so.1\(\)\(64bit\) libm.so.6\(\)\(64bit\) libncursesw.so.5\(\)\(64bit\) libstdc++.so.6\(\)\(64bit\) libtinfo.so.5\(\)\(64bit\)
  else
    unsupported_os
    exit 1
  fi
  ;;
  debian|ubuntu)
  # Adapted from https://debian.pkgs.org/sid/debian-main-amd64/cataclysm-dda-curses_0.E-1-1_amd64.deb.html
  apt install libc6 libgcc-s1 libncursesw5 libstdc++6 libtinfo5
  ;;
  fedora)
  # Adapted from https://fedora.pkgs.org/32/fedora-updates-x86_64/cataclysm-dda-0.E.2-1.fc32.x86_64.rpm.html
  dnf install libc.so.6\(\)\(64bit\) libgcc_s.so.1\(\)\(64bit\) libm.so.6\(\)\(64bit\) libncursesw.so.5\(\)\(64bit\) libstdc++.so.6\(\)\(64bit\) libtinfo.so.5\(\)\(64bit\)
  ;;
  opensuse-*)
  zypper in libc.so.6\(\)\(64bit\) libgcc_s.so.1\(\)\(64bit\) libm.so.6\(\)\(64bit\) libncursesw.so.5\(\)\(64bit\) libstdc++.so.6\(\)\(64bit\) libtinfo.so.5\(\)\(64bit\)
  ;;
  *)
  unsupported_os
  exit 1
  ;;
  esac
elif [[ "${KIND}" = "tiles" ]]; then
  case ${ID} in
  arch|manjaro)
  # Adapted from https://archlinux.pkgs.org/rolling/archlinux-community-x86_64/cataclysm-dda-tiles-0.E.2-1-x86_64.pkg.tar.zst.html
  pacman -S freetype2 sdl2_image sdl2_mixer sdl2_ttf --needed
  ;;
  centos|rhel)
  # Adapted from https://fedora.pkgs.org/32/fedora-updates-x86_64/cataclysm-dda-tiles-0.E.2-1.fc32.x86_64.rpm.html
  if [[ ${VERSION_ID} -gt 7 ]]; then
    # At the time of writing SDL_image, SDL_mixer and SDL_ttf are not yet available in EPEL, this will probably get rectified in the future
    dnf install mesa-dri-drivers mesa-libGL libSDL2-2.0.so.0\(\)\(64bit\) libSDL2_image-2.0.so.0\(\)\(64bit\) libSDL2_mixer-2.0.so.0\(\)\(64bit\) libSDL2_ttf-2.0.so.0\(\)\(64bit\) libc.so.6\(\)\(64bit\) libgcc_s.so.1\(\)\(64bit\) libm.so.6\(\)\(64bit\) libpthread.so.0\(\)\(64bit\) libstdc++.so.6\(\)\(64bit\)
  else
    unsupported_os
    exit 1
  fi
  ;;
  debian|ubuntu)
  # Adapted from https://debian.pkgs.org/sid/debian-main-amd64/cataclysm-dda-sdl_0.E-1-1_amd64.deb.html
  apt install libc6 libgcc-s1 libsdl2-2.0-0 libsdl2-image-2.0-0 libsdl2-mixer-2.0-0 libsdl2-ttf-2.0-0 libstdc++6
  ;;
  fedora)
  # Adapted from https://fedora.pkgs.org/32/fedora-updates-x86_64/cataclysm-dda-tiles-0.E.2-1.fc32.x86_64.rpm.html
  dnf install mesa-dri-drivers mesa-libGL libSDL2-2.0.so.0\(\)\(64bit\) libSDL2_image-2.0.so.0\(\)\(64bit\) libSDL2_mixer-2.0.so.0\(\)\(64bit\) libSDL2_ttf-2.0.so.0\(\)\(64bit\) libc.so.6\(\)\(64bit\) libgcc_s.so.1\(\)\(64bit\) libm.so.6\(\)\(64bit\) libpthread.so.0\(\)\(64bit\) libstdc++.so.6\(\)\(64bit\)
  ;;
  opensuse-*)
  zypper in Mesa-dri libSDL2-2_0-0 libSDL2_image-2_0-0 libSDL2_mixer-2_0-0 libSDL2_ttf-2_0-0 libc.so.6\(\)\(64bit\) libgcc_s.so.1\(\)\(64bit\) libm.so.6\(\)\(64bit\) libpthread.so.0\(\)\(64bit\) libstdc++.so.6\(\)\(64bit\)
  ;;
  *)
  unsupported_os
  exit 1
  ;;
  esac
else
  echo "Usage: $0 [curses|tiles]" >&2
  exit 1
fi

@Dudecake Have you tested this script with a recent version of those distributions?

I have tested the curses path on CentOS 7 and 8 (7 doesn't work), Ubuntu 20.04, Fedora 32 and OpenSUSE Leap 15.2. The tiles path is tested the same way, but with that testing method SDL naturally can't open the display. Tonight I can test this better.

@remyroy I have since tested the tiles path and made some changes so CDDA correctly starts. I've edited the script in the previous post.

@remyroy
I have put my hands on porting CDD-Game-Launcher to Linux. Here is my fork:
https://github.com/PassionateAngler/CDDA-Game-Launcher
It is WiP. What works now is downloading stable game and launching it, but every evening it gets better :)
Small discussion here:
https://www.reddit.com/r/cataclysmdda/comments/j6dk5d/cdda_game_launcher_remyroy_linux_port/

@PassionateAngler This is awesome! Keep up the good work 💪

@PassionateAngler Hey just tried to open this up on my system but getting an error when building with Python 3.9.

CDDA Game Launcher started: 1.4.12
Global error:
Launcher version: 1.4.12
Type: <class 'AttributeError'>
Value: 'NoneType' object has no attribute 'strip'
Traceback:
  File "/home/USER/git/CDDA-Game-Launcher/cddagl/ui/views/main.py", line 3326, in run
    build_changes = list(unique(build_changes))
  File "/home/USER/git/CDDA-Game-Launcher/cddagl/functions.py", line 35, in unique
    for x in seq:
  File "/home/USER/git/CDDA-Game-Launcher/cddagl/ui/views/main.py", line 3324, in <lambda>
    build_changes = map(lambda x: html.escape(x.text.strip(), True),

I'd have posted this on your fork but doesn't look like issues are enabled there.

Launcher is freezeing on my end. @PassionateAngler Is this a reported bug?
104960328-c939ef00-59b2-11eb-8548-1b2e740af6c6
Pop! OS.
i7
16gb
GTX 960m

Hi guys @scanevaro @rodneyrod thank you for feedback.
I have enabled issues on my repo.
https://github.com/PassionateAngler/CDDA-Game-Launcher/issues
Please create tickets there.