{% set version = '1.1.1' %}
{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}

package:
  name: r-rpostgres
  version: {{ version|replace("-", "_") }}

source:
  fn: RPostgres_{{ version }}.tar.gz
  url:
    - {{ cran_mirror }}/src/contrib/RPostgres_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/RPostgres/RPostgres_{{ version }}.tar.gz
  sha256: d1fc96d426cfb25c8dd0076bf8b672b37059c45078cd58e62f6cb664d6a445e8

build:
  merge_build_host: True  # [win]
  number: 1
  skip: true  # [win32]
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}        # [not win]
    - {{ compiler('cxx') }}      # [not win]
    - {{native}}toolchain        # [win]
    - {{posix}}filesystem        # [win]
    - {{posix}}sed               # [win]
    - {{posix}}grep              # [win]
    - {{posix}}autoconf
    - {{posix}}automake          # [not win]
    - {{posix}}automake-wrapper  # [win]
    - {{posix}}pkg-config
    - {{posix}}make
    - {{posix}}coreutils         # [win]
    - {{posix}}zip               # [win]
  host:
    - r-base
    - r-bh
    - r-dbi >=1.0.0
    - r-rcpp >=0.11.4.2
    - r-bit64
    - r-blob >=1.1.1
    - r-hms
    - r-plogr >=0.2.0
    - r-withr
    - postgresql
  run:
    - r-base
    - {{native}}gcc-libs         # [win]
    - r-bh
    - r-dbi >=1.0.0
    - r-rcpp >=0.11.4.2
    - r-bit64
    - r-blob >=1.1.1
    - r-hms
    - r-plogr >=0.2.0
    - r-withr
    - libpq

test:
  commands:
    - $R -e "library('RPostgres')"           # [not win]
    - "\"%R%\" -e \"library('RPostgres')\""  # [win]
    - conda inspect linkages -p $PREFIX r-rpostgres  # [not win]
    - conda inspect objects -p $PREFIX r-rpostgres  # [osx]

about:
  home: https://github.com/r-dbi/RPostgres
  license: GPL-2
  summary: |
    Fully 'DBI'-compliant 'Rcpp'-backed interface to 'PostgreSQL' <https://www.postgresql.org/>,
    an open-source relational database.
  license_family: GPL2
  license_file: '{{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-2'  # [unix]
  license_file: '{{ environ["PREFIX"] }}\R\share\licenses\GPL-2'  # [win]

extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
    - cbrueffer
    - halldc
