{
  "app-id": "com.sumnerevans.SublimeMusic",
  "runtime": "org.gnome.Platform",
  "runtime-version": "3.34",
  "sdk": "org.gnome.Sdk",
  "command": "sublime-music",
  "rename-icon": "sublime-music",
  "rename-desktop-file": "sublime-music.desktop",
  "rename-appdata-file": "sublime-music.metainfo.xml",
  "add-extentions": {
    "org.freedesktop.Platform.ffmpeg-full": {
      "directory": "lib/ffmpeg",
      "version": "19.08",
      "add-ld-path": "."
    }
  },
  "finish-args": [
    "--share=ipc",
    "--socket=fallback-x11",
    "--socket=wayland",
    "--share=network",
    "--socket=pulseaudio",
    "--socket=session-bus",
    "--own-name=org.mpris.MediaPlayer2.SublimeMusic",
    "--filesystem=xdg-config/sublime-music",
    "--filesystem=xdg-cache/sublime-music",
    "--filesystem=xdg-data/sublime-music"
  ],
  "modules": [
    {
      "name": "icons-and-metadata",
      "buildsystem": "simple",
      "build-commands": [
        "install -Dm644 16.png /app/share/icons/hicolor/16x16/apps/sublime-music.png",
        "install -Dm644 22.png /app/share/icons/hicolor/22x22/apps/sublime-music.png",
        "install -Dm644 32.png /app/share/icons/hicolor/32x32/apps/sublime-music.png",
        "install -Dm644 36.png /app/share/icons/hicolor/36x36/apps/sublime-music.png",
        "install -Dm644 48.png /app/share/icons/hicolor/48x48/apps/sublime-music.png",
        "install -Dm644 64.png /app/share/icons/hicolor/64x64/apps/sublime-music.png",
        "install -Dm644 72.png /app/share/icons/hicolor/72x72/apps/sublime-music.png",
        "install -Dm644 96.png /app/share/icons/hicolor/96x96/apps/sublime-music.png",
        "install -Dm644 128.png /app/share/icons/hicolor/128x128/apps/sublime-music.png",
        "install -Dm644 192.png /app/share/icons/hicolor/192x192/apps/sublime-music.png",
        "install -Dm644 512.png /app/share/icons/hicolor/512x512/apps/sublime-music.png",
        "install -Dm644 sublime-music.desktop /app/share/applications/sublime-music.desktop",
        "install -Dm644 sublime-music.metainfo.xml /app/share/metainfo/sublime-music.metainfo.xml"
      ],
      "sources": [
        {
          "type": "dir",
          "path": "../logo/rendered"
        },
        {
          "type": "file",
          "path": "../sublime-music.desktop"
        },
        {
          "type": "file",
          "path": "../sublime-music.metainfo.xml"
        }
      ]
    },
    {
      "name": "sublime",
      "buildsystem": "simple",
      "build-commands": [
        "pip3 install --prefix=/app ."
      ],
      "sources": [
        {
          "type": "dir",
          "path": ".."
        }
      ],
      "modules": [
        "pypi-dependencies.json",
        {
          "name": "libmpv",
          "cleanup": [
            "/include",
            "/lib/pkgconfig",
            "/share/man"
          ],
          "buildsystem": "simple",
          "build-commands": [
            "python3 waf configure --prefix=/app --enable-libmpv-shared --disable-cplayer --disable-build-date --disable-oss-audio --disable-alsa",
            "python3 waf build",
            "python3 waf install"
          ],
          "sources": [
            {
              "type": "archive",
              "url": "https://github.com/mpv-player/mpv/archive/v0.30.0.tar.gz",
              "sha256": "33a1bcb7e74ff17f070e754c15c52228cf44f2cefbfd8f34886ae81df214ca35"
            },
            {
              "type": "file",
              "url": "https://waf.io/waf-2.0.12",
              "sha256": "0979ca87f45928e0d752049ab2f43be8551249be73dc5563b944ec54f8871d1f",
              "dest-filename": "waf"
            }
          ],
          "modules": [
            {
              "name": "luajit",
              "no-autogen": true,
              "cleanup": [
                "/bin",
                "/lib/*.a",
                "/include",
                "/lib/pkgconfig",
                "/share/man"
              ],
              "sources": [
                {
                  "type": "archive",
                  "url": "http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz",
                  "sha256": "1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3"
                },
                {
                  "type": "shell",
                  "commands": [
                    "sed -i 's|/usr/local|/app|' ./Makefile"
                  ]
                }
              ]
            },
            {
              "name": "libass",
              "cleanup": [
                "/include",
                "/lib/*.la",
                "/lib/pkgconfig"
              ],
              "config-opts": [
                "--disable-static"
              ],
              "sources": [
                {
                  "type": "archive",
                  "url": "https://github.com/libass/libass/releases/download/0.14.0/libass-0.14.0.tar.xz",
                  "sha256": "881f2382af48aead75b7a0e02e65d88c5ebd369fe46bc77d9270a94aa8fd38a2"
                }
              ]
            },
            {
              "name": "uchardet",
              "buildsystem": "cmake-ninja",
              "config-opts": [
                "-DCMAKE_BUILD_TYPE=Release",
                "-DBUILD_STATIC=0"
              ],
              "cleanup": [
                "/bin",
                "/include",
                "/lib/pkgconfig",
                "/share/man"
              ],
              "sources": [
                {
                  "type": "archive",
                  "url": "https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.6.tar.xz",
                  "sha256": "8351328cdfbcb2432e63938721dd781eb8c11ebc56e3a89d0f84576b96002c61"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
