{% set version = "5.212" %}
{% set snapshotid = "1600955993" %}

package:
  name: qtwebkit
  version: {{ version }}

source:
  url: https://download.qt.io/snapshots/ci/qtwebkit/{{ version }}/{{ snapshotid }}/src/submodules/qtwebkit-opensource-src-{{ version }}.tar.xz
  sha256: 10cbdaba60aac79d27016aa05bae9ab3ec7b0aed4df163debfbf8fddd66adc14
  patches:
    # Fix path for ICU libs on Windows - seems to pick up some system libs instead
    - patches/0001-win-fix-icu-path.patch  # [win]
    # MSYS gperf needs Unix newlines
    - patches/0002-win-gperf-lf.patch  # [win]
    # Fix TRUE/FALSE definition for newer ICU
    - patches/0003-linux-icu-TRUE-FALSE.patch  # [linux]
    ## glib patch from https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webkit/trunk/glib-2.68.patch
    - patches/0004-linux-glib.patch  # [linux] 

build:
  number: 5
  skip: True  # [linux and (s390x or ppc64le)]
  run_exports:
    - qtwebkit

requirements:
  build:
    - sysroot_linux-64 2.17  # [linux64]
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    # The CDT packages below are those used in qt-feedstock
    - {{ cdt('xorg-x11-proto-devel') }}  # [linux]
    - {{ cdt('libx11-devel') }}          # [linux]
    - {{ cdt('libxext-devel') }}         # [linux]
    - {{ cdt('libxrender-devel') }}      # [linux]    
    - {{ cdt('mesa-libgl-devel') }}      # [linux]
    - {{ cdt('mesa-dri-drivers') }}      # [linux]
    - {{ cdt('libselinux') }}            # [linux]
    - {{ cdt('libxdamage') }}            # [linux]
    - {{ cdt('libxfixes') }}             # [linux]
    - {{ cdt('libxxf86vm') }}            # [linux]
    - {{ cdt('libxcb') }}                # [linux]
    - {{ cdt('libxext') }}               # [linux]
    - {{ cdt('libxau') }}                # [linux]
    - {{ cdt('libxcomposite-devel') }}   # [linux]
    - pkg-config                         # [unix]
    - cmake
    - ninja
    # On Linux, cmake picks up /usr/bin/python2 (since python2 is checked
    # first) which is v2.6 and too old. Workaround this by giving it a
    # new Python 2
    - python 2.7  # [linux and not aarch64]
    # On other platforms, use a recent Python (but fix version so we don't
    # end up with combos being built). This is especially needed on Windows
    # so we end up with a Python with a recent runtime. 
    - python 3.8  # [not linux]
    - perl
    - ruby
    - m2-bison    # [win]
    - bison       # [unix]
    - m2-flex     # [win]
    - flex        # [unix]
    - m2-gperf    # [win]
    - gperf       # [unix]
    - llvm-tools  # [osx]
    - patch       # [unix]
    - m2-patch    # [win]
  host:
    - qt-main
    - qt-webengine
    - glib  # [linux]
    - libxslt
    - libxml2 2.10
    - sqlite
    - jpeg
    - zlib
    - libpng
    - libwebp
    - icu
  run:
    - qt-main
    - qt-webengine
    - glib
    - libxslt
    - libxml2
    - sqlite
    - jpeg
    - zlib
    - libpng
    - libwebp
    - icu
    
  run_constrained:                                            # [osx]
    - __osx >={{ MACOSX_DEPLOYMENT_TARGET|default("10.9") }}  # [osx]

test:
  commands:
    - test -f $PREFIX/lib/libQt5WebKit${SHLIB_EXT}  # [not win]
    - test -f $PREFIX/lib/libQt5WebKitWidgets${SHLIB_EXT}  # [not win]
    - if not exist %LIBRARY_BIN%\\Qt5WebKit.dll exit 1  # [win]
    - if not exist %LIBRARY_BIN%\\Qt5WebKitWidgets.dll exit 1  # [win]

about:
  home: https://wiki.qt.io/Qt_WebKit
  license: LGPL-2.1-only
  license_file: LICENSE.LGPLv21
  license_family: LGPL
  summary: 'WebKit is one of the major engine to render webpages and execute JavaScript code'
  description: |
    Qt WebKit is the port of WebKit on top of Qt. QtWebKit relies on the public APIs of Qt
    and can theoretically be used on any platform supported by Qt
    (theoretically because WebKit also requires a recent/good compiler).
  doc_url: https://github.com/qtwebkit/qtwebkit/wiki
  dev_url: https://github.com/qt/qtwebkit

extra:
  recipe-maintainers:
    - gillins
    - ceholden
    - ocefpaf
