Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite build system for new versions and Heroku stacks #14

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions Dockerfile

This file was deleted.

38 changes: 25 additions & 13 deletions Makefile
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-14

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cedar-14 isn't deprecated, can just remove this comment

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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This uses Docker to build against Heroku
[stack-image](https://github.com/heroku/stack-images)-like images.

```bash
make
make VERSION=5.0.1
```

Artifacts will be dropped in `dist/`. See `Dockerfile`s for build options.
Artifacts will be dropped in `dist/` based on Heroku stack and jemalloc version.
17 changes: 17 additions & 0 deletions build.sh
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 .