choco msys2 emacs
Press Windows button, in ‘Type to search’ type cmd, right-click on Command Promp Desktop app and select Run as administrator.
Paste each following line separately
SET PATH=%APPDATA%\cabal\bin;C:\msys64\mingw64\bin;C:\msys64\usr\bin;C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.0.2\bin;C:\ProgramData\chocolatey\lib\cabal\tools;%PATH% SET PKG_CONFIG_PATH=C:\msys64\mingw64\lib\pkgconfig SET XDG_DATA_DIRS=C:\msys64\mingw64\share choco install ghc --version 8.0.2
I will take a while so in the meantimme let’s do something else. Keep the cmd open.
In Msys2 terminal
pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-gobject-introspection mingw64/mingw-w64-x86_64-gtksourceview3 mingw64/mingw-w64-x86_64-webkitgtk3
In cmd ghc and cabal version.
ghc --version cabal --version
In C:\Users\IEUser folder create emacslauncher.cmd with the following content
set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH% set XDG_DATA_DIRS=c:/msys64/mingw64/share set PKG_CONFIG_PATH=c:/msys64/mingw64/lib/pkgconfig set HASKELL_GI_GIR_SEARCH_PATH=c:/msys64/mingw64/share/gir-1.0 C:\msys64\mingw64\bin\runemacs
Close Emacs if open, run the emaclauncher.cmd thus starting Emacs, open eshell by pressing Alt+x and test ghc and cabal version in Emacs. If you get the same result as in cmd you are good to go.
Subsequent examples should work both in cmd and Emacs eshell.
The command cabal user-config init
gave me the location of cabal file. So I
modified the extra-*-dirs to point to msys libraries.
-- flags: extra-include-dirs: c:/msys64/mingw64/include -- deterministic: -- cid: extra-lib-dirs: c:/msys64/mingw64/lib -- extra-framework-dirs: extra-prog-path: C:\Users\IEUser\AppData\Roaming\cabal\bin -- instantiate-with:
cabal update cabal install alex happy cabal install gi-gtk
I used 64 bit installer from https://docs.haskellstack.org/en/stable/install_and_upgrade/
Restart Emacs, if you want to use Emacs for shell operations.
Test if the installation went well.
stack --version Version 1.5.1, Git revision 600c1f01435a10d127938709556c1682ecfd694e x86_64 hpack-0.17.1
stack --system-ghc install --dependencies-only stack --system-ghc build
Running stack exec <programName>
does not work on eshell, but in cmd you will
get a dialog about a missing dlls.
To solve it use cmd and do to the c:\msys64\mingw64\bin directory that contains your dlls and execute
..\..\..\Users\your\project\.stack-work\install\345123444\bin\yourexec.exe
You have to do it because the current folder is not in the system PATH. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx
Create a file cmdlauncher.cmd and put the following code in it. This will start cmd shell with modified PATH so it doesn’t have to interfere with your Windows system. If you do it this way you do not need the long command as in the previous section.
set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH% set XDG_DATA_DIRS=c:/msys64/mingw64/share set PKG_CONFIG_PATH=c:/msys64/mingw64/lib/pkgconfig set HASKELL_GI_GIR_SEARCH_PATH=c:/msys64/mingw64/share/gir-1.0 cmd
File
C:\sr\config.yaml
contains following additional options(s)
skip-msys: true system-ghc: true
https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md