Skip to content

Commit

Permalink
fix macOS artifacts (#122)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Raszyk <martin.raszyk@dfinity.org>
  • Loading branch information
mraszyk and mraszyk authored Dec 8, 2022
1 parent ece29f6 commit 3cc51be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,13 @@ jobs:
echo "::set-output name=out::$out_path"
- run: |
tar -C "${{ steps.buildit.outputs.out }}/bin" -czvf ic-ref.tar.gz ic-ref
tar -C "${{ steps.buildit.outputs.out }}" -czvf ic-ref-test.tar.gz bin test-data
if [[ -d "${{ steps.buildit.outputs.out }}/build/libs" ]]
then
tar -C "${{ steps.buildit.outputs.out }}/build" -czvf ic-ref.tar.gz ic-ref libs
else
tar -C "${{ steps.buildit.outputs.out }}/build" -czvf ic-ref.tar.gz ic-ref
fi
tar -C "${{ steps.buildit.outputs.out }}" -czvf ic-ref-test.tar.gz build test-data
ref_short="$(echo "$GITHUB_SHA" | cut -c1-8)"
version="${{ steps.get_version.outputs.version }}-$ref_short"
Expand Down
34 changes: 17 additions & 17 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ let
buildInputs = [ nixpkgs.macdylibbundler nixpkgs.removeReferencesTo ];
allowedRequisites = [];
} ''
mkdir -p $out/bin
cp ${ic-ref}/bin/ic-ref $out/bin
cp ${ic-ref}/bin/ic-ref-test $out/bin
mkdir -p $out/build/libs
cp ${ic-ref}/bin/ic-ref $out/build
cp ${ic-ref}/bin/ic-ref-test $out/build
mkdir -p $out/test-data
cp ${ic-ref}/test-data/universal-canister.wasm $out/test-data/universal-canister.wasm
chmod u+w $out/bin/ic-ref
chmod u+w $out/bin/ic-ref-test
chmod u+w $out/build/ic-ref
chmod u+w $out/build/ic-ref-test
dylibbundler \
-b \
-x $out/bin/ic-ref \
-x $out/bin/ic-ref-test \
-d $out/bin \
-p '@executable_path' \
-x $out/build/ic-ref \
-x $out/build/ic-ref-test \
-d $out/build/libs \
-p '@executable_path/libs' \
-i /usr/lib/system \
-i ${nixpkgs.libiconv}/lib \
-i ${nixpkgs.darwin.Libsystem}/lib
Expand All @@ -86,10 +86,10 @@ let
-t ${nixpkgs.darwin.CF} \
-t ${nixpkgs.libiconv} \
-t ${staticHaskellPackages.tasty-html.data} \
$out/bin/*
$out/build/*
# sanity check
$out/bin/ic-ref --version
$out/build/ic-ref --version
''

# on Linux, build statically using musl
Expand All @@ -105,9 +105,9 @@ let
allowedReferences = [];
nativeBuildInputs = [ nixpkgs.removeReferencesTo ];
} ''
mkdir -p $out/bin
cp ${ic-hs-static}/bin/ic-ref $out/bin
cp ${ic-hs-static}/bin/ic-ref-test $out/bin
mkdir -p $out/build
cp ${ic-hs-static}/bin/ic-ref $out/build
cp ${ic-hs-static}/bin/ic-ref-test $out/build
mkdir -p $out/test-data
cp ${ic-hs}/test-data/universal-canister.wasm $out/test-data/universal-canister.wasm
Expand All @@ -120,7 +120,7 @@ let
# warp_libexecdir"/nix/store/...-warp-static-x86_64-unknown-linux-musl-3.3.17/libexec/x86_64-linux-ghc-8.10.7/warp-3.3.17"
# warp_sysconfdir"/nix/store/...-warp-static-x86_64-unknown-linux-musl-3.3.17/etc"
#
# These paths end up in the statically compiled $out/bin/ic-ref which
# These paths end up in the statically compiled $out/build/ic-ref which
# will fail the `allowedReferences = []` check.
#
# Fortunatley warp doesn't use these `warp_*` paths:
Expand All @@ -134,11 +134,11 @@ let
# Network/Wai/Handler/Warp/Settings.hs: , settingsServerName = C8.pack $ "Warp/" ++ showVersion Paths_warp.version
#
# So we can safely remove the references to warp:
remove-references-to -t ${staticHaskellPackages.warp} $out/bin/ic-ref
remove-references-to -t ${staticHaskellPackages.warp} $out/build/ic-ref
remove-references-to \
-t ${staticHaskellPackages.tasty-html} \
-t ${staticHaskellPackages.tasty-html.data} \
$out/bin/ic-ref-test
$out/build/ic-ref-test
'';


Expand Down

0 comments on commit 3cc51be

Please sign in to comment.