Skip to content

Commit

Permalink
Build odenc manually in Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Oskar Wickström committed Jan 15, 2016
1 parent b8092e9 commit d4862ab
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
FROM haskell:7.10

RUN apt-get update && apt-get install make
RUN apt-get update && apt-get install -y make wget

RUN cabal update

WORKDIR /tmp
RUN wget https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf go1.5.2.linux-amd64.tar.gz
ENV PATH $PATH:/usr/local/go/bin

WORKDIR /src/oden
ADD oden.cabal /src/oden/

Expand Down
26 changes: 21 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ OS=$(shell tools/get_os.sh)
DIST_NAME=oden-$(VERSION)-$(OS)
DIST_ARCHIVE=dist/$(DIST_NAME).tar.gz

IMPORTER_SRC=$(shell find go/src/oden/importer -name '*.go')
IMPORTER_SRC=$(shell find go/src/oden -name '*.go')

NODEMON=node_modules/.bin/nodemon

.PHONY: build
build: dist/go-lib/importer.a
cabal build
build: dist/build/libHSoden-0.2.0-GciwqqWdZXOA5DC5lRnLx5.a

dist/build/libHSoden-0.2.0-GciwqqWdZXOA5DC5lRnLx5.a: dist/go-lib/importer.a
cabal build oden

dist/go-lib/importer.a: $(IMPORTER_SRC)
mkdir -p dist/go-lib
Expand Down Expand Up @@ -43,8 +45,22 @@ init-dev:
cabal install --enable-tests --only-dependencies
cabal configure --enable-tests

dist/build/odenc/odenc:
cabal build odenc
dist/build/odenc/odenc: dist/build/libHSoden-0.2.0-GciwqqWdZXOA5DC5lRnLx5.a
mkdir -p dist/build/odenc
ghc \
-package-db .cabal-sandbox/*-packages.conf.d \
--make \
-odir dist/mytmp \
-hidir dist/mytmp/ \
-isrc/odenc \
-isrc/oden \
dist/build/libHSoden-0.2.0-*.a \
src/odenc/Main.hs \
dist/build/autogen/Paths_oden.hs dist/go-lib/importer.a \
-fPIC \
-static \
-threaded \
-o dist/build/odenc/odenc

dist/oden: dist/build/odenc/odenc
@mkdir -p dist/oden/bin
Expand Down
3 changes: 1 addition & 2 deletions oden.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ library
Oden.Type.Polymorphic
default-language: Haskell2010
hs-source-dirs: src/oden
ghc-options: -optc-O dist/go-lib/importer.a -Wall
ghc-options: -fPIC -Wall dist/go-lib/importer.a

executable odenc
build-depends:
Expand All @@ -72,7 +72,6 @@ executable odenc
default-language: Haskell2010
main-is: Main.hs
hs-source-dirs: src/odenc
ghc-options: -optc-O dist/go-lib/importer.a

test-suite spec
type: exitcode-stdio-1.0
Expand Down

0 comments on commit d4862ab

Please sign in to comment.