{
    "app-id": "org.freac.freac",
    "runtime": "org.freedesktop.Platform",
    "runtime-version": "22.08",
    "sdk": "org.freedesktop.Sdk",
    "command": "freac",
    "finish-args": [
        "--device=all",
        "--env=DCONF_USER_CONFIG_DIR=.config/dconf",
        "--filesystem=host",
        "--filesystem=xdg-run/dconf",
        "--filesystem=~/.config/dconf:ro",
        "--share=ipc",
        "--share=network",
        "--socket=pulseaudio",
        "--socket=x11",
        "--talk-name=ca.desrt.dconf"
    ],
    "cleanup": [
        "/bin/mac",
        "/include",
        "/lib/pkgconfig",
        "/share/aclocal",
        "/share/info",
        "/share/man",
        "*.a",
        "*.la"
    ],
    "modules": [
        "shared-modules/mac/mac.json",
        {
            "name": "libcdio",
            "config-opts": [
                "--disable-cxx",
                "--disable-example-progs",
                "--without-cd-drive",
                "--without-cd-info",
                "--without-cd-read",
                "--without-cdda-player",
                "--without-iso-info",
                "--without-iso-read"
            ],
            "cleanup": [
                "/bin/mmc-tool",
                "/lib/libiso9660.*",
                "/lib/libudf.*"
            ],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://ftp.gnu.org/gnu/libcdio/libcdio-2.1.0.tar.bz2",
                    "sha256": "8550e9589dbd594bfac93b81ecf129b1dc9d0d51e90f9696f1b2f9b2af32712b"
                }
            ]
        },
        {
            "name": "libcdio-paranoia",
            "config-opts": [
                "--disable-cxx",
                "--disable-example-progs"
            ],
            "cleanup": [
                "/bin/cd-paranoia"
            ],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://github.com/rocky/libcdio-paranoia/archive/release-10.2+2.0.1.tar.gz",
                    "sha256": "7a4e257c85f3f84129cca55cd097c397364c7a6f79b9701bbc593b13bd59eb95"
                }
            ]
        },
        {
            "name": "libmp3lame",
            "config-opts": [
                 "--enable-nasm",
                 "--disable-frontend"
            ],
            "cleanup": [
                "/share/doc/lame"
            ],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://sourceforge.net/projects/lame/files/lame/3.100/lame-3.100.tar.gz",
                    "sha256": "ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e"
                },
                {
                    "only-arches": [ "x86_64" ],
                    "type": "patch",
                    "path": "patches/lame-3.100-sse-20171014.patch",
                    "strip-components": 0
                }
            ]
        },
        {
            "name": "libmp4v2",
            "cleanup": [
                "/bin/mp4*"
            ],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://github.com/enzo1982/mp4v2/releases/download/v2.1.2/mp4v2-2.1.2.tar.bz2",
                    "sha256": "0b943133673cffd4625247783e34080797de7386142061a6613e0c26285953ef"
                },
                {
                    "type": "patch",
                    "path": "patches/mp4v2-2.1.2-sfocache.patch"
                }
            ]
        },
        {
            "name": "liburiparser",
            "buildsystem": "cmake",
            "config-opts": [
                "-DURIPARSER_BUILD_DOCS=OFF",
                "-DURIPARSER_BUILD_TESTS=OFF"
            ],
            "cleanup": [
                "/bin/uriparse"
            ],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://github.com/uriparser/uriparser/releases/download/uriparser-0.9.6/uriparser-0.9.6.tar.bz2",
                    "sha256": "9ce4c3f151e78579f23937b44abecb428126863ad02e594e115e882353de905b"
                }
            ]
        },
        {
            "name": "libvorbis",
            "cleanup": [
                "/share/doc/libvorbis*"
            ],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.7.tar.xz",
                    "sha256": "b33cc4934322bcbf6efcbacf49e3ca01aadbea4114ec9589d1b1e9d20f72954b"
                },
                {
                    "type": "patch",
                    "path": "patches/libvorbis-1.3.7-aotuv-b6.03.patch"
                },
                {
                    "only-arches": [ "x86_64" ],
                    "type": "patch",
                    "path": "patches/libvorbis-1.3.7-aotuv-b6.03-lancer.patch"
                }
            ]
        },
        {
            "name": "ffmpeg",
            "config-opts": [
                "--disable-autodetect",
                "--enable-gpl",
                "--enable-small",
                "--enable-runtime-cpudetect"
            ],
             "cleanup": [
                "/bin/ffprobe",
                "/share/doc/ffmpeg",
                "/share/ffmpeg"
            ],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://ffmpeg.org/releases/ffmpeg-6.0.tar.xz",
                    "sha256": "57be87c22d9b49c112b6d24bc67d42508660e6b718b3db89c44e47e289137082"
                }
            ]
        },
        {
            "name": "musepack",
            "config-opts": [
                "--disable-shared"
            ],
            "cleanup": [
                "/bin/mpc2sv8",
                "/bin/mpccut",
                "/bin/wavcmp"
            ],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://files.musepack.net/source/musepack_src_r475.tar.gz",
                    "sha256": "a4b1742f997f83e1056142d556a8c20845ba764b70365ff9ccf2e3f81c427b2b"
                },
                {
                    "type": "patch",
                    "path": "patches/musepack_src_r475-const.patch"
                },
                {
                    "type": "shell",
                    "commands": [
                        "touch include/config.h.in",
                        "head -n 34 configure.in >> configure.ac",
                        "echo \"AM_CONDITIONAL([HAVE_VISIBILITY], [false])\" >> configure.ac",
                        "echo \"AC_CHECK_LIB([m],[cos])\" >> configure.ac",
                        "tail -n 18 configure.in >> configure.ac",
                        "rm configure.in",
                        "autoreconf -i"
                    ]
                }
            ]
        },
        {
            "name": "rnnoise",
            "cleanup": [
                "/share/doc/rnnoise"
            ],
            "sources": [
                {
                    "type": "git",
                    "url": "https://github.com/xiph/rnnoise.git",
                    "commit": "9acc1e5a633e0961a5895a73204df24744f199b6"
                }
            ]
        },
        {
            "name": "rubberband",
            "build-options": {
                "env": { "Vamp_CFLAGS": " ", "Vamp_LIBS": " " }
            },
            "sources": [
                {
                    "type": "archive",
                    "url": "https://breakfastquay.com/files/releases/rubberband-1.8.2.tar.bz2",
                    "sha256": "86bed06b7115b64441d32ae53634fcc0539a50b9b648ef87443f936782f6c3ca"
                },
                {
                    "type": "shell",
                    "commands": [
                        "sed -i -e \"s/^all\\:.*/all: bin lib \\$\\(DYNAMIC_TARGET\\)/\" Makefile.in",
                        "head -n 169 Makefile.in >> Makefile.in.temp",
                        "head -n 172 Makefile.in | tail -n 1 >> Makefile.in.temp",
                        "head -n 185 Makefile.in | tail -n 6 >> Makefile.in.temp",
                        "tail -n 100 Makefile.in >> Makefile.in.temp",
                        "mv Makefile.in.temp Makefile.in"
                    ]
                }
            ]
        },
        {
            "name": "smooth",
            "no-autogen": true,
            "make-install-args": [ "prefix=/app" ],
            "sources": [
                {
                    "type": "git",
                    "url": "https://github.com/enzo1982/smooth.git"
                }
            ]
        },
        {
            "name": "BoCA",
            "no-autogen": true,
            "make-install-args": [ "prefix=/app" ],
            "sources": [
                {
                    "type": "git",
                    "url": "https://github.com/enzo1982/BoCA.git"
                }
            ]
        },
        {
            "name": "freac",
            "no-autogen": true,
            "make-install-args": [ "prefix=/app" ],
            "build-options": {
                "cxxflags": "-DFREAC_DATE=\\\"$(shell date +\"%Y%m%d\")\\\""
            },
            "sources": [
                {
                    "type": "git",
                    "url": "https://github.com/enzo1982/freac.git"
                },
                {
                    "type": "patch",
                    "path": "patches/freac-1.1-beta-noudev.patch"
                }
            ]
        }
    ]
}
