Skip to content

Commit

Permalink
Default to installing in /opt/agbcc
Browse files Browse the repository at this point in the history
  • Loading branch information
mid-kid committed Oct 31, 2021
1 parent fb65760 commit 43a8a7c
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
#!/bin/sh
set -e
if [ "$1" != "" ]; then
dest="$(realpath "$1/tools/agbcc")"
install -Dm755 -t "$dest/bin" agbcc old_agbcc agbcc_arm
install -Dm644 -t "$dest/lib" libgcc.a libc.a
install -Dm644 -t "$dest/include" ginclude/*
cp -R libc/include "$dest/" #drop include, because we don't want include/include
make -C binutils/build DESTDIR="$dest" install

default_dest=/opt/agbcc

if [ $# -ge 1 ]; then
dest="$(realpath "$1")"
else
echo "Usage: install.sh PATH"
echo "INFO: Missing parameter, defaulting to installing in $default_dest" 1>&2
dest="$default_dest"
fi

# Check if we can access $dest
if [ -d "$dest" -a ! -w "$dest" ] || ! install -d "$dest" 2> /dev/null; then
echo "ERROR: Can't access directory '$dest'. Are you sure you have sufficient permissions? (hint: use 'sudo ./install.sh')" 1>&2
exit 1
fi

install -Dm755 -t "$dest/bin" agbcc old_agbcc agbcc_arm
install -Dm644 -t "$dest/lib" libgcc.a libc.a
install -Dm644 -t "$dest/include" ginclude/*
cp -R libc/include "$dest/" #drop include, because we don't want include/include
make -C binutils/build DESTDIR="$dest" install

0 comments on commit 43a8a7c

Please sign in to comment.