Skip to content

Instantly share code, notes, and snippets.

@alexanderkjeldaas
Created May 22, 2018 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexanderkjeldaas/4e7418db7cf8536e38dce983eaf77d51 to your computer and use it in GitHub Desktop.
Save alexanderkjeldaas/4e7418db7cf8536e38dce983eaf77d51 to your computer and use it in GitHub Desktop.
ghcjs-8.4 with stack.
#!/bin/bash
docker build -t tmp-ghcjs .
echo "Copying ghcjs.tar.gz file from the docker image."
docker run --rm tmp-ghcjs cat /opt/ghcjs.tar.gz > ghcjs.tar.gz
FROM ubuntu:16.04
## ensure locale is set during build
ENV LANG C.UTF-8
## Haskell environment
RUN echo 'deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main' > \
/etc/apt/sources.list.d/ghc.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6F88286 && \
apt-get update && \
apt-get install -y --no-install-recommends \
cabal-install-2.2 \
ghc-8.4.2 \
happy-1.19.5 \
alex-3.1.7 \
zlib1g-dev \
libtinfo-dev \
libsqlite3-0 \
libsqlite3-dev \
ca-certificates \
build-essential \
libgmp-dev \
autoconf \
automake \
curl \
g++ \
python3 \
git
ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/bin:/opt/ghc/8.4.2/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.7/bin:$PATH
## node.js
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get install -y nodejs
## build GHCJS
WORKDIR /opt
RUN cabal update
RUN git clone https://github.com/alexanderkjeldaas/ghcjs.git && \
cd ghcjs && \
git checkout ghc-8.4 && \
git submodule update --init --recursive
RUN cd ghcjs && ./utils/makePackages.sh -j8
RUN tar cf ghcjs.tar ghcjs && gzip --fast ghcjs.tar
resolver: nightly-2018-05-10
packages:
- location: '.'
compiler: ghcjs-0.2.0.9011009_ghc-8.4.1
setup-info:
ghcjs:
source:
ghcjs-0.2.0.9011009_ghc-8.4.1:
url: /opt/ghcjs.tar.gz
@RobertFischer
Copy link

This is really great, but where can I find the appropriate compiler name when I do my own build of GHCJS?

@andrewthad
Copy link

I would also appreciate an answer to that question.

@neobrain
Copy link

@RobertFischer @andrewthad Any name is fine, it just needs to be consistent between the "compiler:" field and the "setup-info:" block.

@DoctorRyner
Copy link

Hm, it's weird, somehow it's much more confusing than usual, I don't get which version I should use to make it work

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for transformers-0.5.5.0:
    base-4.11.1.0 from stack configuration does not match (>=2 && <6) && <0 
needed due to ghcjs-8.4.0.1 -> transformers-0.5.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment