# This file is part of LilyPond, the GNU music typesetter.
#
# Copyright (C) 2021--2022 Jonas Hahnfeld <hahnjo@hahnjo.de>
#
# LilyPond is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# LilyPond is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.

- name: CentOS 7
  hosts: lily_centos7
  tasks:
    - name: Enable additional repositories
      yum:
        name:
          - centos-release-scl
          - epel-release
    - name: Upgrade all packages
      yum:
        name: '*'
        state: latest
    - name: Install packages
      yum:
        name:
          - bison
          - devtoolset-11-gcc
          - devtoolset-11-gcc-c++
          - flex
          - fontforge
          - gperf
          - m4
          - ninja-build
          - perl
          - python-setuptools
          - python3
          - t1utils
          - texlive-kpathsea-bin
          - texlive-metafont-bin
          - texlive-metapost
    - name: Create directory for TexLive 2020
      file:
        path: /usr/local/texlive/2020
        state: directory
    - name: Install MetaPost from TexLive 2020
      unarchive:
        src: ftp://tug.org/historic/systems/texlive/2020/tlnet-final/archive/metapost.x86_64-linux.tar.xz
        dest: /usr/local/texlive/2020
        remote_src: yes
    - name: Create configuration for MetaPost
      copy:
        content: "MPINPUTS = .;/usr/share/texlive/texmf-dist/metapost//"
        dest: /usr/local/texlive/2020/bin/x86_64-linux/texmf.cnf
    - name: Create link to MetaPost
      file:
        src: /usr/local/texlive/2020/bin/x86_64-linux/mpost
        dest: /usr/local/bin/mpost
        state: link
    - name: Install Python packages
      pip:
        executable: pip3
        name:
          - meson==0.59.0
