Skip to content

Commit 59a3afb

Browse files
committed
Update fixup-nix-deps
1 parent b040899 commit 59a3afb

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

.github/workflows/build-and-test.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ jobs:
111111
# see https://github.com/actions/upload-artifact#permission-loss
112112
# windows doesn't care \o/
113113
- name: Restore Executable Permission
114-
if: ${{ inputs.target-platform != '-windows' }}
114+
# Disable for windows cross and dynamic macOS builds (fail due to missing libgmp dylib)
115+
if: ${{ inputs.target-platform != '-windows' && (inputs.target-platform != '' || (inputs.platform != 'x86_64-darwin' && inputs.platform != 'aarch64-darwin')}}
115116
run: chmod +x ./hello
116117

117118
- name: Run hello executable

.github/workflows/hello.yml

-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ jobs:
3737
# Just cross compiling javascript with ghc 9.6 and above
3838
- compiler-nix-name: ghc810
3939
target-platform: "-js"
40-
# Static builds not working for darwin yet
41-
- platform: x86_64-darwin
42-
target-platform: "-static"
43-
# Static tools not working right now (so just building "-static-minimal" for now)
44-
- target-platform: "-static"
45-
minimal: false
4640
# Windows cross compilation only works on x86_64 right now.
4741
- platform: aarch64-darwin
4842
target-platform: "-windows"

dynamic.nix

+12-10
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@ let tool-version-map = (import ./tool-map.nix) self;
2121
# a shared file. It will also not work for anything that has more than
2222
# the system libs linked.
2323
fixup-nix-deps = pkgs.writeShellApplication {
24-
name = "fixup-nix-deps";
25-
text = ''
24+
name = "fixup-nix-deps";
25+
text = ''
2626
for nixlib in $(otool -L "$1" |awk '/nix\/store/{ print $1 }'); do
27-
case "$nixlib" in
28-
*libiconv.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.dylib "$1" ;;
29-
*libffi.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libffi.dylib "$1" ;;
30-
*libz.dylib) install_name_tool -change "$nixlib" /usr/lib/libz.dylib "$1" ;;
27+
case "$nixlib" in
28+
*libiconv.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.dylib "$1" ;;
29+
*libiconv.2.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.2.dylib "$1" ;;
30+
*libffi.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libffi.dylib "$1" ;;
31+
*libc++.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libc++.dylib "$1" ;;
32+
*libz.dylib) install_name_tool -change "$nixlib" /usr/lib/libz.dylib "$1" ;;
33+
*libresolv.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libresolv.dylib "$1" ;;
3134
*) ;;
32-
esac
35+
esac
3336
done
34-
'';
35-
};
37+
'';
3638

3739
# this wrapped-cabal is for now the identity, but it's the same logic we
3840
# have in the static configuration, and we may imagine needing to inject
@@ -126,8 +128,8 @@ pkgs.mkShell {
126128
++ optionals withIOGFull (
127129
[ postgresql ] ++ (optional stdenv.hostPlatform.isAarch64 R)
128130
)
129-
++ attrValues haskell-tools
130131
)
132+
++ attrValues haskell-tools
131133
++ optionals withGHCTooling (
132134
with pkgs; [ python3 automake autoconf alex happy git libffi.dev ]
133135
)

static.nix

+11-9
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@ let tool-version-map = (import ./tool-map.nix) self;
1414
# fixup-nix-deps allows us to drop dylibs from macOS executables that can be
1515
# linked directly.
1616
fixup-nix-deps = pkgs.writeShellApplication {
17-
name = "fixup-nix-deps";
18-
text = ''
17+
name = "fixup-nix-deps";
18+
text = ''
1919
for nixlib in $(otool -L "$1" |awk '/nix\/store/{ print $1 }'); do
20-
case "$nixlib" in
21-
*libiconv.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.dylib "$1" ;;
22-
*libffi.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libffi.dylib "$1" ;;
23-
*libc++.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libc++.dylib "$1" ;;
24-
*libz.dylib) install_name_tool -change "$nixlib" /usr/lib/libz.dylib "$1" ;;
20+
case "$nixlib" in
21+
*libiconv.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.dylib "$1" ;;
22+
*libiconv.2.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.2.dylib "$1" ;;
23+
*libffi.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libffi.dylib "$1" ;;
24+
*libc++.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libc++.dylib "$1" ;;
25+
*libz.dylib) install_name_tool -change "$nixlib" /usr/lib/libz.dylib "$1" ;;
26+
*libresolv.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libresolv.dylib "$1" ;;
2527
*) ;;
26-
esac
28+
esac
2729
done
28-
'';
30+
'';
2931
};
3032
# A cabal-install wrapper that sets the appropriate static flags
3133
wrapped-cabal = pkgs.writeShellApplication {

0 commit comments

Comments
 (0)