Makefile.mingw 4.31 KB
Newer Older
David Schulz's avatar
David Schulz committed
1 2
broot=${PWD}
source=${broot}/source
Orgad Shaneh's avatar
Orgad Shaneh committed
3
targets=arm-none-eabi,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.1
David Schulz's avatar
David Schulz committed
8
iconvversion=1.14
Orgad Shaneh's avatar
Orgad Shaneh committed
9
version=7.12
David Schulz's avatar
David Schulz committed
10
targetdir=${broot}/qtcreator-gdb-${version}
Orgad Shaneh's avatar
Orgad Shaneh committed
11
packageparts=${targetdir}/lib ${targetdir}/data-directory ${targetdir}/libiconv-2.dll ${targetdir}/python27.dll ${targetdir}/libexpat-1.dll
David Schulz's avatar
David Schulz committed
12 13 14 15 16 17 18 19 20 21 22 23
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
24
	@test -e ${source} || mkdir ${source}
David Schulz's avatar
David Schulz committed
25 26

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

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

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

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

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

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

Orgad Shaneh's avatar
Orgad Shaneh committed
50
${source}/gdb-${version}.tar.xz: | makesourcedir checkwget
David Schulz's avatar
David Schulz committed
51
	cd ${source} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
52
	echo "Downloading gdb..." && \
Orgad Shaneh's avatar
Orgad Shaneh committed
53 54 55
	wget -q http://ftp.gnu.org/gnu/gdb/gdb-${version}.tar.xz || \
	wget -Oq gdb-${version}.tar.xz http://ftp.gnu.org/gnu/gdb/gdb-${version}a.tar.xz && \
	touch gdb-${version}.tar.xz
David Schulz's avatar
David Schulz committed
56 57 58

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

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

Orgad Shaneh's avatar
Orgad Shaneh committed
69
${staging}/gdb-${version}/configure: ${source}/gdb-${version}.tar.xz | makestagingdir
David Schulz's avatar
David Schulz committed
70
	cd ${staging} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
71
	echo "Extracting gdb..." && \
Orgad Shaneh's avatar
Orgad Shaneh committed
72
	tar xf ${source}/gdb-${version}.tar.xz && \
David Schulz's avatar
David Schulz committed
73
	cd gdb-${version} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
74 75
	touch configure && \
	patch -p1 < ${broot}/patches/mingw-python.patch
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
	${MAKE} && ${MAKE} install

85
${staging}/lib/libexpat.a: ${source}/expat-${expatversion}.tar.bz2 | makestagingdir
David Schulz's avatar
David Schulz committed
86
	cd ${staging} && \
Orgad Shaneh's avatar
Orgad Shaneh committed
87
	echo "Extracting expat..." && \
88
	tar xf ${source}/expat-${expatversion}.tar.bz2 && \
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

Orgad Shaneh's avatar
Orgad Shaneh committed
93 94
${targetdir}/gdb.exe: ${staging}/lib/libexpat.a ${staging}/lib/libiconv.a ${staging}/gdb-${version}/configure | maketargetdir ${broot}/python/python.exe
	test -e ${staging}/gdb-${version}-build || mkdir ${staging}/gdb-${version}-build
David Schulz's avatar
David Schulz committed
95 96 97
	export PYTHONHOME=${pydir} && \
	LDFLAGS="L${pydir} -lpthread -ldl -lutil -lpython27" && \
	CFLAGS="-I${pydir}/include" && \
Orgad Shaneh's avatar
Orgad Shaneh committed
98 99
	cd ${staging}/gdb-${version}-build && \
	${staging}/gdb-${version}/configure --enable-targets=${targets} --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

Orgad Shaneh's avatar
Orgad Shaneh committed
107
package: ${targetdir}/gdb.exe ${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
	mkdir -p ${targetdir}/data-directory && \
Orgad Shaneh's avatar
Orgad Shaneh committed
113
	cp -r ${staging}/gdb-${version}-build/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}