Skip to content

Commit

Permalink
Ormolu Live: update ghc-wasm-meta
Browse files Browse the repository at this point in the history
  • Loading branch information
amesgen committed Jan 17, 2025
1 parent 2d333eb commit cf9a8b2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ormolu-live/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ else
"$ORMOLU_WASM" -o "$WDIR/ormolu-init.wasm"
ORMOLU_WASM_FINAL="$WDIR/ormolu-opt.wasm"
wasm-opt "$WDIR/ormolu-init.wasm" -o "$ORMOLU_WASM_FINAL" -Oz
wasm-strip "$ORMOLU_WASM_FINAL"
wasm-tools strip "$ORMOLU_WASM_FINAL" -o "$ORMOLU_WASM_FINAL"
fi

rm -rf dist
mkdir -p dist
cp "$ORMOLU_WASM_FINAL" dist/ormolu-live.wasm

wasmedge --dir /:. "$(wasm32-wasi-cabal list-bin exe:pregen)" \
wasmtime --dir .::/ "$(wasm32-wasi-cabal list-bin exe:pregen)" \
www/jsaddle.js dist/index.html

esbuild_args=(--platform=browser --format=esm)
[[ $dev_mode == false ]] && esbuild_args+=(--minify)
esbuild www/{index,worker}.js --outdir=dist --bundle "${esbuild_args[@]}"
esbuild www/{index,worker}.js --external:node:timers --outdir=dist --bundle "${esbuild_args[@]}"
esbuild www/jsaddle.js --outdir=dist "${esbuild_args[@]}"

cp node_modules/bulma/css/bulma.min.css dist/
6 changes: 1 addition & 5 deletions ormolu-live/cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ packages: . ..
index-state: 2025-01-16T23:07:37Z

if arch(wasm32)
-- Older versions of time don't build on WASM.
constraints: time installed
allow-newer: time

package ghc-lib-parser
-- The WASM backend does not support the threaded RTS.
flags: -threaded-rts
Expand All @@ -15,4 +11,4 @@ if arch(wasm32)
source-repository-package
type: git
location: https://github.com/amesgen/splitmix
tag: 5f5b766d97dc735ac228215d240a3bb90bc2ff75
tag: cea9e31bdd849eb0c17611bb99e33d590e126164
9 changes: 9 additions & 0 deletions ormolu-live/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

let
pkgs = inputs.ghc-wasm-meta.inputs.nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
in
{
shell = pkgs.mkShell {
Expand All @@ -11,5 +12,13 @@ in
pkgs.npm-check-updates
pkgs.miniserve
];

# Otherwise there are `happy` errors in GHA CI.
shellHook = ''
export LANG="en_US.UTF-8"
'' + lib.optionalString
(pkgs.glibcLocales != null && pkgs.stdenv.hostPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive"
'';
};
}

0 comments on commit cf9a8b2

Please sign in to comment.