3
# TODO: Rename this file without "armhf" when it's safe to do so.
11
echo "Usage: ${name} [options] mychroot-dir"
13
echo " -a arch Select architecture, i.e. armhf, arm64, ppc... Default is armhf"
14
echo " -d dist Select distribution, i.e. vivid, wily. Default is vivid"
15
echo " -r rep Select an additional repository for bootstrap. Default is none"
17
echo "please supply at least a directory to create partial chroot in. (eg, ./setup-partial-armhf-chroot.sh mychroot-dir)"
20
# Default to vivid as we don't seem to have any working wily devices right now.
21
# Also Jenkins expects this script to default to vivid (TODO: update CI?)
28
while getopts a:d:r:h opt; do
37
repositories="$repositories $OPTARG"
39
sources="$sources source$sourceid"
42
echo "Option -$OPTARG requires an argument"
51
echo "Invalid option: -$OPTARG"
66
echo "creating phablet-compatible $arch partial chroot for aethercast compilation in directory ${directory}"
68
if [ ! -d ${directory} ]; then
72
DEBCONTROL=$(pwd)/../debian/control
74
pushd ${directory} > /dev/null
76
# Empty dpkg status file, so that ALL dependencies are listed with dpkg-checkbuilddeps
79
# Manual error code checking is needed for dpkg-checkbuilddeps
82
# Parse dependencies from debian/control
83
# dpkg-checkbuilddeps returns non-zero when dependencies are not met and the list is sent to stderr
84
builddeps=$(dpkg-checkbuilddeps -a ${arch} --admindir=. ${DEBCONTROL} 2>&1 )
85
if [ $? -eq 0 ] ; then
90
# now turn exit on error option
93
# Sanitize dependencies list for submission to multistrap
94
# build-essential is not needed as we are cross-compiling
95
builddeps=$(echo ${builddeps} | sed -e 's/dpkg-checkbuilddeps://g' \
97
-e 's/Unmet build dependencies://g' \
98
-e 's/build-essential:native//g')
99
builddeps=$(echo ${builddeps} | sed 's/([^)]*)//g')
100
builddeps=$(echo ${builddeps} | sed -e 's/abi-compliance-checker//g')
101
builddeps=$(echo ${builddeps} | sed -e 's/multistrap//g')
105
source_url=http://archive.ubuntu.com/ubuntu
108
source_url=http://ports.ubuntu.com/ubuntu-ports
114
directory=${directory}
117
bootstrap=Ubuntu ${sources}
120
packages=${builddeps}
126
for x in ${repositories};
129
echo "[source${sourceid}]
135
multistrap -f mstrap.conf
137
rm -f var/cache/apt/archives/lock
139
# Remove libc libraries that confuse the cross-compiler
140
rm -f var/cache/apt/archives/libc-dev*.deb
141
rm -f var/cache/apt/archives/libc6*.deb
143
for deb in var/cache/apt/archives/* ; do
144
if [ ! -d ${deb} ] ; then
145
echo "unpacking: ${deb}"
150
# Fix up symlinks which asssumed the usual root path
151
for broken_symlink in $(find . -name \*.so -type l -xtype l) ; do
152
ln -sf $(pwd)$(readlink ${broken_symlink}) ${broken_symlink}