#!/usr/bin/make -f include /usr/share/cdbs/1/rules/debhelper.mk package = mingw-w32-gcc target = i686-w64-mingw32 crt_xargs=--disable-lib64 --enable-lib32 prefix=/usr sysroot=$(prefix)/$(target) DESTDIR = $(shell /bin/pwd)/debian/$(package) docdir = debian/$(package)/usr/share/doc/$(package) DEB_INSTALL_DOCS_ALL := gcc/COPYING DEB_SHLIBDEPS_INCLUDE := debian/$(package)/usr/bin/$(target)-gcc DEB_DH_ALWAYS_EXCLUDE := .svn # do not strip anything. # call 'strip' on a mingw lib*.a file causes the ranlib information to # be discarded rendering the libraries useless. DEB_DH_STRIP_ARGS := -Xlib INSTALL_PROGRAM = install common-build-arch:: rm -rf debian/$(package) mkdir -p debian/$(package)$(sysroot)/mingw cd debian/$(package)$(sysroot)/mingw && ln -s $(sysroot)/mingw/include include rm -rf gcc/build mkdir gcc/build cd gcc/build && ../configure --disable-multilib --target=$(target) --prefix=$(prefix) --with-sysroot=$(sysroot) --with-build-sysroot=$(DESTDIR)$(sysroot) --datadir=$(sysroot)/share --mandir=$(sysroot)/share/man --infodir=$(sysroot)/share/info cd gcc/build && make all-gcc cd gcc/build && make DESTDIR=$(DESTDIR) install-gcc rm -rf mingw-w64-crt/build mkdir mingw-w64-crt/build cd mingw-w64-crt/build && CC="$(DESTDIR)/usr/bin/$(target)-gcc -B/usr/$(target)/bin -B$(DESTDIR)/usr/libexec/gcc" CXX="$(DESTDIR)/usr/bin/$(target)-g++ -B/usr/$(target)/bin -B$(DESTDIR)/usr/libexec/gcc" ../configure --host=$(target) --prefix=$(prefix) --with-sysroot=$(sysroot) --datarootdir=$(sysroot)/share $(crt_xargs) cd mingw-w64-crt/build && make cd mingw-w64-crt/build && make DESTDIR=$(DESTDIR) install rm -f gcc/winsup cd gcc && ln -s $(DESTDIR)$(sysroot) winsup rm -f gcc/build/$(target)/winsup mkdir -p gcc/build/$(target)/winsup cd gcc/build/$(target)/winsup && ln -s $(DESTDIR)$(sysroot)/lib mingw cd gcc/build/gcc && for file in $(DESTDIR)$(sysroot)/lib/*.o $(DESTDIR)$(sysroot)/lib/lib*.a; do test ! -e `basename $file` && ln -s $$file .; done cd gcc/build && make all touch common-build-arch clean:: rm -f compile common-install-arch common-build-arch rm -rf *~ debian/$(package) debian/*~ debian/files* debian/substvars debian/compat rm -rf gcc/build rm -rf mingw-w64-crt/build rm -f gcc/winsup # # info pages, locale data and man pages are in /usr/$(target)/share # static helper libraries for host system (libiberty.a) are deleted # common-install-arch:: cd gcc/build && make DESTDIR=$(DESTDIR) install mkdir -p debian/$(package)$(sysroot)/bin mv debian/$(package)$(sysroot)/lib32/libgcc_s_sjlj-1.dll debian/$(package)$(sysroot)/bin rm -f debian/$(package)$(sysroot)/mingw/include rm -rf debian/$(package)/usr/lib/lib*.a touch common-install-arch