name: wireshare
title: @release_app_name@
version: '@release_version@'
summary: Peer-to-peer sharing for Gnutella, BitTorrent, magnet, and eD2k.
description: |
  WireShare is a desktop peer-to-peer client that continues the LimeWire and
  LimeWire Pirate Edition lineage while shipping a consistent Linux desktop
  identity across hosted builders and distro recipes.
base: core24
grade: stable
confinement: strict
license: GPL-3.0-or-later
website: @release_homepage_url@
issues: @release_issues_url@
source-code: @release_homepage_url@
icon: packaging/common/icons/hicolor/512x512/apps/@release_app_id@.png
architectures:
  - build-on: amd64
apps:
  wireshare:
    command: usr/bin/WireShare
    common-id: @release_app_id@
    desktop: usr/share/applications/@release_app_id@.desktop
    plugs:
      - audio-playback
      - desktop
      - desktop-legacy
      - home
      - network
      - opengl
      - wayland
      - x11
parts:
  wireshare:
    plugin: nil
    source: .
    build-packages:
      - curl
    stage-packages:
      - openjdk-21-jre-headless
      - libnotify4
      - zenity
    override-build: |
      set -eu
      RELEASE_JAR_URL="@wire_share_jar_url@"
      curl -L "${RELEASE_JAR_URL}" -o @wire_share_jar_name@
      install -Dm644 @wire_share_jar_name@ "${CRAFT_PART_INSTALL}/usr/share/wireshare/@wire_share_jar_name@"
      install -Dm755 packaging/common/launchers/WireShare "${CRAFT_PART_INSTALL}/usr/bin/WireShare"
      install -Dm644 packaging/common/app/@release_app_id@.desktop "${CRAFT_PART_INSTALL}/usr/share/applications/@release_app_id@.desktop"
      install -Dm644 packaging/common/app/@release_app_id@.metainfo.xml "${CRAFT_PART_INSTALL}/usr/share/metainfo/@release_app_id@.metainfo.xml"
      install -Dm644 packaging/common/icons/scalable/apps/@release_app_id@.svg "${CRAFT_PART_INSTALL}/usr/share/icons/hicolor/scalable/apps/@release_app_id@.svg"
      install -Dm644 packaging/common/icons/scalable/status/@release_app_id@.XferDone.svg "${CRAFT_PART_INSTALL}/usr/share/icons/hicolor/scalable/status/@release_app_id@.XferDone.svg"
      for size in 16 20 22 24 32 36 40 48 64 72 96 128 192 256 384 512 1024; do
        install -Dm644 "packaging/common/icons/hicolor/${size}x${size}/apps/@release_app_id@.png" "${CRAFT_PART_INSTALL}/usr/share/icons/hicolor/${size}x${size}/apps/@release_app_id@.png"
        install -Dm644 "packaging/common/icons/hicolor/${size}x${size}/status/@release_app_id@.XferDone.png" "${CRAFT_PART_INSTALL}/usr/share/icons/hicolor/${size}x${size}/status/@release_app_id@.XferDone.png"
      done
      install -Dm644 nativelibs/linux/libjdic.so "${CRAFT_PART_INSTALL}/usr/lib/wireshare/libjdic.so"
      install -Dm644 nativelibs/linux/libtorrent-wrapper.so "${CRAFT_PART_INSTALL}/usr/lib/wireshare/libtorrent-wrapper.so"
      install -Dm644 nativelibs/linux/libtorrent-wrapper64.so "${CRAFT_PART_INSTALL}/usr/lib/wireshare/libtorrent-wrapper64.so"
      install -Dm644 nativelibs/linux/libtray.so "${CRAFT_PART_INSTALL}/usr/lib/wireshare/libtray.so"
