georgestagg / pandoc-wasm

The universal document converter, compiled for WebAssembly and running in the browser.
https://georgestagg.github.io/pandoc-wasm/
Other
43 stars 2 forks source link

Document how to build locally #3

Open n3f opened 2 days ago

n3f commented 2 days ago

I'm curious about trying to build this locally, but noticed that there aren't any instructions. It's possible that it's super simple, but I'm missing the required information to get started 😆.

georgestagg commented 5 hours ago

It has been several months since I last looked at this, but from what I remember something like the following should work:

git clone https://github.com/georgestagg/pandoc-wasm.git
cd pandoc-wasm
make submodules
make docker-container
make all

This should build a docker container containing Asterius and pandoc's prerequisites, then run Asterius to build pandoc with the result written to the ./dist directory.

Note that some Haskell packages will have updated releases since I last build the Wasm binary, you will likely need to add some additional fixed older versions of packages in the file pandoc-wasm.cabal.

EDIT: I've pushed an update so that running make docker-container pulls the pre-built Docker container distributed with this GitHub project. This avoids the issue above by providing Asterius and a working set of pre-built versions of Pandoc's prerequisites.


The process begins with Asterius's docker image, so if you'd like to build locally outside Docker you'll also need to recreate the terrorjack/asterius container image in your local development environment. The Asterius source is at https://github.com/tweag/asterius, though is now archived.

In the future, when I return to this, I want to switch from Asterius to the ghc wasm backend. When that happens there will be a completely new set of development instructions. At that point, I will add a Development Build section to the README.md file with relevant information on how to build the Wasm binary from scratch.

frabera commented 2 hours ago

It has been several months since I last looked at this, but from what I remember something like the following should work:

git clone https://github.com/georgestagg/pandoc-wasm.git
cd pandoc-wasm
make submodules
make docker-container
make all

This should build a docker container containing Asterius and pandoc's prerequisites, then run Asterius to build pandoc with the result written to the ./dist directory.

Note that some Haskell packages will have updated releases since I last build the Wasm binary, you will likely need to add some additional fixed older versions of packages in the file pandoc-wasm.cabal.

EDIT: I've pushed an update so that running make docker-container pulls the pre-built Docker container distributed with this GitHub project. This avoids the issue above by providing Asterius and a working set of pre-built versions of Pandoc's prerequisites.

The process begins with Asterius's docker image, so if you'd like to build locally outside Docker you'll also need to recreate the terrorjack/asterius container image in your local development environment. The Asterius source is at https://github.com/tweag/asterius, though is now archived.

In the future, when I return to this, I want to switch from Asterius to the ghc wasm backend. When that happens there will be a completely new set of development instructions. At that point, I will add a Development Build section to the README.md file with relevant information on how to build the Wasm binary from scratch.

Do you think that by switching to the ghc wasm backend will the following features work?