Skip to content

Update fixup-nix-deps #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/aarch64-linux.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: DevX closures for aarch64-linux

on:
push:
# Disabled until we have a new aarch64-linux hydra builder
# push:

jobs:
build:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ jobs:
# see https://github.com/actions/upload-artifact#permission-loss
# windows doesn't care \o/
- name: Restore Executable Permission
if: ${{ inputs.target-platform != '-windows' }}
# Disable for windows cross and dynamic macOS builds (fail due to missing libgmp dylib)
if: ${{ inputs.target-platform != '-windows' && (inputs.target-platform != '' || (inputs.platform != 'x86_64-darwin' && inputs.platform != 'aarch64-darwin')}}
run: chmod +x ./hello

- name: Run hello executable
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/hello.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ jobs:
# Just cross compiling javascript with ghc 9.6 and above
- compiler-nix-name: ghc810
target-platform: "-js"
# Static builds not working for darwin yet
- platform: x86_64-darwin
target-platform: "-static"
# Static tools not working right now (so just building "-static-minimal" for now)
- target-platform: "-static"
minimal: false
# Windows cross compilation only works on x86_64 right now.
- platform: aarch64-darwin
target-platform: "-windows"
Expand Down
22 changes: 12 additions & 10 deletions dynamic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@ let tool-version-map = (import ./tool-map.nix) self;
# a shared file. It will also not work for anything that has more than
# the system libs linked.
fixup-nix-deps = pkgs.writeShellApplication {
name = "fixup-nix-deps";
text = ''
name = "fixup-nix-deps";
text = ''
for nixlib in $(otool -L "$1" |awk '/nix\/store/{ print $1 }'); do
case "$nixlib" in
*libiconv.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.dylib "$1" ;;
*libffi.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libffi.dylib "$1" ;;
*libz.dylib) install_name_tool -change "$nixlib" /usr/lib/libz.dylib "$1" ;;
case "$nixlib" in
*libiconv.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.dylib "$1" ;;
*libiconv.2.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.2.dylib "$1" ;;
*libffi.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libffi.dylib "$1" ;;
*libc++.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libc++.dylib "$1" ;;
*libz.dylib) install_name_tool -change "$nixlib" /usr/lib/libz.dylib "$1" ;;
*libresolv.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libresolv.dylib "$1" ;;
*) ;;
esac
esac
done
'';
'';
};

# this wrapped-cabal is for now the identity, but it's the same logic we
# have in the static configuration, and we may imagine needing to inject
# some flags into cabal (temporarily), hence we'll keep this functionality
Expand Down Expand Up @@ -126,8 +128,8 @@ pkgs.mkShell {
++ optionals withIOGFull (
[ postgresql ] ++ (optional stdenv.hostPlatform.isAarch64 R)
)
++ attrValues haskell-tools
)
++ attrValues haskell-tools
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was moved inside isIOG in #175. I am pretty sure it was unintentional.

++ optionals withGHCTooling (
with pkgs; [ python3 automake autoconf alex happy git libffi.dev ]
)
Expand Down
20 changes: 11 additions & 9 deletions static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ let tool-version-map = (import ./tool-map.nix) self;
# fixup-nix-deps allows us to drop dylibs from macOS executables that can be
# linked directly.
fixup-nix-deps = pkgs.writeShellApplication {
name = "fixup-nix-deps";
text = ''
name = "fixup-nix-deps";
text = ''
for nixlib in $(otool -L "$1" |awk '/nix\/store/{ print $1 }'); do
case "$nixlib" in
*libiconv.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.dylib "$1" ;;
*libffi.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libffi.dylib "$1" ;;
*libc++.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libc++.dylib "$1" ;;
*libz.dylib) install_name_tool -change "$nixlib" /usr/lib/libz.dylib "$1" ;;
case "$nixlib" in
*libiconv.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.dylib "$1" ;;
*libiconv.2.dylib) install_name_tool -change "$nixlib" /usr/lib/libiconv.2.dylib "$1" ;;
*libffi.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libffi.dylib "$1" ;;
*libc++.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libc++.dylib "$1" ;;
*libz.dylib) install_name_tool -change "$nixlib" /usr/lib/libz.dylib "$1" ;;
*libresolv.*.dylib) install_name_tool -change "$nixlib" /usr/lib/libresolv.dylib "$1" ;;
*) ;;
esac
esac
done
'';
'';
};
# A cabal-install wrapper that sets the appropriate static flags
wrapped-cabal = pkgs.writeShellApplication {
Expand Down
Loading