Last active
December 28, 2015 19:49
-
-
Save dblackdblack/7552428 to your computer and use it in GitHub Desktop.
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
################################################# | |
# Makefile for bepress-pythonz deb package | |
# | |
# pythonz (https://github.com/saghul/pythonz) is the python equivalent of perlbrew | |
# (there is also a 'pythonbrew' package, but it is unmaintained, which is why | |
# pythonz was forked from pythonbrew) | |
# | |
# This package contains an installed copy of pythonz with a pre-compiled (for | |
# amd64) copy of python 3.3.2. It installs into /opt/bepress/pythonz. | |
# Python 3.3.2 ends up in /opt/bepress/pythonz/pythons/CPython-3.3.2 | |
# You can create a virtualenv using this python by running | |
# /opt/bepress/pythonz/pythons/CPython-3.3.2/bin/pyvenv | |
# (note that the virtualenv module that ships with python 3.3 does not set up | |
# easy_install or pip for you. To install pip, you first need to download and | |
# run https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py which | |
# installs easy_install. Then, run 'easy_install pip' to install pip | |
# | |
# To build the package, just type "make". It'll tell you it created a filename | |
# something like "bepress-setuid-svstat-1.20110524-4_all.deb". | |
# | |
# A Debian package consists of three files in an 'ar' archive: | |
# | |
# - debian-binary | |
# - data.tar.gz | |
# - control.tar.gz | |
# | |
# The first is just the number "2.0". | |
# | |
# The second is the contents of the "data", so if you have data/var/lib/foo it'll | |
# be installed into /var/lib/foo. | |
# | |
# The third are the files in control/: one file called "control" and then any/all of the four | |
# maintainer scripts preinst, postinst, prerm, postrm as described here: | |
# http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html | |
# | |
################################################# | |
# BUILD_NUM is for when you are generating more than one version in a day | |
BUILD_NUM := 1 | |
VERSION := 1.$(shell date +%Y%m%d)-$(BUILD_NUM) | |
# ARCHITECTURE should almost certainly be either 'all' or 'amd64' | |
ARCHITECTURE := amd64 | |
DEBFILE := bepress-pythonz-$(VERSION)_$(ARCHITECTURE).deb | |
# ******************** | |
# 'PHONY' targets get executed independently of whether a file of that name exists | |
.PHONY: fakeroot unique-build-num data-tar control-tar install package | |
# ******************** | |
# .DEFAULT gets run when you type "make" without arguments | |
.DEFAULT=package | |
# ******************** | |
# here's the default target, it builds the .deb file | |
package: unique-build-num control-tar data-tar | |
/usr/bin/ar rc $(DEBFILE) debian-binary data.tar.gz control.tar.gz | |
@echo . | |
@echo . | |
@echo "****" | |
@echo "**** Created $(DEBFILE) *****" | |
@echo "****" | |
@echo "****" | |
@echo "**** You can copy that to /usr/bepress/debs" | |
@echo "**** and arrange for data_update.pl to install it." | |
@echo "****" | |
@echo . | |
install: | |
dpkg -i $(DEBFILE) | |
control-tar: fakeroot | |
# no tabs in description field: http://kambing.ui.ac.id/bebas/v04/org/vlsm/sangam/share/Debian-Doc/debian-policy/ch-controlfields.html#s-f-Description | |
perl -pi -e 's/\t/ /' control/control | |
perl -pi -e 's/^Version: .*/Version: 1:$(VERSION)/' control/control | |
/usr/bin/fakeroot -- tar --exclude-vcs -C control -czvf control.tar.gz . | |
data-tar: fakeroot | |
/usr/bin/fakeroot -- tar --exclude-vcs -C data -czvf data.tar.gz . | |
unique-build-num: | |
@if [ -e $(DEBFILE) ] ; \ | |
then \ | |
echo "It looks like you already built $(DEBFILE) today, please increment BUILD_NUM in this Makefile"; \ | |
/bin/false; \ | |
fi | |
fakeroot: | |
@if [ ! -e /usr/bin/fakeroot ] ; \ | |
then \ | |
echo "*** You need the fakeroot package to build this, do 'sudo apt-get install fakeroot'" ;\ | |
/bin/false ; \ | |
fi | |
clean: | |
rm *.gz | |
rm *.deb | |
svn revert control/control |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment