package rosa

import "hakurei.app/internal/pkg"

func (t Toolchain) newDBus() (pkg.Artifact, string) {
	const (
		version  = "1.16.2"
		checksum = "INwOuNdrDG7XW5ilW_vn8JSxEa444rRNc5ho97i84I1CNF09OmcFcV-gzbF4uCyg"
	)
	return t.NewPackage("dbus", version, newFromGitLab(
		"gitlab.freedesktop.org",
		"dbus/dbus",
		"dbus-"+version,
		checksum,
	), &PackageAttr{
		// OSError: [Errno 30] Read-only file system: '/usr/src/dbus/subprojects/packagecache'
		Writable: true,
		// PermissionError: [Errno 13] Permission denied: '/usr/src/dbus/subprojects/packagecache'
		Chmod: true,
	}, &MesonHelper{
		Setup: []KV{
			{"Depoll", "enabled"},
			{"Dinotify", "enabled"},
			{"Dx11_autolaunch", "disabled"},
		},
	},
		GLib,
		Libexpat,
	), version
}
func init() {
	artifactsM[DBus] = Metadata{
		f: Toolchain.newDBus,

		Name:        "dbus",
		Description: "a message bus system",
		Website:     "https://www.freedesktop.org/wiki/Software/dbus/",

		Dependencies: P{
			GLib,
			Libexpat,
		},

		ID: 5356,
	}
}

func (t Toolchain) newXDGDBusProxy() (pkg.Artifact, string) {
	const (
		version  = "0.1.7"
		checksum = "UW5Pe-TP-XAaN-kTbxrkOQ7eYdmlAQlr2pdreLtPT0uwdAz-7rzDP8V_8PWuZBup"
	)
	return t.NewPackage("xdg-dbus-proxy", version, newFromGitHub(
		"flatpak/xdg-dbus-proxy",
		version,
		checksum,
	), nil, &MesonHelper{
		Setup: []KV{
			{"Dman", "disabled"},
		},
	},
		DBus,

		GLib,
	), version
}
func init() {
	artifactsM[XDGDBusProxy] = Metadata{
		f: Toolchain.newXDGDBusProxy,

		Name:        "xdg-dbus-proxy",
		Description: "a filtering proxy for D-Bus connections",
		Website:     "https://github.com/flatpak/xdg-dbus-proxy",

		Dependencies: P{
			GLib,
		},

		ID: 58434,
	}
}
