{% set version = "3.34.0" %}
{% set year = "2020" %}
{% set version_split = version.split(".") %}
{% set major = version_split[0] %}
{% set minor = version_split[1]|int * 10 %}
{% set bugfix = version_split[2]|int * 100 %}
{% set version_coded=(major ~ (("%03d" % minor)|string) ~ (("%03d" % bugfix)|string)) %}

package:
  name: sqlite
  version: {{ version }}

source:
  url: https://www.sqlite.org/{{ year }}/sqlite-autoconf-{{ version_coded }}.tar.gz
  sha256: bf6db7fae37d51754737747aaaf413b4d6b3b5fbacd52bdb2d0d6e5b2edd9aee
  patches:
    - expose_symbols.patch  # [win]

build:
  number: 0
  run_exports:
    # sometimes adds new symbols.  Default behavior is OK.
    #    https://abi-laboratory.pro/tracker/timeline/sqlite/
    - {{ pin_subpackage('sqlite') }}

requirements:
  build:
    - {{ compiler('c') }}
    - make  # [not win]
    - libtool  # [not win]
  host:
    - ncurses  # [not win]
    - readline  # [not win]
    - zlib  # [not win]
  run:
    - ncurses  # [not win]
    - readline  # [not win]
    - zlib  # [not win]

test:
  commands:
    - sqlite3 --version
    - if not exist %PREFIX%\\Library\bin\sqlite3.dll exit 1  # [win]
    - if not exist %PREFIX%\\Library\lib\sqlite3.lib exit 1  # [win]
    - test -f $PREFIX/lib/libsqlite3${SHLIB_EXT}  # [not win]
    - test ! -f $PREFIX/lib/libsqlite3.a  # [not win]
    - if not exist %PREFIX%\\Library\include\sqlite3.h exit 1  # [win]
    - if not exist %PREFIX%\\Library\include\sqlite3ext.h exit 1  # [win]
    - test -f $PREFIX/include/sqlite3.h  # [not win]
    - test -f $PREFIX/include/sqlite3ext.h  # [not win]

about:
  home: http://www.sqlite.org/
  license: Public-Domain (http://www.sqlite.org/copyright.html)
  license_url: http://www.sqlite.org/copyright.html
  summary: Implements a self-contained, zero-configuration, SQL database engine
  description: |
    SQLite is a self-contained, high-reliability, embedded, full-featured,
    public-domain, SQL database engine.It is the most used database engine
    in the world.
  doc_url: http://www.sqlite.org/docs.html
  doc_source_url: https://github.com/mackyle/sqlite/tree/master/doc
  dev_url: https://github.com/mackyle/sqlite

extra:
  recipe-maintainers:
    - jakirkham
    - jjhelmus
    - msarahan
    - ocefpaf
    - snorfalorpagus
    - mingwandroid
    - xylar
