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
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
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
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
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
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