Skip to content

Commit

Permalink
Merge pull request #415 from elopez/windows-9.4
Browse files Browse the repository at this point in the history
Move Windows build to GHC 9.4
  • Loading branch information
d-xo authored Oct 26, 2023
2 parents a82924f + 5661ee8 commit 90fabf0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 22 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ jobs:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
path-type: inherit
msystem: CLANG64
path-type: minimal
update: true
install: >-
base-devel
Expand All @@ -75,14 +75,23 @@ jobs:
pacboy: >-
cmake:p
ninja:p
gcc:p
clang:p
lld:p
autotools:p
gmp:p
openssl:p
- uses: haskell/actions/setup@v2
- uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: '9.2.8'
ghc-version: '9.4.7'

- name: Extract GHC & Cabal paths
run: |
HASKELL_PATHS="$(cygpath -u "$GHC_PATH"):$(cygpath -u "$CABAL_PATH")"
echo "HASKELL_PATHS=$HASKELL_PATHS" >> "$GITHUB_ENV"
env:
GHC_PATH: ${{ steps.setup.outputs.ghc-path }}
CABAL_PATH: ${{ steps.setup.outputs.cabal-path }}

- name: build and install c dependencies
run: |
Expand All @@ -94,6 +103,7 @@ jobs:
echo "::endgroup::"
- name: Configure the build
run: |
export PATH="$HASKELL_PATHS:$PATH"
cabal configure --disable-tests --disable-benchmarks --disable-documentation
cabal build --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.
Expand All @@ -109,7 +119,9 @@ jobs:
restore-keys: ${{ env.key }}-

- name: Install haskell dependencies
run: cabal build all --only-dependencies
run: |
export PATH="$HASKELL_PATHS:$PATH"
cabal build all --only-dependencies
# Cache dependencies already, so that we do not have to rebuild them should the subsequent steps fail.
- name: Save cached dependencies
Expand All @@ -122,7 +134,9 @@ jobs:

- name: build hevm library
run: |
cabal build --extra-include-dirs="$HOME/.local/include" --extra-lib-dirs="$HOME/.local/lib"
export PATH="$HASKELL_PATHS:$PATH"
cabal build --extra-include-dirs="$HOME/.local/include" --extra-lib-dirs="$HOME/.local/lib" \
--extra-include-dirs="D:/a/_temp/msys64/clang64/include" --extra-lib-dirs="D:/a/_temp/msys64/clang64/lib"
cabal-check:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
grep = "${pkgs.gnugrep}/bin/grep";
otool = "${pkgs.darwin.binutils.bintools}/bin/otool";
install_name_tool = "${pkgs.darwin.binutils.bintools}/bin/install_name_tool";
codesign_allocate = "${pkgs.darwin.binutils.bintools}/bin/codesign_allocate";
codesign = "${pkgs.darwin.sigtool}/bin/codesign";
in if pkgs.stdenv.isLinux
then pkgs.haskell.lib.dontCheck hevmUnwrapped
else pkgs.runCommand "stripNixRefs" {} ''
Expand All @@ -151,6 +153,7 @@
chmod 777 $out/bin/hevm
${install_name_tool} -change "$cxx" /usr/lib/libc++.1.dylib $out/bin/hevm
${install_name_tool} -change "$iconv" /usr/lib/libiconv.dylib $out/bin/hevm
CODESIGN_ALLOCATE=${codesign_allocate} ${codesign} -f -s - $out/bin/hevm
chmod 555 $out/bin/hevm
'';

Expand Down
27 changes: 12 additions & 15 deletions hevm.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ common shared
-Wno-unticked-promoted-constructors
-Wno-orphans
-Wno-ambiguous-fields
-optc-Wno-ignored-attributes
default-language: GHC2021
default-extensions:
DuplicateRecordFields
Expand Down Expand Up @@ -103,8 +104,17 @@ library
Paths_hevm
autogen-modules:
Paths_hevm
if os(linux) || os(windows)
if impl(ghc >= 9.4) && !os(darwin)
-- darwin is skipped because it produces this error when building
-- > ghc: loadArchive: Neither an archive, nor a fat archive: `/nix/store/l3lkdfm7sg1wwc850451cikqds766h15-clang-wrapper-11.1.0/bin/clang++'
build-depends: system-cxx-std-lib
elif !os(darwin)
extra-libraries: stdc++
else
-- extra-libraries: c++
-- https://gitlab.haskell.org/ghc/ghc/-/issues/11829
ld-options: -Wl,-keep_dwarf_unwind
ghc-options: -fcompact-unwind
extra-libraries:
secp256k1, ff, gmp
c-sources:
Expand Down Expand Up @@ -187,10 +197,6 @@ executable hevm
Paths_hevm
if os(darwin)
extra-libraries: c++
ld-options: -Wl,-keep_dwarf_unwind
ghc-options: -fcompact-unwind
else
extra-libraries: stdc++
build-depends:
QuickCheck,
aeson,
Expand Down Expand Up @@ -234,8 +240,6 @@ common test-base
import: shared
hs-source-dirs:
test
extra-libraries:
secp256k1
other-modules:
Paths_hevm
autogen-modules:
Expand Down Expand Up @@ -304,11 +308,6 @@ common test-common
buildable: False
if os(darwin)
extra-libraries: c++
-- https://gitlab.haskell.org/ghc/ghc/-/issues/11829
ld-options: -Wl,-keep_dwarf_unwind
ghc-options: -fcompact-unwind
else
extra-libraries: stdc++

--- Test Suites ---

Expand Down Expand Up @@ -351,9 +350,7 @@ benchmark bench
ghc-options:
-O2
if os(darwin)
extra-libraries: c++
else
extra-libraries: stdc++
extra-libraries: c++
other-modules:
Paths_hevm
autogen-modules:
Expand Down

0 comments on commit 90fabf0

Please sign in to comment.