distributable:
  url: https://github.com/LuaJIT/LuaJIT/archive/v{{version.raw}}.ROLLING.tar.gz
  strip-components: 1
versions:
  github: LuaJIT/LuaJIT/tags
  match: /v\d+\.\d+\.ROLLING/
  strip:
    - /^v/
    - /\.ROLLING/
runtime:
  env:
    LUA_PATH: '{{prefix}}/share/luajit-{{version.marketing}}/?.lua'
build:
  dependencies:
    linux:
      gnu.org/gcc: '*'
  script:
    - make --jobs {{hw.concurrency}} amalg PREFIX={{prefix}}
    - make --jobs {{hw.concurrency}} install PREFIX={{prefix}}
    - mkdir -p {{prefix}}/doc
    - mv doc/* {{prefix}}/doc/
    - run: ln -s luajit-{{version.raw}}. luajit
      working-directory: '{{prefix}}/bin'
    - run: |
        ln -s libluajit-5.1.dylib libluajit.dylib
        ln -s libluajit-5.1.a libluajit.a
      working-directory: '{{prefix}}/lib'
provides:
  - bin/luajit
  - bin/luajit-{{version.marketing}}.
test:
  script:
    - luajit -v | grep {{version.marketing}}
    - luajit test.lua | grep 55
    - luajit -e "print(package.path)"
    - luajit -b test.lua test.o
    - ls . | grep "test.o"
