summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2022-04-14 09:50:48 +0200
committerVladimír Čunát <v@cunat.cz>2022-04-14 09:53:21 +0200
commitd5d94127fd6468febe4f5e8eba8cb231bbd56103 (patch)
tree53efc69e691bdf7c7415039f5cdddb90d8fb5fc4 /pkgs/build-support
parent43c910047f4f2882cf9cba1d38045c3f6ebee051 (diff)
parent069038f0931658e6030876f37f81dfb6825f884c (diff)
downloadnixpkgs-d5d94127fd6468febe4f5e8eba8cb231bbd56103.tar
nixpkgs-d5d94127fd6468febe4f5e8eba8cb231bbd56103.tar.gz
nixpkgs-d5d94127fd6468febe4f5e8eba8cb231bbd56103.tar.bz2
nixpkgs-d5d94127fd6468febe4f5e8eba8cb231bbd56103.tar.lz
nixpkgs-d5d94127fd6468febe4f5e8eba8cb231bbd56103.tar.xz
nixpkgs-d5d94127fd6468febe4f5e8eba8cb231bbd56103.tar.zst
nixpkgs-d5d94127fd6468febe4f5e8eba8cb231bbd56103.zip
Merge branch 'staging-next' into staging
Minor conflicts; I hope I didn't mess up:
	pkgs/development/tools/misc/binutils/default.nix
	pkgs/games/openjk/default.nix
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix2
-rw-r--r--pkgs/build-support/setup-hooks/auto-patchelf.py40
-rw-r--r--pkgs/build-support/setup-hooks/auto-patchelf.sh9
3 files changed, 32 insertions, 19 deletions
diff --git a/pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix b/pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix
index a36008d752b..945b9287ed0 100644
--- a/pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix
+++ b/pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix
@@ -178,7 +178,7 @@ let
         chmod -R 755 share
         cp -rLTf ${staticUsrProfileTarget}/share share
       else
-        cp -rLf ${staticUsrProfileTarget}/share share
+        cp -rsHf ${staticUsrProfileTarget}/share share
       fi
     fi
     for i in bin sbin include; do
diff --git a/pkgs/build-support/setup-hooks/auto-patchelf.py b/pkgs/build-support/setup-hooks/auto-patchelf.py
index 26fd623e3da..861d772698d 100644
--- a/pkgs/build-support/setup-hooks/auto-patchelf.py
+++ b/pkgs/build-support/setup-hooks/auto-patchelf.py
@@ -1,23 +1,21 @@
 #!/usr/bin/env python3
 
-from collections import defaultdict
-from contextlib import contextmanager
-from dataclasses import dataclass
-from elftools.common.exceptions import ELFError # type: ignore
-from elftools.elf.dynamic import DynamicSection # type: ignore
-from elftools.elf.elffile import ELFFile # type: ignore
-from elftools.elf.enums import ENUM_E_TYPE, ENUM_EI_OSABI # type: ignore
-from itertools import chain
-from pathlib import Path, PurePath
-
-from typing import Tuple, Optional, Iterator, List, DefaultDict, Set
-
 import argparse
 import os
 import pprint
 import subprocess
 import sys
+from collections import defaultdict
+from contextlib import contextmanager
+from dataclasses import dataclass
+from itertools import chain
+from pathlib import Path, PurePath
+from typing import DefaultDict, Iterator, List, Optional, Set, Tuple
 
+from elftools.common.exceptions import ELFError  # type: ignore
+from elftools.elf.dynamic import DynamicSection  # type: ignore
+from elftools.elf.elffile import ELFFile  # type: ignore
+from elftools.elf.enums import ENUM_E_TYPE, ENUM_EI_OSABI  # type: ignore
 
 
 @contextmanager
@@ -246,7 +244,7 @@ def auto_patchelf(
         lib_dirs: List[Path],
         runtime_deps: List[Path],
         recursive: bool =True,
-        ignore_missing: bool =False) -> None:
+        ignore_missing: List[str] = []) -> None:
 
     if not paths_to_patch:
         sys.exit("No paths to patch, stopping.")
@@ -264,12 +262,19 @@ def auto_patchelf(
     missing = [dep for dep in dependencies if not dep.found]
 
     # Print a summary of the missing dependencies at the end
+    print(f"auto-patchelf: {len(missing)} dependencies could not be satisfied")
+    failure = False
     for dep in missing:
-        print(f"auto-patchelf could not satisfy dependency {dep.name} wanted by {dep.file}")
+        if dep.name.name in ignore_missing or "*" in ignore_missing:
+            print(f"warn: auto-patchelf ignoring missing {dep.name} wanted by {dep.file}")
+        else:
+            print(f"error: auto-patchelf could not satisfy dependency {dep.name} wanted by {dep.file}")
+            failure = True
 
-    if missing and not ignore_missing:
+    if failure:
         sys.exit('auto-patchelf failed to find all the required dependencies.\n'
-                 'Add the missing dependencies to --libs or use --ignore-missing.')
+                 'Add the missing dependencies to --libs or use '
+                 '`--ignore-missing="foo.so.1 bar.so etc.so"`.')
 
 
 def main() -> None:
@@ -280,7 +285,8 @@ def main() -> None:
                     'libraries in the provided paths.')
     parser.add_argument(
         "--ignore-missing",
-        action="store_true",
+        nargs="*",
+        type=str,
         help="Do not fail when some dependencies are not found.")
     parser.add_argument(
         "--no-recurse",
diff --git a/pkgs/build-support/setup-hooks/auto-patchelf.sh b/pkgs/build-support/setup-hooks/auto-patchelf.sh
index 9822674196a..661b8597efe 100644
--- a/pkgs/build-support/setup-hooks/auto-patchelf.sh
+++ b/pkgs/build-support/setup-hooks/auto-patchelf.sh
@@ -53,10 +53,17 @@ autoPatchelf() {
         esac
     done
 
+    if [ "${autoPatchelfIgnoreMissingDeps[*]}" == "1" ]; then
+        echo "autoPatchelf: WARNING: setting 'autoPatchelfIgnoreMissingDeps" \
+             "= true;' is deprecated and will be removed in a future release." \
+             "Use 'autoPatchelfIgnoreMissingDeps = [ \"*\" ];' instead." >&2
+        autoPatchelfIgnoreMissingDeps=( "*" )
+    fi
+
     local runtimeDependenciesArray=($runtimeDependencies)
     @pythonInterpreter@ @autoPatchelfScript@                            \
         ${norecurse:+--no-recurse}                                      \
-        ${autoPatchelfIgnoreMissingDeps:+--ignore-missing}              \
+        --ignore-missing "${autoPatchelfIgnoreMissingDeps[@]}"          \
         --paths "$@"                                                    \
         --libs "${autoPatchelfLibs[@]}"                                 \
                "${extraAutoPatchelfLibs[@]}"                            \