Makefile.linux 3.47 KB
Newer Older
David Schulz's avatar
David Schulz committed
1
2
broot=${PWD}
source=${broot}/source
3
targets=x86_64-unknown-linux-gnu i686-unknown-linux-gnu arm-none-linux-gnueabi
David Schulz's avatar
David Schulz committed
4
5
staging=${broot}/staging
pyversion=2.7
6
expatversion=2.1.0
David Schulz's avatar
David Schulz committed
7
arch=`uname -sm | sed 's/ /-/g' | tr A-Z a-z`
Orgad Shaneh's avatar
Orgad Shaneh committed
8
version=7.7.1
David Schulz's avatar
David Schulz committed
9
10
11
12
13
14
15
16
17
18
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:
Orgad Shaneh's avatar
Orgad Shaneh committed
19
	@test -e ${source} || mkdir ${source}
David Schulz's avatar
David Schulz committed
20
21

maketargetdir:
Orgad Shaneh's avatar
Orgad Shaneh committed
22
	@test -e ${targetdir} || mkdir ${targetdir}
David Schulz's avatar
David Schulz committed
23
24

makestagingdir:
Orgad Shaneh's avatar
Orgad Shaneh committed
25
	@test -e ${staging} || mkdir ${staging}
David Schulz's avatar
David Schulz committed
26
27

${source}/expat-${expatversion}.tar.gz: | makesourcedir
Orgad Shaneh's avatar
Orgad Shaneh committed
28
29
30
	cd ${source} && \
	echo "Downloading expat..." && \
	wget -q http://sourceforge.net/projects/expat/files/expat/${expatversion}/expat-${expatversion}.tar.gz && \
David Schulz's avatar
David Schulz committed
31
32
33
	touch ${source}/expat-${expatversion}.tar.gz

${source}/Python-${pyversion}.tgz: | makesourcedir
Orgad Shaneh's avatar
Orgad Shaneh committed
34
35
36
	cd ${source} && \
	echo "Downloading python..." && \
	wget -q http://www.python.org/ftp/python/${pyversion}/Python-${pyversion}.tgz && \
David Schulz's avatar
David Schulz committed
37
38
39
	touch ${source}/Python-${pyversion}.tgz

${source}/gdb-${version}.tar.bz2: | makesourcedir
Orgad Shaneh's avatar
Orgad Shaneh committed
40
41
42
43
	cd ${source} && \
	echo "Downloading gdb..." && \
	wget -q http://ftp.gnu.org/gnu/gdb/gdb-${version}.tar.bz2 || \
	wget -Oq gdb-${version}.tar.bz2 http://ftp.gnu.org/gnu/gdb/gdb-${version}a.tar.bz2 && \
David Schulz's avatar
David Schulz committed
44
45
46
	touch gdb-*.tar.bz2

${staging}/lib/libexpat.a: ${source}/expat-${expatversion}.tar.gz | makestagingdir
Orgad Shaneh's avatar
Orgad Shaneh committed
47
48
49
	cd ${staging} && \
	echo "Extracting expat..." && \
	tar xf ${source}/expat-${expatversion}.tar.gz && cd expat-${expatversion} && \
David Schulz's avatar
David Schulz committed
50
51
52
	./configure --disable-shared -prefix=${staging} && ${MAKE} && ${MAKE} install

${staging}/lib/libpython${pyversion}.a: ${source}/Python-${pyversion}.tgz | makestagingdir
Orgad Shaneh's avatar
Orgad Shaneh committed
53
54
55
56
	unset PYTHONHOME && cd ${staging} && \
	echo "Extracting python..." && \
	tar xf ${source}/Python-${pyversion}.tgz && \
	cd Python-${pyversion} && \
David Schulz's avatar
David Schulz committed
57
58
59
60
61
62
63
64
65
	export LDFLAGS="-pthread -lm" && \
	./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} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
66
67
	echo "Extracting gdb..." && \
	tar xf ${source}/gdb-${version}.tar.bz2 && \
David Schulz's avatar
David Schulz committed
68
	cd gdb-${version} && \
hjk's avatar
hjk committed
69
	touch configure
David Schulz's avatar
David Schulz committed
70
71
72
73
74

${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" && \
75
	export LDFLAGS="-Wl,--no-as-needed -pthread -lm" && \
David Schulz's avatar
David Schulz committed
76
	cd ${staging}/gdb-${version}-$* && \
77
78
	${staging}/gdb-${version}/configure --disable-nls --target=$* --with-separate-debug-dir="" \
	--disable-werror --with-python=${staging} --with-libexpat-prefix=${staging} && \
David Schulz's avatar
David Schulz committed
79
80
	sleep 3 && \
	${MAKE} MAKEFLAGS+=-j1 && \
Orgad Shaneh's avatar
Orgad Shaneh committed
81
	strip -o ${targetdir}/gdb-$* gdb/gdb
David Schulz's avatar
David Schulz committed
82

David Schulz's avatar
David Schulz committed
83
package: ${gdbtargets} ${targetdir}/python/include/python${pyversion}/pyconfig.h
David Schulz's avatar
David Schulz committed
84
	mv ${targetdir} ${targetdir}-${arch}
Orgad Shaneh's avatar
Orgad Shaneh committed
85
86
	echo "Packing..."
	tar czf ${packagename} qtcreator-gdb-${version}-${arch}
David Schulz's avatar
David Schulz committed
87
	mv ${targetdir}-${arch} ${targetdir}