Commit graph

390 commits

Author SHA1 Message Date
Lassulus 1468e8f52d
Merge pull request #165111 from toonn/darwin-bundle-outputBin
make-darwin-bundle: Use output bin
2022-04-22 12:04:09 +01:00
Domen Kožar 36bbcc2a4a
Merge pull request #165112 from toonn/darwin-bundle-Exec-field-codes
desktopToDarwinBundle: Patch Exec field codes
2022-04-20 12:24:01 +01:00
Robert Hensing 33cf95ef36
Merge pull request #168932 from hercules-ci/init-postgresqlTestHook
`postgresqlTestHook`: init
2022-04-18 11:58:34 +02:00
Robert Hensing e77e09c5d2 postgresqlTestHook: init 2022-04-16 17:17:46 +02:00
Martin Weinelt 2bd8fc9378 Merge remote-tracking branch 'origin/master' into staging-next 2022-04-16 00:52:15 +02:00
Lin Yinfeng bedc267a78
autoPatchelfHook: fix precise dependency ignorance
This commit fixes precise dependency ignorance by converting the
environment variable `autoPatchelfIgnoreMissingDeps` into a bash array
`ignoreMissingDepsArray`, passing `"${ignoreMissingDepsArray[@]}"`
instead of `"${autoPatchelfIgnoreMissingDeps[@]}"` to the python
script.

The original implementation does not work when
`autoPatchelfIgnoreMissingDeps` contains multiple dependency names.
Because it mistakenly passes `"${autoPatchelfIgnoreMissingDeps[@]}"`
to the python script. According to the Nix manual
(https://nixos.org/manual/nix/stable/expressions/derivations.html),
lists of strings are concatenated into whitespace-separated strings,
then passed to the builder as environment variables. So, if
`autoPatchelfIgnoreMissingDeps = [ "dep1" "dep2" "dep3" ]`,
`"${autoPatchelfIgnoreMissingDeps[@]}"` will be expanded to a single
argument `"dep1 dep2 dep3"`, which is not the intended behavior,
because the python script takes the long argument as a dependency
name.

With this commit, `"${ignoreMissingDepsArray[@]}"` will be expanded to
three arguments `"dep1" "dep2" "dep3"` arguments as expected, fixing
the issue.
2022-04-15 10:35:11 +08:00
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