require 'package'

class Libxrender < Package
  description 'X Rendering Extension client library.'
  homepage 'https://www.x.org'
  version '0.9.11'
  license 'custom'
  compatibility 'all'
  source_url 'https://gitlab.freedesktop.org/xorg/lib/libxrender.git'
  git_hashtag "libXrender-#{version}"

  binary_url({
    aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libxrender/0.9.11_armv7l/libxrender-0.9.11-chromeos-armv7l.tar.zst',
     armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libxrender/0.9.11_armv7l/libxrender-0.9.11-chromeos-armv7l.tar.zst',
       i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libxrender/0.9.11_i686/libxrender-0.9.11-chromeos-i686.tar.zst',
     x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libxrender/0.9.11_x86_64/libxrender-0.9.11-chromeos-x86_64.tar.zst'
  })
  binary_sha256({
    aarch64: '859bf33ee1c94216071d6ef524e3f7ccb977cede86ab483b8936d6ef02ad802f',
     armv7l: '859bf33ee1c94216071d6ef524e3f7ccb977cede86ab483b8936d6ef02ad802f',
       i686: '73b44d73f9b0075adb1eb8413ed2e029bef828d0841f92061833e103e0b14110',
     x86_64: '247dda42e157a2eb78da0f9408e0cd8281787df630f6bba62e428d02dd31f217'
  })

  depends_on 'libx11'
  depends_on 'glibc' # R
  depends_on 'libbsd' # R
  depends_on 'libmd' # R
  depends_on 'libxau' # R
  depends_on 'libxcb' # R
  depends_on 'libxdmcp' # R

  def self.build
    system '[ -x configure ] || NOCONFIGURE=1 ./autogen.sh'
    system "./configure #{CREW_OPTIONS}"
    system 'make'
  end

  def self.install
    system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
  end
end
