|
71 | 71 | INPUTS_EXTRA_CARGO_FLAGS: ${{ inputs.extra-cargo-flags }} |
72 | 72 | run: GIT_DIR=/nonexistent cargo auditable build --release --package "${INPUTS_PACKAGE}" --bin "${INPUTS_BINARY}" ${INPUTS_EXTRA_CARGO_FLAGS} |
73 | 73 |
|
| 74 | + - name: Normalize Darwin dynamic binary |
| 75 | + if: endsWith(inputs.triple, '-apple-darwin') |
| 76 | + shell: bash -euo pipefail {0} |
| 77 | + env: |
| 78 | + INPUTS_BINARY: ${{ inputs.binary }} |
| 79 | + run: | |
| 80 | + binary=target/release/${INPUTS_BINARY} |
| 81 | + nix_iconv_paths=$(otool -L "$binary" | awk '$1 ~ "^/nix/store/.*/lib/libiconv\\.2\\.dylib$" { print $1 }') |
| 82 | + if [[ -n "$nix_iconv_paths" ]]; then |
| 83 | + while IFS= read -r nix_iconv_path; do |
| 84 | + install_name_tool -change "$nix_iconv_path" /usr/lib/libiconv.2.dylib "$binary" |
| 85 | + done <<< "$nix_iconv_paths" |
| 86 | + codesign --force --sign - "$binary" |
| 87 | + fi |
| 88 | +
|
| 89 | + - name: Verify Darwin portability |
| 90 | + if: endsWith(inputs.triple, '-apple-darwin') |
| 91 | + shell: bash -euo pipefail {0} |
| 92 | + env: |
| 93 | + INPUTS_BINARY: ${{ inputs.binary }} |
| 94 | + run: | |
| 95 | + binary=target/release/${INPUTS_BINARY} |
| 96 | + nix_dependencies=$(otool -L "$binary" | awk '$1 ~ "^/nix/store/" { print $1 }') |
| 97 | + if [[ -n "$nix_dependencies" ]]; then |
| 98 | + echo "error: $binary has non-portable Nix store dependencies:" >&2 |
| 99 | + printf ' %s\n' "$nix_dependencies" >&2 |
| 100 | + exit 1 |
| 101 | + fi |
| 102 | + codesign --verify --verbose=2 "$binary" |
| 103 | +
|
74 | 104 | - name: Verify ${{ inputs.binary }} |
75 | 105 | shell: nix develop ${{ inputs.dev-shell }} -c bash -euo pipefail {0} |
76 | 106 | env: |
|
0 commit comments