From 807930f1cf47b5c1b6e9e39e7dd7f5f8b9de0567 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus <oleg.grenrus@iki.fi> Date: Mon, 18 Feb 2019 15:03:21 +0200 Subject: [PATCH] Build nofib-analyse with cabal v2-build --- .gitignore | 2 ++ README.md | 28 +++++++++++++++------------- mk/target.mk | 1 - nofib-analyse/Makefile | 6 +++--- nofib-analyse/cabal.project | 2 ++ nofib-analyse/nofib-analyse.cabal | 17 +++++++++++++++++ 6 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 nofib-analyse/cabal.project create mode 100644 nofib-analyse/nofib-analyse.cabal diff --git a/.gitignore b/.gitignore index 80345db9..d884c447 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ cachegrind.out.* cachegrind.out.summary perf.data perf.data.* +dist-newstyle/ +.ghc.environment.* # Specific generated files nofib-analyse/nofib-analyse diff --git a/README.md b/README.md index 6e610a65..005db88f 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,6 @@ pick `$(which ghc)` or whatever the `HC` environment variable is set to. Additional information can also be found on [NoFib's wiki page](https://ghc.haskell.org/trac/ghc/wiki/Building/RunningNoFib). -## Package Depedencies - -Please make sure you have the following packages installed for your -system GHC: - * html - * regex-compat (will install: mtl, regex-base, regex-posix) - ## Using <details> @@ -34,11 +27,7 @@ system GHC: `git clone -c core.symlinks=true <URL>`. </details> -Install the [package dependencies](#package-dependencies): - -``` -$ cabal install html regex-compat -``` +Install [`cabal-install-2.4`](https://www.haskell.org/cabal/download.html) or later. Then, to run the tests, execute: @@ -61,7 +50,7 @@ $ make EXTRA_HC_OPTS="-fllvm" ``` To compare the results of multiple runs, save the output in a logfile -and use the program in `../utils/nofib-analyse`, for example: +and use the program in `./nofib-analyse/nofib-analyse`, for example: ``` ... @@ -115,6 +104,19 @@ This is the default of its `-i` option, which is of course incompatible with `mode=fast`. In that case, you should just set `-i` as appropriate, even deactivate it with `-i 0`. +## Boot vs. benchmarked GHC + +The `nofib-analyse` utility is compiled with `BOOT_HC` compiler, +which may be different then the GHC under the benchmark. + +You can control which GHC you benchmark with `HC` variable + +``` +$ make clean +$ make boot HC=ghc-head +$ make HC=ghc-head 2>&1 | tee nofib-log-ghc-head +``` + ## Configuration There are some options you might want to tweak; search for nofib in diff --git a/mk/target.mk b/mk/target.mk index a8c92a24..3239feb4 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -37,7 +37,6 @@ STDIN_FILE = $(wildcard $(NOFIB_PROG).stdin) endif endif - # Bogosity needed here to cope with .exe suffix for strip & size files. # (shouldn't have to be our problem.) ifneq "$(HC_FAIL)" "YES" diff --git a/nofib-analyse/Makefile b/nofib-analyse/Makefile index 0e9236b3..229f804c 100644 --- a/nofib-analyse/Makefile +++ b/nofib-analyse/Makefile @@ -4,7 +4,8 @@ include $(TOP)/mk/boilerplate.mk PROG = nofib-analyse $(PROG): *.hs - $(BOOT_HC) -O -cpp --make Main -o $(PROG) + cabal v2-build -w $(BOOT_HC) + cp $$(cabal v2-exec -w $(BOOT_HC) -- which $(PROG)) $(PROG) all :: $(PROG) @@ -16,8 +17,7 @@ boot :: $(PROG) .PHONY: mostlyclean clean distclean maintainer-clean mostlyclean:: - rm -f CmdLine.hi GenUtils.hi Main.hi Slurp.hi - rm -f CmdLine.o GenUtils.o Main.o Slurp.o + rm -rf dist-newstyle clean:: mostlyclean rm -f $(PROG) diff --git a/nofib-analyse/cabal.project b/nofib-analyse/cabal.project new file mode 100644 index 00000000..229326e1 --- /dev/null +++ b/nofib-analyse/cabal.project @@ -0,0 +1,2 @@ +-- project file for "boot" utilities +packages: . diff --git a/nofib-analyse/nofib-analyse.cabal b/nofib-analyse/nofib-analyse.cabal new file mode 100644 index 00000000..371b0a3f --- /dev/null +++ b/nofib-analyse/nofib-analyse.cabal @@ -0,0 +1,17 @@ +cabal-version: 2.4 +name: nofib-analyse +version: 0 + +executable nofib-analyse + default-language: Haskell2010 + main-is: Main.hs + other-modules: + CmdLine + GenUtils + Slurp + + build-depends: + , array + , base + , containers + , regex-compat -- GitLab