Commit graph

484 commits

Author SHA1 Message Date
Yarny0 818d0f8cf1 auto-patchelf: don't resolve symlinks if basenames don't match
The auto-patchelf python script assembles a list of
library (so=shared object) file names and their paths.
This helps speed up the discovery of
library files later when patching elf files.
As further optimization, if a symlink points to a library file,
the script uses the resolved path and file name.
However, this produces a broken list entry if the
symlink's target name doesn't match the symlink's name.

A symptom of the bug, affecting the `tsm-client` package,
is fixed in https://github.com/NixOS/nixpkgs/pull/172372 .

The commit at hand stops resolving symlinks if
the target name differs from the symlink's name.
The commit has been authored by
layus (Guillaume Maudoux <layus.on@gmail.com>)
in pull request comment

https://github.com/NixOS/nixpkgs/pull/172372#issuecomment-1194687183
2023-01-15 10:57:22 +01:00
Artturin 033ec05960 setup-hooks/strip.sh: redirect stdout to dev/null
to not unnecessarily print

```
hello> ++ type -f strip
hello> strip is /nix/store/xzqzq99kbbkad23s2bf4bbrjppg6x0vj-bootstrap-stage2-gcc-wrapper-/bin/strip
```

printing what the strip command is is already done in stripDirs

`echo "stripping (with command $cmd and flags $stripFlags) in $paths"`
2023-01-08 21:02:22 +02:00
Artturin ba11c6f123 setup-hooks/make-symlinks-relative.sh: match what other hooks do so
the hook doesn't output the following if $prefix doesn't exist

find: '/nix/store/...': No such file or directory

some other hooks that do this: prune-libtool-files.sh, audit-tmpdir.sh separate-debug-info.sh
2023-01-06 18:56:54 +02:00
Artturin 3b3ef7b766 audit-tmpdir.sh: fix on darwin
compress-man-pages.sh uses `find ... | while ...; do...` so this works
on darwin

vcunat says the following in https://github.com/NixOS/nixpkgs/commit/94d164dd7#r22030369

> Unfortunately, process substitution doesn't work during early darwin bootstrap. http://hydra.nixos.org/build/52433342 We've run into that before.
> I think it should work to have `find ... | while ...; do...`
2022-12-13 00:57:35 +02:00
Artturin af70ba03d3 build-support/setup-hooks: change shebang to shellcheck directive 2022-12-13 00:24:33 +02:00
Artturin daab80e08d move-docs.sh: update comment
_multioutDocs is in multiple-outputs.sh
2022-12-12 21:39:56 +02:00
Robert Hensing 16f5747575
Merge pull request #175649 from Artturin/opt-in-structured-attrs
stdenv: support opt-in __structuredAttrs
2022-12-10 21:12:43 +01:00
Artturin 238a6053c4 stdenv: support opt-in __structuredAttrs
Co-authored-by: Robin Gloster <mail@glob.in>

stdenv: print message if structuredAttrs is enabled

stdenv: add _append

reduces the chance of a user doing it wrong

fix nix develop issue

output hooks don't work yet in nix develop though

making $outputs be the same on non-structuredAttrs and structuredAttrs
is too much trouble.

lets instead make a function that gets the output names

reading environment file '/nix/store/2x7m69a2sm2kh0r6v0q5s9z1dh41m4xf-xz-5.2.5-env-bin'
nix: src/nix/develop.cc:299: std::string Common::makeRcScript(nix::ref<nix::Store>, const BuildEnvironment&, const Path&): Assertion `outputs != buildEnvironment.vars.end()' failed.

use a function to get all output names instead of using $outputs

copy env functionality from https://github.com/NixOS/nixpkgs/pull/76732/commits
2022-12-08 06:13:19 +02:00
Artturin 6c01681679 make-symlinks-relative: fix no such file or directory if output is created in postFixup
wlroots(and others) have
```
wlroots> +++ find /nix/store/3a0xwszw8n5dzzhsgfnilvsqi4hk565s-wlroots-0.15.1-examples -type l -print0
wlroots> find: '/nix/store/3a0xwszw8n5dzzhsgfnilvsqi4hk565s-wlroots-0.15.1-examples': No such file or directory
```

because the examples output is created in postFixup while this hook runs in fixupPhase
2022-12-06 00:08:11 +02:00
Sergei Trofimovich 1238d0ed39
Merge pull request #182055 from wentasah/moveToOutput-comment-fix
multiple-output.sh: fix moveToOutput comment
2022-11-18 22:40:50 +00:00
Shamrock Lee 6386d79326 patchRcPath hooks: use the passthru argument 2022-11-10 09:27:40 +08:00
Shamrock Lee da31bd5673 patchRcPathBash, patchRcPathCsh, patchRcPathFish, patchRcPathPosix: init
Init patchRcPath hooks, which provides
utilities to patch shell scripts to be sourced by users.

Add test cases and documentation.
2022-11-10 09:23:52 +08:00
Yarny0 335a9083b0 patchPpdFilesHook: new setup hook for absolute executable paths
PostScript Printer Description (ppd) files
describe printer features and capabilities.
They are usually evaluated by CUPS to convert
print jobs into a format suitable for a printer.
The conversion is often accomplished by commands
or even short shell scripts inside the ppd files.

ppd files are included in many printer driver packages.
Their scripts sometimes refer to other executables;
some of them are more common (like `perl`),
others are more exotic (like `rastertohp`).
If an executable is called with its name alone,
the effects of the ppd file depend on whether
the executable is in the PATH of CUPS,
and on the executable's version.
If an executable is called with an absolut path
(like `/usr/bin/perl`), it won't work at all in NixOS.

The commit at hand adds a setup hook that uses
the `fixupPhase` to substitute certain executable's
invocations in pdd files with absolute paths.
To use it, add the hook to `nativeBuildInputs` and
provide a list of executable names in `ppdFileCommands`.
Each executable must be available in the
package that is being built, or in `buildInputs`.
The setup hook's script then looks for ppd files in
`share/cups/model` and `share/ppds` in each output,
and replaces executable names with their absolute paths.
If ppd files need to be patched in unorthodox locations or
the setup hook needs to be invoked manually for other reasons,
one may leave the list `ppdFileCommands` empty to
avoid automatic processing of ppd files, then call
the shell function `patchPpdFileCommands` directly.
Details are described in the file `patch-ppd-hook.sh`.

Notes on the motivation for this setup hook:

Most packages in nixpkgs that provide
ppd files do not patch those ppd files at all.
This is not fatal when the executables are just called
with their names since the user can add packages
with the executables to `services.printing.drivers`.
E.g. if the user adds `pkgs.perl`, then all ppd
files that invoke `perl` will work as expected.
Nevertheless, to make these ppd files independent of
their execution environment, command invocations should
be substituted with absolut paths into the nix store.
This is similar to patching shebang lines so scripts can be
called independently of having the interpreter in the PATH.

The hook script in this commit is meant to support new packages
`foomatic-db*` which will generate several thousands of
ppd files referencing a plethora of different executables.
During development of these packages, I realized that
it's quite hard to patch ppd files in a robust way.
While binary names like `rastertokpsl` seem to be sufficiently
unique to be patched with `sed`, names like `date` or `gs`
are hard to patch without producing "false positives",
i.e., coincidental occurences of the executable's name that do
*not* refer to the executable and should not be patched at all.
As this problem also affects other packages,
it seems reasonable to put a robust implementation
in its own setup hook so that other
packages can use it without much effort.

Notes on the implementation:

The ppd file format is far from trivial.
The basic structure are key-value pairs;
keys may occur multiple times.
Only a small subset of keys may contain
executable names or shell scripts in their values.
Some values may span multiple lines;
a linebreak might even occur in the middle of a token.
Some executable names also occur in other keys by accident
where they must not be substituted (e.g. `gs` or `date`).

It is necessary to provide the list of command
names that will be patched for two reasons:
ppd files often contain "tokens" that might look
like commands (e.g. "file" or "host") but aren't;
these would erroneously get patched.
Also, looking for everything that might be a command
would slow down the patching process considerably.

The implementation uses `awk` to detect
keys that might contain executable names;
only their values are treated for substitution.
This avoids most cases of "overzealous" substitutions.
Since values may span multiple lines,
`sed` alone (while faster than `awk`) cannot focus
its substitution capabilities on relevant keys.
An elaborate set of regular expressions further helps
to minimize the probability of "false positives".
Several tricks are employed to speed up `awk`.
Notably, relevant files are identified with
`grep` before `awk` is applied to those files only.
Note that the script probably cannot handle fancy command
names (like spaces or backslashes as part of the name).
Also, there are still edge cases that the script would
mistakenly skip, e.g. if a shell script contains a
line break in the middle of an executable's name;
although ppd files permit such constellations,
I have yet to see one.

ppd files may be gzipped.
The setup hook accepts gzipped ppd files:
It decompresses them, substitutes paths, then recompresses them.
However, Nix cannot detect substituted paths as
runtime dependencies in compressed ppd files.
To ensure substituted paths are propagated as
runtime dependencies, the script adds each substituted
path to the variable `propagatedBuildInputs`.
Since this might not be enough for multi-output packages,
those paths are also written directly to
`nix-support/propagated-build-inputs`.
See the comment in `patch-ppd-hook.sh` for details.

Finally, the setup hook comes with a small test that
probes some edge cases with an artificial ppd file.

References:

* https://www.cups.org/doc/spec-ppd.html
  * general ppd file specification
  * lists some keys that may contain
    executable names or shell scripts

* https://refspecs.linuxfoundation.org/LSB_4.0.0/LSB-Printing/LSB-Printing/ppdext.html
  * lists some keys that may contain
    executable names or shell scripts

* https://en.wikipedia.org/wiki/PostScript_Printer_Description#CUPS
  * lists the usual locations of ppd files
2022-11-06 16:19:22 +01:00
adisbladis 01535ff0b0 autoPatchelfHook: support glob patterns
so for example cuda could be ignored by setting:
``` nix
autoPatchelfIgnoreMissingDeps = [ "*cuda*.so*" ];
```
2022-10-10 17:55:11 +13:00
adisbladis 41c09640e7 autoPatchelfHook: fix turning [ "*" ] into bash array
Previously globs were incorrectly handled and expanded by bash into the files in the temporary build directory.
2022-10-10 17:55:11 +13:00
Robert Hensing 8deb17a36e
Merge pull request #186323 from ShamrockLee/make-setuphook-passthru
trivial-builders.nix: Add input argument `passthru` to makeSetupHook
2022-09-19 11:30:37 +01:00
Robert Hensing c078d552fe wrapGAppsHook: Set name
The previous commit, removing substitutions, causes a mass rebuild,
so we use the opportunity to set the name; also a mass rebuild.
2022-08-13 11:53:06 +02:00
Robert Hensing 4dc28e0057 setup hooks: substitutions.passthru -> passthru 2022-08-13 10:29:10 +02:00
Shamrock Lee ba895a7da8 trivial-builders.nix: Add input argument passthru to makeSetupHook
One significant use case is adding `passthru.tests` to setup-hooks,
and help increase test coverage for mission-critical setup-hooks.

As `meta`, `passthru` doesn't go into the build script directly.
However, passing an empty set to `passthru` breaks nixpkgs-review
and OfBorg tests, so pass it only when specified.
2022-08-13 04:20:12 +08:00
Sergei Trofimovich b3b672d5a1 setup-hooks/separate-debug-info.sh: don't inhibit strip hook
Before the change separate-debug-info.sh did the stripping itself.
This scheme has a few problems:
1. Stripping happens only on ELF files. *.a and *.o files are skipped.
   Derivations have to do it manually. Usually incorrectly
   as they don't run $RANLIB (true for `glibc` and `musl`).
2. Stripping happens on all paths. Ideally only `stripDebugList` paths
   should be considered.
3. Host strip is called on Target files.

This change offloads stripping logic to strip hook. This strips more
files for `glibc` and `musl`. Now we can remove most $STRIP calls
from individual derivations.

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2022-08-07 12:49:37 +01:00
Sergei Trofimovich c817efe660 gcc: extend stripping of .a libraries and .o objects
The initial intent was to strip .a and .o files, not .a.o files.
While at it expanded stripping for $lib output as well.

Without the change `libgcc.a` was not stripped and `.debug*` sections
made into final binaries. It's not a problem on it's own, but it's an
unintended side-effect. Noticed on `crystal_1_0` test failure where
`crystal` was not able to handle `dwarf-5`.

While at it allowed absolute file names to be passed to stripDebugList
and friends.
2022-08-03 22:28:47 +01:00
Bernardo Meurer 88c63ca65a
Merge pull request #182513 from trofi/strip-for-host-and-target
gcc: enable stripping for cross-compilers
2022-07-28 00:30:49 -07:00
Sergei Trofimovich 0507725061 setup-hooks/strip.sh: run RANLIB on static archives after stripping
'strip' does not normally preserve archive index in .a files.
This usually causes linking failures against static libs like:

    $ nix build --no-link -f. pkgsCross.mingw32.re2c
    > ...-i686-w64-mingw32-binutils-2.38/bin/i686-w64-mingw32-ld:
      /nix/store/...-i686-w64-mingw32-stage-final-gcc-13.0.0-lib/i686-w64-mingw32/lib/libstdc++.dll.a:
        error adding symbols: archive has no index; run ranlib to add one

We restore the index by running ranlib explicitly.
2022-07-25 11:06:58 +01:00
Sergei Trofimovich 0f45ce6e77 setup-hooks/strip.sh: add strip{All,Debug}ListTarget variables
This change mimics existing strip{All,Debug}List variables to
allow special stripping directories just for Target.

The primary use case in mind is gcc where package has to install
both host and target ELFs. They have to be stripped by their own
strip tools accordingly.

Co-authored-by: Rick van Schijndel <Mindavi@users.noreply.github.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2022-07-25 11:06:45 +01:00
Sergei Trofimovich 17f413f293 setup-hooks/strip.sh: use STRIP_FOR_TARGET, not TARGET_STRIP
Since 1ac53985 "*-wrapper; Switch from `infixSalt` to `suffixSalt`"
(2020) 'TARGET_' prefix (and infix) is no more. '_FOR_TARGET' suffix
is the only used suffix for target-specific tools and flags.

Use that in stip instead of always-empty variable.
2022-07-22 18:38:02 +01:00
John Ericson c38de9b3f2
Merge pull request #181525 from alyssais/rust-debug
separateDebugInfo: enable full Rust debug info
2022-07-21 13:09:19 -04:00
Artturin 7249b8a2f3 makePkgconfigItem: init new function to generate pc files
A function to generate pkg-config files for Nix packages that need to create them ad hoc,
like blas and lapack.

Inspiration taken from `makeDesktopItem`.
2022-07-20 06:22:39 +03:00
Michal Sojka ae45c235fa multiple-output.sh: fix moveToOutput comment
The comment suggested that "{foo,bar}" is a supported pattern, which
is not true. "{foo,bar}" is only understood by brace expansion but the
code performs only globbing. We replace the comment with "[abc]",
which is a correct example of globbing.
2022-07-19 08:23:35 +02:00
Alyssa Ross d7fff81159
separateDebugInfo: enable full Rust debug info
By default, Cargo will only enable line tables.  -g enables full debug
info.  The RUSTFLAGS environment variable is examined by Cargo,
similar to how the NIX_*FLAGS* variables are examined by our compiler
wrappers.
2022-07-14 21:44:12 +00:00
Thiago Kenji Okada 299538e834
Merge pull request #172769 from ncfavier/wrappers-append-args
makeWrapper,makeBinaryWrapper: implement `--append-flags`
2022-06-12 11:46:03 +01:00
Naïm Favier eef2c762ce
makeBinaryWrapper: fix cross-compilation and add test
Fixes https://github.com/NixOS/nixpkgs/issues/175045
2022-05-31 13:55:41 +02:00
Naïm Favier 1c70b694fe
makeWrapper,makeBinaryWrapper: implement --append-flags 2022-05-30 23:07:58 +02:00
Naïm Favier 1cc6f08cdd
makeBinaryWrapper: fix codesign on aarch64-darwin
Reverts 8b79ef2c on aarch64-darwin, no-op on other platforms.
2022-05-22 21:46:06 +02:00
Naïm Favier 3e385d9a82
makeBinaryWrapper: add comment 2022-05-12 15:23:38 +02:00
Naïm Favier 88369997e1
makeBinaryWrapper: add extractCmd
A small shell script that can be used to extract a binary wrapper's
makeCWrapper call from its embedded docstring, without depending on
makeBinaryWrapper.
2022-05-12 01:44:02 +02:00
Naïm Favier 2ae69114a1
makeWrapper: implement --inherit-argv0
For symmetry/interoperability with makeBinaryWrapper. Implemented as
--argv0 '$0'
2022-05-10 22:07:57 +02:00
Naïm Favier 8b79ef2cb6
makeBinaryWrapper: remove cc from deps
Fixes https://github.com/NixOS/nixpkgs/issues/172249
2022-05-10 22:07:57 +02:00
Naïm Favier 81b9c712ce
wrapGAppsHook: rename argument to makeWrapper
...and pass it makeBinaryWrapper in all-packages.nix
2022-05-10 22:07:56 +02:00
Naïm Favier 62245943aa
makeWrapper,makeBinaryWrapper: introduce explicitly named functions
Because both versions might end up in a derivation's build inputs, it
might be useful to be able to explicitly select which function to use.
2022-05-10 22:07:56 +02:00
Naïm Favier 0d6bcb513b
makeBinaryWrapper: move into its own folder
The derivation is complex enough to warrant moving out of
all-packages.nix
2022-05-10 22:07:56 +02:00
Naïm Favier d4aa650608
makeBinaryWrapper: really unset NIX_CFLAGS
f8cc8ff575
fails to unset the variables in the environment due to a Bash quirk,
so set them to the empty string instead.
2022-05-06 17:03:52 +02:00
Naïm Favier 42a4c05dd0
makeBinaryWrapper: add -Wno-overlength-strings
The generated C code contains large string literals that are longer than
the maximum length specified by the standard.

However, GCC has no trouble dealing with those strings, so we can just
add -Wno-overlength-strings.

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Woverlength-strings
2022-05-06 16:12:57 +02:00
Naïm Favier f8cc8ff575
makeBinaryWrapper: unset NIX_CFLAGS
Prevent the wrapper from being affected by the derivation's CFLAGS,
which may not even apply to GCC.
2022-04-26 12:14:39 +02:00
Naïm Favier 532ebf6b57
wrapGAppsHook: use makeBinaryWrapper
Reduces the likelihood of having apps wrapped twice by a shell script,
which causes problems with argv0.
2022-04-26 12:14:39 +02:00
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
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