# * Copyright 2024 Soumyadeep Ghosh (সৌম্যদীপ ঘোষ) <soumyadeepghosh2004@zohomail.in>
# * Copyright 2023 Scarlett Moore <sgmoore@kde.org>
# * SPDX-License-Identifier: GPL-2.0-or-later
name: kweather
confinement: strict
grade: stable
base: core22
adopt-info: kweather

apps:
  kweather:
    extensions: [kde-neon-6]
    common-id: org.kde.kweather
    desktop: usr/share/applications/org.kde.kweather.desktop
    command: usr/bin/kweather
    plugs:
      - unity7
      - network

compression: lzo

slots:
  session-dbus-interface:
    interface: dbus
    name: org.kde.kweather
    bus: session

parts:
  libplasma:
    plugin: cmake
    source: https://invent.kde.org/plasma/libplasma/-/archive/v6.0.3/libplasma-v6.0.3.tar.gz
    cmake-parameters:
      - -DCMAKE_INSTALL_PREFIX=/usr
      - -DCMAKE_BUILD_TYPE=Release
      - -DBUILD_DESKTOPTHEMES=OFF
      - -DBUILD_TESTING=OFF
    build-packages:
      - libxcb-composite0-dev
      - libxcb-damage0-dev
      - libxcb-shape0-dev
      - libxcb-glx0-dev
      - libwayland-dev
      - doxygen
      - gettext
      - graphviz
      - pkg-config
      - libgl-dev
      - libgl1-mesa-dev
      - libgles-dev
      - libglvnd-dev
      - libglx-dev
      - libegl-dev
      - libsm-dev
      - docbook
      - docbook-xml
      - docbook-xsl
    prime:
      - -usr/lib/*/cmake/*
      - -usr/include/*
      - -usr/share/ECM/*
      - -usr/share/doc/*
      - -usr/share/man/*
      - -usr/share/icons/breeze-dark*
      - -usr/bin/X11
      - -usr/lib/gcc/$CRAFT_ARCH_TRIPLET_BUILD_FOR
      - -usr/lib/aspell/*
      - -usr/share/docs
      - -usr/share/lintain

  kweathercore:
    plugin: cmake
    source: https://invent.kde.org/libraries/kweathercore.git
    source-tag: "v0.8.0"
    source-depth: 1
    cmake-parameters:
      - -DCMAKE_INSTALL_PREFIX=/usr
      - -DCMAKE_BUILD_TYPE=Release
      - -DBUILD_TESTING=OFF
      - -DKDE_SKIP_TEST_SETTINGS=ON
    prime:
      - -usr/lib/*/cmake/*
      - -usr/include/*
      - -usr/share/ECM/*
      - -usr/share/doc/*
      - -usr/share/man/*
      - -usr/share/icons/breeze-dark*
      - -usr/bin/X11
      - -usr/lib/gcc/$CRAFT_ARCH_TRIPLET_BUILD_FOR
      - -usr/lib/aspell/*
      - -usr/share/docs
      - -usr/share/lintain

  kweather:
    after:
      - libplasma
      - kweathercore
    parse-info:
      - usr/share/metainfo/org.kde.kweather.appdata.xml
    plugin: cmake
    build-packages:
      - reuse
      - libvulkan-dev
      - libxkbcommon-dev
    source: .
    cmake-parameters:
      - -DCMAKE_INSTALL_PREFIX=/usr
      - -DCMAKE_BUILD_TYPE=Release
      - -DENABLE_TESTING=OFF
      - -DBUILD_TESTING=OFF
      - -DKDE_SKIP_TEST_SETTINGS=ON
    prime:
      - -usr/lib/*/cmake/*
      - -usr/include/*
      - -usr/share/ECM/*
      - -usr/share/doc/*
      - -usr/share/man/*
      - -usr/share/icons/breeze-dark*
      - -usr/bin/X11
      - -usr/lib/gcc/$CRAFT_ARCH_TRIPLET_BUILD_FOR/6.0.0
      - -usr/lib/aspell/*
      - -usr/share/lintian
    build-environment:
      - CMAKE_PREFIX_PATH: $CRAFT_STAGE/usr:/snap/kf6-core22-sdk/current/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}
