freebsd: format tree

This commit is contained in:
Audrey Dutcher
2025-12-06 22:36:39 -07:00
parent e5516ab15c
commit a0611ad79b
8 changed files with 55 additions and 35 deletions
@@ -12,7 +12,7 @@ mkDerivation rec {
pname =
"drm-kmod-firmware" + lib.optionalString withAmd "-amd" + lib.optionalString withIntel "-intel";
version = "20230625_4"; # there is a _8 but freebsd-ports is pinned to _4
version = "20230625_4"; # there is a _8 but freebsd-ports is pinned to _4
src = fetchFromGitHub {
owner = "freebsd";
@@ -16,6 +16,9 @@ mkDerivation {
"sys/sys/elf_common.h"
];
extraNativeBuildInputs = [ m4 ];
buildInputs = compatIfNeeded ++ [ zlib libelf ];
buildInputs = compatIfNeeded ++ [
zlib
libelf
];
MK_TESTS = "no";
}
@@ -29,9 +29,13 @@ mkDerivation {
];
# XXX mass rebuild moment
postPatch = if withPwdMkdb == null then null else ''
substituteInPlace lib/libutil/pw_util.c --replace-fail _PATH_PWD_MKDB '"${lib.getExe withPwdMkdb}"'
'';
postPatch =
if withPwdMkdb == null then
null
else
''
substituteInPlace lib/libutil/pw_util.c --replace-fail _PATH_PWD_MKDB '"${lib.getExe withPwdMkdb}"'
'';
preBuild = ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
@@ -41,7 +41,7 @@ mkDerivation rec {
"pic" # generates relocations the linker can't handle
];
env.NIX_CFLAGS_COMPILE_AFTER = "-O0"; # XXX REMOVE
env.NIX_CFLAGS_COMPILE_AFTER = "-O0"; # XXX REMOVE
meta.platforms = [ "x86_64-freebsd" ];
meta.license = lib.licenses.unfree;
@@ -19,32 +19,36 @@ mkDerivation rec {
"debug"
];
patches = lib.optionals (lib.versionOlder version "565") [
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/d07cdab9108a8cf6ab66aa1ff834339f8695f457/graphics/nvidia-drm-61-kmod/files/extra-patch-nvidia-drm-conftest.h";
extraPrefix = "a/src/nvidia-drm";
hash = "sha256-EgzEx1VxQyoNpnY0MnNVa08A0ENSyU/rdRM2hOwUE2g=";
})
] ++ lib.optionals (lib.versionOlder version "555") [
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/d07cdab9108a8cf6ab66aa1ff834339f8695f457/graphics/nvidia-drm-61-kmod/files/extra-patch-nvidia-drm-freebsd-lkpi.c";
extraPrefix = "a/src/nvidia-drm";
hash = "sha256-aFOs811J5e9Nu8Kwd6dImiSefEOlKlnRp3kg7DTIccg=";
})
];
patches =
lib.optionals (lib.versionOlder version "565") [
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/d07cdab9108a8cf6ab66aa1ff834339f8695f457/graphics/nvidia-drm-61-kmod/files/extra-patch-nvidia-drm-conftest.h";
extraPrefix = "a/src/nvidia-drm";
hash = "sha256-EgzEx1VxQyoNpnY0MnNVa08A0ENSyU/rdRM2hOwUE2g=";
})
]
++ lib.optionals (lib.versionOlder version "555") [
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/d07cdab9108a8cf6ab66aa1ff834339f8695f457/graphics/nvidia-drm-61-kmod/files/extra-patch-nvidia-drm-freebsd-lkpi.c";
extraPrefix = "a/src/nvidia-drm";
hash = "sha256-aFOs811J5e9Nu8Kwd6dImiSefEOlKlnRp3kg7DTIccg=";
})
];
postPatch = lib.optionalString (lib.versionAtLeast version "570") ''
sed -E -i -e 's:\&nv_drm_fbdev_module_param\, 1\,:\&nv_drm_fbdev_module_param\, 0\,:' src/nvidia-drm/nvidia-drm-freebsd-lkpi.c
sed -E -i -e 's:bool nv_drm_fbdev_module_param = true;:bool nv_drm_fbdev_module_param = false;:' src/nvidia-drm/nvidia-drm-os-interface.c
'' + ''
sed -E -i -e '/DRMKMODDIR.*\/linuxkpi\/dummy\/include/d' src/nvidia-drm/Makefile
postPatch =
lib.optionalString (lib.versionAtLeast version "570") ''
sed -E -i -e 's:\&nv_drm_fbdev_module_param\, 1\,:\&nv_drm_fbdev_module_param\, 0\,:' src/nvidia-drm/nvidia-drm-freebsd-lkpi.c
sed -E -i -e 's:bool nv_drm_fbdev_module_param = true;:bool nv_drm_fbdev_module_param = false;:' src/nvidia-drm/nvidia-drm-os-interface.c
''
+ ''
sed -E -i -e '/DRMKMODDIR.*\/linuxkpi\/dummy\/include/d' src/nvidia-drm/Makefile
mkdir -p $TMP/bin
ln -s ${stdenv.cc}/bin/${stdenv.cc.targetPrefix}nm $TMP/bin/nm
export PATH=$PATH:$TMP/bin
'';
mkdir -p $TMP/bin
ln -s ${stdenv.cc}/bin/${stdenv.cc.targetPrefix}nm $TMP/bin/nm
export PATH=$PATH:$TMP/bin
'';
env.NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; # conftests rely on this
env.NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; # conftests rely on this
env.CONFTEST_BSD_KMODPATHS = "${sys}/kernel ${drm-kmod}/kernel";
extraNativeBuildInputs = [
@@ -55,10 +55,10 @@ let
for f in sys/conf/*.mk; do
substituteInPlace "$f" --replace-quiet 'KERN_DEBUGDIR}''${' 'KERN_DEBUGDIR_'
done
''
+ lib.optionalString (baseConfigFile != null) ''
cat ${baseConfigFile} >>sys/${hostArchBsd}/conf/${baseConfig}
'';
''
+ lib.optionalString (baseConfigFile != null) ''
cat ${baseConfigFile} >>sys/${hostArchBsd}/conf/${baseConfig}
'';
};
# Kernel modules need this for kern.opts.mk
@@ -1,4 +1,8 @@
{ lib, stdenv, fetchurl }:
{
lib,
stdenv,
fetchurl,
}:
let
types_h = fetchurl {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/3da53417998c611f340d75e45962da2fa912add5/multimedia/libv4l/files/types.h";
@@ -1,4 +1,9 @@
{ stdenv, fetchFromGitHub, xorg, pkg-config }:
{
stdenv,
fetchFromGitHub,
xorg,
pkg-config,
}:
stdenv.mkDerivation rec {
pname = "xf86-video-scfb";
version = "0.0.7";