git.iko.soy/heroku-buildpack-stack
on master help sign in
Merge pull request #19 from aaronshim/master

Adding Makefile functionality

commitc330c899e73465f9ec9617433254f3076b8bfbe0 authorMark Fine <mark.fine@gmail.com> dateSat 25 Mar 2017, 09:56 (10 years ago) parent25be72fab4ad1b
2 files changed+16−3
README.md+6 bin/compile+10−3
README.md+6
@@ -35,6 +35,12 @@ before compilation, the `stack.yaml` will be substituted as follows:
3535 -location:
3636 git: https://mfine:abc123@github.com/mfine/heroku-buildpack-stack.git
3737
38+
39+### Makefile Support
40+This buildpack now supports an optional Makefile, in case you need to coordinate other build steps with Stack. It assumes that the Makefile includes a `make install` target that uses the Stack build command with the flag `--copy-bins`. For example, a possible `install` target configuration in the Makefile could be:
41+
42+ install: stack build --copy-bins
43+
3844[1]: https://github.com/mfine/heroku-buildpack-stack
3945[2]: http://devcenter.heroku.com/articles/buildpacks
4046[3]: https://github.com/commercialhaskell/stack
bin/compile+10−3
@@ -93,8 +93,15 @@ fi
9393
9494speak "Running stack"
9595cd "$WORK_DIR"
96−stack setup
97−stack build --fast --copy-bins
96+# Makefile support (if you need other build tools than Stack that you need to use in conjunction)
97+if [ -f "$BUILD_DIR/Makefile" ]; then
98+ speak "Makefile detected"
99+ make -C "$BUILD_DIR"
100+ make -C "$BUILD_DIR" install
101+else
102+ stack setup
103+ stack build --fast --copy-bins
104+fi
98105
99106# Set context environment variables.
100107set-env PATH "$WORK_DIR/.local/bin:$PATH"
@@ -109,6 +116,6 @@ mv "$WORK_DIR/.local/bin" "$BUILD_DIR/.local"
109116
110117speak "Caching .stack-work"
111118rsync -avq "$WORK_DIR/.stack-work/" "$SANDBOX_DIR"
112−mv "$WORK_DIR/.stack-work" "$BUILD_DIR"
119+cp -Rp "$WORK_DIR/.stack-work" "$BUILD_DIR"
113120
114121speak "Finished!"