package rosa

import "hakurei.app/internal/pkg"

func (t Toolchain) newOpenSSL() (pkg.Artifact, string) {
	const (
		version  = "3.6.2"
		checksum = "jH004dXTiE01Hp0kyShkWXwrSHEksZi4i_3v47D9H9Uz9LQ1aMwF7mrl2Tb4t_XA"
	)
	return t.NewPackage("openssl", version, newFromGitHubRelease(
		"openssl/openssl",
		"openssl-"+version,
		"openssl-"+version+".tar.gz",
		checksum,
		pkg.TarGzip,
	), &PackageAttr{
		Env: []string{
			"CC=cc",
		},
	}, &MakeHelper{
		OmitDefaults: true,

		ConfigureName: "/usr/src/openssl/Configure",
		Configure: []KV{
			{"prefix", "/system"},
			{"libdir", "lib"},
			{"openssldir", "etc/ssl"},
			{"", "no-docs"},
		},
		Check: []string{
			"HARNESS_JOBS=" + jobsE,
			"test",
		},
	},
		Perl,
		Coreutils,

		Zlib,
		KernelHeaders,
	), version
}
func init() {
	artifactsM[OpenSSL] = Metadata{
		f: Toolchain.newOpenSSL,

		Name:        "openssl",
		Description: "TLS/SSL and crypto library",
		Website:     "https://www.openssl.org/",

		ID: 2566,

		// strange malformed tags treated as pre-releases in Anitya
		latest: (*Versions).getStable,
	}
}
