Makefile.mingw 4.3 KB
Newer Older
David Schulz's avatar
David Schulz committed
1
2
broot=${PWD}
source=${broot}/source
3
targets=arm-none-linux-gnueabi i686-pc-mingw32
David Schulz's avatar
David Schulz committed
4
5
6
staging=${broot}/staging
pyversion=2.7
pydir=${broot}/python
7
expatversion=2.1.0
David Schulz's avatar
David Schulz committed
8
iconvversion=1.14
Orgad Shaneh's avatar
Orgad Shaneh committed
9
version=7.7.1
David Schulz's avatar
David Schulz committed
10
11
targetdir=${broot}/qtcreator-gdb-${version}
gdbtargets=$(addprefix ${targetdir}/gdb-, ${targets})
Orgad Shaneh's avatar
Orgad Shaneh committed
12
packageparts=${targetdir}/lib ${targetdir}/data-directory ${targetdir}/libiconv-2.dll ${targetdir}/python27.dll ${targetdir}/libexpat-1.dll
David Schulz's avatar
David Schulz committed
13
14
15
16
17
18
19
20
21
22
23
24
arch=`uname -sm | sed 's/ /-/g' | tr A-Z a-z`
packagename=qtcreator-gdb-${version}-${arch}.tar.gz

all: package

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

distclean:
	rm -rf ${staging} ${source} ${broot}/qtcreator-gdb-*

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

maketargetdir:
Orgad Shaneh's avatar
Orgad Shaneh committed
28
	@test -e ${targetdir} || mkdir ${targetdir}
David Schulz's avatar
David Schulz committed
29
30

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

33
34
35
36
37
checkunzip:
	unzip -v &> /dev/null || mingw-get install msys-unzip

${source}/python.zip: | makesourcedir checkwget
	cd ${source} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
38
	echo "Downloading python..." && \
39
	wget -q http://download.qt-project.org/development_releases/prebuilt/gdb/build-prerequisites/python.zip && \
40
41
42
43
	touch python.zip

${broot}/python/python.exe: ${source}/python.zip | checkunzip
	cd ${broot} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
44
45
46
	echo "Extracting python..." && \
	unzip -oq ${source}/python.zip && \
	touch python/python.exe
47

David Schulz's avatar
David Schulz committed
48
checkwget:
49
	wget -V &> /dev/null || mingw-get install msys-wget-bin
David Schulz's avatar
David Schulz committed
50
51
52

${source}/gdb-${version}.tar.bz2: | makesourcedir checkwget
	cd ${source} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
53
54
55
	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
56
57
58
59
	touch gdb-${version}.tar.bz2

${source}/libiconv-${iconvversion}.tar.gz: | makesourcedir checkwget
	cd ${source} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
60
61
	echo "Downloading iconv..." && \
	wget -q http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${iconvversion}.tar.gz  && \
David Schulz's avatar
David Schulz committed
62
63
64
	touch ${source}/libiconv-${iconvversion}.tar.gz

${source}/expat-${expatversion}.tar.gz: | makesourcedir checkwget
Orgad Shaneh's avatar
Orgad Shaneh committed
65
66
67
	cd ${source} && \
	echo "Downloading expat..." && \
	wget -q http://sourceforge.net/projects/expat/files/expat/${expatversion}/expat-${expatversion}.tar.gz/download && \
David Schulz's avatar
David Schulz committed
68
69
70
71
	touch ${source}/expat-${expatversion}.tar.gz

${staging}/gdb-${version}/configure: ${source}/gdb-${version}.tar.bz2 | makestagingdir
	cd ${staging} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
72
73
	echo "Extracting gdb..." && \
	tar xf ${source}/gdb-${version}.tar.bz2 && \
David Schulz's avatar
David Schulz committed
74
	cd gdb-${version} && \
hjk's avatar
hjk committed
75
	touch configure
David Schulz's avatar
David Schulz committed
76
77
78

${staging}/lib/libiconv.a: ${source}/libiconv-${iconvversion}.tar.gz | makestagingdir
	cd ${staging} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
79
80
	echo "Extracting iconv..." && \
	tar xf ${source}/libiconv-${iconvversion}.tar.gz && \
David Schulz's avatar
David Schulz committed
81
	cd libiconv-${iconvversion} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
82
	./configure -prefix=${staging} --enable-static --build=i686-pc-mingw32 && \
David Schulz's avatar
David Schulz committed
83
84
85
86
	${MAKE} && ${MAKE} install

${staging}/lib/libexpat.a: ${source}/expat-${expatversion}.tar.gz | makestagingdir
	cd ${staging} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
87
88
	echo "Extracting expat..." && \
	tar xf ${source}/expat-${expatversion}.tar.gz && \
David Schulz's avatar
David Schulz committed
89
	cd expat-${expatversion} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
90
	./configure -prefix=${staging} --enable-static --build=i686-pc-mingw32 && \
David Schulz's avatar
David Schulz committed
91
92
	${MAKE} && ${MAKE} install

93
${gdbtargets}: ${targetdir}/gdb-%: ${staging}/lib/libexpat.a ${staging}/lib/libiconv.a ${staging}/gdb-${version}/configure | maketargetdir ${broot}/python/python.exe
David Schulz's avatar
David Schulz committed
94
95
96
97
98
	test -e ${staging}/gdb-${version}-$* || mkdir ${staging}/gdb-${version}-$*
	export PYTHONHOME=${pydir} && \
	LDFLAGS="L${pydir} -lpthread -ldl -lutil -lpython27" && \
	CFLAGS="-I${pydir}/include" && \
	cd ${staging}/gdb-${version}-$* && \
Orgad Shaneh's avatar
Orgad Shaneh committed
99
	${staging}/gdb-${version}/configure --target=$* --disable-nls --disable-werror --build=i686-pc-mingw32 \
David Schulz's avatar
David Schulz committed
100
101
	--with-libiconv-prefix=${staging} \
	--with-expat --with-libexpat-prefix=${staging} \
102
	--with-separate-debug-dir="" \
Orgad Shaneh's avatar
Orgad Shaneh committed
103
104
105
	--with-python=${pydir} && \
	${MAKE} MAKEFLAGS+= -j1 && \
	strip -o ${targetdir}/gdb-$*.exe gdb/gdb.exe
David Schulz's avatar
David Schulz committed
106

107
package: ${gdbtargets} ${broot}/python/python.exe
David Schulz's avatar
David Schulz committed
108
109
110
111
	cp ${staging}/bin/libiconv* ${targetdir} && \
	cp ${staging}/bin/libexpat* ${targetdir} && \
	cp ${pydir}/python*.dll ${targetdir} && \
	cp -r ${pydir}/lib ${targetdir} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
112
113
	mkdir -p ${targetdir}/data-directory && \
	cp -r ${staging}/gdb-${version}-i686-pc-mingw32/gdb/data-directory/{python,syscalls} ${targetdir}/data-directory && \
David Schulz's avatar
David Schulz committed
114
	mv ${targetdir} ${targetdir}-${arch} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
115
116
	echo "Packing..." && \
	tar czf ${packagename} qtcreator-gdb-${version}-${arch} && \
David Schulz's avatar
David Schulz committed
117
	mv ${targetdir}-${arch} ${targetdir}