vinix-ports / openssl / PKGBUILD.vile
55 lines · 53 sloc · 3.53 KB · 19f9785ff6225f1d4093cb3eeb7b56a3cc29bb50
Raw
1; Keep the libssl.so.3 and libcrypto.so.3 ABI used by the Alpine 3.21 userland.
2; Use upstream's supported 3.5 LTS branch and Alpine's corresponding fixes.
3selected := get-environment-variable("VPAC_TARGET_ARCH")
4arch := if string?(selected) { selected } else if memq(string->symbol("aarch64"), features()) { "aarch64" } else { "x86_64" }
5cross := get-environment-variable("CROSS_COMPILE")
6prefix := if string?(cross) { cross } else { "" }
7
8defpkgbuild(openssl,
9 #:pkgname, "openssl",
10 #:pkgver, "3.5.9",
11 #:pkgrel, 2,
12 #:pkgdesc, "OpenSSL TLS toolkit, libraries and development headers for Vinix",
13 #:arch, [#:x86-64, #:aarch64],
14 #:url, "https://openssl-library.org/",
15 #:license, "Apache-2.0",
16 #:depends, ["musl"],
17 #:makedepends, ["linux-headers"],
18 #:source, [
19 "https://github.com/openssl/openssl/releases/download/openssl-3.5.9/openssl-3.5.9.tar.gz",
20 "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-88822.patch",
21 "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-88823.patch",
22 "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-95691.patch",
23 "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-95692.patch",
24 "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-107496.patch"],
25 #:sha256sums, ["603f5602e2eef00d77fbd429d34dcd5822bb301757a1bc9cdb24c670f1eb859a",
26 "50f7cc52fb146703379ca043d17e204c4fda99c684efe3db6d6f3ae1d175bd2a",
27 "a945077c0a978dbfe5af5e4f7174a2151466547f8fb94562f395baa7b6b7c147", "93d8e82fdc995172a6d5cc6952491658106191bd5ac221d34596adbddfcd1afe", "0e328604c0038de6629a29322ae5f02d2f5f5128c2625b57ca64262efab99e05",
28 "77d3759d279c71af59629c4a0fa82d8272a099762f2fa9e3f66d7ca5ed544157"],
29
30 #:prepare, fn() {
31 for-each(fn(patch) {
32 run("patch", "--batch", "--fuzz=0", "-p1", "-d", "openssl-3.5.9", "-i", string-append("../", patch))
33 }, list("CVE-2026-88822.patch", "CVE-2026-88823.patch", "CVE-2026-95691.patch",
34 "CVE-2026-95692.patch", "CVE-2026-107496.patch"))
35 },
36 #:build, fn() {
37 ; OpenSSL prefixes tool names itself. vinix-cc selects the real target
38 ; compiler and sysroot, so pass the archive tools to Configure explicitly.
39 run("env", "-u", "CROSS_COMPILE", "CC=vinix-cc", string-append("VINIX_REAL_CC=", prefix, "gcc"),
40 string-append("AR=", prefix, "ar"), string-append("RANLIB=", prefix, "ranlib"),
41 "perl", "openssl-3.5.9/Configure", string-append("linux-", arch), "--prefix=/usr", "--libdir=lib",
42 "--openssldir=/etc/ssl", "shared", "no-tests", "no-docs", "no-zlib", "no-async", "no-afalgeng")
43 run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH", "make", "build_sw")
44 },
45 #:check, fn() {
46 run("vinix-run", "--library-path", ".", "apps/openssl", "version")
47 run("vinix-run", "--library-path", ".", "apps/openssl", "dgst", "-sha256", "/dev/null")
48 },
49 #:package, fn() {
50 ; The core command implements 'openssl rehash'. Optional upstream Perl
51 ; convenience scripts require a Perl installation in the guest.
52 run("make", "BIN_SCRIPTS=", "MISC_SCRIPTS=", string-append("DESTDIR=", pkgdir()), "install_sw", "install_ssldirs")
53 run("install", "-Dm644", "openssl-3.5.9/LICENSE.txt",
54 string-append(pkgdir(), "/usr/share/licenses/openssl/LICENSE.txt"))
55 })
56