vinix-ports / ports / openssl / PKGBUILD.vile
62 lines · 60 sloc · 4.1 KB · c33d8afc2906b8dd9a8b905224eccd49a44f7ad5
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" }
5arm := string=?(arch, "aarch64")
6musl := if arm { "musl>=1.2.6-4" } else { "musl" }
7cross := get-environment-variable("CROSS_COMPILE")
8prefix := if string?(cross) { cross } else { "" }
9
10defpkgbuild(openssl,
11 #:pkgname, "openssl",
12 #:pkgver, "3.5.9",
13 #:pkgrel, if arm { 5 } else { 4 },
14 #:pkgdesc, "OpenSSL TLS toolkit, libraries and development headers for Vinix",
15 #:arch, [#:x86-64, #:aarch64],
16 #:url, "https://openssl-library.org/",
17 #:license, "Apache-2.0",
18 #:depends, [musl],
19 #:makedepends, ["linux-headers"],
20 #:source, [
21 "https://github.com/openssl/openssl/releases/download/openssl-3.5.9/openssl-3.5.9.tar.gz",
22 "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-88822.patch",
23 "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-88823.patch",
24 "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-95691.patch",
25 "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-95692.patch",
26 "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-107496.patch", "ec-methods.c"],
27 #:sha256sums, ["603f5602e2eef00d77fbd429d34dcd5822bb301757a1bc9cdb24c670f1eb859a",
28 "50f7cc52fb146703379ca043d17e204c4fda99c684efe3db6d6f3ae1d175bd2a",
29 "a945077c0a978dbfe5af5e4f7174a2151466547f8fb94562f395baa7b6b7c147", "93d8e82fdc995172a6d5cc6952491658106191bd5ac221d34596adbddfcd1afe", "0e328604c0038de6629a29322ae5f02d2f5f5128c2625b57ca64262efab99e05",
30 "77d3759d279c71af59629c4a0fa82d8272a099762f2fa9e3f66d7ca5ed544157", "84d12e762fc20464364d1eba38de830c159bde249ef9cf29e10b4d1f3e8d59fd"],
31
32 #:prepare, fn() {
33 for-each(fn(patch) {
34 run("patch", "--batch", "--fuzz=0", "-p1", "-d", "openssl-3.5.9", "-i", string-append("../", patch))
35 }, list("CVE-2026-88822.patch", "CVE-2026-88823.patch", "CVE-2026-95691.patch",
36 "CVE-2026-95692.patch", "CVE-2026-107496.patch"))
37 },
38 #:build, fn() {
39 ; OpenSSL prefixes tool names itself. vinix-cc selects the real target
40 ; compiler and sysroot, so pass the archive tools to Configure explicitly.
41 run("env", "-u", "CROSS_COMPILE", "CC=vinix-cc", string-append("VINIX_REAL_CC=", prefix, "gcc"),
42 string-append("AR=", prefix, "ar"), string-append("RANLIB=", prefix, "ranlib"),
43 "perl", "openssl-3.5.9/Configure", string-append("linux-", arch), "--prefix=/usr", "--libdir=lib",
44 "--openssldir=/etc/ssl", "shared", "enable-ec_nistp_64_gcc_128", "no-tests", "no-docs", "no-zlib", "no-async", "no-afalgeng")
45 ; OpenSSL's configured Makefile exports its own empty CROSS_COMPILE.
46 run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH",
47 string-append("VINIX_REAL_CC=", prefix, "gcc"), "make", "build_sw")
48 },
49 #:check, fn() {
50 run("vinix-run", "--library-path", ".", "apps/openssl", "version")
51 run("vinix-run", "--library-path", ".", "apps/openssl", "dgst", "-sha256", "/dev/null")
52 run("vinix-cc", "-Iinclude", "-Iopenssl-3.5.9/include", "ec-methods.c", "-L.", "-lcrypto", "-o", "ec-methods")
53 run("vinix-run", "--library-path", ".", "./ec-methods")
54 },
55 #:package, fn() {
56 ; The core command implements 'openssl rehash'. Optional upstream Perl
57 ; convenience scripts require a Perl installation in the guest.
58 run("env", string-append("VINIX_REAL_CC=", prefix, "gcc"), "make", "BIN_SCRIPTS=", "MISC_SCRIPTS=",
59 string-append("DESTDIR=", pkgdir()), "install_sw", "install_ssldirs")
60 run("install", "-Dm644", "openssl-3.5.9/LICENSE.txt",
61 string-append(pkgdir(), "/usr/share/licenses/openssl/LICENSE.txt"))
62 })
63