1 # Maintainer: Karolina Lindqvist <karolina.lindqvist@kramnet.se>
6 pkgdesc="PIC24/dsPIC30 gcc"
8 url="http://www.microchip.com"
9 depends=('pic30-binutils>=$pkgver')
12 source=(http://ww1.microchip.com/downloads/en/DeviceDoc/mplabc30v${pkgver/./_}.tar.gz
13 makefile_in.diff t-pic30.diff
14 pic30-standard-prefix.diff resource-path.diff cpp-defaults.diff
15 version.diff resource.diff patches.diff docs.diff flag_definitions.diff
19 cd $srcdir/gcc-4.0.2/gcc-4.0.2/
21 find . -type f -exec dos2unix -U "{}" ';' || return 1
22 find $srcdir/c30_resource/src/c30/ -type f -exec dos2unix -U "{}" ';' || return 1
23 find $srcdir/c30_resource/src/generator/ -type f -exec dos2unix -U "{}" ';' || return 1
26 # patch -p0 -b < ../../pic30-standard-prefix.diff || return 1
27 patch -p0 -b < ../../t-pic30.diff || return 1
28 patch -p0 -b < ../../resource-path.diff || return 1
29 patch -p0 -b < ../../makefile_in.diff || return 1
30 # patch -p0 -b < ../../bug.diff || return 1
31 patch -p0 -b < ../../patches.diff || return 1
32 patch -p0 -b < ../../docs.diff || return 1
33 patch -b -p0 < ../../version.diff || return 1
34 patch -b -p0 < ../../cpp-defaults.diff || return 1
35 patch -b -p0 < ../../configure.diff || return 1
36 (cd $srcdir && patch -b -p0 < resource.diff || return 1)
37 (cd $srcdir && patch -b -p0 < flag_definitions.diff || return 1)
40 (cd libiberty && autoreconf)
45 # We need to regenerate ./configure for libiberty
46 # (cd libiberty && aclocal -I .. && autoconf )
50 echo "#define MCHP_VERSION \"v$pkgver for Arch Linux\"" >../gcc/mchp_version.h
51 # echo version_string = \"$pkgver\" > ./version-trigger
52 findCPP="/usr/bin/cpp" ../configure --prefix=/usr -exec-prefix=/usr/pic30 -bindir=/usr/bin --target=pic30-elf --enable-languages=c --mandir=/usr/share/man --libexecdir=/usr/lib/ --includedir=/usr/pic30/include --program-prefix=pic30- --enable-target-optspace --without-headers --program-transform-name='s,pic30-pic30-,pic30-,' --with-cross-host=pic30 --libdir=/usr/pic30/lib --infodir=/usr/share/info|| return 1
54 # --program-transform-name='s,pic30-pic30-,pic30-,'
55 # --with-headers=/usr/pic30/include
56 # --with-gnu-as --with-as=pic30-as --with-gnu-ld --with-ld=pic30-ld
58 # -with-gcc-version-trigger=../version-trigger
61 sed -i '/^SUBDIRS =/s/libiberty//' Makefile
65 # make -C ../libiberty distclean
67 # ../../libiberty/configure --host=pic30 --libdir/usr/pic30/lib --includedir=/usr/pic30/include
71 make -w DESTDIR="$pkgdir/" install || return 1
72 # make -C libiberty -w DESTDIR="$pkgdir/" install || return 1
74 rm -fr $pkgdir/usr/share/locale $pkgdir/usr/share/man/man7/gpl.7 $pkgdir/usr/share/man/man7/gfdl.7 $pkgdir/usr/share/man/man7/fsf-funding.7
75 # rm -fr $pkgdir/usr/info
77 # Despite all the above, things do not end up in the right places
78 # and with the right names. So we fix it up here
79 # mkdir $pkgdir/usr/pic30/lib
80 # rmdir $pkgdir/usr/pic30-elf/lib
81 # rmdir $pkgdir/usr/pic30-elf
82 # mv $pkgdir/usr/lib/libiberty.a $pkgdir/usr/pic30/lib
83 # ln -t $pkgdir/usr/pic30/include $pkgdir/usr/lib/gcc/pic30-elf/include/*.h
84 # ln -t $pkgdir/usr/pic30/lib $pkgdir/usr/lib/gcc/pic30-elf/*.a
85 # rm $pkgdir/usr/bin/pic30-elf-gcc-
86 install -m 0755 -d $pkgdir/usr/include
87 for f in float.h iso646.h stdarg.h stdbool.h stddef.h varargs.h; do \
88 mv $pkgdir/usr/pic30/lib/gcc/pic30-elf/4.0.3/include/$f $pkgdir/usr/pic30/include; \
90 # Pick up the gcc limits file before junk was added
91 install -m644 $srcdir/gcc-4.0.2/gcc-4.0.2/gcc/glimits.h $pkgdir/usr/pic30/include/limits.h
92 # rm -fr $pkgdir/usr/pic30/lib/gcc
93 install -m 0755 -d $pkgdir/usr/bin
94 # ln $pkgdir/usr/lib/gcc/pic30-elf/pic30-cc1 $pkgdir/usr/bin
96 # Remove libiberty built for host
97 rm $pkgdir/usr/pic30/pic30-elf/lib/libiberty.a
98 # Remove info-files that are in gcc
99 rm $pkgdir/usr/share/info/*
101 # rm -fr $pkgdir/usr/pic30/lib/gcc/pic30-elf
103 md5sums=('9daf896854afa227f71070f7b6983d09'
104 '478893528f6e763f1b593666c8f1fc07'
105 'c30eb5a197ead2b3ec61181faf8c1a6b'
106 '6f0e9458822e7c2ce0a680611de29e27'
107 '6f7024857c852feb22004bfa91d6189a'
108 '3d699ccc6fd7613e0f171c4791e27a53'
109 '8ec322ba83c0c67968b81e989e014ee4'
110 'f4315e861e6ac3cc7a768c74ebb559fa'
111 '0fb9a218f2912478a7d12038db081d99'
112 '1584397be4c3924153ca2e21719fc4d4'
113 'd020613e7257fda69bf7dd94c2480bba'
114 '327506067389f6252ad7c544fad05061')