AppImageCommunity / pkg2appimage

Tool and recipes to convert existing deb packages to AppImage
http://appimage.org
MIT License
684 stars 209 forks source link

Specific build for package #521

Closed vitor251093 closed 1 year ago

vitor251093 commented 1 year ago

I'm trying to create an AppImage for Wine, for I'm having trouble with setting the Wine build.

When creating an AppImage with "winehq-stable" in the packages list, it will install the 2.0.2 version. If I use "winehq-stable=6.0.4\~buster" instead, Wine won't be installed. If I replace "winehq-stable=6.0.4\~buster" with "winehq-stable 6.0.4\~buster", it installs winehq-stable 2.0.2 instead. How can I specify which package build do I want to install?

Here is a sample of the YML file:

app: Wine
binpatch: true
ingredients:
  dist: buster
  packages:
    - winehq-stable=6.0.4~buster
    - bash
    - cabextract
    - dash
    - perl
    - coreutils
    - mesa-utils
    - unionfs-fuse
  sources:
    - deb http://deb.debian.org/debian buster main contrib non-free
    - deb https://dl.winehq.org/wine-builds/debian/ buster main
script:
  - cat > ./usr/bin/winewrapper << 'EOF'
  - #!/bin/bash
  - 
  - # WINE env
  - export WINEPREFIX=${WINEPREFIX:-"$HOME/.wine-appimage"}
  - export WINEDEBUG=${WINEDEBUG:-"fixme-all"}
  - 
  - # DXVK env
  - export DXVK_HUD=${DXVK_HUD:-"0"}
  - export DXVK_LOG_LEVEL=${DXVK_LOG_LEVEL:-"none"}
  - export DXVK_STATE_CACHE=${DXVK_STATE_CACHE:-"0"}
  - export DXVK_CONFIG_FILE=${DXVK_CONFIG_FILE:-"$progHome/dxvk.conf"}
  - 
  - # check gpu vendor
  - VENDOR=$(glxinfo -B | grep "OpenGL vendor")
  - 
  - if [[ $VENDOR == *"Intel"* ]]; then
  -   export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/intel_icd.i686.json:/usr/share/vulkan/icd.d/intel_icd.x86_64.json"
  - elif [[ $VENDOR == *"NVIDIA"* ]]; then
  -   export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/nvidia_icd.json"
  - elif [[ $VENDOR == *"Radeon"* ]]; then
  -   export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/radeon_icd.i686.json:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json"
  - fi
  - 
  - # Load winecfg if no arguments given
  - APPLICATION=""
  - if [ -z "$*" ] ; then
  -   APPLICATION="winecfg"
  - fi
  - 
  - # Allow the AppImage to be symlinked to e.g., /usr/bin/wineserver
  - if [ -n "$APPIMAGE" ] ; then
  -   BINARY_NAME=$(basename "$ARGV0")
  - else
  -   BINARY_NAME=$(basename "$0")
  - fi
  - 
  - if [ -n "$1" ] && [ -e "$APPDIR/bin/$1" ] ; then
  -   MAIN="$APPDIR/bin/$1" ; shift
  - elif [ -n "$1" ] && [ -e "$APPDIR/usr/bin/$1" ] ; then
  -   MAIN="$APPDIR/usr/bin/$1" ; shift
  - elif [ -e "$APPDIR/bin/$BINARY_NAME" ] ; then
  -   MAIN="$APPDIR/bin/$BINARY_NAME"
  - elif [ -e "$APPDIR/usr/bin/$BINARY_NAME" ] ; then
  -   MAIN="$APPDIR/usr/bin/$BINARY_NAME"
  - else
  -   MAIN="$APPDIR/usr/bin/wine"
  - fi
  - 
  - if [ -z "$APPLICATION" ] ; then
  - "$MAIN" "$@" | cat
  - else
  - "$MAIN" "$APPLICATION" | cat
  - fi  
  - EOF
  - chmod +x ./usr/bin/winewrapper
  - wget -q "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" -P ./bin && chmod +x ./bin/winetricks
  - wget -N https://source.winehq.org/git/wine.git/blob_plain/HEAD:/loader/wine.desktop
  - sed -i -e 's|Icon=wine.*|Icon=/usr/share/icons/wine.svg|g' wine.desktop
  - sed -i -e 's|Name=Wine.*|Name=Wine|g' wine.desktop
  - sed -i -e '/Name\[.*/d' wine.desktop
  - sed -i -e 's|Exec=wine.*|Exec=winewrapper|g' wine.desktop
  - echo 'Categories=Utility;Settings;' >> wine.desktop
  - mkdir -p ./usr/share/applications/
  - rm ./usr/share/applications/wine.desktop || true
  - cp ./wine.desktop ./usr/share/applications/wine.desktop
  - mkdir -p usr/share/icons
  - wget -N https://source.winehq.org/git/wine.git/blob_plain/HEAD:/dlls/wineandroid.drv/wine.svg
  - cp wine.svg usr/share/icons
  - wget -q "https://github.com/mmtrt/sommelier-core/raw/master/themes/light/light.msstyles" -P ./winedata/resources/themes/light
probonopd commented 1 year ago

Please check out https://github.com/mmtrt/WINE_AppImage. This task is too complex for pkg2appimage.

vitor251093 commented 1 year ago

I'm not asking for a Wine AppImage. I'm working on it. I tried to build an AppImage using that project you mentioned, but it didn't work.

What I'm asking for is for a method to install a package with an specific version/build. Is that really too complex for pkg2appimage?

vitor251093 commented 1 year ago

Just checked pkg2appimage source. It seems that, in order to have version support, the function apt-get.do-download would need to be updated accordingly. Otherwise, it will only consider the package name, but not the package version. Is that right?

probonopd commented 1 year ago

Packaging WINE is too complex for pkg2appimage. Trust me. I've been there.

vitor251093 commented 1 year ago

I've managed to package Wine with pkg2appimage with ease, but I had to do some improvements in pkg2appimage to do do, so it could download packages at specific versions. I will submit a pull request later.

In the meanwhile, you can check the result yourself: https://github.com/vitor251093/Wine_AppImage_Builder

If you have NodeJS installed that should be enough to try the build.js script. Downloading pkg2appimage isn't a requirement right now because, in order to test my changes, I've added it inside the project temporarily.