{"id":13547381,"url":"https://github.com/ghcjs/ghcjs","last_synced_at":"2025-04-14T04:13:46.304Z","repository":{"id":1021400,"uuid":"849182","full_name":"ghcjs/ghcjs","owner":"ghcjs","description":"Haskell to JavaScript compiler, based on GHC","archived":false,"fork":false,"pushed_at":"2023-01-21T23:46:36.000Z","size":6831,"stargazers_count":2612,"open_issues_count":293,"forks_count":186,"subscribers_count":74,"default_branch":"ghc-8.10","last_synced_at":"2025-04-14T04:13:41.859Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghcjs.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-08-19T16:32:40.000Z","updated_at":"2025-04-09T22:01:33.000Z","dependencies_parsed_at":"2023-02-12T13:18:04.293Z","dependency_job_id":null,"html_url":"https://github.com/ghcjs/ghcjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghcjs%2Fghcjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghcjs%2Fghcjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghcjs%2Fghcjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghcjs%2Fghcjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghcjs","download_url":"https://codeload.github.com/ghcjs/ghcjs/tar.gz/refs/heads/ghc-8.10","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819405,"owners_count":21166477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T12:00:54.808Z","updated_at":"2025-04-14T04:13:46.269Z","avatar_url":"https://github.com/ghcjs.png","language":"Haskell","readme":"\nIntroduction\n============\n\nGHCJS is a Haskell to JavaScript compiler that uses the GHC API.\n\nQuick Start - Developing GHCJS\n==============================\n\nGHCJS contains a library, `ghcjs`, which contains the JavaScript code generator and a slightly customized variant of the `ghc` library, and several executable programs.\n\nThe repository has several submodules and some files must be generated before the package can be installed.\n\n### prerequisites\n\n#### GHC\n\nYou need the same major version of GHC as the version of the GHCJS branch you're building.\n\n#### cabal-install\n\ncabal-install 3.0 is supported\n\n#### emscripten emsdk\n\nGHCJS uses a C toolchain, mostly for build system related tasks like the C preprocessor, Autoconf scripts and tools like `hsc2hs`. Direct support for using compiled foreign libraries from Haskell code may follow at a later date.\n\nPlease follow the installation instructions at https://emscripten.org/docs/getting_started/index.html\n\nGHCJS requires the \"upstream\" emscripten backend, which is the default now. The earlier \"fastcomp\" backend will not work.\n\n### getting and preparing the source tree\n\n```\n$ git clone https://github.com/ghcjs/ghcjs.git\n$ cd ghcjs\n$ git submodule update --init --recursive\n```\n\n\n\n### building the compiler\n\nGHCJS depends on a few \"local\" packages in the source tree. You can use\n`cabal-install` and `stack` to set up a build environment that contains\nthese packages.\n\n#### Cabal new-install\n\nAfter the source tree has been prepared, the package can be installed.\nYou may want ensure that binaries of earlier versions are overwritten:\n\n```{.shell}\ncabal v2-install --overwrite-policy=always --install-method=copy --installdir=inplace/bin\n```\n\nAt the time of writing, `cabal-install` does not support creating symbolic links on Windows, even though this is the default installation method. A workaround is telling it to copy the executables instead:\n\n```{.shell}\ncabal v1-install --prefix=inplace\n```\n\n#### v1 style Cabal sandbox\n\nv1 style cabal sandboxes are also supported\n\nif you want to build with a Cabal sandbox, use the `makeSandbox.sh` script\nto add the local packages.\n\n```\n$ cabal v1-sandbox init\n$ cabal v1-install\n```\n\n#### stack\n\nor you can use stack:\n\n```\n$ stack --system-ghc --skip-ghc-check install --local-bin-dir=inplace/bin\n```\n\n#### Booting GHCJS\n\nThe `ghcjs-boot` program builds the \"boot\" libraries, like `ghc-prim`, `base` and `template-haskell` with GHCJS. After booting, GHCJS can compile regular Haskell programs and packages.\n\n`ghcjs-boot` needs to be able to find the emscripten toolchain, a nodejs executable. The easiest way to do this is by running the `emsdk_env.sh` script. After that, you can run `ghcjs-boot` by pointing it to the boot libraries (the directory containing the `boot.yaml` file)\n\n```\n$ source ~/emsdk/emsdk_env.sh\n$ ./inplace/bin/ghcjs-boot -s ./lib/boot\n```\n\n### GHCJS executables and library paths\n\n\nAfter booting, you can add the directory containing the GHCJS binaries to\nyour executable PATH. The `ghcjs-boot` program prints the location after\nfinishing building the libraries.\n\nYou can also create a symbolic link for the `ghcjs` and `ghcjs-pkg`\nprograms, or use the `--with-compiler` and `--with-hc-pkg` flags\nwhen using `cabal-install`\n\n#### Generating a source distribution\n\nif you work on boot packages that need some for an upstream library,\nmake sure to update the patches in `/lib/patches` first\n\n```\n$ ./utils/updatePatches.sh\n```\n\nthen regenerate the packages\n\n```\n$ ./utils/makePackages.sh\n```\n","funding_links":[],"categories":["Haskell","Functional Languages that Compile to JavaScript"],"sub_categories":["Lenses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghcjs%2Fghcjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghcjs%2Fghcjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghcjs%2Fghcjs/lists"}