package rosa

import "hakurei.app/internal/pkg"

func (t Toolchain) newLMSensors() (pkg.Artifact, string) {
	const (
		version  = "3-6-2"
		checksum = "7JYNutrihe-FP6r3ftf96uFZJJWPfxnBHL0ALSMA-vovaXVRr-sAjlLitw7WWpCI"
	)
	return t.NewPackage("lm_sensors", version, newFromGitHub(
		"lm-sensors/lm-sensors",
		"V"+version,
		checksum,
	), &PackageAttr{
		Writable:    true,
		Chmod:       true,
		EnterSource: true,

		ScriptEarly: `
ln -s \
	../../system/bin/perl \
	/usr/bin/
`,
	}, &MakeHelper{
		InPlace:       true,
		SkipConfigure: true,

		Make: []string{
			"CC=cc",
			"ETCDIR=/system/etc",
			"PREFIX=/system",
		},

		Check: []string{
			"CC=cc",
			"check",
		},

		Install: "make DESTDIR=/work PREFIX=/system install",
	},
		Perl,
		PerlTestCmd,

		M4,
		Bison,
		Flex,
	), version
}
func init() {
	artifactsM[LMSensors] = Metadata{
		f: Toolchain.newLMSensors,

		Name:        "lm_sensors",
		Description: "user-space support for hardware monitoring drivers",
		Website:     "https://hwmon.wiki.kernel.org/lm_sensors",

		ID: 1831,
	}
}
