{% set version = "3.27.2" %}
{% set year="2019" %}
{% 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
  # sha1 is provided by sqlite.org download site
  sha1: 5f5750e3f39b7b60394a2fb6ddb2371f848670e6
  patches:
    - 0001-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        # [unix]

  host:
    - libedit     # [unix]
    - zlib        # [osx]

  run:
    - libedit     # [unix]

test:
  commands:
    - sqlite3 --version
    - IF NOT EXIST %LIBRARY_BIN%\sqlite3.dll exit 1  # [win]
    - IF NOT EXIST %LIBRARY_LIB%\sqlite3.lib exit 1  # [win]
    - IF NOT EXIST %LIBRARY_INC%\sqlite3.h exit 1  # [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
    - mingwandroid
