# Adapted from Arch Linux qt5-webchannel PKGBUILD at:
# https://github.com/archlinux/svntogit-packages/raw/packages/qt5-webchannel/trunk/PKGBUILD

require 'package'

class Qtwebchannel < Package
  description 'Provides access to QObject or QML objects from HTML clients for seamless integration of Qt applications with HTML/JavaScript clients'
  homepage 'https://www.qt.io'
  version '5.15.7-4e35fe9'
  license 'GPL3 LGPL3 FDL custom'
  compatibility 'all'
  source_url 'https://invent.kde.org/qt/qt/qtwebchannel.git'
  git_hashtag '4e35fe9429920067c17596986b486fb1c1e95db0'

  binary_url({
    aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/qtwebchannel/5.15.7-4e35fe9_armv7l/qtwebchannel-5.15.7-4e35fe9-chromeos-armv7l.tar.zst',
     armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/qtwebchannel/5.15.7-4e35fe9_armv7l/qtwebchannel-5.15.7-4e35fe9-chromeos-armv7l.tar.zst',
       i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/qtwebchannel/5.15.7-4e35fe9_i686/qtwebchannel-5.15.7-4e35fe9-chromeos-i686.tar.zst',
     x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/qtwebchannel/5.15.7-4e35fe9_x86_64/qtwebchannel-5.15.7-4e35fe9-chromeos-x86_64.tar.zst'
  })
  binary_sha256({
    aarch64: 'f424c60bf4c5a8da2c1eaed811bb61f101446e07fd2987053cd484aba198148e',
     armv7l: 'f424c60bf4c5a8da2c1eaed811bb61f101446e07fd2987053cd484aba198148e',
       i686: '6648a1fbe95e2381fa6b642f54159020631c35171231a45b45f7518ef8881437',
     x86_64: '7f4a52e802c25ee71479b5fcf841a58e01bb992363948f1c189679bf9a797343'
  })

  depends_on 'gcc' # R
  depends_on 'glibc' # R
  depends_on 'libglvnd' # R
  depends_on 'qtbase' # R
  depends_on 'qtdeclarative' # R

  def self.build
    system 'qmake'
    system 'make'
  end

  def self.install
    system "make INSTALL_ROOT=#{CREW_DEST_DIR} install"
  end
end
