Skip to content

Commit 5b19b4f

Browse files
authored
[ git ] Merge pull request #34 from agda-web/wasm-fix-compat
Fix broken build after #32 being merged
2 parents 0c418fa + 1c6425d commit 5b19b4f

File tree

6 files changed

+24
-8
lines changed

6 files changed

+24
-8
lines changed

.github/workflows/wasm.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: Compile WASM
22

3-
on: [push, pull_request, workflow_dispatch]
3+
on:
4+
push:
5+
branches: [master, ci-*, ci]
6+
tags:
7+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
8+
pull_request:
9+
branches: [master]
410

511
env:
612
GHC_WASM_META_FLAVOUR: '9.10'
@@ -74,9 +80,11 @@ jobs:
7480
echo ">>> Install alex and happy"
7581
~/.ghc-wasm/cabal/bin/cabal install alex-3.5.0.0 happy-1.20.1.1
7682
77-
- name: Run cabal configure
83+
- name: Cabal configure
7884
working-directory: './als'
79-
run: wasm32-wasi-cabal configure --flag=Agda-2-7-0-1
85+
run: |
86+
mv cabal.project.wasm32 cabal.project
87+
wasm32-wasi-cabal configure --flag=Agda-2-7-0-1
8088
8189
- name: 'Build dep: lsp-types'
8290
uses: nick-fields/retry@v3

BUILDING_WASM.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
1. Setup a working ghc (tested with v9.10) with WASM backend and wasm32-wasi-cabal.
44
2. `cd` into `wasm-submodules/network` and run `autoreconf -i`.
5-
3. In the project root, run `wasm32-wasi-cabal build`.
5+
3. In the project root, run `cp cabal.project{.wasm32,}`, and then `wasm32-wasi-cabal build`.
66

77
The process might output the following:
88

@@ -24,4 +24,4 @@ Node.js v22.14.0
2424
At this moment, you should terminate the process and run it again.
2525
This is a known issue ([ghc#26106](https://gitlab.haskell.org/ghc/ghc/-/issues/26106)). If this does *not* occur to you or you can fix it, please report to that issue.
2626

27-
If everything works properly, it should build a `als.wasm`.
27+
If everything works properly, it should build a binary `als.wasm`.

agda-language-server.cabal

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ library
8282
PatternSynonyms
8383
TypeOperators
8484
ghc-options: -Wincomplete-patterns -Wunused-do-bind -Wunused-foralls -Wwarnings-deprecations -Wwrong-do-bind -Wmissing-fields -Wmissing-methods -Wmissing-pattern-synonym-signatures -Wmissing-signatures -Werror=incomplete-patterns -fno-warn-orphans
85+
if !arch(wasm32)
86+
ghc-options: -threaded -with-rtsopts=-N
8587
build-depends:
8688
Agda
8789
, aeson
@@ -126,6 +128,8 @@ executable als
126128
PatternSynonyms
127129
TypeOperators
128130
ghc-options: -Wincomplete-patterns -Wunused-do-bind -Wunused-foralls -Wwarnings-deprecations -Wwrong-do-bind -Wmissing-fields -Wmissing-methods -Wmissing-pattern-synonym-signatures -Wmissing-signatures -rtsopts -Werror=incomplete-patterns -fno-warn-orphans
131+
if !arch(wasm32)
132+
ghc-options: -threaded -with-rtsopts=-N
129133
build-depends:
130134
Agda
131135
, aeson
@@ -197,6 +201,8 @@ test-suite als-test
197201
PatternSynonyms
198202
TypeOperators
199203
ghc-options: -Wincomplete-patterns -Wunused-do-bind -Wunused-foralls -Wwarnings-deprecations -Wwrong-do-bind -Wmissing-fields -Wmissing-methods -Wmissing-pattern-synonym-signatures -Wmissing-signatures -rtsopts -Werror=incomplete-patterns -fno-warn-orphans
204+
if !arch(wasm32)
205+
ghc-options: -threaded -with-rtsopts=-N
200206
build-depends:
201207
Agda
202208
, aeson

cabal.project renamed to cabal.project.wasm32

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ packages:
66
wasm-submodules/network-simple-0.4.2
77
wasm-submodules/lsp/lsp-types
88

9+
package Agda
10+
flags: +optimise-heavily

src/Options.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ versionNumber = 5
7777
versionString :: String
7878
versionString =
7979
#ifdef wasm32_HOST_ARCH
80-
"Agda v2.7.0.1 Language Server (WebAssembly build) v" <> show versionNumber
80+
"Agda v2.7.0.1 Language Server v" <> show versionNumber <> " (WebAssembly build)"
8181
#elif MIN_VERSION_Agda(2,7,0)
8282
"Agda v2.7.0.1 Language Server v" <> show versionNumber
8383
#elif MIN_VERSION_Agda(2,6,4)

src/Server.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ run options = do
5050
-- Switchboard.destroy switchboard
5151
return 0
5252
Nothing -> do
53-
#if defined(wasm32_HOST_ARCH)
53+
#if defined(wasm32_HOST_ARCH)
5454
liftIO $ setFdOption stdInput NonBlockingRead True
5555
`catchIO` (\ e -> hPutStrLn stderr $ "Failed to enable nonblocking on stdin: " ++ (show e) ++ "\nThe WASM module might not behave correctly.")
56-
#endif
56+
#endif
5757
runServer (serverDefn options)
5858
where
5959
serverDefn :: Options -> ServerDefinition Config

0 commit comments

Comments
 (0)