about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/bintools-wrapper
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-30 15:04:10 +0000
committerAlyssa Ross <hi@alyssa.is>2020-11-27 13:27:23 +0000
commit156b690d84f41491bcbb6f90338e9d73b5f4be23 (patch)
treee2dc55ba95221fc92b2ffd89c6b14033d7ff2fdf /nixpkgs/pkgs/build-support/bintools-wrapper
parent778e3a44254f5c1173fd88762f7b4e131ab16225 (diff)
downloadnixlib-156b690d84f41491bcbb6f90338e9d73b5f4be23.tar
nixlib-156b690d84f41491bcbb6f90338e9d73b5f4be23.tar.gz
nixlib-156b690d84f41491bcbb6f90338e9d73b5f4be23.tar.bz2
nixlib-156b690d84f41491bcbb6f90338e9d73b5f4be23.tar.lz
nixlib-156b690d84f41491bcbb6f90338e9d73b5f4be23.tar.xz
nixlib-156b690d84f41491bcbb6f90338e9d73b5f4be23.tar.zst
nixlib-156b690d84f41491bcbb6f90338e9d73b5f4be23.zip
{cc,bintools}-wrapper: Comments no longer spliced
This means we can freely keep the comments up to date without the
penalty of a mass rebuild.

(cherry picked from commit 1085403acdbaa7337d6074074f69ec6698226474)
Diffstat (limited to 'nixpkgs/pkgs/build-support/bintools-wrapper')
-rw-r--r--nixpkgs/pkgs/build-support/bintools-wrapper/default.nix73
1 files changed, 37 insertions, 36 deletions
diff --git a/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix b/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix
index 9e31ca6a8a21..31373d6b2392 100644
--- a/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix
+++ b/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix
@@ -132,15 +132,15 @@ stdenv.mkDerivation {
       ldPath="${bintools_bin}/bin"
     ''
 
+    # Solaris needs an additional ld wrapper.
     + optionalString (targetPlatform.isSunOS && nativePrefix != "") ''
-      # Solaris needs an additional ld wrapper.
       ldPath="${nativePrefix}/bin"
       exec="$ldPath/${targetPrefix}ld"
       wrap ld-solaris ${./ld-solaris-wrapper.sh}
     '')
 
+    # Create a symlink to as (the assembler).
     + ''
-      # Create a symlink to as (the assembler).
       if [ -e $ldPath/${targetPrefix}as ]; then
         ln -s $ldPath/${targetPrefix}as $out/bin/${targetPrefix}as
       fi
@@ -200,26 +200,28 @@ stdenv.mkDerivation {
   ];
 
   postFixup =
+    ##
+    ## General libc support
+    ##
     optionalString (libc != null) (''
-      ##
-      ## General libc support
-      ##
-
       echo "-L${libc_lib}${libc.libdir or "/lib"}" > $out/nix-support/libc-ldflags
 
       echo "${libc_lib}" > $out/nix-support/orig-libc
       echo "${libc_dev}" > $out/nix-support/orig-libc-dev
+    ''
 
-      ##
-      ## Dynamic linker support
-      ##
-
+    ##
+    ## Dynamic linker support
+    ##
+    + ''
       if [[ -z ''${dynamicLinker+x} ]]; then
         echo "Don't know the name of the dynamic linker for platform '${targetPlatform.config}', so guessing instead." >&2
         local dynamicLinker="${libc_lib}/lib/ld*.so.?"
       fi
+    ''
 
-      # Expand globs to fill array of options
+    # Expand globs to fill array of options
+    + ''
       dynamicLinker=($dynamicLinker)
 
       case ''${#dynamicLinker[@]} in
@@ -241,45 +243,45 @@ stdenv.mkDerivation {
         local ldflagsBefore=(-dynamic-linker "$dynamicLinker")
     '') + ''
       fi
-
-      # The dynamic linker is passed in `ldflagsBefore' to allow
-      # explicit overrides of the dynamic linker by callers to ld
-      # (the *last* value counts, so ours should come first).
+    ''
+    # The dynamic linker is passed in `ldflagsBefore' to allow
+    # explicit overrides of the dynamic linker by callers to ld
+    # (the *last* value counts, so ours should come first).
+    + ''
       printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before
     '')
 
+    # Ensure consistent LC_VERSION_MIN_MACOSX and remove LC_UUID.
     + optionalString stdenv.targetPlatform.isMacOS ''
-      # Ensure consistent LC_VERSION_MIN_MACOSX and remove LC_UUID.
       echo "-macosx_version_min 10.12 -sdk_version 10.12 -no_uuid" >> $out/nix-support/libc-ldflags-before
     ''
 
-    + optionalString (!nativeTools) ''
-      ##
-      ## User env support
-      ##
+    ##
+    ## User env support
+    ##
 
-      # Propagate the underling unwrapped bintools so that if you
-      # install the wrapper, you get tools like objdump (same for any
-      # binaries of libc).
+    # Propagate the underling unwrapped bintools so that if you
+    # install the wrapper, you get tools like objdump (same for any
+    # binaries of libc).
+    + optionalString (!nativeTools) ''
       printWords ${bintools_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages
     ''
 
+    ##
+    ## Man page and info support
+    ##
     + optionalString propagateDoc (''
-      ##
-      ## Man page and info support
-      ##
-
       ln -s ${bintools.man} $man
     '' + optionalString (bintools ? info) ''
       ln -s ${bintools.info} $info
     '')
 
-    + ''
-      ##
-      ## Hardening support
-      ##
+    ##
+    ## Hardening support
+    ##
 
-      # some linkers on some platforms don't support specific -z flags
+    # some linkers on some platforms don't support specific -z flags
+    + ''
       export hardening_unsupported_flags=""
       if [[ "$($ldPath/${targetPrefix}ld -z now 2>&1 || true)" =~ un(recognized|known)\ option ]]; then
         hardening_unsupported_flags+=" bindnow"
@@ -307,12 +309,11 @@ stdenv.mkDerivation {
       substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
       substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
       substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
-
-      ##
-      ## Extra custom steps
-      ##
     ''
 
+    ##
+    ## Extra custom steps
+    ##
     + extraBuildCommands;
 
   inherit dynamicLinker expand-response-params;