forked from mojodna/heroku-buildpack-jemalloc
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite build system for new versions and Heroku stacks
This allows new versions to be built for uploading by running `make VERSION=5.0.1` rather than updating the hard coded version in multiple places. I've also added support for building against either the legacy cedar-14 architecture or heroku-16. While versions built on cedar-14 appear to run on heroku-16, the newer stack should also mean a newer and better tool chain. I've removed the Dockerfile and switched to using Heroku's docker images directly as this removes the need for cleaning them up afterwards. It possibly makes debugging harder but having build.sh available should avoid some of that. Fixes #2 Fixes #7 Fixes #13
- Loading branch information
Showing
4 changed files
with
44 additions
and
26 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
default: dist/jemalloc-5.0.0-1.tar.gz | ||
default: heroku-16 cedar | ||
|
||
dist/jemalloc-5.0.0-1.tar.gz: jemalloc-cedar | ||
docker cp $<:/tmp/jemalloc-cedar.tar.gz . | ||
mkdir -p $$(dirname $@) | ||
mv jemalloc-cedar.tar.gz $@ | ||
VERSION := 5.0.1 | ||
ROOT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
clean: | ||
rm -rf src/ dist/ | ||
-docker rm jemalloc-cedar | ||
|
||
src/jemalloc.tar.bz2: | ||
# Download missing source archives to ./src/ | ||
src/jemalloc-%.tar.bz2: | ||
mkdir -p $$(dirname $@) | ||
curl -sL https://github.com/jemalloc/jemalloc/releases/download/5.0.0/jemalloc-5.0.0.tar.bz2 -o $@ | ||
curl -fsL https://github.com/jemalloc/jemalloc/releases/download/$*/jemalloc-$*.tar.bz2 -o $@ | ||
|
||
.PHONY: cedar-14 heroku-16 | ||
|
||
# Build for cedar stack (deprecated) | ||
cedar-14: src/jemalloc-$(VERSION).tar.bz2 | ||
docker run -it --volume="$(ROOT_DIR):/wrk" \ | ||
heroku/cedar:14 /wrk/build.sh $(VERSION) cedar-14 | ||
|
||
.PHONY: jemalloc-cedar | ||
# Build for heroku-16 stack | ||
heroku-16: src/jemalloc-$(VERSION).tar.bz2 | ||
docker run -it --volume="$(ROOT_DIR):/wrk" \ | ||
heroku/heroku:16-build /wrk/build.sh $(VERSION) heroku-16 | ||
|
||
jemalloc-cedar: src/jemalloc.tar.bz2 | ||
docker build --rm -t mojodna/$@ . | ||
-docker rm $@ | ||
docker run --name $@ mojodna/$@ /bin/echo $@ | ||
# Build recent releases for heroku-16 and cedar | ||
all: | ||
$(MAKE) cedar-14 VERSION=3.6.0 | ||
$(MAKE) cedar-14 VERSION=4.5.0 | ||
$(MAKE) cedar-14 VERSION=5.0.1 | ||
$(MAKE) heroku-16 VERSION=3.6.0 | ||
$(MAKE) heroku-16 VERSION=4.5.0 | ||
$(MAKE) heroku-16 VERSION=5.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
# usage: build [version] [stack] | ||
set -e | ||
|
||
version=$1 | ||
stack=$2 | ||
build=`mktemp -d` | ||
|
||
tar -C $build --strip-components=1 -xj -f /wrk/src/jemalloc-$version.tar.bz2 | ||
|
||
cd $build | ||
./configure --prefix=/app/vendor/jemalloc | ||
make install_bin install_include install_lib_shared install_lib_static | ||
|
||
# Bundle and compress the compiled library | ||
mkdir -p /wrk/dist/$stack | ||
tar -C /app/vendor/jemalloc -zc -f /wrk/dist/$stack/jemalloc-$version.tar.gz . |