1# ThreadScope 2 3[![Hackage](https://img.shields.io/hackage/v/threadscope.svg)](https://hackage.haskell.org/package/threadscope) 4[![Hackage-Deps](https://img.shields.io/hackage-deps/v/threadscope.svg)](http://packdeps.haskellers.com/feed?needle=threadscope) 5[![Build Status](https://travis-ci.org/haskell/ThreadScope.svg?branch=master)](https://travis-ci.org/haskell/ThreadScope) 6[![Build status](https://ci.appveyor.com/api/projects/status/tiwkb7k6p38dde03/branch/master?svg=true)](https://ci.appveyor.com/project/maoe/threadscope-44t6e/branch/master) 7 8## Using pre-built binaries 9 10Currently [pre-built binaries](https://github.com/haskell/ThreadScope/releases) for the following platforms are provided: 11 12* Ubuntu Trusty (64-bit) 13* macOS (XCode 11) 14* Windows (x64) 15 16GTK+2 needs to be installed for those binaries to work. 17 18On Windows, the [MSYS2](http://www.msys2.org) is the recommended way to install GTK+2. In MSYS2 MINGW64 shell: 19 20```sh 21pacman -S $MINGW_PACKAGE_PREFIX-gtk2 22``` 23 24then you can run the threadscope binary from the shell. 25 26## Building from source 27 28Use `git clone` or `cabal unpack threadscope` to get the source and move into the threadscope directory. 29 30### Linux 31 32GTK+2 is required to be installed. On Ubuntu-like systems: 33 34```sh 35sudo apt install libgtk2.0-dev 36``` 37 38Then you can build threadscope using cabal: 39 40```sh 41cabal v2-build # to only build the project, or 42cabal v2-install # to build and install the binary 43``` 44 45Or using stack: 46 47```sh 48stack build # to only build the project, or 49stack install # to build and install the binary 50``` 51 52### OS X 53 54GTK+ and GCC 9 are required: 55 56```sh 57brew install gtk+ gcc@9 58``` 59 60Then you can build threadscope using cabal: 61 62```sh 63cabal --project-file=cabal.project.osx v2-build # to only build the project, or 64cabal --project-file=cabal.project.osx v2-install # to build and install the binary 65``` 66 67Or using stack: 68 69```sh 70stack --stack-yaml=stack.osx.yaml build # to only build the project, or 71stack --stack-yaml=stack.osx.yaml install # to install the binary 72``` 73 74### Windows 75 76[Chocolatey](https://chocolatey.org/) can be used to install GHC and [MSYS2](https://www.msys2.org/) is the recommended way to install GTK+. 77 78```sh 79choco install ghc 80refreshenv 81set PATH=C:\\msys64\\mingw64\\bin;C:\\msys64\\usr\\bin;%PATH% 82pacman -Sy mingw-w64-x86_64-gtk2 83``` 84 85then you can build threadscope using cabal: 86 87```sh 88cabal v2-build 89``` 90 91Or you can use stack instead. 92 93CAVEAT: gtk2 needs to be installed twice: one for stack's MSYS2 environment and another for local MSYS2 environment. 94 95In command prompt: 96 97```sh 98stack setup 99stack exec -- pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime msys2-runtime-devel 100stack exec -- pacman -Syu 101stack exec -- pacman -Syuu 102stack exec -- pacman -S base-devel mingw-w64-x86_64-pkg-config mingw-w64-x86_64-toolchain mingw-w64-x86_64-gtk2 103stack install 104``` 105 106Then in MSYS2 MINGW64 shell: 107 108```sh 109pacman -S $MINGW_PACKAGE_PREFIX-gtk2 110echo 'export PATH=$APPDATA/local/bin:$PATH' >> .profile 111source .profile 112threadscope 113``` 114 115Building using stack is not tested in CI. If you find any issues with building with stack, please update the instructions and send a PR. 116