1- The Glasgow Haskell Compiler
2- ============================
1+ Plinth Standalone Compiler
2+ ==========================
33
4- [ ![ pipeline status] ( https://gitlab.haskell.org/ghc/ghc/badges/master/pipeline.svg?style=flat )] ( https://gitlab.haskell.org/ghc/ghc/commits/master )
4+ About this fork
5+ ===============
56
6- This is the source tree for [ GHC] [ 1 ] , a compiler and interactive
7- environment for the Haskell functional programming language.
8-
9- For more information, visit [ GHC's web site] [ 1 ] .
10-
11- Information for developers of GHC can be found on the [ GHC issue tracker] [ 2 ] , and you can also view [ proposals for new GHC features] [ 13 ] .
7+ This is a fork of GHC that embeds the [ Plinth] [ plinth ] compiler, used to write
8+ smart contracts for the [ Cardano] [ cardano ] blockchain. Plinth (formerly known
9+ as Plutus Tx) is a subset of Haskell compiled to Plutus Core via a GHC Core
10+ plugin shipped here as a built-in static plugin.
1211
12+ See the Plinth documentation:
1313
14- Getting the Source
15- ==================
14+ - [ Plinth user guide] [ plinth ]
15+ - [ Plutus / Plinth GitHub repository] [ plutus-repo ]
16+ - [ Plinth project template] [ plinth-template ]
1617
17- There are two ways to get a source tree:
18+ The text below is the upstream GHC README.
1819
19- 1 . * Download source tarballs*
20-
21- Download the GHC source distribution:
20+ This is the source tree for [ GHC] [ 1 ] , a compiler and interactive
21+ environment for the Haskell functional programming language.
2222
23- ghc-<version>-src.tar.xz
23+ For more information, visit [ GHC's web site ] [ 1 ] .
2424
25- which contains GHC itself and the "boot" libraries .
25+ Information for developers of GHC can be found on the [ GHC issue tracker ] [ 2 ] , and you can also view [ proposals for new GHC features ] [ 13 ] .
2626
27- 2 . * Check out the source code from git*
2827
29- $ git clone --recurse-submodules git@gitlab.haskell.org:ghc/ghc.git
28+ Building from source
29+ ====================
3030
31- Note: cloning GHC from Github requires a special setup. See [ Getting a GHC
32- repository from Github ] [ 7 ] .
31+ Clone the repository together with its submodules (the ` plutus ` submodule
32+ provides ` plutus-tx ` , ` plutus-tx-plugin ` , and ` plutus-core ` ):
3333
34- * See the GHC team's working conventions regarding [ how to contribute a patch to GHC ] ( https://gitlab.haskell.org/ ghc/ghc/wikis/working-conventions/fixing-bugs ) . * First time contributors are encouraged to get started by just sending a Merge Request.
34+ $ git clone --recurse-submodules git@github.com:input-output-hk/ ghc-plinth.git
3535
36+ If you already cloned without ` --recurse-submodules ` , fetch them with:
3637
37- Building & Installing
38- =====================
38+ $ git submodule update --init --recursive
3939
40- For full information on building GHC, see the [ GHC Building Guide] [ 3 ] .
41- Here follows a summary - if you get into trouble, the Building Guide
42- has all the answers.
40+ Then build with the ` plinth-build.sh ` script at the root of the repository:
4341
44- Before building GHC you may need to install some other tools and
45- libraries. See, [ Setting up your system for building GHC] [ 8 ] .
42+ $ ./plinth-build.sh
4643
47- * NB.* In particular, you need [ GHC] [ 1 ] installed in order to build GHC,
48- because the compiler is itself written in Haskell. You also need
49- [ Happy] [ 4 ] , [ Alex] [ 5 ] , and [ Cabal] [ 9 ] . For instructions on how
50- to port GHC to a new platform, see the [ GHC Building Guide] [ 3 ] .
44+ The script bootstraps GHC and then builds the Plinth-enabled compiler,
45+ ` uplc-ghc ` . It expects a boot ` ghc-9.6.7 ` and ` cabal >= 3.14.2.0 ` on ` PATH `
46+ (` happy ` and ` alex ` are built locally if missing). Useful environment knobs:
5147
52- For building library documentation, you'll need [ Haddock] [ 6 ] . To build
53- the compiler documentation, you need [ Sphinx] ( http://www.sphinx-doc.org/ )
54- and Xelatex (only for PDF output).
48+ - ` REBUILD=1 ` forces a full rebuild.
49+ - ` RELEASE=1 ` builds a release flavour including documentation.
5550
56- ** Quick start ** : GHC is built using the [ Hadrian build system ] ( hadrian/README.md ) .
57- The following gives you a default build:
51+ A binary distribution archive ( ` ghc-<version>-<platform>.tar.xz ` ) is produced
52+ under ` _build/bindist/ ` .
5853
59- $ ./boot
60- $ ./configure
61- $ hadrian/build # can also say '-jX' for X number of jobs
6254
63- On Windows, you need an extra repository containing some build tools.
64- These can be downloaded for you by configure. This only needs to be done once by running:
55+ How to use it?
56+ ==============
6557
66- $ ./configure --enable-tarballs-autodownload
58+ The build produces ` uplc-ghc ` , a GHC that ships the Plinth plugin as a built-in
59+ static plugin. Use it as the compiler for a Plinth project, for example by
60+ pointing ` cabal ` at it:
6761
68- Additionally, on Windows, to run Hadrian you should run ` hadrian/build.bat `
69- instead of ` hadrian/build ` .
62+ $ cabal build -w _build/stage1/bin/uplc-ghc
7063
71- (NB: ** Do you have multiple cores? Be sure to tell that to ` hadrian ` ! ** This can
72- save you hours of build time depending on your system configuration, and is
73- almost always a win regardless of how many cores you have. As a simple rule,
74- you should have about N+1 jobs, where ` N ` is the amount of cores you have.)
64+ Compiling a module that defines Plinth code then yields Plutus Core in addition
65+ to the usual GHC outputs. For a ready-made project layout to start from, see the
66+ [ Plinth project template ] [ plinth-template ] , and consult the
67+ [ Plinth user guide ] [ plinth ] for how to write and compile Plinth code.
7568
76- The ` ./boot ` step is only necessary if this is a tree checked out
77- from git. For source distributions downloaded from [ GHC's web site] [ 1 ] ,
78- this step has already been performed.
7969
80- These steps give you the default build, which includes everything
81- optimised and built in various ways (eg. profiling libs are built).
82- It can take a long time. To customise the build, see the file ` HACKING.md ` .
70+ How to test it?
71+ ===============
8372
84- Filing bugs and feature requests
85- ================================
73+ After building, run the ` plinth-test.sh ` script at the root of the repository:
8674
87- If you've encountered what you believe is a bug in GHC, or you'd like
88- to propose a feature request, please let us know! Submit an [ issue] [ 10 ] and we'll be sure to look into it. Remember:
89- ** Filing a bug is the best way to make sure your issue isn't lost over
90- time** , so please feel free.
75+ $ ./plinth-test.sh
9176
92- If you're an active user of GHC, you may also be interested in joining
93- the [ glasgow-haskell-users] [ 11 ] mailing list, where developers and
94- GHC users discuss various topics and hang out.
77+ It builds the example Plinth project under ` plinth/test/ ` with ` uplc-ghc ` and
78+ regenerates its expected outputs. Set ` CLEAN=1 ` to force a clean rebuild:
9579
96- Hacking & Developing GHC
97- ========================
80+ $ CLEAN=1 ./plinth-test.sh
9881
99- Once you've filed a bug, maybe you'd like to fix it yourself? That
100- would be great, and we'd surely love your company! If you're looking
101- to hack on GHC, check out the guidelines in the ` HACKING.md ` file in
102- this directory - they'll get you up to speed quickly.
82+ There is also ` plinth-bench.sh ` , which builds and runs the ` plutus-benchmark `
83+ test-suites with ` uplc-ghc ` and reports any diffs against the golden files
84+ committed under ` plutus/plutus-benchmark/ ` (it requires the ` plutus ` submodule):
10385
104- Contributors & Acknowledgements
105- ===============================
86+ $ ./plinth-bench.sh
10687
107- GHC in its current form wouldn't exist without the hard work of
108- [ its many contributors] [ 12 ] . Over time, it has grown to include the
109- efforts and research of many institutions, highly talented people, and
110- groups from around the world. We'd like to thank them all, and invite
111- you to join!
11288
11389 [ 1 ] : http://www.haskell.org/ghc/ " www.haskell.org/ghc/ "
11490 [ 2 ] : https://gitlab.haskell.org/ghc/ghc/issues
@@ -131,3 +107,11 @@ you to join!
131107 "https://gitlab.haskell.org/ghc/ghc/wikis/team-ghc"
132108 [ 13 ] : https://github.com/ghc-proposals/ghc-proposals
133109 "https://github.com/ghc-proposals/ghc-proposals"
110+ [ plinth ] : https://plutus.cardano.intersectmbo.org/docs/
111+ "Plinth and Plutus Core Documentation"
112+ [ cardano ] : https://cardano.org/
113+ "cardano.org"
114+ [ plutus-repo ] : https://github.com/IntersectMBO/plutus
115+ "github.com/IntersectMBO/plutus"
116+ [ plinth-template ] : https://github.com/IntersectMBO/plinth-template
117+ "github.com/IntersectMBO/plinth-template"
0 commit comments