···43 libarchive
44 ];
450000000046 postPatch = ''
47 # Fix a /usr/bin/env reference in here that breaks sandboxed builds
48 patchShebangs arch/lkl/scripts
···43 libarchive
44 ];
4546+ patches = [
47+ # Fix corruption in hijack and zpoline libraries when building in parallel,
48+ # because both hijack and zpoline share object files, which may result in
49+ # missing symbols.
50+ # https://github.com/lkl/linux/pull/612/commits/4ee5d9b78ca1425b4473ede98602b656f28027e8
51+ ./fix-hijack-and-zpoline-parallel-builds.patch
52+ ];
53+54 postPatch = ''
55 # Fix a /usr/bin/env reference in here that breaks sandboxed builds
56 patchShebangs arch/lkl/scripts
···1+#!/usr/bin/env nix-shell
2+#! nix-shell -i nu -p nushell nix
3+4+use std/log
5+6+def replace [ p: path old: string new: string ] {
7+ open $p
8+ | str replace $old $new
9+ | save -f $p
10+}
11+12+def eval [ attr: string ] {
13+ with-env {
14+ NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM: 1
15+ } {
16+ nix eval -f ./. $attr --json
17+ }
18+ | from json
19+}
20+21+def main [] {
22+ # List of all the link in the RSS feed for
23+ # https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/
24+ let links = http get https://sourceforge.net/projects/mingw-w64/rss?path=/mingw-w64/mingw-w64-release/
25+ | from xml
26+ | get content.content.0
27+ | where tag == item
28+ | get content
29+ | flatten
30+ | where tag == title
31+ | get content
32+ | flatten
33+ | get content
34+35+ # Select only files ending in "tar.bz2", then select the largest value
36+ # We only consider values with at least two digits cause they are at
37+ # 13.0 and sorting strings doesn't work well if they aren't the same length
38+ let newest = $links
39+ | where { ($in | str ends-with "tar.bz2") and ($in =~ v[0-9][0-9]\.) }
40+ | sort -r
41+ | get 0
42+43+ # Extract the newest version out of the URL
44+ let new_version = $newest
45+ | split column /
46+ | get column4.0
47+ | split column -
48+ | get column3.0
49+ | str replace .tar.bz2 ""
50+ | str trim -c v
51+52+ # Get the current version in the drv
53+ let current_version = eval "windows.mingw_w64_headers.version"
54+55+ if $new_version == $current_version {
56+ log info "Current mingw-w64 version matches the latest, exiting..."
57+ return
58+ } else {
59+ log info $"Current version is ($current_version)\nLatest version is ($new_version)"
60+ }
61+62+ # Get the current hash
63+ let current_hash = eval "windows.mingw_w64_headers.src.outputHash"
64+65+ # Set to the new version
66+ replace ./pkgs/os-specific/windows/mingw-w64/headers.nix $current_version $new_version
67+68+ # The nix derivation creates the URL from the version, so just grab that.
69+ let new_url = eval "windows.mingw_w64_headers.src.url"
70+71+ # Prefetch to get the new hash
72+ let new_hash = nix-prefetch-url --type sha256 $new_url
73+ | nix hash to-sri --type sha256 $in
74+75+ # Set the hash
76+ replace ./pkgs/os-specific/windows/mingw-w64/headers.nix $current_hash $new_hash
77+}