{% set version = "3.35.0" %}
{% set year = "2021" %}
{% 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: 3dfb3f143c83695a555c7dd9e06ed924f9d273c287989874e102656724baf2d0
  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') }}
  ignore_run_exports:
    - ncurses 

requirements:
  build:
    - {{ compiler('c') }}
    - make  # [not win]
    - libtool  # [not win]
  host:
    - ncurses  # [not win]
    - readline  # [not win]
    - zlib  # [not win]
  run:
    - 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
