distributable:
  url: https://www.x.org/archive/individual/lib/libSM-{{version}}.tar.gz
  strip-components: 1

versions:
  url: https://www.x.org/archive/individual/lib/
  match: /libSM-\d+\.\d+\.\d+.tar.gz/
  strip:
    - /libSM-/
    - /.tar.gz/

dependencies:
  x.org/ice: '*'

build:
  dependencies:
    freedesktop.org/pkg-config: ~0.29
    x.org/xtrans: '*'
  script: |
    ./configure \
      --prefix="{{prefix}}" \
      --sysconfdir="$SHELF"/etc \
      --localstatedir="$SHELF"/var
    make --jobs {{ hw.concurrency }} install
  env:
    SHELF: ${{pkgx.prefix}}/x.org

test:
  dependencies:
  script: |
    mv $FIXTURE test.c
    cc test.c
    ./a.out
  fixture: |
    #include "X11/SM/SMlib.h"

    int main(int argc, char* argv[]) {
      SmProp prop;
      return 0;
    }
