{% set version = "2020.0.0" %}
{% set version_major_minor = ".".join(version.split('.')[:2]) %}

package:
  name: hugin
  version: {{ version }}

source:
  url: https://iweb.dl.sourceforge.net/project/hugin/hugin/hugin-{{ version_major_minor }}/hugin-{{ version }}.tar.bz2
  sha256: 283e7601259a7914cb075333424410928a439dc5f84216f33e2fe55501fbcacb
  # Line endings frustrate me. So I've just vendored the files but documented the patch.
  # patches:
  #   - windows_unbundle.patch

build:
  skip: true  # [osx]
  number: 0

requirements:
  build:
    - {{ compiler('cxx') }}
    - libgomp      # [linux]
    - make   # [unix]
    - ninja  # [win]
    - cmake
    - swig
    - binutils  # [linux]
    - pkg-config  # [unix]
    - {{ cdt('mesa-libgl-devel') }}  # [linux]
    - {{ cdt('mesa-dri-drivers') }}  # [linux]
    - {{ cdt('libselinux') }}  # [linux]
    - {{ cdt('libxdamage') }}  # [linux]
    - {{ cdt('libxxf86vm') }}  # [linux]
    - {{ cdt('libxext') }}     # [linux]
    # Just taken from wxWidgets
    - {{ cdt('libice-devel') }}  # [linux]
    - {{ cdt('libsm-devel') }}  # [linux]
    - {{ cdt('libx11-devel') }}  # [linux]
    - {{ cdt('libxcomposite-devel') }}  # [linux]
    - {{ cdt('libxcursor-devel') }}  # [linux]
    - {{ cdt('libxdamage-devel') }}  # [linux]
    - {{ cdt('libxext-devel') }}  # [linux]
    - {{ cdt('libxi-devel') }}  # [linux]
    - {{ cdt('libxinerama-devel') }}  # [linux]
    - {{ cdt('libxfixes-devel') }}  # [linux]
    - {{ cdt('libxrandr-devel') }}  # [linux]
    - {{ cdt('libxrender-devel') }}  # [linux]
    - {{ cdt('libxtst-devel') }}  # [linux]
    - {{ cdt('mesa-libEGL-devel') }}  # [linux]
    - {{ cdt('mesa-libGL-devel') }}  # [linux]
    - {{ cdt('xorg-x11-proto-devel') }}  # [linux]
  host:
    - xorg-libxfixes           # [linux]
    - xorg-libsm               # [linux]
    - python
    - pip
    - libtiff
    - libpano13
    - jpeg
    - libpng
    - openexr
    - vigra
    - exiv2
    - glew
    - sqlite
    - lcms2
    # Warning: With vanially conda, wxwidgets will not work on linux since they
    # internally code strings as UTF-16 strings on windows
    # conda-forge has patched conda: https://github.com/conda-forge/conda-feedstock/pull/117
    # But upstream has rejected a similar patch:
    # https://github.com/conda/conda/pull/9946
    # In favor of more time to work on a longer term fix
    # https://github.com/conda/conda-build/blob/master/tests/test_api_build.py#L240
    - wxwidgets 3.1
    - perl
    - libglu  # [linux]
    - boost-cpp
    - fftw
    # For some reason these are requried by the windows
    # build system
    - enblend
    - pthreads-win32  # [win]
    - ilmbase
  run:
    - boost-cpp
    - libglu  # [linux]
    - python
    - pthreads-win32  # [win]
    # not sure why run exports isn't working
    - exiftool
    - enblend
    - exiv2
    - xorg-libx11  # [linux]
    - xorg-libsm   # [linux]

test:
  commands:
    - nona -help
    - cpfind -help
    - autooptimiser -help
    - pano_modify -help

about:
  home: http://hugin.sourceforge.net/
  license: GPL-2.0-only
  license_family: GPL
  license_file: COPYING.txt
  summary: Panorama photo stitcher

  description: |
    An easy to use cross-platform panoramic imaging toolchain based on Panorama Tools.

    With Hugin you can assemble a mosaic of photographs into a complete
    immersive panorama, stitch any series of overlapping pictures and much
    more.

  doc_url: http://hugin.sourceforge.net/docs/
  dev_url: https://sourceforge.net/projects/hugin/

extra:
  recipe-maintainers:
    - hmaarrfk
