aboutsummaryrefslogtreecommitdiff
path: root/tools/darwin/depends/python26/Makefile.osx
blob: 80cd24f360128cc1e026ef0a24188990999d7f51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
include ../Makefile.include

# lib name, version
LIBNAME=Python
VERSION=2.6.5
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.bz2

# configuration settings
export OPT=$(CFLAGS)
CONFIGURE=./configure --prefix=$(PREFIX) --enable-shared \
  --disable-toolbox-glue --disable-framework --enable-unicode=ucs4 \
  --with-system-ffi

CONFIGURE_NATIVE= CFLAGS="" CXXFLAGS="" LDFLAGS="" CPPFLAGS="" \
  CPP="gcc -E" \
  CC="gcc" \
  CXX="g++" \
  LD="ld" \
  ./configure --prefix=$(TOOLCHAIN) --enable-shared --disable-toolbox-glue --disable-framework

LIBDYLIB=$(SOURCE)/libpython2.6.dylib

all: $(LIBDYLIB) .installed

$(TARBALLS_LOCATION)/$(ARCHIVE):
	$(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(LIBDYLIB): $(TARBALLS_LOCATION)/$(ARCHIVE)
	rm -rf $(SOURCE)
	$(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
	echo $(SOURCE) > .gitignore
	# http://bugs.python.org/issue6869
	cd $(SOURCE); patch -p1 < ../Python-2.6-ctypes.patch
	cd $(SOURCE); $(CONFIGURE_NATIVE)
	cd $(SOURCE); make -j $(MAKE_JOBS)
	cd $(SOURCE); make install
	cd $(SOURCE); make distclean
	sed -ie "s#/usr/include/ffi#$(PREFIX)/include/ffi#" $(SOURCE)/setup.py
	cd $(SOURCE); $(CONFIGURE)
	# python2.6 has an issue detecting and using the same version of openssl in configure and setup.py
	# this forces python2.6 hashlib to be compatible with osx 10.4 boxes.
	sed -ie "s|openssl_ver >= 0x00907000)|openssl_ver >= 0x00907000 and False)|" "$(SOURCE)/setup.py"
	sed -ie "s|(openssl_ver < 0x00908000)|(True or openssl_ver < 0x00908000)|" "$(SOURCE)/setup.py"
	cd $(SOURCE); make -j $(MAKE_JOBS)

.installed:
	cd $(SOURCE); make install
	find $(PREFIX)/lib/python2.6 -type f -name *.pyc -exec rm -f {} \;	
	find $(PREFIX)/lib/python2.6 -type f -name *.pyo -exec rm -f {} \;	
	touch $@

clean:
	rm -rf $(SOURCE) .installed

distclean::
	rm -rf $(SOURCE) .installed