distributable:
  url: https://ftp.gnu.org/gnu/libtool/libtool-{{ version }}.tar.gz
  strip-components: 1

versions:
  url: https://ftp.gnu.org/gnu/libtool/
  match: /libtool-(\d+\.\d+\.\d+)\.tar\.gz/
  strip:
    - /libtool-/
    - /.tar.gz/

provides:
  - bin/libtool
  - bin/libtoolize

build:
  dependencies:
    gnu.org/autoconf: ^2.65.0
    gnu.org/m4: 1
  script: |-
    ./configure --prefix={{ prefix }}
    make --jobs {{ hw.concurrency }} install

    cd {{prefix}}/bin

    sed -i.bak \
      -e 's_prefix="{{prefix}}"_prefix="$(dirname $(dirname $0))"_' \
      -e 's_{{prefix}}_$prefix_' \
      libtoolize
    rm libtoolize.bak

    # often expected aliases
    ln -s libtoolize glibtoolize
    ln -s libtool glibtool

test:
  script: |
    libtoolize
    test -f ltmain.sh
