4ian / GDevelop

:video_game: Open-source, cross-platform game engine designed to be used by everyone.
https://gdevelop.io
Other
6.2k stars 713 forks source link

Help fix AUR packages #6550

Open xiota opened 2 weeks ago

xiota commented 2 weeks ago

The AUR packages aur/gdevelop and aur/gdevelop-git are in unusable state.

In early March, @arthuro555 posted messages saying, "I'd like to help maintain & update this package, could I be added as a co-maintainer?" However, after taking ownership of aur/gdevelop-git and being made comaintainer of aur/gdevelop, has not yet contributed updates to either package.

I understand upstream developers are not necessarily interested in helping with downstream packaging, but improved documentation or access to the scripts used to make the release appimage would be helpful.

arthuro555 commented 2 weeks ago

Hey! I've been working on a new pkgbuild but have met an issue, that being that the emscripten build inexplicably fails when configured by emconfigure in the fakeroot environement. I've sought advice of a debian and a fedora packager I knew and they were as clueless as I am. I can use a prebuilt version of the wasm GDevelop library, but it bothers me to include a prebuilt binary instead of building them from source :/

Another issue I've been having is that running GDevelop with the system wide installation of electron causes it to be falsely thinking it is running the dev version of GDevelop, and fail to load as no dev server is running. I still got it to technically work by patching the source files to to replace the check with a hardcoded const isDev = false;, but that is an incredibly ugly hack that could break anytime :/

I was thinking it wasn't worth uploading the new pkgbuild yet, until I figure these out, but even after over 30h of work & testing I couldn't find the source of the emscripten build failure.

xiota commented 2 weeks ago

This seems like a complicated application to package. Is the script that's used to make the release appimage available for examination? Or is the procedure documented somewhere? If not, would you mind providing an overview of the steps needed to put this package together?

arthuro555 commented 2 weeks ago

Building an app image is, appart from the WASM build part I can't get to work, straightforward:

  1. Clone GDevelop and emsdk repositories
  2. Run npm install in GDevelop.js
  3. Run the script in the emsdk repo to install the version of emsdk documented in the readme of GDevelop.js
  4. Enter the emsdk environment
  5. Run nom run build in GDevelop.js
  6. Go to newIDE/electron-app
  7. Run npm run build -- -l AppImage
  8. Get the app image at newIDE/electron-app/dist/GDevelop-xxxxxx.appimage
4ian commented 2 weeks ago

You can also check the CI doing the full build of the app (which is mostly what arthuro555 explained) here: https://github.com/4ian/GDevelop/blob/b7a4bab53c86ebdd1c29c270db857b72cbac692d/.circleci/config.yml#L123-L148

(+ a bit of setup before to install packages)

xiota commented 2 weeks ago

That's the build script I was unable to find before. I was looking inside the .github directory.

Where I got stuck is the wrong copy of clang is run. Complains that wasm architecture does not exist.

arthuro555 commented 2 weeks ago

Here's my current PKGBUILD for the gdevelop package:

# Maintainer: Arthur Pacaud <arthur.pacaud@hotmail.fr>
# Maintainer: Popolon <popolon@popolon.org>
# Contributor: Paulequilibrio
# Contributor: JKA Network <contacto@jkanetwork.com>
# Contributor: Todor Imreorov for github <blurymind@gmail.com>

pkgname=gdevelop
pkgver=5.3.195
pkgrel=1
pkgdesc="A full featured, open source game development software, allowing to create HTML5 and native games without knowing a programming language. All the game logic is made thanks to an intuitive and powerful event based system."
arch=('x86_64')
url=https://gdevelop.io
license=('MIT')
groups=()
provides=("gdevelop=${pkgver}")
conflicts=('gdevelop-bin' 'gdevelop-git')
makedepends=('npm' 'git' 'jq')
depends=('electron')
source=("gdevelop::git+https://github.com/4ian/GDevelop.git#tag=v${pkgver}"
  'emsdk::git+https://github.com/emscripten-core/emsdk.git'
  'gdevelop.desktop'
  'gdevelop.sh')
sha256sums=('SKIP'
  'SKIP'
  '81de9743eb30435302e429263b9bdcf6c3a8b36c52e29b87d9cd2d69be07b9e2'
  '8bcced9dacea29a0db4072365dd0df07f10fd29d2595700557b0a7c73a498645')

prepare() {
  "$srcdir/emsdk/emsdk" install 3.1.21
  "$srcdir/emsdk/emsdk" activate 3.1.21
}

build() {
  source "$srcdir/emsdk/emsdk_env.sh"

# CMake has a wrong output when running in fakeroot for some reason,
# so using prebuilt WASM instead of rebuilding it ourselves for now.
<<emsdk_build
  cd "$srcdir/gdevelop/GDevelop.js"
  npm install
  npm run build
emsdk_build

  cd "$srcdir/gdevelop/newIDE/app"
  npm install
  npx -y update-browserslist-db@latest

  cd "$srcdir/gdevelop/newIDE/electron-app"

  local electronVer="$(</usr/lib/electron/version)"
  local package="$(jq ".devDependencies.electron = \"$electronVer\"" package.json)"
  echo -E "${package}" > package.json

  npm install
  npm run build -- --linux --x64 --dir -c.electronDist="/usr/lib/electron" -c.electronVersion="$electronVer"
}

package() {
  mkdir -p "${pkgdir}/usr/share/gdevelop/"
  cp -dpr --no-preserve=ownership "$srcdir/gdevelop/newIDE/electron-app/dist/linux-unpacked/resources/" "${pkgdir}/usr/share/gdevelop/"
  chmod -R 755 "${pkgdir}/usr/share/gdevelop/"
  install -D -m 755 "$srcdir/gdevelop.sh" "${pkgdir}/usr/bin/gdevelop"
  install -D -m 644 "$srcdir/gdevelop.desktop" "${pkgdir}/usr/share/applications/gdevelop.desktop"
}

gdevelop.sh:

#!/bin/bash
exec "electron" "/usr/share/gdevelop/resources/app.asar" "$@"
arthuro555 commented 2 weeks ago

Notes:

xiota commented 1 week ago

@arthuro555 I haven't tried your PKGBUILD. I've been trying to use extra/emscripten (3.1.55). My last attempt failed after the following:

  cd "$srcdir/$_pkgsrc/GDevelop.js"
  npm install --no-audit --no-fund --prefer-offline
  npm run build

With the error:

[ 96%] Linking CXX executable libGD.js
.../GDevelop-5.3.201/Binaries/Output/Release_Emscripten/libGDCore.bc:1:2: error: expected integer
    1 | !<arch>
      |  ^
1 error generated.