-
Notifications
You must be signed in to change notification settings - Fork 3
/
Arduino_IDE_builder.bash
executable file
·755 lines (660 loc) · 24.4 KB
/
Arduino_IDE_builder.bash
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
#!/bin/bash -ex
# A simple script to build the Arduino IDE
# GNU General Public License invoked
# Debian dependacies
# apt-get update && apt-get upgrade -y
# apt-get install -y mercurial subversion build-essential gperf bison ant texinfo zip automake flex libusb-dev libusb-1.0-0-dev libtinfo-dev pkg-config
# apt-get install -y libwxbase3.0-dev libtool
# Beerware by ShorTie
# Options, rem out or set to sumfin else to not
# Normally, Update_git is the only 1 needed to be un-rem'd
# The rest are mainly for if your playing with the sources, and my debug, lol.
echo -e "\n\nConfiguration values\n\n"
Stable="1.6.7"
Update_me="yes"
#Update_git="yes"
#Update_Arduino_git="yes"
#Build_distro="yes"
#ReBuild_Arduino="yes"
#ReBuild_toolchain_avr="yes"
#ReBuild_avrdude="yes"
#ReBuild_arduino_builder="yes"
#ReBuild_astyle="yes"
#ReBuild_ctags="yes"
#ReBuild_listSerialPortsC="yes"
#Bossac="yes"
#Coan="yes"
#OpenOCD="yes"
# This is only used on the initial run to sed a few things, mainly in toolchain-avr, can not be re-done without a do over from beginnig
Silence_is_Golden="yes"
#Toolchain_avr_version="3.4.5"
#Toolchain_avr_version="3.5.0"
# https://github.com/arduino/ArduinoCore-samd
# Script,
# *****************************************************************
echo -e "\n\nSystem check\n\n"
start_time=$(date)
Start_Directory=`pwd`
Working_Directory=`pwd`/Arduino/build
# Check to see if Arduino_IDE_builder.bash is being run as root
echo -e "\n\nChecking for root .. \n"
if [ `id -u` != 0 ]; then
echo -e "\n\nOoops, So, So, Sorry, We play only as root !!\nTry sudo\nHave A Great Day\n\n"
exit -1
else
echo "Yuppers .. :)~"
fi
if [[ $Update_me == "yes" ]]; then
echo -e "\n\nChecking to see if I'm update\n"
git remote update
if [[ ! `git status -uno | grep up-to-date` ]]; then
git checkout -- .
git pull
echo -e "\n\nUpdating me\nRestart required\n\n"
exit 1
fi
fi
echo -e "\n\nJava Checking and setup\n"
Java_Version=`java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q'`
echo $JAVA_HOME
# Check for what version of Java and set JAVA_HOME
if [[ $Java_Version != "18" ]]; then
echo -e "\n\nOops, you need Java 1.8\n\n"
exit -1
elif [ `uname -s` == "Linux" ]; then
if [ `readlink -f /usr/bin/javac | sed "s:bin/javac::" | grep 8` ]; then
JAVA_HOME=`readlink -f /usr/bin/javac | sed "s:bin/javac::"`
export JAVA_HOME
else
echo -e "\n\nSo, So, Sorry, Could not set JAVA_HOME\n\n"
exit -1
fi
fi
# Checking for go
echo -e "\n\nChecking for go\n"
if [ `uname -s` == "Linux" ]; then
if [[ ! -f /usr/local/go/bin/go ]]; then
echo -e "\n\nInstalling go for arduino-builder\n"
cd /usr/local
wget https://storage.googleapis.com/golang/go1.4.3.src.tar.gz
tar -xf go1.4.3.src.tar.gz
rm go1.4.3.src.tar.gz
cd go/src
./all.bash
../bin/./go version
cd $Start_Directory
else
/usr/local/go/bin/./go version
fi
else
echo -e "\n\nSo So Sorry, don't know how to check for go\n"
exit -1
fi
# Determine system type
echo -e "\n\nDetermining system type\n"
if [ `uname -s` == "Linux" ]; then
if [ `uname -m | grep arm` ]; then
Sys="arm"
SysTag="armhf"
elif [ `getconf LONG_BIT` == "32" ]; then
Bits="32"
Sys="linux32"
SysTag="i686"
elif [ `getconf LONG_BIT` == "64" ]; then
Bits="64"
Sys="linux64"
SysTag="x86_64"
fi
# Lets speed some compiles up
if [[ `nproc` > "2" ]]; then
JOBS=$((`nproc`+1))
# Silence is Golden
JOBS+=" -s"
else
JOBS="2 -s"
fi
elif [ `uname -s` == "Darwin" ]; then
Sys="macosx"
echo "So So Sorry, not fully implemented yet"
exit 0
elif [ `uname -s | grep CYGWIN` ]; then
Sys="windows"
echo "So So Sorry, not fully implemented yet"
exit 0
elif [ `uname -s | grep MINGW` ]; then
Sys="windows"
echo "So So Sorry, not fully implemented yet"
exit 0
fi
echo -e "\n\nBuilding Arduino_IDE for $Sys\n\n"
if [[ ! -d Arduino ]]; then
echo -e "\n\nRetriving Arduino_IDE for $Sys form github and remove some junk\n\n"
if [[ $Stable ]]; then
git clone --depth 1 -b $Stable https://github.com/arduino/Arduino.git
else
git clone --depth 1 https://github.com/arduino/Arduino.git
fi
if [[ $Sys == "arm" ]]; then
cd Arduino
if [[ $Stable == "1.6.7" ]]; then
patch -p1 < ../debian/patches/build.xml.167.arm_fix.patch
else
patch -p1 < ../debian/patches/build.xml.arm_fix.patch
fi
patch -p1 < ../debian/patches/remove_update_warning.patch
if [[ ! $Stable ]]; then
patch -p1 < ../debian/patches/Boards_Manager_Revert.patch
fi
cd ..
fi
rm -rfv Arduino/build/arduino-builde*
rm -v Arduino/build/linux/avr-gcc*
rm -v Arduino/build/linux/avrdude*
if [[ -d files ]]; then
./put_files.bash
fi
rm -v Arduino/build/libastyle*
if [[ `ls Arduino/build/liblistSerials-*` ]]; then
rm -v Arduino/build/liblistSerials-*
fi
cd $Working_Directory
fi
#exit 0
if [[ $Update_Arduino_git == "yes" ]]; then
echo -e "\n\nChecking for Arduino_IDE github updates\n\n"
cd Arduino
if [[ ! `git branch | grep master` ]]; then
git checkout -- .
git remote add upstream https://github.com/arduino/Arduino.git
git checkout -b master
git fetch upstream
git merge upstream/master
if [[ $Sys == "arm" ]]; then
if [[ ! `patch -p1 < ../debian/patches/build.xml.arm_fix.patch --dry-run | grep Reversed ` ]]; then
patch -p1 < ../debian/patches/build.xml.arm_fix.patch
fi
if [[ ! `patch -p1 < ../debian/patches/remove_update_warning.patch --dry-run | grep Reversed ` ]]; then
patch -p1 < ../debian/patches/remove_update_warning.patch
fi
if [[ ! `patch -p1 < ../debian/patches/Boards_Manager_Revert.patch --dry-run | grep Reversed ` ]]; then
patch -p1 < ../debian/patches/Boards_Manager_Revert.patch
fi
fi
ReBuild_Arduino="yes"
ReBuild_arduino_builder="yes"
ReBuild_astyle="yes"
ReBuild_ctags="yes"
ReBuild_listSerialPortsC="yes"
if [[ -d files ]]; then
./put_files.bash
fi
cd build
else
git remote update
if [[ ! `git status -uno | grep up-to-date` ]]; then
git checkout -- .
git pull
if [[ $Sys == "arm" ]]; then
if [[ ! `patch -p1 < ../debian/patches/build.xml.arm_fix.patch --dry-run | grep Reversed ` ]]; then
patch -p1 < ../debian/patches/build.xml.arm_fix.patch
fi
if [[ ! `patch -p1 < ../debian/patches/remove_update_warning.patch --dry-run | grep Reversed ` ]]; then
patch -p1 < ../debian/patches/remove_update_warning.patch
fi
if [[ ! `patch -p1 < ../debian/patches/Boards_Manager_Revert.patch --dry-run | grep Reversed ` ]]; then
patch -p1 < ../debian/patches/Boards_Manager_Revert.patch
fi
fi
ReBuild_Arduino="yes"
ReBuild_arduino_builder="yes"
ReBuild_astyle="yes"
ReBuild_ctags="yes"
ReBuild_listSerialPortsC="yes"
if [[ -d files ]]; then
./put_files.bash
fi
cd build
else
cd build
fi
fi
else
cd $Working_Directory
fi
# toolchain-avr
if [[ ! -d toolchain-avr ]]; then
echo -e "\n\nRetriving toolchain-avr form github\n\n"
git clone --depth 1 https://github.com/arduino/toolchain-avr.git
# Silence is Golden
if [[ "$Silence_is_Golden" == "yes" ]]; then
sed -i 's/cp -v -f/cp -f/' toolchain-avr/*.bash
sed -i 's/tar xfjv/tar xf/' toolchain-avr/*.bash
sed -i 's/tar xfv/tar xf/' toolchain-avr/*.bash
sed -i 's/tar -cjvf/tar -cjf/' toolchain-avr/*.bash
sed -i 's/unzip/unzip -q/' toolchain-avr/*.bash
sed -i 's/make install/make install -s/' toolchain-avr/*.bash
sed -i 's/patch -/patch -s -/' toolchain-avr/*.bash
#sed -i 's@/configure @/configure --silent @' toolchain-avr/*.bash
sed -i 's@/configure @/configure --silent --with-pkgversion="Arduino" @' toolchain-avr/*.bash
fi
fi
if [[ $Update_git == "yes" ]]; then
echo -e "\n\nChecking for toolchain-avr github updates\n\n"
cd toolchain-avr
git remote update
if [[ ! `git status -uno | grep up-to-date` ]]; then
git pull
rm -v ../linux/avr-gcc*arduino* ../linux/avrdude*arduino*
fi
cd ..
fi
if [[ $ReBuild_toolchain_avr == "yes" ]]; then
echo -e "\n\nDelete stuff to enable Rebuilding of toolchain-avr\n\n"
if [[ `ls linux/avr-gcc*bz2*` ]]; then
rm -v linux/avr-gcc*arduino*
fi
fi
if [[ $ReBuild_avrdude == "yes" ]] || [[ $ReBuild_toolchain_avr == "yes" ]]; then
echo -e "\n\nDelete stuff to enable Rebuilding of avrdude\n\n"
if [[ `ls linux/avrdude*bz2*` ]]; then
rm -v linux/avrdude*arduino*
fi
fi
if [ ! `ls linux/avr-gcc*bz2` ]; then
echo -e "\n\nBuilding toolchain-avr\n\n"
cd toolchain-avr
if [ `uname -s` == "Linux" ]; then
if [ $Sys == "arm" ]; then
MAKE_JOBS="$JOBS" ./arch.arm.build.bash
shasum avr-gcc-4.8.1-arduino5-armhf-pc-linux-gnu.tar.bz2 | awk '{ print $1 }' > avr-gcc-4.8.1-arduino5-armhf-pc-linux-gnu.tar.bz2.sha
shasum avrdude-6.0.1-arduino5-armhf-pc-linux-gnu.tar.bz2 | awk '{ print $1 }' > avrdude-6.0.1-arduino5-armhf-pc-linux-gnu.tar.bz2.sha
elif [ $Sys == "linux32" ]; then
MAKE_JOBS="$JOBS" ./arch.linux32.build.bash
shasum avr-gcc-4.8.1-arduino5-i686-pc-linux-gnu.tar.bz2 | awk '{ print $1 }' > avr-gcc-4.8.1-arduino5-i686-pc-linux-gnu.tar.bz2.sha
shasum avrdude-6.0.1-arduino5-i686-pc-linux-gnu.tar.bz2 | awk '{ print $1 }' > avrdude-6.0.1-arduino5-i686-pc-linux-gnu.tar.bz2.sha
elif [ $Sys == "linux64" ]; then
MAKE_JOBS="$JOBS" ./arch.linux64.build.bash
shasum avr-gcc-4.8.1-arduino5-x86_64-pc-linux-gnu.tar.bz2 | awk '{ print $1 }' > avr-gcc-4.8.1-arduino5-x86_64-pc-linux-gnu.tar.bz2.sha
shasum avrdude-6.0.1-arduino5-x86_64-pc-linux-gnu.tar.bz2 | awk '{ print $1 }' > avrdude-6.0.1-arduino5-x86_64-pc-linux-gnu.tar.bz2.sha
fi
elif [ `uname -s` == "Darwin" ]; then
MAKE_JOBS="$JOBS" arch.mac32.build.bash
shasum avr-gcc-4.8.1-arduino5-i386-apple-darwin11.tar.bz2 | awk '{ print $1 }' > avr-gcc-4.8.1-arduino5-i386-apple-darwin11.tar.bz2.sha
shasum avrdude-6.0.1-arduino5-i686-i386-apple-darwin11.tar.bz2 | awk '{ print $1 }' > avrdude-6.0.1-arduino5-i386-apple-darwin11.tar.bz2.sha
fi
mv -v avr-gcc* ../linux/
mv -v avrdude*arduino* ../linux/
cd $Working_Directory
fi
if [ ! `ls linux/avrdude*arduino*bz2` ]; then
echo -e "\n\nBuilding avrdude\n\n"
cd toolchain-avr
git tag
if [ `uname -s` == "Linux" ]; then
if [ $Sys == "arm" ]; then
./clean.bash
MAKE_JOBS="$JOBS" ./avrdude.build.bash
shasum avrdude-6.0.1-arduino5-armhf-pc-linux-gnu.tar.bz2 | awk '{ print $1 }' > avrdude-6.0.1-arduino5-armhf-pc-linux-gnu.tar.bz2.sha
elif [ $Sys == "linux32" ]; then
./clean.bash
MAKE_JOBS="$JOBS" ./avrdude.build.bash
shasum avrdude-6.0.1-arduino5-i686-pc-linux-gnu.tar.bz2 | awk '{ print $1 }' > avrdude-6.0.1-arduino5-i686-pc-linux-gnu.tar.bz2.sha
elif [ $Sys == "linux64" ]; then
./clean.bash
MAKE_JOBS="$JOBS" ./avrdude.build.bash
shasum avrdude-6.0.1-arduino5-x86_64-pc-linux-gnu.tar.bz2 | awk '{ print $1 }' > avrdude-6.0.1-arduino5-x86_64-pc-linux-gnu.tar.bz2.sha
fi
elif [ `uname -s` == "Darwin" ]; then
./clean.bash
MAKE_JOBS="$JOBS" ./avrdude.build.bash
shasum avrdude-6.0.1-arduino5-i686-i386-apple-darwin11.tar.bz2 | awk '{ print $1 }' > avrdude-6.0.1-arduino5-i386-apple-darwin11.tar.bz2.sha
fi
mv -v avrdude*arduino* ../linux/
cd $Working_Directory
fi
# End toolchain-avr
# Asyle
if [[ ! -d astyle ]]; then
echo -e "\n\nGetting astyle\n"
git clone https://github.com/arduino/astyle
sed -i 's/svn co/svn co --quiet/' astyle/setup.bash
fi
if [[ $ReBuild_astyle == "yes" ]]; then
echo -e "\n\nDelete stuff to enable Rebuilding of astyle\n"
if [ `ls libastylej*.zip` ]; then
rm -v ./libastylej*.zip
fi
if [ `ls libastylej*.sha` ]; then
rm -v ./libastylej*.sha
fi
fi
if [[ $Update_git == "yes" ]]; then
echo -e "\n\nChecking for astyle github updates\n"
cd astyle
git remote update
if [[ ! `git status -uno | grep up-to-date` ]]; then
git pull
rm -v ../libastylej*.zip
rm -v ../libastylej*.sha
fi
cd ..
fi
if [[ ! `ls libastylej-*.zip` ]]; then
echo -e "\n\nBuilding astyle\n"
if [ `uname -s` == "Linux" ]; then
cd astyle
git tag
./setup.bash
cd astyle-code/AStyle/build/gcc/
if [ $Sys == "arm" ]; then
CFLAGS="-Os" LDFLAGS="-s" make java -j $JOBS
cd bin
mkdir libastylej-2.05.1
cp libastyle*.so libastylej-2.05.1/libastylej_arm.so
else
CFLAGS="-m$Bits -Os" LDFLAGS="-m$Bits -s" make java -s
cd bin
mkdir libastylej-2.05.1
cp libastyle*.so libastylej-2.05.1/libastylej$Bits.so
fi
elif [ `uname -s` == "Darwin" ]; then
# UN-tested
cd astyle
./setup.bash
cd astyle-code/AStyle/build/mac/
CFLAGS="-arch i386 -arch x86_64 -Os" LDFLAGS="-arch i386 -arch x86_64 -liconv" make java
cd bin
mkdir libastylej-2.05.1
cp libastyle*.dylib libastylej-2.05.1/libastylej.jnilib
fi
zip -rv libastylej-2.05.1.zip libastylej-2.05.1
shasum libastylej-2.05.1.zip | awk '{ print $1 }' > libastylej-2.05.1.zip.sha
mv libastylej-2.05.1.zip* $Working_Directory
cd $Working_Directory
fi
# End Asyle
# ctags
if [[ ! -d ctags ]]; then
echo -e "\n\nChecking for ctags\n"
git clone https://github.com/arduino/ctags.git
fi
if [[ $ReBuild_ctags == "yes" ]]; then
echo -e "\n\nDelete stuff to enable Rebuilding of ctags\n"
if [[ -f ctags/ctags ]]; then
rm -v ctags/ctags
fi
fi
if [[ $Update_git == "yes" ]]; then
echo -e "\n\nUpdate ctags git\n"
cd ctags
git tag
git remote update
if [[ ! `git status -uno | grep up-to-date` ]]; then
git pull
if [[ -f ctags ]]; then
rm -v ctags
fi
fi
cd ..
fi
if [[ ! -f ctags/ctags ]]; then
echo -e "\n\nBuilding ctags\n"
#[new tag] 5.8-arduino6 -> 5.8-arduino6
cd ctags
if [[ -f ctags ]]; then
make distclean
fi
./configure --silent
make -j $JOBS
cd ..
fi
# End ctags
# Bossac
if [[ ! $Bossac && ! `grep -ir 'exclude name="arduino/sam' build.xml` ]]; then
patch -p1 -R < ../../debian/patches/sam_fix.patch
fi
if [[ $Bossac == "yes" ]]; then
if [[ `grep -ir 'exclude name="arduino/sam' build.xml` ]]; then
patch -p1 < ../../debian/patches/sam_fix.patch
fi
if [[ ! `ls linux/bossac*arduino*` ]]; then
echo -e "\n\nBuilding bossac\n"
# bossac bossac-1.6.1-arduino-i486-linux-gnu.tar.gz
# apt-get install libwxbase3.0-dev
if [ ! `which wx-config` ]; then
echo "nope, You need libwxbase3.0-dev"
exit 1
fi
if [[ ! -f Bossa-1.6.1-arduino.tar.gz ]]; then
wget -N https://github.com/shumatech/BOSSA/archive/1.6.1-arduino.tar.gz
mv 1.6.1-arduino.tar.gz Bossa-1.6.1-arduino.tar.gz
fi
tar xf Bossa-1.6.1-arduino.tar.gz
cd BOSSA-1.6.1-arduino
sed -i 's/-j4/-j4 -s/' arduino/make_package.sh
arduino/./make_package.sh
shasum arduino/bossac-1.6.1-arduino-arm-linux-gnueabihf.tar.gz | awk '{ print $1 }' > arduino/bossac-1.6.1-arduino-arm-linux-gnueabihf.tar.gz.sha
mv arduino/bossac*arduino* ../linux
ReBuild_Arduino="yes"
cd ..
fi
fi
# End Bossac
# Coan
if [[ $Coan == "yes" ]]; then
if [[ ! `ls linux/coan*arduino*` ]]; then
echo -e "\n\nBuilding coan\n"
if [[ ! -f coan-5.2.tar.gz ]]; then
wget -N http://sourceforge.net/projects/coan2/files/v5.2/coan-5.2.tar.gz
fi
rm -rf coan-5.2
tar xf coan-5.2.tar.gz
cd coan-5.2
PREFIX=`pwd`
./configure --prefix=$PREFIX
make -j $JOBS
make install -j $JOBS
shasum arduino/bossac-1.6.1-arduino-arm-linux-gnueabihf.tar.gz | awk '{ print $1 }' > coan-5.2-arduino-arm-linux-gnueabihf.tar.gz.sha
mv coan*arduino* ../linux
cd ..
fi
fi
# End Coan
# liblistserials
if [[ ! -d listSerialPortsC ]]; then
echo -e "\n\nGetting listSerialPortsC\n"
git clone https://github.com/facchinm/listSerialPortsC.git
cd listSerialPortsC
rm -rvf libserialport
git clone https://github.com/facchinm/libserialport.git
cd $Working_Directory
fi
if [[ $Update_git == "yes" ]]; then
echo -e "\n\nChecking for listSerialPortsC github updates\n"
cd listSerialPortsC
git remote update
if [[ ! `git status -uno | grep up-to-date` ]]; then
git pull
rm -v ../liblistSerials*.zip
rm -v ../liblistSerials*.sha
fi
cd libserialport
git remote update
if [[ ! `git status -uno | grep up-to-date` ]]; then
git pull
rm -v ../../liblistSerials*.zip
rm -v ../../liblistSerials*.sha
fi
cd $Working_Directory
fi
if [[ $ReBuild_listSerialPortsC == "yes" ]]; then
echo -e "\n\nDelete stuff to enable Rebuilding of listSerialPortsC\n"
if [[ `ls liblistSerials*.zip` ]]; then
rm -v ./liblistSerials*
fi
fi
if [[ ! `ls liblistSerials*.zip` ]]; then
cd listSerialPortsC
VERSION=`grep -ir 'value="./liblistSerials' ../build.xml | cut -d '/' -f2 | head -1`
VERSION=`echo $VERSION | cut -d '-' -f2`
VERSION=`echo $VERSION | cut -d '"' -f1`
VERSION=`sed 's/.zip//g' <<<"$VERSION"`
git_VERSION=`git tag`
echo -e "\n\nBuilding listSerialPortsC version $git_VERSION\ntar'ing as $VERSION for the build.xml\n\n"
if [[ `uname -s` == "Linux" ]]; then
mkdir -p distrib/$Sys
cd libserialport
#git tag
if [[ -f make ]]; then
make distclean
fi
./autogen.sh
./configure --silent
make clean
make -j $JOBS
cd ..
if [[ $Sys == "arm" ]]; then
gcc -s main.c libserialport/linux_termios.c libserialport/linux.c libserialport/serialport.c -Ilibserialport/ -o listSerialC
gcc -s jnilib.c libserialport/linux_termios.c libserialport/linux.c libserialport/serialport.c -Ilibserialport/ -I$JAVA_HOME/include -I$JAVA_HOME/include/linux -shared -fPIC -o liblistSerialsj.so
else
gcc -m$Bits -s main.c libserialport/linux_termios.c libserialport/linux.c libserialport/serialport.c -Ilibserialport/ -o listSerialC
gcc -m$Bits -s jnilib.c libserialport/linux_termios.c libserialport/linux.c libserialport/serialport.c -Ilibserialport/ -I$JAVA_HOME/include -I$JAVA_HOME/include/linux -shared -fPIC -o liblistSerialsj.so
fi
elif [ `uname -s` == "Darwin" ]; then
# UN-tested
exit -1
fi
cp listSerialC distrib/$Sys/listSerialC
cp liblistSerialsj.so distrib/$Sys
mv distrib liblistSerials-$VERSION
zip -r liblistSerials-$VERSION.zip liblistSerials-$VERSION
shasum liblistSerials-$VERSION.zip | awk '{ print $1 }' > liblistSerials-$VERSION.zip.sha
rm -rf liblistSerials-$VERSION
mv liblistSerials-$VERSION.zip* $Working_Directory
cd $Working_Directory
fi
# End liblistserials
# OpenOCD
if [[ $OpenOCD == "yes" ]]; then
if [[ ! `ls linux/OpenOCD*` ]]; then
if [[ ! -d OpenOCD ]]; then
git clone https://github.com/arduino/OpenOCD.git
fi
if [ $Update_git == "yes" ]; then
cd OpenOCD
if [[ ! `git status -uno | grep up-to-date` ]]; then
git pull
rm ctags
fi
cd ..
fi
cd OpenOCD
PREFIX=`pwd`/OpenOCD-0.9.0-dev-arduino
#bootstrap: Error: libtool is required
./bootstrap
./configure --prefix=$PREFIX
make -j $JOBS
make install -j $JOBS
tar -cjf OpenOCD-0.9.0-arduino-i486-linux-gnu.tar.bz2 OpenOCD-0.9.0-dev-arduino
sha256sum OpenOCD-0.9.0-arduino-i486-linux-gnu.tar.bz2 | awk '{print$1}' > OpenOCD-0.9.0-arduino-i486-linux-gnu.tar.bz2.sha
mv OpenOCD*arduino*bz2* ../linux
cd ..
fi
fi
# OpenOCD
# arduino-builder
if [[ ! -d arduino-builder ]]; then
echo -e "\n\nGetting Arduino_builder\n"
if [[ $Sys == "arm" ]]; then
git clone -b arm https://github.com/arduino/arduino-builder
else
git clone https://github.com/arduino/arduino-builder
fi
cd arduino-builder
export PATH=$PATH:/usr/local/go/bin/
export GOPATH=`pwd`
export GOROOT=/usr/local/go
go get github.com/go-errors/errors
go get github.com/stretchr/testify
go get golang.org/x/codereview/patch
go get github.com/jstemmer/go-junit-report
go get golang.org/x/tools/cmd/vet
cd ..
fi
if [[ $Update_git == "yes" ]]; then
echo -e "\n\nChecking for github updates for Arduino_builder\n"
cd arduino-builder
git remote update
if [[ ! `git status -uno | grep up-to-date` ]]; then
git pull
rm -v ../arduino-builder-*
fi
cd ..
rm -v arduino-builder-*
fi
if [[ $ReBuild_arduino_builder == "yes" ]]; then
echo -e "\n\nDelete stuff to enable Rebuilding of Arduino_builder\n"
if [[ `ls arduino-builder-*bz2` ]]; then
rm -v arduino-builder-*
fi
fi
if [[ ! `ls arduino-builder-*bz2` ]]; then
cd arduino-builder
git_ver=`grep -ir 'const VERSION' main.go | cut -d " " -f4`
Arduino_Builder_version=`grep -ir 'ARDUINO-BUILDER-VERSION" value="' ../build.xml | cut -d '"' -f4`
echo -e "\n\nBuilding Arduino_builder github version $git_ver\ntar'ing as $Arduino_Builder_version for build.xml\n"
if [[ -d arduino-builder-$Sys ]]; then
rm -rvf arduino-builder-$Sys
fi
export PATH=$PATH:/usr/local/go/bin/
export GOPATH=`pwd`
export GOROOT=/usr/local/go
go clean
go build
mkdir -p arduino-builder-$Sys/{hardware,tools/5.8-arduino5}
cp -v arduino-builder arduino-builder-$Sys/
cp $Working_Directory/ctags/ctags arduino-builder-$Sys/tools/5.8-arduino5/
wget https://raw.githubusercontent.com/arduino/arduino-builder/master/src/arduino.cc/builder/hardware/platform.keys.rewrite.txt --directory-prefix=arduino-builder-$Sys/hardware
wget https://raw.githubusercontent.com/arduino/arduino-builder/master/src/arduino.cc/builder/hardware/platform.txt --directory-prefix=arduino-builder-$Sys/hardware
if [[ $Sys == "arm" ]]; then
wget http://downloads.arduino.cc/packages/test_package_arm_index.json --directory-prefix=arduino-builder-$Sys/hardware
fi
tar -cjSf ./arduino-builder-$Sys-$Arduino_Builder_version.tar.bz2 -C ./arduino-builder-$Sys/ ./
shasum arduino-builder-$Sys-$Arduino_Builder_version.tar.bz2 | awk '{ print $1 }' > arduino-builder-$Sys-$Arduino_Builder_version.tar.bz2.sha
cp -v arduino-builder-$Sys-$Arduino_Builder_version.tar.bz2* $Working_Directory
cd $Working_Directory
fi
# End arduino-builder
# Arduino_IDE
build_rev=$((head -n 1 shared/revisions.txt) | awk '{print$2}')
if [[ $ReBuild_Arduino == "yes" ]]; then
echo -e "\n\nDelete stuff to enable Rebuilding of the IDE\n"
ant clean
fi
if [[ ! -f linux/work/arduino ]]; then
git_ver=`git tag | tail -2`
git_ver=`echo $git_ver | cut -d " " -f1`
echo -e "\n\nBuilding Arduino IDE $build_rev for $Sys\ngit version $git_ver\n"
ant clean build
mkdir -p linux/work/tools-builder/ctags/5.8-arduino5
cp ctags/ctags linux/work/tools-builder/ctags/5.8-arduino5/
if [[ $Bossac == "yes" ]]; then
patch -p1 < ../../debian/patches/sam_path_fix.patch
fi
fi
# End Arduino_IDE
# Build_distro
if [[ $Build_distro == "yes" ]]; then
if [[ -f ../../arduino-*.xz ]]; then
rm -v ../../arduino-*.xz
fi
echo "$build_rev" | ant dist
mv -v linux/arduino-*.xz ../../
fi
# End Build_distro
echo $start_time
date
echo -e "\n\nHave Fun and A Great Day\nShorTie\n"
exit 0
# Too run, if'n in X11
Arduino/build/linux/work/./arduino