Skip to content

Commit fb261b2

Browse files
committed
Docs: Added SSymlinker bash script usage case
- Updated QT_build_instructions.md - Fixed bugs in SSymlinker bash script. - Added `sudo` privilege to `ln` commands in SSymlinker. - Changed line endings to UNIX.
1 parent 45b41c7 commit fb261b2

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

QT_build_instructions.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,26 @@ sudo mkdir /usr/local/qt5.15
233233
sudo chown -R pi:pi /usr/local/qt5.15
234234
```
235235

236-
Also don't forget to setup Important Symlinks as follows: **(Important)**
237-
238-
```sh
239-
sudo ln -sf -r /usr/include/arm-linux-gnueabihf/asm /usr/include
240-
sudo ln -sf -r /usr/include/arm-linux-gnueabihf/gnu /usr/include
241-
sudo ln -sf -r /usr/include/arm-linux-gnueabihf/bits /usr/include
242-
sudo ln -sf -r /usr/include/arm-linux-gnueabihf/sys /usr/include
243-
sudo ln -sf -r /usr/include/arm-linux-gnueabihf/openssl /usr/include
244-
sudo ln -sf /usr/lib/arm-linux-gnueabihf/crtn.o /usr/lib/crtn.o
245-
sudo ln -sf /usr/lib/arm-linux-gnueabihf/crt1.o /usr/lib/crt1.o
246-
sudo ln -sf /usr/lib/arm-linux-gnueabihf/crti.o /usr/lib/crti.o
236+
### 11. Setup Important Symlinks as follows: *(Important)*
237+
238+
Our toolchains requires few additional symbolic links to work properly. Therefore, to create all required symbolic link reliably, we need to download `SSymlinker` bash script as follows:
239+
240+
```sh
241+
wget https://raw.githubusercontent.com/abhiTronix/raspberry-pi-cross-compilers/master/utils/SSymlinker
242+
```
243+
244+
Once it is downloaded, you just need to make it executable, and then run it for each path manually using the following commands:
245+
246+
```sh
247+
sudo chmod +x SSymlinker
248+
./SSymlinker -s /usr/include/arm-linux-gnueabihf/asm -d /usr/include
249+
./SSymlinker -s /usr/include/arm-linux-gnueabihf/gnu -d /usr/include
250+
./SSymlinker -s /usr/include/arm-linux-gnueabihf/bits -d /usr/include
251+
./SSymlinker -s /usr/include/arm-linux-gnueabihf/sys -d /usr/include
252+
./SSymlinker -s /usr/include/arm-linux-gnueabihf/openssl -d /usr/include
253+
./SSymlinker -s /usr/lib/arm-linux-gnueabihf/crtn.o -d /usr/lib/crtn.o
254+
./SSymlinker -s /usr/lib/arm-linux-gnueabihf/crt1.o -d /usr/lib/crt1.o
255+
./SSymlinker -s /usr/lib/arm-linux-gnueabihf/crti.o -d /usr/lib/crti.o
247256
```
248257

249258
That's it for Raspberry Pi setup.

utils/SSymlinker

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ set -eo pipefail # abort on errors
2929
helpFunction() {
3030
echo ""
3131
echo ""
32-
figlet -t -k -f /usr/share/figlet/standard.flf "SSymlinker: easy and safe"
32+
figlet -t -k -f /usr/share/figlet/standard.flf "SSymlinker: Safe Symlinker"
3333
echo ""
3434
echo "Usage: $0 -s SOURCE -d DESTINATION"
3535
echo -e "\t-s Source directory/file."
@@ -46,21 +46,27 @@ while getopts "s:d:" opt; do
4646
esac
4747
done
4848

49-
#print helpFunction in case parameters are empty
49+
# print helpFunction in case parameters are empty
5050
if [ -z "$SOURCE" ] || [ -z "$DESTINATION" ]; then
5151
echo "Parameters are not valid. Aborting!"
5252
helpFunction
5353
fi
5454

55+
# throw error if source doesn't exists
56+
if [[ ! -d "$SOURCE" && ! -f "$SOURCE" ]]; then
57+
echo "Source $SOURCE doesn't exist. Aborting!"
58+
exit 1
59+
fi
60+
5561
# get valid destination
56-
if [[ -d $DESTINATION && -L $DESTINATION ]]; then
62+
if [[ -f $DESTINATION ]]; then
5763
# get parent directory
58-
DESTINATION=$(cd -- "$DESTINATION" && pwd)
64+
DESTINATION=$(dirname $(readlink -f $DESTINATION))
5965
else
6066
DESTINATION=$(readlink -f "$DESTINATION")
6167
fi
62-
if [[ ! -d $DESTINATION && ! -w $DESTINATION ]]; then
63-
echo "$DESTINATION is not valid destination directory. Aborting!"
68+
if [[ ! -d $DESTINATION ]]; then
69+
echo "$DESTINATION is not valid destination. Aborting!"
6470
exit 1
6571
fi
6672

@@ -74,8 +80,8 @@ fi
7480

7581
# check if symlink already present or
7682
# SOURCE path and DESTINATION path are same
77-
if [[ $DESTINATION == $SOURCE ]]; then
78-
if [[ -f $DESTINATION ]]; then
83+
if [[ $DESTINATION == $SOURCE || $DESTINATION == $(dirname $SOURCE) ]]; then
84+
if [[ $DESTINATION == $(dirname $SOURCE) ]]; then
7985
echo "Symlink already present, Aborting!"
8086
exit 0
8187
else
@@ -87,7 +93,7 @@ fi
8793
# handle symlink creation
8894
if [[ ! -L "$DESTINATION/$(basename $SOURCE)" && -d "$DESTINATION/$(basename $SOURCE)" ]]; then
8995
# a similar named non-empty folder already present at destination
90-
ln -s -f -v "$SOURCE/*" "$DESTINATION/$(basename $SOURCE)/*"
96+
sudo ln -s -f -v "$SOURCE/*" "$DESTINATION/$(basename $SOURCE)/*"
9197
exit 0
9298
elif [[ -f $DESTINATION ]]; then
9399
# a similar named file already present a destination
@@ -98,4 +104,4 @@ else
98104
answer=y
99105
fi
100106
# create symlink
101-
[[ "$answer" = @(y|Y) ]] && ln -s -n -f -v -- "$SOURCE" "$DESTINATION"
107+
[[ "$answer" = @(y|Y) ]] && sudo ln -s -n -f -v -- "$SOURCE" "$DESTINATION"

0 commit comments

Comments
 (0)