Commit graph

484 commits

Author SHA1 Message Date
Vladimír Čunát d5d94127fd
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
2022-04-14 09:53:21 +02:00
Samuel Ainsworth 263292cb5e
Merge pull request #167397 from samuela/samuela/autopatchelf
autoPatchelfHook: more precise dependency ignorance
2022-04-12 08:58:00 -07:00
Samuel Ainsworth a7fc2f6392 autoPatchelfHook: more precise dependency ignorance 2022-04-11 01:28:55 +00:00
zowoq 3a70d5dc83 Merge remote-tracking branch 'origin/staging-next' into staging
Conflicts:
	pkgs/development/compilers/go/2-dev.nix
2022-04-07 22:12:13 +10:00
toonn 5eb21a55ee copyDesktopItems: Use variable for repeated path
Co-authored-by: K900 <me@0upti.me>
2022-04-07 11:04:11 +00:00
toonn d1bbb2b3d6 copyDesktopItems: Use bin output
Desktop files are only useful when accompanied by the binaries they
specify. So it makes more sense to put them next to the binaries rather
than `$out` which only usually contains the binaries.
2022-04-07 11:04:11 +00:00
toonn 261b736521
desktopToDarwinBundle: Implement %F and %U Exec field codes
Similar to the implementation of the `%f` and `%u` field codes. In this
case the amount of arguments passed poses no problem but the position
could, at least in theory.

This finishes the implementation of all the non-deprecated field codes.
As a part of that, repetitions of field codes are left alone. Originally
all field codes were removed. Now we replace only the first occurence.
This is correct for at least `%f`, `%u`, `%F` and `%U` because at most
one of them is permitted.

Shortcomings:

  1. We replace `%[cfFikuU]` patterns one at a time. This means if the
     right field code appears as part of the rest of the `Exec` field or
     in a field code that was substituted earlier.

  2. If any field code is repeated, only the first occurence is
     substituted.
2022-03-31 15:27:39 +02:00
toonn f31d945755
desktopToDarwinBundle: Implement %f and %u Exec field codes
`%f` and `%u` are used to signal the program only accepts a single file
or URI argument. I do not believe there's a way to signal this
information to macOS but it is possible the program really won't work if
multiple files are passed and it's possible the relative position of
`%i`, `%c` or `%k` matters. So we replace `%f` or `%u` with `$1`. That
way we only pass one file in the (possibly significant) position of the
field code.
2022-03-31 14:04:52 +02:00
toonn 196f989ae8
desktopToDarwinBundle: Implement %i Exec field code 2022-03-31 13:44:15 +02:00
toonn 4dc94e1489
desktopToDarwinBundle: Implement %c Exec field code 2022-03-31 13:00:11 +02:00
toonn 4a749a89c4
desktopToDarwinBundle: Implement %k Exec field code 2022-03-31 12:47:54 +02:00
toonn 30e8e0a9a3
desktopToDarwinBundle: Change empty directory test
`ls -1 "$iconsdir/"*` listed the source directory for me when the glob
had no matches. Switching to `-A` circumvents this problem and has the
added advantage that it cannot run into argument list length limits.
2022-03-31 12:47:54 +02:00
toonn 7ef15c96dc
desktopToDarwinBundle: Add X-macOS-Exec and log editing Exec
Co-authored-by: milahu <milahu@gmail.com>
2022-03-30 16:42:13 +02:00
toonn b52a962141
desktopToDarwinBundle: Complete field code removal
Checked the desktop entry spec, there's other field codes than `%[fFuU]`
and those can in fact occur more than once, hence dropping '$' and
adding `/g`.
2022-03-30 16:42:13 +02:00
toonn 99f387e462
desktopToDarwinBundle: Fixup Exec
The "Exec" key in desktop items sometimes has one of the `%f`, `%F`,
`%u` and `%U` suffixes, which specify whether the command takes a file,
multiple files or a generalized URL or URLs. Darwin application bundles
do no understand this syntax so we do the next best thing, which is
simply dropping it.
2022-03-30 16:42:02 +02:00
github-actions[bot] 8357b101a5
Merge staging-next into staging 2022-03-25 12:02:05 +00:00
José Romildo Malaquias eff8a32c29
Merge pull request #163623 from ilya-fedin/fix-mate-utils-inkscape
nixos/wrap-gapps-hook: don't add data directories of icon dependencies into XDG_DATA_DIRS
2022-03-24 21:34:23 -03:00
toonn 6aa5c53748
desktopToDarwinBundle: Fall back to scaling available
Sometimes scalable icons or icons within the thresholds from the desired
resolutions aren't available. In this case it's still nicer to end up
with a blocky scaled icon rather than the generic default.
2022-03-21 14:20:03 +01:00
toonn 08a2b83c96
desktopToDarwinBundle: Include TOC in generated ICNS file
In order to compose a `.icns` file containing multiple icon sizes I had
to pass `--toc` to `icnsutil`. This did not seem to have a negative
effect on `.icns` containing only a single icon size.
2022-03-21 14:20:03 +01:00
toonn c3d974e441
desktopToDarwinBundle: Simplify double negation 2022-03-21 14:20:03 +01:00
toonn 21fe5d3b8b
desktopToDarwinBundle: Drop 48x48 size
On macOS 10.13 the 48x48 icon size is not supported. It results in a
corrupted image being displayed. I suspect the image data is being
truncated to what it expects for 32x32 or maybe data is read for
128x128, which would be a buffer overflow.
2022-03-21 14:20:03 +01:00
toonn a8d7ac1b11
make-darwin-bundle: Use actual bin output
The script and the hook assume `/bin` is in `$out` but that's not always
true for a multi-output derivation.
2022-03-21 13:48:20 +01:00
Naïm Favier 10479e4f51
makeWrapper: add --chdir
For symmetry with `makeBinaryWrapper`.
2022-03-18 18:55:58 +01:00
Ilya Fedin b1e73fa2e0 nixos/wrap-gapps-hook: don't add data directories of icon dependencies into XDG_DATA_DIRS
As discussed in https://github.com/NixOS/nixpkgs/issues/163590, it's not really required and has a side effect of adding refeferences to packages from nativeBuildInputs that aren't really required
2022-03-11 00:58:26 +04:00
github-actions[bot] cd1f27794e
Merge master into staging-next 2022-03-02 06:11:13 +00:00
Randy Eckenrode 8a2fdda938
desktopToDarwinBundle: use Bash arithmetic
Co-authored-by: Uri Baghin <uri@canva.com>
2022-03-01 22:00:13 -05:00
Randy Eckenrode d2748e84f8
desktopToDarwinBundle: support 48x48 icons 2022-03-01 21:59:22 -05:00
Randy Eckenrode 30a09ae9ac
desktopToDarwinBundle: fix squircle icons
- Convert icons to a single .icns file; and
- Provide an opt-out via X-macOS-Squircle in the desktop item to
  override the squircle behavior when the source icons look bad when
  converted automatically.
2022-02-23 20:29:52 -05:00
talyz 183147a037
makeWrapper: Don't glob in prefix/suffix
Disable file globbing in --prefix/--suffix, since bash will otherwise
try to find filenames matching the the value to be prefixed/suffixed
if it contains characters considered wildcards, such as `?` and
`*`. We want the value as is, except we also want to split it on on
the separator; hence we can't quote it.
2022-02-12 11:03:32 +01:00
github-actions[bot] fa600e2c3a
Merge staging-next into staging 2022-02-11 00:02:23 +00:00
Uri Baghin 1c2d7f85b9
Merge pull request #131891 from hexagonal-sun/darwin-app-creation
Darwin Application Launcher creation expression
2022-02-11 09:26:32 +11:00
Matthew Leach 850fc57f56 build-support: make-darwin-bundle: new
Add a new module that allows darwin-style application bundles to be
created
2022-02-10 18:53:53 +00:00
Guillaume Maudoux 7b9fd5d1c9
rewrite autoPatchelfHook in python (#149731)
* rewrite autoPatchelfHook in python

* Update pkgs/build-support/setup-hooks/auto-patchelf.py

Co-authored-by: aszlig <aszlig@redmoonstudios.org>

* Update pkgs/build-support/setup-hooks/auto-patchelf.py

Co-authored-by: aszlig <aszlig@redmoonstudios.org>

* Apply suggestions from code review

Co-authored-by: aszlig <aszlig@redmoonstudios.org>

* Fix issues discovered during tests

* Apply suggestions from code review

Co-authored-by: aszlig <aszlig@redmoonstudios.org>

* fixup line wrapping

* autoPatchelfHook: Improve compatibility with bash version

* autoPatchelfHook: Fix symlink-reated issues

* autoPatchelfHook: Revert dubious patchelf invocation test

* autoPatchelfHook: Untangle the executable detection logic

* fixup! autoPatchelfHook: Untangle the executable detection logic

* autoPatchelfHook: Fix invalid borrow issue

* autoPatchelfHook: Handle runtimeDependencies as the bare string it is

* autoPatchelfHook: add bintools dependency

For the very rare cases where it is not included by default.

* autoPatchelfHook: replace old hook with the rewrite

* autoPatchelfHook: get rid of the old hook content

* autoPatchelfHook: fix wrong ordering of debug info

* autoPatchelfHook: persist extra search path across incovations

* autoPatchelfHook: fix wrong usage of global variables

* Update auto-patchelf.py

PEP8: ignoreMissing -> ignore_missing

* Apply suggestions from code review

Co-authored-by: aszlig <aszlig@redmoonstudios.org>

* autoPatchelfHook: remove imprecise and incorrect warning

* Apply explicit types from code review

Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>

* Complement and polish types and snake_casing

Co-authored-by: aszlig <aszlig@redmoonstudios.org>
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2022-02-04 10:08:27 +01:00
talyz c67f885fe4
makeWrapper: Don't readd existing values in prefix/suffix
When prefixing or suffixing list variables, check that the value or
values aren't already part of the list. If this is the case when
suffixing, the list won't be touched at all. When prefixing, however,
the last matching instance of the value will be moved to the beginning
of the list. Any remaining duplicates of the value will be left as-is.

Co-authored-by: Vincenzo Mantova <xworld21@users.sf.net>
2022-02-02 19:46:58 +01:00
Gabriella Gonzalez 07f1f2ca9c
makeWrapper: Add --prefix-each flag (#145104)
This is for symmetry with `--suffix-each`, and also because
(in my limited experience), `--prefix-each` is more useful since it
ensures that the new entries superseded the existing `PATH` entries
2021-12-27 22:15:06 -08:00
github-actions[bot] 39d035c4cf
Merge master into staging-next 2021-12-22 00:01:35 +00:00
Naïm Favier ffdf9681ab
makeBinaryWrapper: create destination directory 2021-12-21 18:22:49 +01:00
github-actions[bot] 92aabc6576
Merge master into staging-next 2021-12-10 00:01:53 +00:00
Robert Hensing 9fb7d91888
Merge pull request #124556 from bergkvist/bergkvist/make-c-wrapper
Generate tiny compiled binary for wrapping executables
2021-12-10 00:45:30 +01:00
Jacek Galowicz d5e028a441 make-binary-wrapper: Make CC substitution safer 2021-12-09 17:22:55 +01:00
Jacek Galowicz 87fcb7b79e make-binary-wrapper: Add -euo pipefail to bash script 2021-12-09 17:22:55 +01:00
Jacek Galowicz b7e00ed89e make-binary-wrapper: Add -Wall -Werror -Wpedantic 2021-12-09 17:22:55 +01:00
Tobias Bergkvist df13841609
Merge branch 'bergkvist/make-c-wrapper' into make-c-wrapper 2021-12-09 13:00:24 +01:00
Jacek Galowicz 177f0a6eed make makeWrapper and makeBinaryWrapper drop-in-replaceable 2021-12-09 11:32:29 +00:00
Doron Behar 32d566e1b9 wrapProgramBinary -> binaryWrapProgram 2021-12-08 18:59:38 +02:00
Jacek Galowicz f3b16a6b5d Fix typo in make-binary-wrapper 2021-12-08 10:26:17 +00:00
Tobias Bergkvist 7cf1aa102a Separate out indentation responsibility to indent4 in makeCWrapper using awk.
Generated code no longer needs to worry about its own indent level in the output.
2021-12-07 17:42:54 +01:00
Tobias Bergkvist 2b5a2d4a8e Switch to embedding input arguments instead of generated C code in binary. 2021-12-07 01:50:38 +01:00
Tobias Bergkvist 64da82731d Add new argument: --chdir DIR (alternative to --run "cd DIR" in makeWrapper) 2021-12-02 03:39:25 +01:00
Tobias Bergkvist a47286f0a0 Add argument --inherit-argv0 to replace use case --argv0 '$0'. Fix wrapProgramBinary by using this new argument 2021-12-02 02:29:00 +01:00
Tobias Bergkvist e3c94f3d6b Use cc instead of gcc in makeBinaryWrapper 2021-12-02 02:07:17 +01:00
Tobias Bergkvist a1e62262bc Replace concat3 with asprintf in set_env_prefix and set_env_suffix. 2021-12-01 23:27:26 +01:00
Tobias Bergkvist 3997e9de67 Switch from malloc to calloc in addFlags 2021-12-01 23:07:30 +01:00
Tobias Bergkvist 97d62a90f5 Switch from exit(1) to abort() in assert_success 2021-12-01 22:56:18 +01:00
Tobias Bergkvist 4e55d34535 Add assertValidEnvName and check that variable name is valid during code generation. Add assert_success, and assert that setenv/unsetenv succeeds to crash if they don't 2021-12-01 22:49:20 +01:00
Alyssa Ross bea767e5fe
separateDebugInfo: skip files objcopy can't read 2021-11-21 21:44:27 +00:00
Robert Hensing 9005cb8835
Merge pull request #145841 from l0b0/fix-indentation
Fix indentation
2021-11-18 00:38:59 +01:00
github-actions[bot] f8cf67790e
Merge master into staging-next 2021-11-17 06:01:28 +00:00
Sandro e0d488f1a3
Merge pull request #140911 from sersorrel/copy-desktop-items 2021-11-17 02:40:57 +01:00
Victor Engmark 57b496ea98 misc: Replace tab indentation with spaces
I've tried to be consistent, using four or eight spaces to line up
with existing code.
2021-11-14 16:04:46 +13:00
John Ericson 5a7f6e1f18
Merge pull request #144839 from l0b0/fix-redirect
pkgs/build-support: Redirect to standard error rather than file "2"
2021-11-13 21:56:43 -05:00
Victor Engmark 8ed1104a4a pkgs/build-support: Redirect to standard error rather than file "2" 2021-11-11 18:14:21 +13:00
Tobias Bergkvist 3a014be2f2 Assert that malloc does not return a NULL pointer for better error messages + to satisfy static analysis tools. 2021-11-09 02:56:32 +01:00
Alyssa Ross 3f01b576af
Merge remote-tracking branch 'nixpkgs/staging-next' into staging
Conflicts:
	nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
	nixos/doc/manual/release-notes/rl-2111.section.md
2021-10-28 16:07:38 +00:00
github-actions[bot] 22401dcc39
Merge master into staging-next 2021-10-27 18:01:02 +00:00
bb010g 29fedf210f canonicalize-jars-hook: add
A build hook to run functions previously only implemented privately in
`pkgs/build-support/release/functions.sh`.
2021-10-27 13:21:27 +03:00
John Ericson e2eccfc521
Merge pull request #141072 from r-burns/validatepkgconfig-cross
[staging] validatePkgConfig: fix cross-compilation
2021-10-23 23:09:42 -04:00
Ryan Burns 9fb1f66d30 validatePkgConfig: fix cross-compilation
Fixes cross-compilation for duktape and pugixml
2021-10-23 15:50:21 -07:00
Tobias Bergkvist 1218b82bce Move assertExecutable from makeCWrapper to makeBinaryWrapper to ensure that makeCWrapper is a pure function 2021-10-19 14:37:05 +02:00
Doron Behar c310cb0d94 makeBinaryWrapper: add wrapProgramBinary (like wrapProgram) 2021-10-19 05:30:42 -07:00
Doron Behar a45c5db391 makeBinaryWrapper: Assert $1 is executable 2021-10-19 05:30:42 -07:00
ash c6b0247067 copyDesktopItems: fix handling of plain paths 2021-10-08 01:36:13 +01:00
sterni 5d0972c63b
Merge pull request #138289 from sternenseemann/fix-non-gnu-strip
stdenv: move --enable-deterministic-archives flag into GNU wrapper
2021-10-07 12:29:59 +02:00
Tobias Bergkvist adef70ce7c Specify uses_prefix, uses_suffix and uses_concat3 as local vars. Make sure errors in makeCWrapper are located next to the line with the issue. 2021-10-04 14:29:22 +02:00
Tobias Bergkvist 3df841bb99 Make error messages more consistent 2021-10-01 18:57:26 +02:00
Tobias Bergkvist d930fecc3c Return an #error macro if the wrong number of arguments are supplied 2021-10-01 18:51:19 +02:00
Tobias Bergkvist b62216a211 Fix shellcheck warnings. Use single quotes for printf format strings. Switch to strncpy in concat3. Use multiline strings to print C functions. Switch from if/elif to case. 2021-10-01 17:43:23 +02:00
Noah Fontes a7f5e8321e
autoPatchelfHook: fix packages that use stdenvNoCC
autoPatchelfHook actually doesn't depend on stdenv and only needs
bintools (with its wrapper). This change uses $NIX_BINTOOLS instead of
$NIX_CC and makes the dependency on bintools explicit.
2021-09-18 21:58:02 -07:00
Noah Fontes 4765a3e153
autoPatchelfHook: improve arch/ABI compatibility
Fully enabling crossSystem support for autoPatchelfHook came with some
perhaps unintended consequences of being a bit more aggressive about
patching ELF files from architectures/ABIs that differ from the target
(previously, those files would be ignored because ldd usually couldn't
handle them).

This change adds architecture and rough OS ABI detection to the script
so that it doesn't try to blindly replace the interpreter of files that
can't possibly use that interpreter, and also makes sure it doesn't
accidentally use libraries of other architectures/ABIs.
2021-09-18 21:57:08 -07:00
sternenseemann 11fe2fc3cf stdenv: move --enable-deterministic-archives flag into GNU wrapper
`--enable-deterministic-archives` is a GNU specific strip flag and
causes other strip implementations (for example LLVM's, see #138013)
to fail. Since strip failures are ignored, this means that stripping
doesn't work at all in certain situation (causing unnecessary
dependencies etc.).

To fix this, no longer pass `--enable-deterministic-archives`
unconditionally, but instead add it in a GNU binutils specific strip
wrapper only.

`commonStripFlags` was only used for this flag, so we can remove
it altogether.

Future work could be to make a generic strip wrapper, with support for
nix-support/strip-flags-{before,after} and NIX_STRIP_FLAGS_{BEFORE,AFTER}.
This possibly overkill and unnecessary though -- also with the
additional challenge of incorporating the darwin strip wrapper somehow.
2021-09-18 15:11:17 +02:00
github-actions[bot] 0f78d9c4b7
Merge staging-next into staging 2021-09-15 00:02:12 +00:00
github-actions[bot] 728f30ca03
Merge master into staging-next 2021-09-15 00:01:33 +00:00
Noah Fontes b79483d2b7
autoPatchelfHook: fix detection under crossSystem
In #84415, autoPatchelfHook was taught to use the correct path to the
readelf binary when a crossSystem is specified. Unfortunately, the
remainder of the functionality in the script depended on ldd, which only
reads ELF files of its own architecture. It has the further unfortunate
quality of not reporting any useful error, but rather that the file is
not a dynamic executable.

This change uses patchelf to directly analyze the DT_NEEDED tags in the
target files instead, which correctly works across architectures. It
also updates the use of objdump to be prefix-aware $OBJDUMP (which would
have been required in the PR mentioned above, but we never made it that
far into the script execution).
2021-09-12 15:07:15 -07:00
Artturi fb2781ff0a
Merge pull request #134881 from OmnipotentEntity/dont-compress-xz
setup-hooks: compress-man-pages.sh: Do not attempt to compress .xz files
2021-09-11 04:03:12 +03:00
Martin Weinelt 7f732aca66 Revert "Merge remote-tracking branch 'origin/python-unstable' into staging-next"
This reverts commit b041b2e1b2, reversing
changes made to 5b6c2380ad.
2021-09-05 15:02:25 +02:00
happysalada 5b86e637d7 move-docs.sh: simplify redundant conditional
remove impossible check for empty variable after it's been set twice
2021-08-30 10:27:45 +09:00
Tobias Bergkvist b58c857bfb Switch to using strlen in concat3Fn. Make sure uses-variables are local to improve purity of makeCWrapper. Refactor 2021-08-26 14:36:30 +02:00
Tobias Bergkvist dcba4171d4 Add support for --add-flags, --prefix and --suffix 2021-08-23 23:44:57 +02:00
Michael Reilly 51f21e91e8 setup-hooks: compress-man-pages.sh: Do not attempt to compress .xz files 2021-08-19 17:13:05 -04:00
Sandro f6b209b891
Merge pull request #132800 from deliciouslytyped/separatedebuginfo-extraneous-local
setup-hooks: separate-debug-info.sh: Remove extraneous local variable…
2021-08-07 11:53:29 +02:00
deliciouslytyped 0e6b107cac setup-hooks: separate-debug-info.sh: Remove extraneous local variable originally used in ec5b66eb 2021-08-05 17:52:27 +02:00
happysalada 0900850680 stdenv: conservative undefined variables 2021-08-03 12:43:34 +09:00
happysalada f3d9711f05 stdenv: add link to clarify 2021-07-19 14:50:01 +09:00
Tobias Bergkvist 1d64281401 Remove line at the bottom of make-binary-wrapper that executes makeBinaryWrapper "$@" 2021-06-01 01:25:22 +02:00
Tobias Bergkvist 8d2964a8e6 Rename make-c-wrapper.sh to make-binary-wrapper.sh. Refactor to match style of other setup-hooks. Add compilation step with gcc. Embed the entire generated source code into the binary for troubleshooting. 2021-06-01 01:02:08 +02:00
Tobias Bergkvist e8cedf3819 make-c-wrapper: Fix typo in generated documentation 2021-05-27 02:04:12 +02:00
Tobias Bergkvist 131ed20b2f make-c-wrapper: Remove trailing whitespace (editorconfig) 2021-05-27 01:56:23 +02:00
Tobias Bergkvist eef4fa82c1 make-c-wrapper: Fix typo in generated code documentation 2021-05-27 01:47:40 +02:00
Tobias Bergkvist de1f53b84d Add make-c-wrapper.sh for creating binary executable wrappers 2021-05-27 01:11:06 +02:00
Andrew Childs c696fcdacb fixDarwinDylibNames: set name of install_name_tool 2021-05-17 00:27:01 +09:00
Andrew Childs ca156a66b7 stdenv/patchShebangs: fix off by one reading old interpreter
This caused shebangs that were already store paths to be rewritten.

Introduced by ab4c359822 in #94642

Example difference:

    $ echo "hello world" | tail -c+3
    llo world

    $ str="hello world"; echo ${str:3}
    lo world
2021-02-09 13:05:38 +09:00
Andrew Childs 2bd3aa4bc2 Revert "Revert "stdenv/patchShebangs: avoid temporary time reference file""
This reverts commit df21fb8afa.
2021-02-09 12:57:21 +09:00
Martin Weinelt df21fb8afa Revert "stdenv/patchShebangs: avoid temporary time reference file"
This reverts commit 6e3f4c9079.

This apparently breaks the x86_64 darwin stdenv. Details in #112417.
2021-02-09 01:33:33 +01:00
Jörg Thalheim 2dcc858efc
Merge pull request #94642 from Mic92/patch-shebangs 2021-02-04 21:20:40 +00:00
Jörg Thalheim 6e3f4c9079
stdenv/patchShebangs: avoid temporary time reference file
less commands -> faster
2021-01-14 20:00:58 +01:00
Jörg Thalheim cb1654ff92
stdenv/patchShebangs: consistent conditional tests
according to shellcheck [[ foo == "bla" ]] && [[ ... ]] has better posix
semantics over [ foo = "bla" -a ... ]. It is also easier to read.
2021-01-14 20:00:57 +01:00
Jörg Thalheim ab4c359822
stdenv/patchShebangs: use builtins where possible
builtins for small input sizes should be faster due to less forking.
2021-01-14 20:00:54 +01:00
Sandro 7ff9b3699d
Merge pull request #108081 from SuperSandro2000/silence-file-format-not-recognized
setup-hooks/strip: silence 'File format not recognized' errors again
2021-01-07 00:49:44 +01:00
Andreas Rammhold c2884c4011
Merge pull request #106954 from r-burns/randomseed
[staging] stdenv: trim random seed to avoid reference cycles
2021-01-02 11:01:34 +01:00
Sandro Jäckel 03ba885fa2
setup-hooks/strip: silence 'File format not recognized' errors again
This got lost in e4d17dc558.
2021-01-02 10:46:27 +01:00
DavHau 2efcf6dc26 autoPatchelf: add comment why ignore failing ldd/sed 2020-12-25 12:13:03 +01:00
DavHau 2fde1e63ba autoPatchelfHook: fix shellcheck errors 2020-12-25 12:13:03 +01:00
DavHau 4ac5d22654 autoPatchelfHook: fix bug introduced by #101142 2020-12-25 12:13:03 +01:00
Ryan Burns 61a6d1aae2 stdenv: trim random seed to avoid reference cycles
Using the full store hash as the random seed occasionally caused
reference cycles when the invocation was stored in output artifacts.
For example, cross-compiled gcc was failing due to this:
https://hydra.nixos.org/eval/1631713#tabs-now-fail

Simply truncating the hash is sufficient to avoid this.
2020-12-23 16:46:39 -08:00
Emery Hemingway e4d17dc558 setup-hooks/strip: more robust stripping
Use "find -exec" to strip rather than "find … | xargs …". The former
ensures that stripping is attempted for each file, whereas the latter
will stop stripping at the first failure. Unstripped files can fool
runtime dependency detection and bloat closure sizes.
2020-12-08 05:35:48 +01:00
Anderson Torres cef4502feb
Merge pull request #105818 from raboof/symlink-compressed-manpages-deterministically
compress-man-pages: symlink compressed manpages deterministically
2020-12-07 23:37:35 -03:00
Arnout Engelen 777cb35eb8
compress-man-pages: symlink compressed manpages deterministically
For example graphviz has chained symlinked manpages: dot2gxl.1 is
a symlink to gv2gxl.1 which is a symlink to gxl2gv.1

The second loop replaces each non-compressed symlink to a compressed
symlink. The target is determined with 'readlink -f', which follows
links recursively until the first name that is not a link (so either
the 'target name' or the first 'dangling' symlink).

This means that if the loop converted dot2gxl.1 before converting
gv2gxl.1 it would add a symlink `dot2gxl.1.gz->gxl2gv.1.gz`. When
it converted gv2gxl.1 first, it would then add a
`dot2gxl.1.gz->gv2gxl.1.gz` symlink.

Both are 'correct', but it's weird the result depends on the order
in which 'find' returns the files. This PR makes the behaviour
deterministic.

fixes #104708
2020-12-04 09:24:37 +01:00
Frederik Rietdijk c7843cf6a2
Merge pull request #101142 from DavHau/improve-autopatchelf
autoPatchelfHook: optimize performance; better error handling
2020-12-03 12:34:05 +01:00
Frederik Rietdijk 05d1c49209 Merge staging-next into staging 2020-11-29 13:51:33 +01:00
Frederik Rietdijk 0d8491cb2b Merge master into staging-next 2020-11-29 13:51:10 +01:00
Fabian Möller 50f54c5ca7 copyDesktopItems: add new setup-hook 2020-11-29 04:03:38 +01:00
Jan Tojnar 136152af80
Merge pull request #101537 from jtojnar/gtk-tracker 2020-11-28 01:37:37 +01:00
Jan Tojnar acfc45bacc
wrapGAppsNoGuiHook: init 2020-11-26 14:06:07 +01:00
DavHau 05fa0f1a2e improve things shellcheck complains about 2020-11-07 18:08:48 +07:00
Andreas Rammhold 83f0bccc89 stdenv: add -frandom-seed to NIX_CFLAGS_COMPILE for reproducibility
This adds -frandom-seed to each compiler invocation in stdenv. The
object here is to make the compierl invocations produce the same output
every time they are called (for the same derivation). When the
-frandom-seed option is not set the compiler will use a combination of
random numbers (in GCC's case from /dev/urandom) and the durrent time to
produce a "random" input per file. This can (among other things) lead to
different ordering of symbols in the produced object files.

For reason of reproducibility we prefer having the same derivation
produce the exact same outputs. This is not a silver bullet but one way
to tame the compiler.
2020-11-01 19:40:12 +01:00
DavHau 112f275f4d
autoPatchelfHook: fix typos in comments 2020-10-26 17:17:07 +07:00
Vladimír Čunát 89023c38fc
Recover the complicated situation after my bad merge
I made a mistake merge.  Reverting it in c778945806 undid the state
on master, but now I realize it crippled the git merge mechanism.
As the merge contained a mix of commits from `master..staging-next`
and other commits from `staging-next..staging`, it got the
`staging-next` branch into a state that was difficult to recover.

I reconstructed the "desired" state of staging-next tree by:
 - checking out the last commit of the problematic range: 4effe769e2
 - `git rebase -i --preserve-merges a8a018ddc0` - dropping the mistaken
   merge commit and its revert from that range (while keeping
   reapplication from 4effe769e2)
 - merging the last unaffected staging-next commit (803ca85c20)
 - fortunately no other commits have been pushed to staging-next yet
 - applying a diff on staging-next to get it into that state
2020-10-26 09:01:04 +01:00
Vladimír Čunát 336bc8283b
Re-Revert "Merge #101508: libraw: 0.20.0 -> 0.20.2"
This reverts commit c778945806.

I believe this is exactly what brings the staging branch into
the right shape after the last merge from master (through staging-next);
otherwise part of staging changes would be lost
(due to being already reachable from master but reverted).
2020-10-26 08:19:17 +01:00
Vladimír Čunát c778945806
Revert "Merge #101508: libraw: 0.20.0 -> 0.20.2"
I'm sorry; I didn't notice it contained staging commits.

This reverts commit 17f5305b6c, reversing
changes made to a8a018ddc0.
2020-10-25 09:41:51 +01:00
DavHau b9d2541a37
autoPatchelfHook: store dependant for dependency 2020-10-23 13:21:08 +07:00
DavHau f833f0406f
autoPatchelfHook: print dependant for missing deps 2020-10-23 13:16:23 +07:00
DavHau 11a08bcfad
Apply suggestions from code review
Co-authored-by: symphorien <symphorien@users.noreply.github.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2020-10-22 10:15:42 +07:00
Frederik Rietdijk 23890fc236 Merge staging-next into staging 2020-10-20 20:55:46 +02:00
DavHau 5c382b7f0e autoPatchelfHook: optimize performance, better error handling 2020-10-20 19:09:32 +07:00
Daniël de Kok 48a20e9337 validatePkgConfig: fix variable scope
validatePkgConfig failed due to a wrong variable scope, as reported in
issue #100834. This change corrects the variable scoping.
2020-10-18 14:00:05 +02:00
Lily Ballard 866a7de409 Fix doc comment for installManPage 2020-10-08 15:08:40 -07:00
Lily Ballard 7e1e8543fc installShellFiles: Enhance installShellCompletion
Teach installShellCompletion how to install completions from a named
pipe. Also add a convenience flag `--cmd NAME` that synthesizes the name
for each completion instead of requiring repeated `--name` flags.

Usage looks something like

    installShellCompletion --cmd foobar \
      --bash <($out/bin/foobar --bash-completion) \
      --fish <($out/bin/foobar --fish-completion) \
      --zsh <($out/bin/foobar --zsh-completion)

Fixes #83284
2020-10-08 15:08:40 -07:00
Robert Helgesson fbc5093649
hooks: add moveSystemdUserUnitsHook
This hook moves systemd user service file from `lib/systemd/user` to
`share/systemd/user`. This is to allow systemd to find the user
services when installed into a user profile. The `lib/systemd/user`
path does not work since `lib` is not in `XDG_DATA_DIRS`.
2020-09-12 18:29:46 +02:00
Jan Tojnar 0be3b18d3e
wrapGAppsHook: add comments 2020-07-24 00:36:12 +02:00
Jan Tojnar 49b89afcc2
wrapGAppsHook: add tests 2020-07-24 00:36:04 +02:00
Jan Tojnar 69b89979ba
wrapGAppsHook: move to a separate file 2020-07-23 22:08:18 +02:00
Alyssa Ross 1421404d42 stdenv: fix backward multiple outputs conditional
This is supposed to shareDocName to a fallback value if it can't be
determined from looking at the configure script.  But the conditional
checked whether shareDocName was set, rather than if it wasn't.  This
meant that if shareDocName had been detected from a configure script,
it would be immediately overridden by the package name, and if it
couldn't be detected, shareDocName would remain unset.

This resulted in QEMU installing files like $out/share/doc/index.html,
which should of course have been in $out/share/doc/qemu/index.html.

An interesting side effect of this is that, since
9f8751528c when this code was added, the
detected package name has never actually been used for installing
documentation, because it would always be overridden.  So this patch
will actually enable that for the first time, four years later.

Fixes: https://github.com/NixOS/nixpkgs/issues/90486
2020-06-29 13:56:27 +00:00
DavHau c8c09b7dda add autoPatchelfIgnoreMissingDeps to auto-patchelf.sh 2020-06-22 10:41:35 +02:00
Frederik Rietdijk 08900c0554 Merge master into staging-next 2020-06-04 15:25:54 +02:00
Daniël de Kok 13083b1a01 validatePkgConfig: init
This adds the `validatePkgConfig` hook, which can be used to validate
pkg-config files in the output(s). Currently, this will just run
`pkg-config --validate` on all `.pc` files, capturing errors such as
the issue that was fixed in #87789.

The hook could be extended in the future with more fine-grained
checks.
2020-05-31 20:45:03 +02:00
John Ericson 1ac5398589 *-wrapper; Switch from infixSalt to suffixSalt
I hate the thing too even though I made it, and rather just get rid of
it. But we can't do that yet. In the meantime, this brings us more
inline with autoconf and will make it slightly easier for me to write a
pkg-config wrapper, which we need.
2020-05-12 00:44:44 -04:00
John Ericson 33c2a76c5e Merge remote-tracking branch 'upstream/master' into staging 2020-04-17 18:40:51 -04:00
Matthew Bauer d83e9c9573 setup-hooks/audit-blas.sh: init
Add a simple hook that makes sure blas and lapack are linked to the
right place.
2020-04-17 16:24:25 -05:00
Matthew Bauer 433d5178ca setup-hooks/auto-patchelf.sh: get prefixed readelf 2020-04-06 16:36:29 -04:00
Bryan Gardiner bc21c247fc
patch-shebangs.sh: Fix error messages to go to stderr, not '0' file. 2020-03-20 17:08:10 -07:00