2022-05-04 11:22:53 +03:00
# Compile a graphql-engine executable using brew and ghc-8.10.7
2021-11-24 12:58:10 +03:00
1. Install ghc-8.10.7 and cabal-install via ghcup
2. Install dependencies:
```sh
brew install google-cloud-sdk
brew install node@14
brew install openssl
brew install pcre
brew install unixodbc
brew install libpq
brew install mysql-client@5.7
brew install libffi
brew install llvm@11
2022-01-21 14:20:52 +03:00
brew install mssql-tools
2021-11-24 12:58:10 +03:00
```
And add them to your environment:
```sh
echo 'export PATH="/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/node@14/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/mysql-client@5.7/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/llvm@11/bin:$PATH"' >> ~/.zshrc
```
3. Install console assets
2022-04-18 11:14:01 +03:00
This step may require you to have python2 installed and available in your $PATH.
2021-11-24 12:58:10 +03:00
```sh
cd console
npm ci
npm run server-build
cd ..
```
4. Install python
```sh
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
2022-04-18 11:14:01 +03:00
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
2021-11-24 12:58:10 +03:00
cd server
python3 -m venv .python-venv
source .python-venv/bin/activate
pip3 install -r tests-py/requirements.txt
(cd tests-py/remote_schemas/nodejs & & npm ci)
```
2022-04-07 10:15:11 +03:00
5. Add the C dependencies in the `cabal/dev-sh.project.local` and `cabal.project.local` files (according to where the dependencies were installed by homebrew):
2021-11-24 12:58:10 +03:00
```sh
package mysql
extra-include-dirs:
/opt/homebrew/opt/openssl/include
/opt/homebrew/opt/mysql-client@5.7/include
extra-lib-dirs:
/opt/homebrew/opt/openssl/lib
/opt/homebrew/opt/mysql-client@5.7/lib
package odbc
extra-include-dirs: /opt/homebrew/opt/unixodbc/include
extra-lib-dirs: /opt/homebrew/opt/unixodbc/lib
package pcre-light
extra-include-dirs: /opt/homebrew/opt/pcre/include
extra-lib-dirs: /opt/homebrew/opt/pcre/lib
package postgresql-libpq
extra-include-dirs:
/opt/homebrew/opt/libpq/include
/opt/homebrew/opt/openssl/include
extra-lib-dirs:
/opt/homebrew/opt/libpq/lib
/opt/homebrew/opt/openssl/lib
package pg-client
extra-include-dirs:
/opt/homebrew/opt/libpq/include
/opt/homebrew/opt/openssl/include
extra-lib-dirs:
/opt/homebrew/opt/libpq/lib
/opt/homebrew/opt/openssl/lib
```
2022-04-07 10:15:11 +03:00
Note: If you have not added any local project overrides in `cabal.project.local` you can just add a symbolic link to `cabal/dev-sh.project.local` :
2021-11-24 12:58:10 +03:00
```sh
2022-04-07 10:15:11 +03:00
ln -s cabal/dev-sh.project.local cabal.project.local
2021-11-24 12:58:10 +03:00
```
6. Building the server should now work:
```sh
cabal v2-update
cabal v2-build graphql-engine -j4
```