-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy patheasy_build_arm.sh
executable file
·167 lines (135 loc) · 5.09 KB
/
easy_build_arm.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
#!/bin/bash
# Script that can be run to set up a Pedigree repository for building with minimal
# effort.
set -e
echo "Pedigree Easy Build script"
echo "This script will ask a couple questions and then automatically install"
echo "dependencies and compile Pedigree for you."
echo
old=$(pwd)
script_dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && script_dir=$script_dir
cd $old
compiler_build_options=""
real_os=""
if [ ! -e $script_dir/.easy_os ]; then
echo "Checking for dependencies... Which operating system are you running on?"
echo "Cygwin, Debian/Ubuntu, OpenSuSE, Fedora, OSX, or some other system?"
if [ $# == 0 ]; then
read os
else
os=$1
shift
fi
shopt -s nocasematch
real_os=$os
case $real_os in
debian)
# TODO: Not sure if the package list is any different for debian vs ubuntu?
echo "Installing packages with apt-get, please wait..."
sudo apt-get install libmpfr-dev libmpc-dev libgmp3-dev sqlite3 texinfo scons genisoimage
;;
ubuntu)
echo "Installing packages with apt-get, please wait..."
sudo apt-get install libmpfr-dev libmpc-dev libgmp3-dev sqlite3 texinfo scons genisoimage
;;
opensuse)
echo "Installing packages with zypper, please wait..."
sudo zypper install mpfr-devel mpc-devel gmp3-devel sqlite3 texinfo scons genisoimage
;;
fedora|redhat|centos|rhel)
echo "Installing packages with YUM, please wait..."
sudo yum install mpfr-devel gmp-devel libmpc-devel sqlite texinfo scons genisoimage
;;
osx|mac)
echo "Installing packages with macports, please wait..."
sudo port install mpfr libmpc gmp libiconv sqlite3 texinfo scons cdrtools wget mtools
real_os="osx"
;;
cygwin|windows|mingw)
echo "Please ensure you use Cygwin's 'setup.exe', or some other method, to install the following:"
echo " - Python"
echo " - GCC & binutils"
echo " - libgmp, libmpc, libmpfr"
echo " - mkisofs/genisoimage"
echo " - sqlite"
echo "You will need to find alternative sources for the following:"
echo " - mtools"
echo " - scons"
real_os="cygwin"
;;
*)
echo "Operating system '$os' is not supported yet."
echo "You will need to find alternative sources for the following:"
echo " - Python"
echo " - GCC & binutils"
echo " - libgmp, libmpc, libmpfr"
echo " - mkisofs/genisoimage"
echo " - sqlite"
echo " - mtools"
echo " - scons"
echo
echo "If you can modify this script to support '$os', please provide patches."
;;
esac
shopt -u nocasematch
echo $real_os > $script_dir/.easy_os
echo
else
real_os=`cat $script_dir/.easy_os`
if [ $real_os == $1 ]; then
shift
fi
fi
echo "Please wait, checking for a working cross-compiler."
echo "If none is found, the source code for one will be downloaded, and it will be"
echo "compiled for you."
# Special parameters for some operating systems when building cross-compilers
case $real_os in
osx)
compiler_build_options="$compiler_build_options osx-compat"
;;
esac
# Install cross-compilers
$script_dir/scripts/checkBuildSystemNoInteractive.pl arm-elf $script_dir/pedigree-compiler $compiler_build_options
old=$(pwd)
cd $script_dir
set +e
# Update the local working copy, only if the working copy is not dirty and we
# are not a developer.
git remote -v | grep ssh > /dev/null 2>&1
if [ $? != 0 ]; then
# Not a developer - check for clean working copy
if [[ $(git diff --shortstat 2> /dev/null | tail -n1) == "" ]]; then
echo
echo "Please wait, checking for a newer revision of the Pedigree source code."
echo "If one is found, it will be downloaded and your local copy will be automatically updated."
git fetch && git rebase origin/master > /dev/null 2>&1
fi
fi
echo
echo "Ensuring CDI is up-to-date."
# Setup all submodules, make sure they are up-to-date
git submodule init > /dev/null 2>&1
git submodule update > /dev/null 2>&1
set -e
echo
echo "Beginning the Pedigree build."
echo
# Build Pedigree.
scons CROSS=$script_dir/compilers/dir/bin/arm-elf- $*
cd "$old"
echo
echo
echo "Pedigree is now ready to be built without running this script."
echo "To build in future, run the following command in the '$script_dir' directory:"
echo "scons CROSS=$script_dir/pedigree-compiler/bin/i686-pedigree-"
echo
echo "If you wish, you can continue to run this script. It won't ask questions"
echo "anymore, unless you remove the '.easy_os' file in '$script_dir'."
echo
echo "You can also run scons --help for more information about options."
echo
echo "Patches should be posted in the issue tracker at http://pedigree-project.org/projects/pedigree/issues"
echo "Support can be found in #pedigree on irc.freenode.net."
echo
echo "Have fun with Pedigree! :)"