me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

Package musl fortify headers with a target consumer check

diviocity committed 6 days ago · 1784ffc7eb97bfe3372fa327e8a742180e519eba View patch
Unverified signature 2 files changed +44 -0
fortify-headers/PKGBUILD.vile new file +34 -0

@@ -0,0 +1,34 @@

1+defpkgbuild(fortify-headers,

2+ #:pkgname, "fortify-headers",

3+ #:pkgver, "1.1",

4+ #:pkgrel, 1,

5+ #:pkgdesc, "Compile-time and runtime checks for musl C library calls",

6+ #:url, "https://git.2f30.org/fortify-headers/",

7+ #:license, "0BSD",

8+ #:arch, [#:x86-64, #:aarch64],

9+ #:depends, ["musl"],

10+ #:source, ["https://distfiles.alpinelinux.org/distfiles/v3.21/fortify-headers-1.1.tar.gz",

11+ "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/fortify-headers/0001-add-initial-clang-support.patch",

12+ "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/fortify-headers/0002-avoid-__extension__-with-clang.patch",

13+ "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/fortify-headers/0003-Disable-wrapping-of-ppoll.patch",

14+ "checked.c"],

15+ #:sha256sums, ["6ba5d860a2d2ba4c3346924b93930c34856eafe148bdbdf271ecab8065201fb6",

16+ "41b0e73131959af228928c3a96403e9831c53033fc07494b63cc3d72252118a5",

17+ "2e8a14f08e6d77b7ec7d78c16a16b0bd96e147bafd1d35a54fba866cf13cf336",

18+ "356e3a8f090a4bfd21bc2ed615a7ad6c0c90c5ffd82e7c8457e63c1bda5ac82c",

19+ "e139b9456913c83543b63b16c9972c129f620aa0169a6e8eea382664be2bd85d"],

20+ #:prepare, fn() {

21+ for-each(fn(patch) {

22+ run("patch", "--batch", "--fuzz=0", "-d", "fortify-headers-1.1", "-p1", "-i", string-append(srcdir(), "/", patch))

23+ }, list("0001-add-initial-clang-support.patch",

24+ "0002-avoid-__extension__-with-clang.patch",

25+ "0003-Disable-wrapping-of-ppoll.patch"))

26+ },

27+ #:check, fn() {

28+ run("vinix-cc", "-O2", "-D_FORTIFY_SOURCE=2", "-Ifortify-headers-1.1/include", "checked.c", "-o", "checked")

29+ run("vinix-run", "./checked", "Vinix")

30+ },

31+ #:package, fn() {

32+ run("make", "-C", "fortify-headers-1.1", "PREFIX=/usr", string-append("DESTDIR=", pkgdir()), "install")

33+ run("install", "-Dm644", "fortify-headers-1.1/LICENSE", string-append(pkgdir(), "/usr/share/licenses/fortify-headers/LICENSE"))

34+ })

fortify-headers/checked.c new file +10 -0

@@ -0,0 +1,10 @@

1+#include <stdio.h>

2+#include <string.h>

3+

4+int main(int argc, char **argv) {

5+ char text[16];

6+ if (argc != 2 || strlen(argv[1]) >= sizeof text)

7+ return 1;

8+ strcpy(text, argv[1]);

9+ return strcmp(text, "Vinix") || puts(text) < 0;

10+}