# appimage-builder recipe see https://appimage-builder.readthedocs.io for details
# Please build this AppImage on Ubuntu 18.04
version: 1
script:
  # Remove any previous build
  - rm -rf AppDir | true
  # Install application dependencies
  - pip3 install --upgrade pip && pip3 install --ignore-installed --prefix=/usr --root=AppDir -r ./requirements.txt
  # Download sciter.so
  - mkdir -p AppDir/usr/lib/rustdesk/
  - pushd AppDir/usr/lib/rustdesk && wget https://github.com/c-smile/sciter-sdk/raw/29a598b6d20220b93848b5e8abab704619296857/bin.lnx/x64/libsciter-gtk.so && popd
  # Build rustdesk
  - pushd .. && python3 inline-sciter.py && cargo build --features inline,appimage --release && popd
  - mkdir -p AppDir/usr/bin
  - cp ../target/release/rustdesk  AppDir/usr/bin/rustdesk
  # Make usr and icons dirs
  - mkdir -p AppDir/usr/share/icons/hicolor/128x128 && cp ../128x128.png AppDir/usr/share/icons/hicolor/128x128/rustdesk.png
  - mkdir -p AppDir/usr/share/icons/hicolor/32x32 && cp ../32x32.png AppDir/usr/share/icons/hicolor/32x32/rustdesk.png
  - cp rustdesk.desktop AppDir/

AppDir:
  path: ./AppDir
  app_info:
    id: rustdesk
    name: RustDesk
    icon: rustdesk
    version: 1.1.10
    exec: usr/bin/rustdesk
    exec_args: $@
  apt:
    arch:
    - amd64
    allow_unauthenticated: true
    sources:
    - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
    - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
    - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic universe
    - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
    - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
    - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
    - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
    - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-security main restricted
    - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-security universe
    - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-security multiverse
    include:
    - libc6:amd64
    - libgcc1:amd64
    - libgcrypt20:amd64
    - libgtk-3-0:amd64
    - liblz4-1:amd64
    - liblzma5:amd64
    - libpcre3:amd64
    - libpulse0:amd64
    - libsystemd0:amd64
    - libxau6:amd64
    - libxcb-randr0:amd64
    - libxdmcp6:amd64
    - libxdo3:amd64
    - libxext6:amd64
    - libxfixes3:amd64
    - libxinerama1:amd64
    - libxrender1:amd64
    - libxtst6:amd64
    - python3:amd64
    - python3-pkg-resources:amd64
  files:
    include: []
    exclude:
    - usr/share/man
    - usr/share/doc/*/README.*
    - usr/share/doc/*/changelog.*
    - usr/share/doc/*/NEWS.*
    - usr/share/doc/*/TODO.*
  runtime:
    env:
      PYTHONHOME: '${APPDIR}/usr'
      PYTHONPATH: '${APPDIR}/usr/lib/python3.6/site-packages'
  test:
    fedora-30:
      image: appimagecrafters/tests-env:fedora-30
      command: ./AppRun
    debian-stable:
      image: appimagecrafters/tests-env:debian-stable
      command: ./AppRun
    archlinux-latest:
      image: appimagecrafters/tests-env:archlinux-latest
      command: ./AppRun
    centos-7:
      image: appimagecrafters/tests-env:centos-7
      command: ./AppRun
    ubuntu-xenial:
      image: appimagecrafters/tests-env:ubuntu-xenial
      command: ./AppRun
AppImage:
  arch: x86_64
  update-information: guess
