summaryrefslogtreecommitdiff
path: root/dist/gdb/Makefile.osx
blob: 6f257079179860977f5968eb7f3279e077849317 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
broot=${PWD}
source=${broot}/source
targets=x86_64-unknown-linux-gnu i686-unknown-linux-gnu arm-none-linux-gnueabi x86_64-apple-darwin10
staging=${broot}/staging
pyversion=2.7
expatversion=2.1.0
arch=`uname -sm | sed 's/ /-/g' | tr A-Z a-z`
version=7.7.1
targetdir=${broot}/qtcreator-gdb-${version}
gdbtargets=$(addprefix ${targetdir}/gdb-, ${targets})
packagename=qtcreator-gdb-${version}-${arch}.tar.gz

all:package

clean:
	rm -rf  ${broot}/qtcreator-gdb-* ${staging}/gdb-* qtcreator-gdb-*.tar.gz

makesourcedir:
	@test -e ${source} || mkdir ${source}

maketargetdir:
	@test -e ${targetdir} || mkdir ${targetdir}

makestagingdir:
	@test -e ${staging} || mkdir ${staging}

${source}/expat-${expatversion}.tar.gz: | makesourcedir
	cd ${source} && \
	echo "Downloading expat..." && \
	curl -LsOf http://sourceforge.net/projects/expat/files/expat/${expatversion}/expat-${expatversion}.tar.gz && \
	touch ${source}/expat-${expatversion}.tar.gz

${source}/Python-${pyversion}.tgz: | makesourcedir
	cd ${source} && \
	echo "Downloading python..." && \
	curl -Osf http://www.python.org/ftp/python/${pyversion}/Python-${pyversion}.tgz && \
	touch ${source}/Python-${pyversion}.tgz

${source}/gdb-${version}.tar.bz2: | makesourcedir
	cd ${source} && \
	echo "Downloading gdb..." && \
	curl -Osf http://ftp.gnu.org/gnu/gdb/gdb-${version}.tar.bz2 || \
	curl -osf gdb-${version}.tar.bz2 http://ftp.gnu.org/gnu/gdb/gdb-${version}a.tar.bz2 && \
	touch gdb-*.tar.bz2

${staging}/lib/libexpat.a: ${source}/expat-${expatversion}.tar.gz | makestagingdir
	cd ${staging} && \
	echo "Extracting expat..." && \
	tar xf ${source}/expat-${expatversion}.tar.gz && cd expat-${expatversion} && \
	./configure --disable-shared -prefix=${staging} && ${MAKE} && ${MAKE} install

${staging}/lib/libpython${pyversion}.a: ${source}/Python-${pyversion}.tgz | makestagingdir
	unset PYTHONHOME && \
	cd ${staging} && \
	echo "Extracting python..." && \
	tar xf ${source}/Python-${pyversion}.tgz && cd Python-${pyversion} && \
	./configure --prefix=${staging} && ${MAKE} && ${MAKE} install

${targetdir}/python/include/python${pyversion}/pyconfig.h: ${staging}/lib/libpython${pyversion}.a | maketargetdir
	mkdir -p ${targetdir}/python/lib && cp -a ${staging}/lib/python${pyversion} ${targetdir}/python/lib/
	mkdir -p ${targetdir}/python/include/python${pyversion} && cp ${staging}/include/python${pyversion}/pyconfig.h ${targetdir}/python/include/python${pyversion}/

${staging}/gdb-${version}/configure: ${source}/gdb-${version}.tar.bz2 | makestagingdir
	cd ${staging} && \
	echo "Extracting gdb..." && \
	tar xf ${source}/gdb-${version}.tar.bz2 && \
	cd gdb-${version} && \
	touch configure

${gdbtargets}: ${targetdir}/gdb-%: ${staging}/gdb-${version}/configure ${staging}/lib/libpython${pyversion}.a ${staging}/lib/libexpat.a | maketargetdir
	test -e ${staging}/gdb-${version}-$* || mkdir ${staging}/gdb-${version}-$*
	export PYTHONHOME=${staging} && \
	export PATH="${staging}/bin/:$$PATH" && \
	cd ${staging}/gdb-${version}-$* && \
	${staging}/gdb-${version}/configure --disable-nls --target=$* --with-separate-debug-dir="" \
        --disable-werror --with-python=${staging} --with-libexpat-prefix=${staging} && \
	${MAKE} MAKEFLAGS+=-j1 && \
	strip -o ${targetdir}/gdb-$* gdb/gdb

package: ${gdbtargets} ${targetdir}/python/include/python${pyversion}/pyconfig.h
	mv ${targetdir} ${targetdir}-${arch}
	echo "Packing..."
	tar czf ${packagename} qtcreator-gdb-${version}-${arch}
	mv ${targetdir}-${arch} ${targetdir}