Skip to content

Instantly share code, notes, and snippets.

@nicferrier
Created August 6, 2013 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicferrier/6164586 to your computer and use it in GitHub Desktop.
Save nicferrier/6164586 to your computer and use it in GitHub Desktop.
commit c91974d5afc8216e4cc87435eaff3bf950074092 (HEAD, refs/remotes/nictest/build-dist, refs/remotes/nicsoundcloud/build-dist, refs/heads/build-dist)
Author: Nic Ferrier <nferrier@ferrier.me.uk>
Date: Wed Jul 31 17:12:35 2013 +0100
add a dist target to the Makefile to build a tarball.
Modified .pkgignore
diff --git a/.pkgignore b/.pkgignore
index 139b42b..be41456 100644
--- a/.pkgignore
+++ b/.pkgignore
@@ -1,3 +1,6 @@
+*~*
+*.tgz
+*.tar
*.swp
.build
.bzr.log
Modified Makefile
diff --git a/Makefile b/Makefile
index 2ce77c3..2d1b998 100644
--- a/Makefile
+++ b/Makefile
@@ -111,6 +111,21 @@ tmp/$(STITCH_CDC_JAR): tmp tmp/$(STITCH_CDC_ARTIFACT)
tmp/$(STITCH_CDC_ARTIFACT):
(cd tmp; curl -O $(STITCH_CDC_ARTIFACT_URI))
+# This does not build a usable tarball but it's useful for checking
+# the tarball creation works
+dist-noassets: REVISION
+ tar -cf /tmp/soundcloud-$(shell cat REVISION).tar -X .pkgignore .
+ mkdir -p ../soundcloud-$(shell cat REVISION)
+ tar -C ../soundcloud-$(shell cat REVISION) -xf /tmp/soundcloud-$(shell cat REVISION).tar
+ tar -C .. -czf ../soundcloud-$(shell cat REVISION).tgz soundcloud-$(shell cat REVISION)
+
+# Builds a distribution tarball
+dist: build
+ tar -cf /tmp/soundcloud-$(shell cat REVISION).tar -X .pkgignore .
+ mkdir -p ../soundcloud-$(shell cat REVISION)
+ tar -C ../soundcloud-$(shell cat REVISION) -xf /tmp/soundcloud-$(shell cat REVISION).tar
+ tar -C .. -czf ../soundcloud-$(shell cat REVISION).tgz soundcloud-$(shell cat REVISION)
+
build: REVISION public/REVISION assets
@@ -123,23 +138,26 @@ assets: bundle
bin/bundle:
GEM_HOME=$(GEM_HOME) PATH=$(PREFIX)/bin:$(PATH) gem install bundler --bindir=./bin --no-ri --no-rdoc
-Gemfile.lock: Gemfile
- RAILS_ENV=development DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) GEM_HOME=$(GEM_HOME) bin/bundle --no-deployment --binstubs --path=$(GEM_HOME)
-bundle: Gemfile.lock bin/bundle hacks setenv db/geoip-city.db $(PREFIX)/bin/geoiplookup $(PREFIX)/lib/libsasl2.la $(PREFIX)/lib/libmysqlclient.a $(PREFIX)/bin/memcached
- # make vendored gems use the vendored c-libs
+# make vendored gems use the vendored c-libs
+bundlestuff:
GEM_HOME=$(GEM_HOME) PATH=$(PREFIX)/bin:$(PATH) bin/bundle config build.cdamian-geoip_city --with-geoip-dir=$(PREFIX)
GEM_HOME=$(GEM_HOME) PATH=$(PREFIX)/bin:$(PATH) bin/bundle config build.geoip --with-geoip-dir=$(PREFIX)
GEM_HOME=$(GEM_HOME) PATH=$(PREFIX)/bin:$(PATH) bin/bundle config build.jberkel-mysql-ruby --with-mysql-dir=$(PREFIX)
-
- # some bundler versions are incapable of quoting multi-value env vars correctly which is why we have to add the following setting by hand :(
- # ... setting is for libsasl, i.e. not necessary on mac (see below)
+ # some bundler versions are incapable of quoting multi-value
+ # env vars correctly which is why we have to add the following
+ # setting by hand
+ #
+ # setting is for libsasl, i.e. not necessary on mac (see below)
$(MAC) || { echo "BUNDLE_BUILD__MEMCACHED: \" --with-ldflags=-L$(PREFIX)/lib --with-cflags='-DLIBMEMCACHED_WITH_SASL_SUPPORT -L$(PREFIX)/lib -I$(PREFIX)/include'\"" >> .bundle/config; }
- # use normal bundle for development and 'deployment' mode otherwise
- test "$(RAILS_ENV)" != "development" || RAILS_ENV=$(RAILS_ENV) DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) GEM_HOME=$(GEM_HOME) PATH=$(PREFIX)/bin:$(PATH) bin/bundle install --binstubs --path=$(GEM_HOME)
- test "$(RAILS_ENV)" = "development" || RAILS_ENV=$(RAILS_ENV) DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) GEM_HOME=$(GEM_HOME) PATH=$(PREFIX)/bin:$(PATH) bin/bundle install --deployment --path=$(GEM_HOME) --binstubs --without test development deploy selenium cucumber
+Gemfile.lock: Gemfile bundlestuff
+ RAILS_ENV=development DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) GEM_HOME=$(GEM_HOME) bin/bundle --no-deployment --binstubs --path=$(GEM_HOME)
+bundle: Gemfile.lock bin/bundle hacks setenv db/geoip-city.db $(PREFIX)/bin/geoiplookup $(PREFIX)/lib/libsasl2.la $(PREFIX)/lib/libmysqlclient.a $(PREFIX)/bin/memcached
+ # use normal bundle for development and 'deployment' mode otherwise
+ test "$(RAILS_ENV)" != "development" || RAILS_ENV=$(RAILS_ENV) DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) GEM_HOME=$(GEM_HOME) bin/bundle install --binstubs --path=$(GEM_HOME)
+ test "$(RAILS_ENV)" = "development" || RAILS_ENV=$(RAILS_ENV) DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) GEM_HOME=$(GEM_HOME) bin/bundle install --deployment --path=$(GEM_HOME) --binstubs --without test development deploy selenium cucumber
@echo ""
@echo "All dependencies are installed."
@echo "In order to start ruby commands, use the provided wrapper script to use the vendored dependencies:"
@@ -495,4 +513,4 @@ $(DESTDIR)/usr/bin/nginx: $(BUILD_TIME_ARTIFACTS)/$(NGINX)/objs/Makefile
# - setenv as it is not only dependent on setenv.in but as well on env vars
# - assets: for now as we don't have the dependencies correctly listed
# - *REVISION: no real good dependency statement possible (would be .git/$(cat .git/HEAD) ... that does not work though)
-.PHONY: setenv assets bundle REVISION public/REVISION
+.PHONY: setenv assets bundle REVISION public/REVISION bundlestuff dist dist-noassets
[back]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment