forked from jasonkajita/chipKIT-cxx-build
-
Notifications
You must be signed in to change notification settings - Fork 4
/
chipKIT-cxx-build.sh
executable file
·1835 lines (1479 loc) · 95.7 KB
/
chipKIT-cxx-build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
MCHP_RESOURCE=A
MCHP_VERSION=1.30
MCHP_RESOURCE="\'${MCHP_RESOURCE}\'"
export MCHP_VERSION
export MCHP_RESOURCE
##############
SUPPORT_HOSTED_LIBSTDCXX="--disable-hosted-libstdcxx"
SUPPORT_SJLJ_EXCEPTIONS="--enable-sjlj-exceptions"
NEWLIB_CONFIGURE_FLAGS="--target=pic32mx --enable-target-optspace --disable-threads --enable-static --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --disable-hosted-libstdcxx --with-arch=pic32mx --enable-sgxx-sde-multilib --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-shared --disable-nls --with-dwarf2 --disable-bootstrap --enable-obsolete --enable-sjlj-exceptions --disable-__cxa_atexit --disable-libfortran --with-bugurl=http://chipkit.org/forum --disable-libgomp --disable-libffi --program-prefix=pic32- --with-newlib --enable-newlib-io-long-long --disable-newlib-multithread --disable-libgloss --disable-newlib-supplied-syscalls --disable-nls --disable-libunwind-exceptions --enable-libstdcxx-allocator=malloc --disable-newlib-atexit-alloc --disable-libstdcxx-verbose -enable-lto --enable-fixed-point --enable-obsolete --disable-sim --disable-checking"
GCC_CONFIGURE_FLAGS="--enable-target-optspace --disable-libunwind-exceptions --enable-sjlj-exceptions --enable-libstdcxx-allocator=malloc --disable-hosted-libstdcxx --target=pic32mx --enable-target-optspace --program-prefix=pic32- --disable-threads --disable-libmudflap --disable-libssp --enable-sgxx-sde-multilibs --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-shared --enable-static --with-newlib --disable-nls --disable-libgomp --without-headers --disable-libffi --disable-bootstrap --disable-decimal-float --disable-libquadmath --disable-__cxa_atexit --disable-libfortran --disable-libstdcxx-pch --with-dwarf2 --disable-libstdcxx-verbose --enable-poison-system-directories --enable-lto --enable-fixed-point --enable-obsolete --disable-sim --disable-checking --disable-gofast --with-bugurl=http://www.chipkit.net/forum"
CXX_FLAGS_FOR_TARGET="-fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections -DSMALL_MEMORY -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET"
CFLAGS_FOR_TARGET="-G 0 -fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections -DSMALL_MEMORY -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET"
CCASFLAGS_FOR_TARGET="-G 0 -fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections -DSMALL_MEMORY -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET"
XGCC_FLAGS_FOR_TARGET="-G 0 -fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections -DSMALL_MEMORY -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET"
echo "$BASH_SOURCE START BUILD..."
# Figure out which MinGW compiler we have. Candidates are:
# i586-mingw32msvc-gcc (Ubuntu)
# i386-mingw32-gcc (Fedora)
if [ "x$MINGW32_HOST_PREFIX" == "x" ]; then
MINGW_GCC=`which i686-w64-mingw32-gcc`
if [ "x$MINGW_GCC" != "x" ] ; then
MINGW32_HOST_PREFIX=i686-w64-mingw32
else
MINGW32_HOST_PREFIX=i586-mingw32msvc
fi
unset MINGW_GCC
fi
if [ "x$ARMLINUX32_HOST_PREFIX" == "x" ]; then
unset ARMLINUX32_HOST_PREFIX
# ARMLINUX32_HOST_PREFIX=arm-none-linux-gnueabi
ARMLINUX32_HOST_PREFIX=arm-linux-gnueabi
fi
# Does notify-send exist?
if [ "x$NOTIFY_SEND" == "x" ] ; then
WHICH_NOTIFY_SEND=`which notify-send`
if [ "x$WHICH_NOTIFY_SEND" == "x" ] ; then
unset NOTIFY_SEND
else
NOTIFY_SEND=notify-send
fi
unset WHICH_NOTIFY_SEND
fi
# Does growlnotify exist?
if [ "x$GROWL_SEND" == "x" ] ; then
WHICH_GROWLSEND=`which growlnotify`
if [ "x$WHICH_GROWLSEND" == "x" ] ; then
unset GROWL_SEND
else
GROWL_SEND="growlnotify"
fi
unset WHICH_GROWLSEND
fi
DATE=`date +%Y%m%d`
TIME=`date +%H%M`
TVAL=master
BUILD=chipKIT-cxx
TAG=master
FULL_ONLY=no
CHECKOUT="yes"
SKIPLIBS=""
SKIPNATIVE=""
SKIPLINUX32=""
SKIPWIN32=""
SKIPARMLINUX=""
SKIPGRAPHITE="yes"
SKIPMULTIPLENEWLIB="yes"
SKIPPLIBIMAGE="yes"
NATIVEIMAGE=`uname`
NATIVEIMAGE+="-image"
echo "Native image is $NATIVEIMAGE"
NM_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-nm"
RANLIB_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ranlib"
STRIP_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-strip"
AR_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ar"
AS_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/as"
LD_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ld"
GCC_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-gcc"
CC_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-gcc"
CFLAGS="-Os -DCHIPKIT_PIC32"
show_usage()
{
# Shows the usage screen
echo "USAGE: $0 [-t <tag> | -?]"
echo " -b <tag> Specify the branch for which you would like to build"
echo " -t <tag> Specify the tag for which you would like to build"
echo " -N No svn checkout build only"
echo " -M OS X build only"
echo " -Q Show svn checkout (no quiet)"
echo " -? | -h Show this usage message"
exit 1
}
# Process the arguments
while getopts b:FMNt:Q:h\? opt
do
case "$opt" in
t)
TVAL=$OPTARG
TAG="$TVAL"
;;
b)
TVAL=$OPTARG
TAG="$TVAL"
BUILD=pic32-$TVAL-$DATE
;;
N)
echo "No checkout"
CHECKOUT="no"
;;
M)
echo "OS X build only"
SKIPLINUX32="yes"
SKIPWIN32="yes"
SKIPARMLINUX="yes"
;;
h | \?) show_usage ;;
esac
done
if [ "x$NATIVEIMAGE" != "xDarwin-image" ]; then
if [ "x$OSXONLY" == "xyes" ]; then
echo "Error: Cannot specify -M option on non-OSX host for now"
exit 1
fi
fi
# Avoid double-date build (YYYYMMDD-YYYYMMDD)
if [[ ${TVAL%%$DATE} = $TVAL ]]; then
BUILD=chipKIT-cxx-$TVAL
else
BUILD=chipKIT-cxx-$TVAL
fi
LOGFILE=`pwd`/$BUILD.log
WORKING_DIR=`pwd`/$BUILD
echo WORKING DIR $WORKING_DIR
####
# assert_success()
# If the first parameter is non-zero, print the second parameter
# and exit the script
####
function assert_success ()
{
local RESULT=$1
local MESSAGE=$2
if [ $RESULT != 0 ]
then
echo "$MESSAGE ($RESULT)"
if [ "x$GROWL_SEND" != "x" ] ; then
echo "$GROWL_SEND -s -p1 -t $BASH_SOURCE -m $MESSAGE"
$GROWL_SEND "-s" "-p1" "-t" "$BASH_SOURCE" "-m" "$MESSAGE"
elif [ "x$NOTIFY_SEND" != "x" ] ; then
$NOTIFY_SEND "$MESSAGE" "Build Error"
fi
echo "$MESSAGE ($RESULT)" >> $LOGFILE
unset GCC_FOR_TARGET
unset CC_FOR_TARGET
unset CXX_FOR_TARGET
unset GXX_FOR_TARGET
unset CPP_FOR_TARGET
unset CC_FOR_BUILD
unset CXX_FOR_BUILD
unset CC
unset CPP
unset CXX
unset LD
unset AR
exit $RESULT
fi
}
function status_update ()
{
local MESSAGE=$1
if [ "x$GROWL_SEND" != "x" ] ; then
$GROWL_SEND "-t" "$BASH_SOURCE:" "-m" "$MESSAGE"
elif [ "x$NOTIFY_SEND" != "x" ] ; then
$NOTIFY_SEND "$MESSAGE" "$BASH_SOURCE"
fi
echo `date` $MESSAGE >> $LOGFILE
}
### build_xc32_sh()
### $1 name of the directory
### $2 any extra arguments for the make
function build_xc32_sh()
{
mkdir -p "$1/pic32-tools/bin/bin"
XC32_SH_SRC=${WORKING_DIR}/pic30-sh
cd $XC32_SH_SRC/bin
echo `pwd`
#clean
#necessary since there isn't a separate build directory
# COMMAND="make clean"
make clean
make xc32 MACOS_DEVELOPERDIR="${DEVELOPERDIR}" $2
# COMMAND="make xc32 $2"
assert_success $? "Error building the XC32 shell"
#install
#No need to add the /bin for call below
export XC32_INSTALL="$1/pic32-tools"
# COMMAND="make chipkit-install $2"
make chipkit-install $2
assert_success $? "Error installing the XC32 shell"
unset XC32_INSTALL
cd $WORKING_DIR
}
function copy_device_files()
{
cp -R ../pic32-part-support/device-info-files/device_files pic32-tools/bin/device_files/
cp ../pic32-part-support/device-info-files/xc32_device.info pic32-tools/bin/
cp ../pic32-part-support/device-info-files/deviceSupport.xml pic32-tools/bin/
cp -R ../pic32-part-support/device-info-files/device_files pic32-tools/pic32mx/device_files/
cp ../pic32-part-support/device-info-files/xc32_device.info pic32-tools/pic32mx/
}
### Main script body
# Create the working directory
echo `date` " START PIC32 build." > $LOGFILE
echo `date` " Creating build in $WORKING_DIR..." >> $LOGFILE
if [ -e $WORKING_DIR ]
then
echo `date` " $WORKING_DIR already exists..." >> $LOGFILE
else
mkdir $WORKING_DIR
assert_success $? "ERROR: creating directory $WORKING_DIR"
fi
cd $WORKING_DIR
# Check out the source code
GITHUB_ACCOUNT=chipKIT32
GITHUB_CXX_ACCOUNT=chipKIT32
GITHUB_CXX_BRANCH=master
GIT_ROOT=https://api.github.com/repos/$GITHUB_ACCOUNT
GIT_PIC32_NEWLIB_REPO=https://api.github.com/repos/$GITHUB_ACCOUNT/pic32-newlib/tarball/master
GIT_CHIPKIT_CXX_REPO=https://api.github.com/repos/$GITHUB_CXX_ACCOUNT/chipKIT-cxx/tarball/$GITHUB_CXX_BRANCH
GIT_PIC32_PART_SUPPORT_REPO=$GIT_ROOT/pic32-part-support/tarball/master
GIT_PIC32_SH_REPO_ROOT=$GIT_ROOT/pic32-sh
GIT_PIC32_FDLIBM_REPO_ROOT=$GIT_ROOT/pic32-fdlibm
if [ "$CHECKOUT" = "yes" ]
then
echo "Downloading $GIT_PIC32_NEWLIB_REPO"
echo `date` " Downloading source from $GIT_PIC32_NEWLIB_REPO..." >> $LOGFILE
if [ -e pic32-newlib ]
then
rm -rf pic32-newlib
fi
curl -L $GIT_PIC32_NEWLIB_REPO | tar zx
assert_success $? "ERROR: Downloading source from $GIT_PIC32_NEWLIB_REPO"
mv *-pic32-newlib-* pic32-newlib
assert_success $? "Normalize pic32-newlib directory name"
fi
if [ "$CHECKOUT" = "yes" ]
then
echo "Downloading $GIT_PIC32_PART_SUPPORT_REPO."
echo `date` "Downloading part support from $GIT_PIC32_PART_SUPPORT_REPO..." >> $LOGFILE
if [ -e pic32-part-support ]
then
rm -rf pic32-part-support
fi
curl -L $GIT_PIC32_PART_SUPPORT_REPO | tar zx
assert_success $? "Downloading part support from $GIT_PIC32_PART_SUPPORT_REPO"
mv *-pic32-part-support-* pic32-part-support
assert_success $? "Normalize pic32-part-support directory name"
fi
if [ "$CHECKOUT" = "yes" ]
then
echo "Downloading $GIT_CHIPKIT_CXX_REPO."
echo `date` "Downloading compiler source from $GIT_CHIPKIT_CXX_REPO..." >> $LOGFILE
if [ -e chipKIT-cxx ]
then
rm -rf chipKIT-cxx
fi
curl -L $GIT_CHIPKIT_CXX_REPO | tar zx
assert_success $? "Downloading compiler source from $GIT_CHIPKIT_CXX_REPO"
mv *-chipKIT-cxx-* chipKIT-cxx
assert_success $? "Normalize chipKIT-cxx directory name"
fi
if [ "$CHECKOUT" = "yes" ]
then
echo "Downloading $GIT_PIC32_SH_REPO_ROOT"
echo `date` " Downloading source from $GIT_PIC32_SH_REPO_ROOT..."
if [ -e pic30-sh ]
then
rm -rf pic30-sh
fi
curl -L $GIT_PIC32_SH_REPO_ROOT/tarball/$TAG | tar zx
assert_success $? "ERROR: Downloading source from $GIT_PIC32_SH_REPO_ROOT"
mv *-pic32-sh-* pic30-sh
assert_success $? "Normalize pic32-sh directory name"
fi
if [ "$CHECKOUT" = "yes" ]
then
echo "Downloading $GIT_PIC32_FDLIBM_REPO_ROOT"
echo `date` " Downloading source from $GIT_PIC32_FDLIBM_REPO_ROOT..."
if [ -e fdlibm ]
then
rm -rf fdlibm
fi
curl -L $GIT_PIC32_FDLIBM_REPO_ROOT/tarball/$TAG | tar zx
assert_success $? "ERROR: Downloading source from $GIT_PIC32_FDLIBM_REPO_ROOT"
mv *-pic32-fdlibm-* fdlibm
assert_success $? "Normalize pic32-fdlibm directory name"
fi
if [ "x$NATIVEIMAGE" == "xDarwin-image" ]
then
LINUX32IMAGE="Linux32-image"
# Figure out which Linux compiler we have.
if [ "x$LINUX32_HOST_PREFIX" == "x" ]; then
LINUX_GCC=`which i586-pc-linux-gcc`
if [ "x$LINUX_GCC" == "x" ] ; then
LINUX32_HOST_PREFIX=i386-linux
else
LINUX32_HOST_PREFIX=i586-pc-linux
fi
unset LINUX_GCC
fi
BUILDMACHINE="--build=i686-apple-darwin10"
if [ -e "/Developer-old" ]
then
DEVELOPERDIR="/Developer-old"
else
DEVELOPERDIR="/Developer"
fi
if [ "x$SKIPNATIVE" == "x" ] ; then
HOSTMACHINE="--host=i686-apple-darwin10"
COMPATIBILITY_FLAGS="-isysroot $DEVELOPERDIR/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -m32 -arch i386 -I$DEVELOPERDIR/SDKs/MacOSX10.5.sdk/usr/include/malloc"
export CXX_FOR_BUILD="$DEVELOPERDIR/usr/bin/g++-4.2 $COMPATIBILITY_FLAGS"
export CC_FOR_BUILD="$DEVELOPERDIR/usr/bin/gcc-4.2 $COMPATIBILITY_FLAGS"
export CC="$DEVELOPERDIR/usr/bin/gcc-4.2 $COMPATIBILITY_FLAGS"
export CPP="$DEVELOPERDIR/usr/bin/cpp-4.2 $COMPATIBILITY_FLAGS"
export CXX="$DEVELOPERDIR/usr/bin/g++-4.2 $COMPATIBILITY_FLAGS"
export LD="$DEVELOPERDIR/usr/bin/gcc-4.2 $COMPATIBILITY_FLAGS"
export AR="$DEVELOPERDIR/usr/bin/ar"
# It's unclear what versions of MacOS need this, but probably
# anything after 2011.
export LDFLAGS="-Wl,-search_paths_first"
fi # SKIPNATIVE
LIBHOST=""
else
LINUX32IMAGE=""
LINUX32_HOST_PREFIX=""
HOSTMACHINE=""
BUILDMACHINE="--build=x86_64-pc-linux-gnu"
LIBHOST="--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
export CC_FOR_BUILD="/usr/bin/gcc -m32 -march=i386"
export CXX_FOR_BUILD="/usr/bin/g++ -m32 -march=i386"
export CPP_FOR_BUILD="/usr/bin/cpp -m32 -march=i386"
export CC="/usr/bin/gcc -m32 -march=i386"
export CPP="/usr/bin/cpp -m32 -march=i386"
export CPPCXX="/usr/bin/cpp -m32 -march=i386"
export CXX="/usr/bin/g++ -m32 -march=i386"
export LD="/usr/bin/g++ -m32 -march=i386"
export AR="/usr/bin/ar"
fi
cd pic32-part-support
# Install headers into cross compiler's install image directory
echo "Making library headers for cross-compiler"
echo `date` "Making library headers for cross compiler's install image..." >> $LOGFILE
echo "make DESTROOT=\"$WORKING_DIR/$NATIVEIMAGE/pic32-tools\" install-headers"
make DESTROOT="$WORKING_DIR/$NATIVEIMAGE/pic32-tools" install-headers
assert_success $? "ERROR: Making headers into cross compiler's $NATIVEIMAGE install image directory"
if [ "x$LINUX32IMAGE" != "x" ] ; then
echo "make DESTROOT=\"$WORKING_DIR/$LINUX32IMAGE/pic32-tools\" install-headers"
make DESTROOT="$WORKING_DIR/$LINUX32IMAGE/pic32-tools" install-headers
assert_success $? "ERROR: Making headers into cross compiler's $LINUXIMAGE install image directory"
fi
echo "make DESTROOT=\"$WORKING_DIR/export-image/pic32-tools\" install-headers"
make DESTROOT="$WORKING_DIR/export-image/pic32-tools" install-headers
assert_success $? "ERROR: Making headers into cross compiler's export-image install image directory"
echo "make DESTROOT=\"$WORKING_DIR/win32-image/pic32-tools\" install-headers"
make DESTROOT="$WORKING_DIR/win32-image/pic32-tools" install-headers
assert_success $? "ERROR: Making headers into cross compiler's win32-image install image directory"
echo "make DESTROOT=\"$WORKING_DIR/arm-linux-image/pic32-tools\" install-headers"
make DESTROOT="$WORKING_DIR/arm-linux-image/pic32-tools" install-headers
assert_success $? "ERROR: Making headers into cross compiler's arm-linux-image install image directory"
# if [ "x$LINUX32IMAGE" != "x" ]; then
# make DESTROOT="$WORKING_DIR/$LINUX32IMAGE" install-headers
# assert_success $? "ERROR: Making headers into cross compiler's $LINUX32IMAGE install image directory"
# fi
# Install fdlibm headers
cd $WORKING_DIR/fdlibm/src/xc32
echo "Making fdlibm headers for cross-compiler"
echo `date` "Making fdlibm library headers for cross compiler's install image..." >> $LOGFILE
echo "make DESTROOT=\"$WORKING_DIR/$NATIVEIMAGE/pic32-tools\" install-headers"
make DESTROOT="$WORKING_DIR/$NATIVEIMAGE/pic32-tools" install-headers
assert_success $? "ERROR: Making headers into cross compiler's $NATIVEIMAGE install image directory"
if [ "x$LINUX32IMAGE" != "x" ] ; then
echo "make DESTROOT=\"$WORKING_DIR/$LINUX32IMAGE/pic32-tools\" install-headers"
make DESTROOT="$WORKING_DIR/$LINUX32IMAGE/pic32-tools" install-headers
assert_success $? "ERROR: Making headers into cross compiler's $LINUXIMAGE install image directory"
fi
echo "make DESTROOT=\"$WORKING_DIR/export-image/pic32-tools\" install-headers"
make DESTROOT="$WORKING_DIR/export-image/pic32-tools" install-headers
assert_success $? "ERROR: Making headers into cross compiler's export-image install image directory"
echo "make DESTROOT=\"$WORKING_DIR/win32-image/pic32-tools\" install-headers"
make DESTROOT="$WORKING_DIR/win32-image/pic32-tools" install-headers
assert_success $? "ERROR: Making headers into cross compiler's win32-image install image directory"
echo "make DESTROOT=\"$WORKING_DIR/arm-linux-image/pic32-tools\" install-headers"
make DESTROOT="$WORKING_DIR/arm-linux-image/pic32-tools" install-headers
assert_success $? "ERROR: Making headers into cross compiler's arm-linux-image install image directory"
cd $WORKING_DIR
if [ "x$SKIPNATIVE" == "x" ] ; then
build_xc32_sh "$WORKING_DIR/$NATIVEIMAGE"
# Build native cross compiler
echo `date` " Creating cross build in $WORKING_DIR/native-build..." >> $LOGFILE
status_update "Beginning native pic32 build"
if [ -e native-build ]
then
rm -rf native-build
fi
mkdir native-build
assert_success $? "ERROR: creating directory $WORKING_DIR/native-build"
cd native-build
if [ -e binutils ]
then
rm -rf binutils
fi
mkdir binutils
assert_success $? "ERROR: creating directory $WORKING_DIR/native-build/binutils"
cd binutils
# Configure cross binutils
echo `date` " Configuring cross binutils build in $WORKING_DIR/native-build..." >> $LOGFILE
../../chipKIT-cxx/src48x/binutils/configure $HOSTMACHINE --target=pic32mx --prefix="$WORKING_DIR/$NATIVEIMAGE/pic32-tools" --bindir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" --libexecdir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" --disable-nls --disable-tui --disable-gdbtk --disable-shared --enable-static --disable-threads --disable-bootstrap --with-dwarf2 --enable-multilib --without-newlib --disable-sim --with-lib-path=: --enable-poison-system-directories --program-prefix=pic32- --with-bugurl=http://chipkit.net/forum/ --disable-werror
assert_success $? "ERROR: configuring cross binutils build"
# Make cross binutils and install it
echo `date` " Making all in $WORKING_DIR/native-build/binutils and installing..." >> $LOGFILE
make CFLAGS="-O2 -DCHIPKIT_PIC32 -DMCHP_VERSION=${MCHP_VERSION}" all -j4
assert_success $? "ERROR: making/installing cross binutils build"
make install
assert_success $? "ERROR: making/installing cross binutils build"
NM_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-nm"
RANLIB_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ranlib"
STRIP_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-strip"
AR_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ar"
AS_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/as"
LD_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ld"
cd ..
if [ -e gmp ]
then
rm -rf gmp
fi
mkdir gmp
assert_success $? "ERROR: creating directory $WORKING_DIR/native-build/gmp"
cd gmp
echo `date` " Configuring native gmp build in $WORKING_DIR/native-build/gmp..." >> $LOGFILE
../../chipKIT-cxx/src48x/gmp/configure $HOSTMACHINE $BUILDMACHINE --enable-cxx --prefix=$WORKING_DIR/native-build/host-libs --disable-shared --enable-static --disable-nls --with-gnu-ld --disable-debug --disable-rpath --enable-fft --enable-hash-synchronization > gmp-make-log.txt
# Make native gmp and install it
echo `date` " Making all in $WORKING_DIR/native-build/gmp and installing..." >> $LOGFILE
make all -j4 >> gmp-make-log.txt
assert_success $? "ERROR: making/installing gmp build"
make install
assert_success $? "ERROR: making/installing gmp build"
cd ..
if [ "x$SKIPGRAPHITE" == "x" ]; then
if [ -e ppl ]
then
rm -rf ppl
fi
mkdir ppl
assert_success $? "ERROR: creating directory $WORKING_DIR/linux32-build/ppl"
cd ppl
echo `date` " Configuring native ppl build in $WORKING_DIR/native-build/ppl..." >> $LOGFILE
../../chipKIT-cxx/src48x/ppl/configure --prefix=$WORKING_DIR/native-build/host-libs --disable-shared --enable-static --with-gnu-ld $HOSTMACHINE --target=pic32mx --disable-nls --with-libgmp-prefix=$WORKING_DIR/native-build/host-libs --with-gmp=$WORKING_DIR/native-build/host-libs
# Make native ppl and install it
echo `date` " Making all in $WORKING_DIR/native-build/ppl and installing..." >> $LOGFILE
make all -j4
assert_success $? "ERROR: making/installing ppl build"
make install
assert_success $? "ERROR: making/installing ppl build"
cd ..
USE_PPL="--with-ppl=$WORKING_DIR/native-build/host-libs --with-isl=$WORKING_DIR/native-build/host-libs"
if [ -e cloog ]
then
rm -rf cloog
fi
mkdir cloog
assert_success $? "ERROR: creating directory $WORKING_DIR/native-build/cloog"
cd cloog
echo `date` " Configuring native cloog build in $WORKING_DIR/native-build/cloog..." >> $LOGFILE
../../chipKIT-cxx/src48x/cloog/configure $BUILDMACHINE --enable-optimization=speed --with-gnu-ld '--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --prefix=$WORKING_DIR/native-build/host-libs--with-gmp=$WORKING_DIR/native-build/host-libs --with-ppl=$WORKING_DIR/native-build/host-libs --target=pic32mx --disable-shared --enable-static --disable-shared
# Make native cloog and install it
echo `date` " Making all in $WORKING_DIR/native-build/cloog and installing..." >> $LOGFILE
make all -j4
assert_success $? "ERROR: making/installing cloog build"
make install
assert_success $? "ERROR: making/installing cloog build"
cd ..
USE_CLOOG="--with-cloog=$WORKING_DIR/native-build/host-libs"
else
USE_CLOOG="--without-cloog"
USE_PPL="--without-isl"
fi
if [ -e libelf ]
then
rm -rf libelf
fi
mkdir libelf
assert_success $? "ERROR: creating directory $WORKING_DIR/native-build/libelf"
cd libelf
echo `date` " Configuring native libelf build in $WORKING_DIR/native-build/libelf..." >> $LOGFILE
../../chipKIT-cxx/src48x/libelf/configure --prefix=$WORKING_DIR/native-build/host-libs $HOSTMACHINE --target=pic32mx --disable-shared --disable-debug --disable-nls
# Make native libelf and install it
echo `date` " Making all in $WORKING_DIR/native-build/libelf and installing..." >> $LOGFILE
make all -j4
assert_success $? "ERROR: making/installing libelf build"
make install
assert_success $? "ERROR: making/installing libelf build"
cd ..
if [ -e zlib ]
then
rm -rf zlib
fi
cp -r ../chipKIT-cxx/src48x/zlib .
assert_success $? "ERROR: copy src48x/zlib directory to $WORKING_DIR/native-build/zlib"
cd zlib
echo `date` " Configuring native zlib build in $WORKING_DIR/native-build/zlib..." >> $LOGFILE
./configure --prefix=$WORKING_DIR/native-build/host-libs
# Make native zlib and install it
echo `date` " Making all in $WORKING_DIR/native-build/zlib and installing..." >> $LOGFILE
make all -j4
assert_success $? "ERROR: making/installing zlib build"
make install
assert_success $? "ERROR: making/installing zlib build"
cd ..
if [ -e gcc ]
then
rm -rf gcc
fi
mkdir gcc
assert_success $? "ERROR: creating directory $WORKING_DIR/native-build/gcc"
cd gcc
# Configure cross compiler
echo `date` " Configuring cross compiler build in $WORKING_DIR/native-build..." >> $LOGFILE
echo AR_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ar" AS_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/as" LD_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ld" ../../chipKIT-cxx/src48x/gcc/configure --target=pic32mx --program-prefix=pic32- --disable-threads --disable-libmudflap --disable-libssp --enable-sgxx-sde-multilibs --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-shared --enable-static --with-newlib --disable-nls --disable-libgomp --without-headers --disable-libffi --disable-bootstrap --disable-decimal-float --disable-libquadmath --disable-__cxa_atexit --disable-libfortran --disable-libstdcxx-pch --prefix="$WORKING_DIR/$NATIVEIMAGE/pic32-tools" --bindir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" --libexecdir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" --with-dwarf2 --with-gmp="$WORKING_DIR/native-build/host-libs" $USE_CLOOG $USE_PPL "$LIBHOST" --enable-lto --enable-fixed-point --with-bugurl=http://chipkit.net/forum/ XGCC_FLAGS_FOR_TARGET="-fno-rtti -fno-enforce-eh-specs" --enable-cxx-flags="-fno-exceptions -ffunction-sections" $SUPPORT_SJLJ_EXCEPTIONS --enable-obsolete --disable-sim --disable-checking $SUPPORT_HOSTED_LIBSTDCXX > gcc-native-log.txt
AR_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ar" AS_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/as" LD_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ld" ../../chipKIT-cxx/src48x/gcc/configure --target=pic32mx --program-prefix=pic32- --disable-threads --disable-libmudflap --disable-libssp --enable-sgxx-sde-multilibs --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-shared --enable-static --with-newlib --disable-nls --disable-libgomp --without-headers --disable-libffi --disable-bootstrap --disable-decimal-float --disable-libquadmath --disable-__cxa_atexit --disable-libfortran --disable-libstdcxx-pch --prefix="$WORKING_DIR/$NATIVEIMAGE/pic32-tools" --bindir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" --libexecdir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" --with-dwarf2 --with-gmp="$WORKING_DIR/native-build/host-libs" $USE_CLOOG $USE_PPL "$LIBHOST" --enable-lto --enable-fixed-point --with-bugurl=http://chipkit.net/forum/ XGCC_FLAGS_FOR_TARGET="-frtti -fexceptions -fno-enforce-eh-specs" CXXFLAGS="-g3" $SUPPORT_SJLJ_EXCEPTIONS --enable-obsolete --disable-sim --disable-checking $SUPPORT_HOSTED_LIBSTDCXX >> gcc-native-log.txt
assert_success $? "ERROR: configuring cross build"
# Make cross compiler and install it
echo `date` " Making all in $WORKING_DIR/native-build/gcc and installing..." >> $LOGFILE
make all-gcc CFLAGS="-O2 -DCHIPKIT_PIC32" CXXFLAGS="-g3 -DCHIPKIT_PIC32 -DTARGET_IS_PIC32MX" \
NM_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-nm" \
RANLIB_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ranlib" \
STRIP_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-strip" \
AR_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ar" \
AS_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/as" \
LD_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ld" -j2 >> gcc-native-log.txt
make all-gcc CFLAGS="-O2 -DCHIPKIT_PIC32" CXXFLAGS="-g3 -DCHIPKIT_PIC32 -DTARGET_IS_PIC32MX" \
NM_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-nm" \
RANLIB_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ranlib" \
STRIP_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-strip" \
AR_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ar" \
AS_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/as" \
LD_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ld" -j2
assert_success $? "ERROR: making/installing cross build all-gcc"
make CFLAGS="-O2 -DCHIPKIT_PIC32 -DTARGET_IS_PIC32MX" CXXFLAGS="-O2 -DCHIPKIT_PIC32 -DTARGET_IS_PIC32MX" install-gcc
assert_success $? "ERROR: making/installing cross build install-gcc"
cd ..
if [ -e newlib ]
then
rm -rf newlib
fi
mkdir newlib
assert_success $? "ERROR: creating directory $WORKING_DIR/native-build/gcc"
cd newlib
status_update "Building newlib"
#build newlib here
GCC_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin/pic32-gcc CC_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin/pic32-gcc -I$WORKING_DIR/chipKIT-cxx/src48x/gcc/gcc/ginclude" CXX_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin/pic32-g++ CPP_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin/pic32-g++ AR_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin/pic32-ar RANLIB_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin/pic32-ranlib READELF_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin/pic32-readelf STRIP_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin/pic32-strip AS_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/as LD_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ld ../../pic32-newlib/configure $NEWLIB_CONFIGURE_FLAGS --prefix=$WORKING_DIR/$NATIVEIMAGE/pic32-tools --bindir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" --libexecdir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" CFLAGS_FOR_TARGET="-fno-short-double -fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections -DSMALL_MEMORY -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET" CCASFLAGS_FOR_TARGET="-fno-short-double -fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections -DSMALL_MEMORY -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET" XGCC_FLAGS_FOR_TARGET="-fno-short-double -fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections" --enable-cxx-flags="-fno-short-double -fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections"
assert_success $? "ERROR: Configure Newlib for native build"
make all -j2 CFLAGS_FOR_TARGET="-fno-short-double -fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections -DSMALL_MEMORY -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET" CCASFLAGS_FOR_TARGET="-fno-short-double -fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections -DSMALL_MEMORY -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET" XGCC_FLAGS_FOR_TARGET="-fno-short-double -fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections"
assert_success $? "ERROR: Make newlib for native build"
make install
assert_success $? "ERROR: Install newlib for native build"
cd $WORKING_DIR
if [ "x$NATIVEIMAGE" != "x" ]
then
rsync -qavzC --include "*/" --include "*" export-image/pic32-tools/ $NATIVEIMAGE/pic32-tools/
assert_success $? "ERROR: Install newlib in $NATIVEIMAGE"
fi
if [ "x$INUX32IMAGE" != "x" ]
then
rsync -qavzC --include "*/" --include "*" export-image/pic32-tools/ $LINUX32IMAGE/pic32-tools/
assert_success $? "ERROR: Install newlib in $LINUX32IMAGE"
fi
if [ -e win32-image ]
then
rsync -qavzC --include "*/" --include "*" export-image/pic32-tools/ win32-image/pic32-tools/
assert_success $? "ERROR: Install newlib in win32-image"
fi
if [ -e arm-linux-image ]
then
rsync -qavzC --include "*/" --include "*" export-image/pic32-tools/ arm-linux-image/pic32-tools/
assert_success $? "ERROR: Install newlib in arm-linux-image"
fi
cd native-build
if [ -e gcc ]
then
rm -rf gcc
fi
mkdir gcc
assert_success $? "ERROR: creating directory $WORKING_DIR/native-build/gcc"
cd gcc
GCC_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-gcc CC_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-gcc CPP_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-g++ AR_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ar AS_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/as LD_FOR_TARGET=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ld ../../chipKIT-cxx/src48x/gcc/configure $GCC_CONFIGURE_FLAGS --prefix=$WORKING_DIR/$NATIVEIMAGE/pic32-tools --bindir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" --libexecdir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" --with-gmp="$WORKING_DIR/native-build/host-libs" $USE_CLOOG $USE_PPL "$LIBHOST" CFLAGS_FOR_TARGET="-fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections" XGCC_FLAGS_FOR_TARGET="-fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections" --enable-cxx-flags="-fno-rtti -fno-exceptions -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fshort-wchar -fno-unroll-loops -fno-enforce-eh-specs -ffunction-sections -fdata-sections" CFLAGS_FOR_BUILD="-Os"
assert_success $? "ERROR: Configure gcc after Newlib for native build"
make all \
CXXFLAGS="$CXXFLAGS_FOR_TARGET -Os -DCHIPKIT_PIC32" \
NM_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-nm" \
RANLIB_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ranlib" \
STRIP_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-strip" \
AR_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/pic32-ar" \
AS_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/as" \
LD_FOR_TARGET="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/pic32mx/bin/ld" -j2
assert_success $? "ERROR: making/installing cross build all"
make install
assert_success $? "ERROR: making/installing cross build install"
cd ..
if [ -e gdb ]
then
rm -rf gdb
fi
mkdir gdb
assert_success $? "ERROR: creating directory $WORKING_DIR/native-build/gdb"
cd gdb
echo `date` " Configuring gdb in $WORKING_DIR/native-build..." >> $LOGFILE
../../chipKIT-cxx/src48x/gdb/configure \
--prefix=$WORKING_DIR/$NATIVEIMAGE/pic32-tools \
--bindir="$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin/bin" \
"$HOSTMACHINE" \
--target=pic32mx \
--program-prefix=pic32- \
--disable-binutils \
--disable-gas \
--disable-ld \
--disable-gprof \
--disable-sim \
--disable-tui \
--disable-gdbtk
assert_success $? "ERROR: Configure gdb for native build"
echo `date` " Building gdb in $WORKING_DIR/native-build..." >> $LOGFILE
make
assert_success $? "ERROR: making gdb for native build"
make install
assert_success $? "ERROR: installing gdb for native build"
status_update "Cross build complete"
cd ../..
# strip native-image
cd $NATIVEIMAGE/pic32-tools
if [ "x$NATIVEIMAGE" == "xDarwin-image" ] ; then
find . -type f -perm -g+x -follow | xargs file | grep Mach-O | cut -d: -f1 | xargs $DEVELOPERDIR/usr/bin/strip
elif [ "x$LINUX32_HOST_PREFIX" != "x" ] ; then
find . -type f -perm -g+x -follow | xargs file | grep ELF | cut -d: -f1 | xargs $LINUX32_HOST_PREFIX-strip
fi
cd $WORKING_DIR
# end strip native-image
fi # skipping native
# end build native toolchain
unset CC
unset CPP
unset CXX
unset LD
unset AR
# Set up path so that we can build the libraries and the win32 cross
# compiler using the cross compiler we just built
OLDPATH=$PATH
PATH=$WORKING_DIR/$NATIVEIMAGE/pic32-tools/bin:$PATH
if [ "x$SKIPLIBS" == "x" ] ; then
cd pic32-part-support
# Build cross compiler libraries
echo `date` " Making and installing cross-compiler libraries to $WORKING_DIR/$NATIVEIMAGE/pic32-tools..." >> $LOGFILE
make DESTROOT=$WORKING_DIR/$NATIVEIMAGE/pic32-tools all
assert_success $? "ERROR: making libraries for cross build"
make DESTROOT=$WORKING_DIR/$NATIVEIMAGE/pic32-tools install -j2
assert_success $? "ERROR: making libraries for $NATIVEIMAGE cross build"
if [ "x$LINUX32IMAGE" != "x" ] ; then
make DESTROOT="$WORKING_DIR/$LINUX32IMAGE/pic32-tools" install -j2
assert_success $? "ERROR: making libraries for linux32-image cross build"
fi
make DESTROOT="$WORKING_DIR/export-image/pic32-tools" install -j2
assert_success $? "ERROR: making libraries for export-image cross build"
make DESTROOT="$WORKING_DIR/win32-image/pic32-tools" install -j2
assert_success $? "ERROR: making libraries for win32-image cross build"
make DESTROOT="$WORKING_DIR/arm-linux-image/pic32-tools" install -j2
assert_success $? "ERROR: making libraries for arm-linux-image cross build"
status_update "cross-compiler library build complete"
cd ..
# Build and install fdlibm
cd $WORKING_DIR/fdlibm/src/xc32
# Build fdlibm once
echo `date` " Making and installing cross-compiler fdlibm libraries to $WORKING_DIR/$NATIVEIMAGE..." >> $LOGFILE
make DESTROOT=$WORKING_DIR/$NATIVEIMAGE/pic32-tools all
assert_success $? "ERROR: making fdlibm libraries for cross build"
# Then install
make DESTROOT=$WORKING_DIR/$NATIVEIMAGE/pic32-tools install -j2
assert_success $? "ERROR: making installing fdlibm for $NATIVEIMAGE cross build"
if [ "x$LINUX32IMAGE" != "x" ] ; then
make DESTROOT="$WORKING_DIR/$LINUX32IMAGE/pic32-tools" install -j2
assert_success $? "ERROR: making fdlibm libraries for Linux32-image cross build"
fi
make DESTROOT="$WORKING_DIR/export-image/pic32-tools" install -j2
assert_success $? "ERROR: making fdlibm libraries for export-image cross build"
make DESTROOT="$WORKING_DIR/win32-image/pic32-tools" install -j2
assert_success $? "ERROR: making fdlibm libraries for win32-image cross build"
make DESTROOT="$WORKING_DIR/arm-linux-image/pic32-tools" install -j2
assert_success $? "ERROR: making fdlibm libraries for arm-linux-image cross build"
status_update "cross-compiler fdlibm library build complete"
fi # skip library build
# Build linux compiler
if [ "x$SKIPLINUX32" == "x" ] ; then
if [ "x$LINUX32IMAGE" != "x" ] ; then
unset CC
unset CPP
unset CXX
build_xc32_sh "$WORKING_DIR/$LINUX32IMAGE" "TARGET=linux"
echo `date` " Creating linux cross build in $WORKING_DIR/linux32-build..." >> $LOGFILE
cd $WORKING_DIR
if [ -e linux32-build ]
then
rm -rf linux32-build
fi
mkdir linux32-build
assert_success $? "ERROR: creating directory $WORKING_DIR/linux32-build"
cd linux32-build
if [ -e binutils ]
then
rm -rf binutils
fi
mkdir binutils
assert_success $? "ERROR: creating directory $WORKING_DIR/linux32-build/binutils"
cd binutils
# Configure linux-cross binutils
echo `date` " Configuring linux32 binutils build in $WORKING_DIR/linux32-build..." >> $LOGFILE
../../chipKIT-cxx/src48x/binutils/configure $BUILDMACHINE --target=pic32mx --prefix="$WORKING_DIR/$LINUX32IMAGE/pic32-tools" --bindir="$WORKING_DIR/$LINUX32IMAGE/pic32-tools/bin/bin" --libexecdir="$WORKING_DIR/$LINUX32IMAGE/pic32-tools/bin/bin" --host=$LINUX32_HOST_PREFIX --disable-nls --disable-tui --disable-gdbtk --disable-shared --enable-static --disable-threads --disable-bootstrap --with-dwarf2 --enable-multilib --without-newlib --disable-sim --with-lib-path=: --enable-poison-system-directories --program-prefix=pic32- --with-bugurl=http://chipkit.net/forum/ --disable-werror
assert_success $? "ERROR: configuring linux32 binutils build"
# Make linux-cross binutils and install it
echo `date` " Making all in $WORKING_DIR/linux32-build/binutils and installing..." >> $LOGFILE
make all CFLAGS="-O2 -DCHIPKIT_PIC32 -DMCHP_VERSION=${MCHP_VERSION}" -j4
assert_success $? "ERROR: making/installing linux32 Canadian-cross binutils build"
make CFLAGS="-O2 -DCHIPKIT_PIC32" install
assert_success $? "ERROR: making/installing linux32 Canadian-cross binutils build"
cd ..
if [ -e gmp ]
then
rm -rf gmp
fi
mkdir gmp
assert_success $? "ERROR: creating directory $WORKING_DIR/linux32-build/gmp"
cd gmp
echo `date` " Configuring linux gmp build in $WORKING_DIR/linux32-build/gmp..." >> $LOGFILE
CFLAGS="-fexceptions" ../../chipKIT-cxx/src48x/gmp/configure --enable-cxx --prefix=$WORKING_DIR/linux32-build/linux-libs --disable-shared --target=$LINUX32_HOST_PREFIX --host=$LINUX32_HOST_PREFIX --disable-nls --with-gnu-ld --disable-debug --disable-rpath --enable-fft --enable-hash-synchronization "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
# Make linux gmp and install it
echo `date` " Making all in $WORKING_DIR/linux32-build/gmp and installing..." >> $LOGFILE
make all -j2
assert_success $? "ERROR: making/installing gmp build"
make install
assert_success $? "ERROR: making/installing gmp build"
cd ..
if [ "x$SKIPGRAPHITE" == "x" ]; then
if [ -e ppl ]
then
rm -rf ppl
fi
mkdir ppl
assert_success $? "ERROR: creating directory $WORKING_DIR/linux32-build/ppl"
cd ppl
echo `date` " Configuring linux32 ppl build in $WORKING_DIR/linux32-build/ppl..." >> $LOGFILE
../../chipKIT-cxx/src48x/ppl/configure --prefix=$WORKING_DIR/linux32-build/linux-libs --disable-shared --enable-static --with-gnu-ld --host=$LINUX32_HOST_PREFIX --target=pic32mx --disable-nls --with-libgmp-prefix=$WORKING_DIR/linux32-build/linux-libs --with-gmp=$WORKING_DIR/linux32-build/linux-libs
# Make native ppl and install it
echo `date` " Making all in $WORKING_DIR/linux32-build/ppl and installing..." >> $LOGFILE
make all -j2
assert_success $? "ERROR: making/installing ppl build"
make install
assert_success $? "ERROR: making/installing ppl build"
cd ..
if [ -e cloog ]
then
rm -rf cloog
fi
mkdir cloog
assert_success $? "ERROR: creating directory $WORKING_DIR/linux32-build/cloog"
cd cloog
echo `date` " Configuring linux cloog build in $WORKING_DIR/linux32-build/cloog..." >> $LOGFILE
../../chipKIT-cxx/src48x/cloog/configure $BUILDMACHINE --enable-optimization=speed --with-gnu-ld '--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --prefix=$WORKING_DIR/linux32-build/linux-libs --host=$LINUX32_HOST_PREFIX --with-gmp=$WORKING_DIR/linux32-build/linux-libs --with-ppl=$WORKING_DIR/linux32-build/linux-libs --target=pic32mx --disable-shared --enable-static --disable-shared
# Make native cloog and install it
echo `date` " Making all in $WORKING_DIR/linux32-build/cloog and installing..." >> $LOGFILE
make all -j2
assert_success $? "ERROR: making/installing cloog build"
make install
assert_success $? "ERROR: making/installing cloog build"
cd ..
else
USE_CLOOG="--without-cloog"
USE_PPL="--without-isl"
fi
if [ -e libelf ]
then
rm -rf libelf
fi
mkdir libelf
assert_success $? "ERROR: creating directory $WORKING_DIR/linux32-build/libelf"
cd libelf
echo `date` " Configuring native libelf build in $WORKING_DIR/linux32-build/libelf..." >> $LOGFILE
../../chipKIT-cxx/src48x/libelf/configure --prefix=$WORKING_DIR/linux32-build/linux-libs --host=$LINUX32_HOST_PREFIX --target=pic32mx --disable-shared --disable-debug --disable-nls
# Make native libelf and install it
echo `date` " Making all in $WORKING_DIR/linux32-build/libelf and installing..." >> $LOGFILE
make all -j2
assert_success $? "ERROR: making/installing libelf build"
make install
assert_success $? "ERROR: making/installing libelf build"
cd ..
if [ -e zlib ]
then
rm -rf zlib
fi
cp -r ../chipKIT-cxx/src48x/zlib .
assert_success $? "ERROR: copy src48x/zlib directory to $WORKING_DIR/linux32-build/zlib"
cd zlib
echo `date` " Configuring linux zlib build in $WORKING_DIR/linux32-build/zlib..." >> $LOGFILE
CC=$LINUX32_HOST_PREFIX-gcc AR="$LINUX32_HOST_PREFIX-ar" RANLIB=$LINUX32_HOST_PREFIX-ranlib ./configure --prefix=$WORKING_DIR/linux32-build/linux-libs
# Make linux zlib and install it
echo `date` " Making all in $WORKING_DIR/linux32-build/zlib and installing..." >> $LOGFILE
make all -j2
assert_success $? "ERROR: making/installing zlib build - all"
make install
assert_success $? "ERROR: making/installing zlib build - install"
cd ..
if [ -e gcc ]
then