{% set name = "r-saige" %}
{% set version = "0.39.0" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  # url: https://github.com/weizhouUMICH/SAIGE/archive/{{ version }}.tar.gz
  url: https://github.com/weizhouUMICH/SAIGE/archive/87a2464ee11642c14734bb638f8d18df1fded6fe.tar.gz
  sha256: b514e8624b1fb7e866bd0319891def7b8f0345ba09f5fb6e2334f05c7130f310
  patches:
    # Fixing shared lib issues
    - patches/0001-use-shared-libs-in-makevars.patch
    # - patches/0358-use-shared-libs-in-makevars-0.35.8.patch
    # - patches/0002-fix-rcpp-returns.patch
    - patches/0003-fix-gettimeofday-import.patch
    - patches/0004-fix-paths-of-imported-libs-should-never-use-path.patch

build:
  skip: true  # [win]
  number: 0
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - {{ compiler('fortran') }}
  host:
    - r-base {{ r_base }}
    - bgenix 1.1.4
    - boost-cpp
    - r-spatest 3.0.2
    - r-rcpp
    - r-rcpparmadillo
    - r-rcppparallel
    - r-metaskat
    - r-skat
    - r-devtools
    - r-matrix
    - r-data.table
    - r-rcppeigen
    - r-bh
    - r-optparse
    - liblapack
    - libopenblas  # [osx]
    - libblas  # [linux]
    - superlu
    - savvy
    - zstd
    - zlib
  run:
    - r-base {{ r_base }}
    - boost-cpp
    - bgenix 1.1.4
    - savvy
    - r-rcpp
    - r-rcppparallel
    - r-matrix
    - r-data.table
    - r-optparse
    - liblapack
    - libopenblas  # [osx]
    - libblas  # [linux]
    - sqlite

test:
  commands:
    - $R -e "library('SAIGE')"
    - step1_fitNULLGLMM.R --help
    - step2_SPAtests.R --help
    - createSparseGRM.R --help

about:
  home: https://github.com/weizhouUMICH/SAIGE
  license: GNU GPL
  license_family: GPL3
  license_file: LICENSE
  summary: SAIGE is an R package with Scalable and Accurate Implementation of Generalized mixed model (Chen, H. et al. 2016)
  description: |
    SAIGE is an R package with Scalable and Accurate Implementation of Generalized
    mixed model (Chen, H. et al. 2016). It accounts for sample relatedness and is
    feasible for genetic association tests in large cohorts and biobanks (N > 400000).
  dev_url: https://github.com/weizhouUMICH/SAIGE

extra:
  recipe-maintainers:
    - matuskosut


# Saige (https://github.com/weizhouUMICH/SAIGE/)
# Versioning guide for builders
# 0.35.8.8: tagged
# 0.39.0: commit 87a2464ee11642c14734bb638f8d18df1fded6fe
# 0.42.0: commit 19afee629fbfe1c450e57a717fc621cce17c8199
