distributable:
  url: https://geuz.org/gl2ps/src/gl2ps-{{version}}.tgz
  strip-components: 1
versions:
  url: https://geuz.org/gl2ps/src/
  match: /gl2ps-\d+\.\d+\.\d+\.tgz/
  strip:
    - /^gl2ps-/
    - /\.tgz/
dependencies:
  libpng.org: '*'
  linux:
    freeglut.sourceforge.io: '*'
build:
  dependencies:
    cmake.org: '*'
  script:
    - cmake . $CMAKE_ARGS
    - make --jobs {{ hw.concurrency }} install
  env:
    CMAKE_ARGS:
      - -DCMAKE_INSTALL_PREFIX="{{prefix}}
      - -DCMAKE_INSTALL_LIBDIR=lib
      - -DCMAKE_BUILD_TYPE=Release
      - -DCMAKE_FIND_FRAMEWORK=LAST
      - -DCMAKE_VERBOSE_MAKEFILE=ON
      - -Wno-dev
      - -DBUILD_TESTING=OFF
test:
  script:
    - run: cc -lgl2ps -framework OpenGL -framework GLUT -framework Cocoa test_darwin.c -o testfile
      if: darwin
    - run: cc -lgl2ps -lglut -lGL test_linux.c -o testfile
      if: linux
    # - ./testfile
    # We cannot run ./testfile due to the absence of a display.
    - ls . | grep testfile
