e9adea1a716f55f9a21c82dfdc0f51d56320ee2c
[zope-bootstrap.git] / Makefile.master
1 # -*- makefile -*-
2
3 PYTHON_VERSION ?= 2.4.6
4 PYTHON_URL     ?= http://www.python.org/ftp/python/$(PYTHON_VERSION)/Python-$(PYTHON_VERSION).tgz
5 SETUPTOOLS_URL ?= http://peak.telecommunity.com/dist/ez_setup.py
6 PIL_VERSION    ?= 1.1.6
7 PIL_URL        ?= http://effbot.org/downloads/Imaging-$(PIL_VERSION).tar.gz
8
9 ###########################################################################
10
11 PYTHON_DIR=python
12 BASEDIR=$(shell pwd)
13
14 PYTHON       = $(BASEDIR)/$(PYTHON_DIR)/bin/python
15 EASY_INSTALL = $(BASEDIR)/$(PYTHON_DIR)/bin/easy_install
16 PASTER       = $(BASEDIR)/$(PYTHON_DIR)/bin/paster
17
18 default: update-nonet
19
20 debdepends:
21         aptitude install build-essential zlibc libjpeg62-dev libfreetype6-dev
22
23 .PHONY: default debdepends python-unpack python-build python-rebuild python-clean python \
24         setuptools eggs pil-unpack pil-build pil-rebuild pil-clean pil buildout bootstrap \
25         update update-nonet shell init otherinit
26
27 python-unpack: $(PYTHON_DIR)/Python-$(PYTHON_VERSION)/README
28 $(PYTHON_DIR)/Python-$(PYTHON_VERSION)/README:
29         mkdir $(PYTHON_DIR)
30         wget "$(PYTHON_URL)" -O $(PYTHON_DIR)/python.tgz
31         tar -C $(PYTHON_DIR) -xzf $(PYTHON_DIR)/python.tgz
32         rm -f $(PYTHON_DIR)/python.tgz
33
34 python-build: $(PYTHON)
35 $(PYTHON):
36         cd $(PYTHON_DIR)/Python-$(PYTHON_VERSION) && ./configure --prefix=$(BASEDIR)/$(PYTHON_DIR)
37         cd $(PYTHON_DIR)/Python-$(PYTHON_VERSION) && make
38         cd $(PYTHON_DIR)/Python-$(PYTHON_VERSION) && make install
39
40 python-rebuild: python-clean python-build
41
42 python-clean:
43         cd $(PYTHON_DIR)/Python-$(PYTHON_VERSION) && make clean
44         rm -f $(PYTHON)
45
46 python: python-unpack python-build
47
48 setuptools: $(EASY_INSTALL)
49 $(EASY_INSTALL):
50         mkdir $(PYTHON_DIR)/Extensions
51         wget $(SETUPTOOLS_URL) -O $(PYTHON_DIR)/Extensions/ez_setup.py
52         cd $(PYTHON_DIR)/Extensions && $(PYTHON) ez_setup.py
53
54 eggs:
55         $(EASY_INSTALL) ZopeSkel
56         $(EASY_INSTALL) zc.buildout
57
58 pil-unpack: $(PYTHON_DIR)/Extensions/Imaging-$(PIL_VERSION)/README
59 $(PYTHON_DIR)/Extensions/Imaging-$(PIL_VERSION)/README:
60         wget $(PIL_URL) -O $(PYTHON_DIR)/Extensions/pil.tgz
61         tar -C $(PYTHON_DIR)/Extensions -xzf $(PYTHON_DIR)/Extensions/pil.tgz
62         rm -f $(PYTHON_DIR)/Extensions/pil.tgz
63
64 pil-build: $(PYTHON_DIR)/bin/pilconvert.py
65 $(PYTHON_DIR)/bin/pilconvert.py:
66         cd $(PYTHON_DIR)/Extensions/Imaging-$(PIL_VERSION) && $(PYTHON) setup.py build --force
67         cd $(PYTHON_DIR)/Extensions/Imaging-$(PIL_VERSION) && $(PYTHON) setup.py install --force
68
69 pil-rebuild: pil-clean pil-build
70
71 pil-clean:
72         rm -f $(PYTHON_DIR)/bin/pilconvert.py
73
74 pil: pil-unpack pil-build
75
76 buildout: buildout.cfg
77 buildout.cfg:
78         $(PASTER) create --no-interactive -t plone3_buildout . zope_password=admin
79
80 bootstrap: 
81         sed -i -e '1s/^#!.*\/python/#!$(subst /,\/,$(PYTHON))/' $(PYTHON_DIR)/bin/*
82         $(PYTHON) bootstrap.py
83
84 .gitignore:
85         @echo "python/" >.gitignore
86         @echo "var/" >>.gitignore
87         @echo "bin/" >>.gitignore
88         @echo "develop-eggs/" >>.gitignore
89         @echo "downloads/" >>.gitignore
90         @echo "eggs/" >>.gitignore
91         @echo "fake-eggs/" >>.gitignore
92         @echo "parts/" >>.gitignore
93         @echo "/.installed.cfg" >>.gitignore
94         @echo "*.pyc" >>.gitignore
95
96 shell:
97         @PATH=$(BASEDIR)/$(PYTHON_DIR)/bin:$(BASEDIR)/bin:$$PATH $$SHELL
98
99 init: python setuptools pil eggs buildout otherinit otherupdate bootstrap update .gitignore
100
101 otherinit::
102
103 otherupdate::
104
105 update: otherupdate
106         bin/buildout
107
108 update-nonet: otherupdate
109         bin/buildout -No