https://github.com/koalaman/shellcheck
I can install the above package using cabal install
. But I'd like to run the raw ghc
commands that compile the binary without the installation.
How can I do it?
https://github.com/koalaman/shellcheck
I can install the above package using cabal install
. But I'd like to run the raw ghc
commands that compile the binary without the installation.
How can I do it?
Here's the usual way. Step one is to get a copy of the code. One of these two will do it:
% git clone https://github.com/koalaman/shellcheck
% cabal unpack shellcheck
Once you are in the directory with the code, you can ask cabal
to build it without installing it by using the build
command instead of the install
command.
% cabal build
If you'd like to see the sequence of subcommands that cabal
invokes for this task, you can ask it to show them by increasing the verbosity.
% cabal build -v3
First of all you'll need to install all dependencies, you can do that with cabal install --dependencies-only
. Then you need to make a file Paths_ShellCheck.hs
with the contents:
module Paths_ShellCheck where
import Data.Version
version = Version [0,7,2] []
Then you can use this GHC command:
ghc \
--make \
-O \
-package-db ~/.cabal/store/ghc-8.10.4/package.db \
-hide-all-packages \
-package regex-tdfa \
-package parsec \
-package containers \
-package base \
-package deepseq \
-package mtl \
-package QuickCheck \
-package array \
-package aeson \
-package bytestring \
-package Diff \
-package filepath \
-package directory \
src/ShellCheck/*.hs \
src/ShellCheck/*/*.hs \
Paths_ShellCheck.hs \
shellcheck.hs
Which will build the executable shellcheck
. Note that this is specifically for GHC 8.10.4, you can change that if you want to use another GHC version.
If you don't even want to run cabal install --dependencies-only
then the easiest way might be to copy all the *.hs source files of all the dependencies, add those to the globs at the end, and remove the corresponding -package ...
argument. You can perhaps keep the packages that are bundled with GHC: namely base, deepseq, mtl, containers, array, bytestring, filepath, parsec, and directory. So that leaves Diff, aeson, QuickCheck and regex-tdfa and their transitive dependencies.