| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | #!/bin/bash
 | 
					
						
							| 
									
										
										
										
											2020-10-30 15:14:39 -04:00
										 |  |  | # Build setup script for continuous integration testing. | 
					
						
							|  |  |  | # See ci-build.sh for the actual test steps. | 
					
						
							| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Stop script early on any error; check variables; be verbose | 
					
						
							|  |  |  | set -eux | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-28 15:03:41 -04:00
										 |  |  | MAIN_DIR=${PWD} | 
					
						
							| 
									
										
										
										
											2020-10-30 15:14:39 -04:00
										 |  |  | BUILD_DIR=${PWD}/ci_build | 
					
						
							|  |  |  | CACHE_DIR=${PWD}/ci_cache | 
					
						
							| 
									
										
										
										
											2018-06-28 15:15:42 -04:00
										 |  |  | mkdir -p ${BUILD_DIR} ${CACHE_DIR} | 
					
						
							| 
									
										
										
										
											2018-06-18 13:04:17 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-30 15:18:01 -04:00
										 |  |  | ###################################################################### | 
					
						
							|  |  |  | # Install system dependencies | 
					
						
							|  |  |  | ###################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | echo -e "\n\n=============== Install system dependencies\n\n" | 
					
						
							| 
									
										
										
										
											2020-11-23 12:21:28 -05:00
										 |  |  | PKGS="virtualenv python-dev libffi-dev build-essential" | 
					
						
							| 
									
										
										
										
											2020-11-23 12:20:00 -05:00
										 |  |  | PKGS="${PKGS} gcc-avr avr-libc" | 
					
						
							|  |  |  | PKGS="${PKGS} libnewlib-arm-none-eabi gcc-arm-none-eabi binutils-arm-none-eabi" | 
					
						
							|  |  |  | PKGS="${PKGS} pv libmpfr-dev libgmp-dev libmpc-dev texinfo bison flex" | 
					
						
							|  |  |  | sudo apt-get install ${PKGS} | 
					
						
							| 
									
										
										
										
											2020-10-30 15:18:01 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-28 15:15:42 -04:00
										 |  |  | ###################################################################### | 
					
						
							|  |  |  | # Install (or build) pru gcc | 
					
						
							|  |  |  | ###################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-10 10:37:58 -04:00
										 |  |  | echo -e "\n\n=============== Install embedded pru gcc\n\n" | 
					
						
							| 
									
										
										
										
											2018-06-28 15:15:42 -04:00
										 |  |  | PRU_FILE=${CACHE_DIR}/gnupru.tar.gz | 
					
						
							|  |  |  | PRU_DIR=${BUILD_DIR}/pru-gcc | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ ! -f ${PRU_FILE} ]; then | 
					
						
							|  |  |  |     cd ${BUILD_DIR} | 
					
						
							| 
									
										
										
										
											2020-09-25 22:13:56 -04:00
										 |  |  |     git config --global user.email "you@example.com" | 
					
						
							|  |  |  |     git config --global user.name "Your Name" | 
					
						
							|  |  |  |     git clone https://github.com/dinuxbg/gnupru -b 2018.03-beta-rc3 --depth 1 | 
					
						
							| 
									
										
										
										
											2018-06-28 15:15:42 -04:00
										 |  |  |     cd gnupru | 
					
						
							|  |  |  |     export PREFIX=${PRU_DIR} | 
					
						
							|  |  |  |     ./download-and-patch.sh 2>&1 | pv -nli 30 > ${BUILD_DIR}/gnupru-build.log | 
					
						
							|  |  |  |     ./build.sh 2>&1 | pv -nli 30 >> ${BUILD_DIR}/gnupru-build.log | 
					
						
							|  |  |  |     cd ${BUILD_DIR} | 
					
						
							|  |  |  |     tar cfz ${PRU_FILE} pru-gcc/ | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  |     cd ${BUILD_DIR} | 
					
						
							|  |  |  |     tar xfz ${PRU_FILE} | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2018-02-26 14:20:11 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ###################################################################### | 
					
						
							|  |  |  | # Create python virtualenv environment | 
					
						
							|  |  |  | ###################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-10 10:37:58 -04:00
										 |  |  | echo -e "\n\n=============== Install python virtualenv\n\n" | 
					
						
							| 
									
										
										
										
											2018-06-28 15:03:41 -04:00
										 |  |  | cd ${MAIN_DIR} | 
					
						
							| 
									
										
										
										
											2020-09-03 13:27:27 -04:00
										 |  |  | virtualenv -p python2 ${BUILD_DIR}/python-env | 
					
						
							| 
									
										
										
										
											2019-04-01 22:20:21 -04:00
										 |  |  | ${BUILD_DIR}/python-env/bin/pip install -r ${MAIN_DIR}/scripts/klippy-requirements.txt |