pkgname =  "breakpad"
pkgver  = "2024.02.16" 
source  = f"https://github.com/google/breakpad.git"
builddir = f"/tmp/fempkgbuild/{pkgname}"
source_type = "git"
fembuilddir = builddir
outputdir = "/home/gabry/lfs-repo/binpkg"
manifestdir = "/home/gabry/lfs-repo/manifests"
destdir = f"{fembuilddir}/DESTDIR"

deps = ["depot_tools"]

build = [

    # 64-bit build
    f"cd {builddir} && fetch breakpad && cd src && ./configure --prefix=/usr",
    f"cd {builddir}/src && make -j$(nproc)",
    f"cd {builddir}/src && make DESTDIR={destdir} install",

    f"install -v -d -m755 {destdir}/usr/share/licenses/{pkgname}/",
    f"install -v -m644 {builddir}/LICENSE {destdir}/usr/share/licenses/{pkgname}/LICENSE",

    # Make tarball + manifests
    f"mkdir -p {outputdir} && cd {destdir} && tar --transform 's|^\\.||' -I zstd -cf {outputdir}/{pkgname}-{pkgver}.tar.zst .",
    f"mkdir -p {manifestdir} && tar -tf {outputdir}/{pkgname}-{pkgver}.tar.zst | grep -v '/$' > {manifestdir}/{pkgname}.txt",

    # Cleanup
    f"rm -rf {builddir}"
]
