package rosa

import "hakurei.app/internal/pkg"

func (t Toolchain) newZlib() (pkg.Artifact, string) {
	const (
		version  = "1.3.2"
		checksum = "KHZrePe42vL2XvOUE3KlJkp1UgWhWkl0jjT_BOvFhuM4GzieEH9S7CioepOFVGYB"
	)
	return t.NewPackage("zlib", version, newTar(
		"https://www.zlib.net/fossils/zlib-"+version+".tar.gz",
		checksum,
		pkg.TarGzip,
	), nil, &CMakeHelper{
		Cache: []KV{
			{"CMAKE_C_FLAGS", "-fPIC"},
			{"ZLIB_BUILD_TESTING", "ON"},
			{"ZLIB_BUILD_SHARED", "ON"},
			{"ZLIB_BUILD_STATIC", "ON"},
			{"ZLIB_BUILD_MINIZIP", "OFF"},

			{"ZLIB_INSTALL", "ON"},
			{"ZLIB_PREFIX", "OFF"},
		},

		// ninja dependency loop
		Make: true,
	}), version
}
func init() {
	artifactsM[Zlib] = Metadata{
		f: Toolchain.newZlib,

		Name:        "zlib",
		Description: "lossless data-compression library",
		Website:     "https://zlib.net/",

		ID: 5303,
	}
}
