package rosa

import (
	"hakurei.app/fhs"
	"hakurei.app/internal/pkg"
)

func (t Toolchain) newGLib() (pkg.Artifact, string) {
	const (
		version  = "2.88.1"
		checksum = "Rkszn6W4RHjyspyqfXdVAVawdwDJCuS0Zu0f7qot7tbJhnw2fUDoUUJB40m-1MCX"
	)
	return t.NewPackage("glib", version, t.newTagRemote(
		"https://gitlab.gnome.org/GNOME/glib.git",
		version, checksum,
	), &PackageAttr{
		Paths: []pkg.ExecPath{
			pkg.Path(fhs.AbsEtc.Append(
				"machine-id",
			), false, pkg.NewFile(
				"glib-machine-id",
				[]byte("ffffffffffffffffffffffffffffffff\n"),
			)),
			pkg.Path(AbsSystem.Append(
				"var/lib/dbus/machine-id",
			), false, pkg.NewFile(
				"glib-machine-id",
				[]byte("fefefefefefefefefefefefefefefefe\n"),
			)),
		},
	}, &MesonHelper{
		Setup: []KV{
			{"Ddefault_library", "both"},
		},
	},
		PythonPackaging,
		Bash,

		PCRE2,
		Libffi,
		Zlib,
	), version
}
func init() {
	artifactsM[GLib] = Metadata{
		f: Toolchain.newGLib,

		Name:        "glib",
		Description: "the GNU library of miscellaneous stuff",
		Website:     "https://developer.gnome.org/glib/",

		Dependencies: P{
			PCRE2,
			Libffi,
			Zlib,
		},

		ID: 10024,
	}
}
