{
    "id": "org.gnome.gitlab.somas.Apostrophe.Plugin.TexLive",
    "runtime": "org.gnome.gitlab.somas.Apostrophe",
    "branch": "stable",
    "runtime-version": "stable",
    "sdk": "org.gnome.Sdk//48",
    "build-extension": true,
    "separate-locales": false,
    "appstream-compose": false,
    "finish-args": [],
    "build-options" : {
        "prepend-path": "/app/extensions/TexLive",
        "env": {
            "PATH": "/app/extensions/TexLive/bin:/app/extensions/TexLive/bin/x86_64-linux:/app/bin:/usr/bin"
        }
    },
    "modules": [
        {
            "name": "p7zip",
            "no-autogen": true,
            "build-options": {
                "prefix": "/app/extensions/TexLive"
            },
            "make-args": ["7z"],
            "cleanup": ["*"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://sourceforge.net/projects/p7zip/files/p7zip/16.02/p7zip_16.02_src_all.tar.bz2",
                    "sha256": "5eb20ac0e2944f6cb9c2d51dd6c4518941c185347d4089ea89087ffdd6e2341f"
                },
                {
                    "type": "shell",
                    "commands": ["sed -i 's|/usr/local|/app/extensions/TexLive|g' makefile.common"]
                },
                {
                    "type": "patch",
                    "path" : "p7zip-gcc10.patch"
                }
            ]
        },
        {
            "name": "texlive",
            "buildsystem": "simple",
            "sources": [
                {
                    "type":"file",
                    "url": "http://mirrors.ctan.org/systems/texlive/Images/texlive.iso",
                    "sha512": "1fd9a2234d086f50c832ab3ac8b83477bbc39b1138a3c4a2351244c1fd4b8bea6d1ac81d4a5b0cba95f2e82c00f0d9df5b33189eb222e4bae5dae1523ef0da0e"
                },
                {
                    "type": "file",
                    "path": "texlive.profile"
                },
                {
                    "type": "shell",
                    "commands": ["7z x texlive.iso"]
                }
            ],
            "build-commands": [
                "chmod +x install-tl",
                "echo \"In\" | TEXLIVE_INSTALL_PREFIX=/app/extensions/TexLive ./install-tl --profile texlive.profile",
                "rm -rf /app/extensions/TexLive/texmf-dist/doc"
            ]
        },
        {
            "name": "appdata",
            "buildsystem": "simple",
            "build-commands": [
                "mkdir -p /app/extensions/TexLive/share/appdata",
                "install -Dm644 org.gnome.gitlab.somas.Apostrophe.Plugin.TexLive.appdata.xml /app/extensions/TexLive/share/appdata/org.gnome.gitlab.somas.Apostrophe.Plugin.TexLive.appdata.xml",
                "appstream-compose --basename=org.gnome.gitlab.somas.Apostrophe.Plugin.TexLive --prefix=/app/extensions/TexLive --origin=flatpak org.gnome.gitlab.somas.Apostrophe.Plugin.TexLive"
            ],
            "sources": [
                {
                    "type": "file",
                    "path": "org.gnome.gitlab.somas.Apostrophe.Plugin.TexLive.appdata.xml"
                }
            ]
        }
    ]
}
