[arch-commits] Commit in ncdu/trunk (PKGBUILD hardening.patch)

Daurnimator daurnimator at gemini.archlinux.org
Sat Mar 26 15:47:01 UTC 2022


    Date: Saturday, March 26, 2022 @ 15:47:01
  Author: daurnimator
Revision: 1176836

Be explicit with zig and targets

  - The hardening patch was unused with the moved to invoking `zig build-exe`
  - Need to specify kernel version or it defaults to 3.16.
    I selected 5.10 as it is one linux-lts release behind
  - Should specify gnu ABI to prevent incorrect auto-detection in some environments
  - Need to specify glibc version or it defaults to 2.19
  - When using non-native target and skipping build.zig, need to specify lib/include search dirs

Modified:
  ncdu/trunk/PKGBUILD
Deleted:
  ncdu/trunk/hardening.patch

-----------------+
 PKGBUILD        |   31 ++++++++++++++++---------------
 hardening.patch |   11 -----------
 2 files changed, 16 insertions(+), 26 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-03-26 15:06:44 UTC (rev 1176835)
+++ PKGBUILD	2022-03-26 15:47:01 UTC (rev 1176836)
@@ -1,5 +1,6 @@
 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
 # Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
+# Contributor: Daurnimator <daurnimator at archlinux.org>
 # Contributor: Eli Schwartz <eschwartz at archlinux.org>
 # Contributor: lp76 <l.peduto at gmail.com>
 # Contributor: Daenyth <Daenyth+Arch AT gmail DOT com>
@@ -14,30 +15,30 @@
 depends=('ncurses')
 makedepends=('zig')
 arch=('x86_64')
-source=("https://dev.yorhel.nl/download/${pkgname}-${pkgver}.tar.gz"{,.asc}
-        "hardening.patch")
+source=("https://dev.yorhel.nl/download/${pkgname}-${pkgver}.tar.gz"{,.asc})
 sha256sums=('d6c2374ca50d40b6211346972a2e89c9601172fd0704d885eda5b1e09a2a48ed'
-            'SKIP'
-            '4b90e881d1dd5fb36b269e52952be40e050926dd6d4ce08ac7a7f0e5940e790d')
+            'SKIP')
 b2sums=('27857c110b80d2b90313d628dd0412dd281948ccae924c9b2b3e870232786f02006658899668e1a342b7f845ef992358cfc0cc06899f3008cb34baddca34951e'
-        'SKIP'
-        '54b47c408e4144bee629d1d80410e4c97baf375d10399da3644a7a929b21732b8323723b2218890fe7d7d5b9b7b42427a8af74bc64c4002ef23e722c3ed969bf')
+        'SKIP')
 validpgpkeys=('74460D32B80810EBA9AFA2E962394C698C2739FA') # Yoran Heling <projects at yorhel.nl>
 
-prepare() {
-    cd "${pkgname}-${pkgver}"
-
-    patch --verbose --strip=1 --input=../hardening.patch
-}
-
 build() {
     cd "${pkgname}-${pkgver}"
 
     # since RELRO is not doable in the zig.build file (https://github.com/ziglang/zig/issues/6977)
     # we are running zig build-exe directly
-    #zig build -Drelease-safe -Dcpu=baseline
-
-    zig build-exe ./src/main.zig ./src/ncurses_refs.c -lc -lncursesw -OReleaseSafe --name ncdu -target native-native -mcpu x86_64 -D _DEFAULT_SOURCE -D _XOPEN_SOURCE=600 -fPIE -z relro -z now -fno-each-lib-rpath
+    zig build-exe \
+        -target x86_64-linux.5.10-gnu.2.34 -mcpu baseline \
+        -L /usr/local/lib -L /usr/lib \
+        -isystem /usr/local/include -isystem /usr/include \
+        ./src/main.zig ./src/ncurses_refs.c \
+        -lc -lncursesw \
+        -OReleaseSafe \
+        --name ncdu \
+        -D _DEFAULT_SOURCE -D _XOPEN_SOURCE=600 \
+        -fPIE \
+        -z relro -z now \
+        -fno-each-lib-rpath
 }
 
 check() {

Deleted: hardening.patch
===================================================================
--- hardening.patch	2022-03-26 15:06:44 UTC (rev 1176835)
+++ hardening.patch	2022-03-26 15:47:01 UTC (rev 1176836)
@@ -1,11 +0,0 @@
---- ncdu-2.1/build.zig	2022-01-01 15:59:36.000000000 +0100
-+++ ncdu-2.1_patched/build.zig	2022-03-23 22:58:15.208756978 +0100
-@@ -13,6 +13,8 @@
-     exe.addCSourceFile("src/ncurses_refs.c", &[_][]const u8{});
-     exe.linkLibC();
-     exe.linkSystemLibrary("ncursesw");
-+    exe.pie = true;
-+    exe.each_lib_rpath = false;
-     exe.install();
- 
-     const run_cmd = exe.run();



More information about the arch-commits mailing list