distributable:
  url: https://downloads.sourceforge.net/project/xmlstar/xmlstarlet/{{version}}/xmlstarlet-{{version}}.tar.gz
  strip-components: 1

versions:
  url: https://sourceforge.net/projects/xmlstar/files/xmlstarlet/
  match: /xmlstarlet-\d+\.\d+\.\d+\.tar\.gz/
  strip:
    - /^xmlstarlet-/
    - /\.tar\.gz/

dependencies:
  gnome.org/libxslt: ^1

build:
  dependencies:
    linux:
      gnu.org/gcc: '*'
  script:
    - ./configure $ARGS
    - make --jobs {{ hw.concurrency }}
    - make --jobs {{ hw.concurrency }} install
    - run: ln -s xml xmlstarlet
      working-directory: ${{prefix}}/bin
  env:
    ARGS:
      - --disable-dependency-tracking
      - --prefix={{prefix}}
      - --mandir={{prefix}}/share/man

provides:
  - bin/xml
  - bin/xmlstarlet

test:
  - xmlstarlet --version | grep {{version}}
  - xml --help
  - xml validate test.xml | grep 'valid'
