2018-11-16 08:04:34 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-11-16 08:34:58 +03:00
|
|
|
# Give other users access to /root
|
|
|
|
# (We probably should have just built the build tools somewhere else...)
|
|
|
|
chmod o+x /root
|
2021-10-13 15:12:29 +03:00
|
|
|
chmod -R o+rw /root/gcc_local/bin
|
2018-11-16 08:34:58 +03:00
|
|
|
|
|
|
|
# Who owns this directory?
|
|
|
|
NEWUID=`stat -c '%u' .`
|
|
|
|
|
2019-05-28 16:15:47 +03:00
|
|
|
if [[ "$NEWUID" == "0" ]]; then
|
|
|
|
echo "Are you running this on Docker for Mac? Owner UID is 0, going to use 501 instead."
|
|
|
|
NEWUID=501
|
|
|
|
fi
|
|
|
|
|
2018-11-16 08:34:58 +03:00
|
|
|
# Create a fake user with this name
|
|
|
|
useradd -u $NEWUID local
|
|
|
|
|
|
|
|
# Map the build tools
|
2018-11-16 08:04:34 +03:00
|
|
|
ln -s /root/gcc_local util/local
|
|
|
|
|
2018-11-16 08:34:58 +03:00
|
|
|
# Run make as local
|
2021-10-13 15:13:16 +03:00
|
|
|
runuser -u local -- sh -c 'make base/lib/libc.so && make -j4' || exit 1
|
2018-11-16 08:34:58 +03:00
|
|
|
|
|
|
|
# Remove the build tools
|
|
|
|
rm util/local
|
|
|
|
|