build-in-docker.sh 619 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. # Give other users access to /root
  3. # (We probably should have just built the build tools somewhere else...)
  4. chmod o+x /root
  5. chmod -R o+rw /root/gcc_local/bin
  6. # Who owns this directory?
  7. NEWUID=`stat -c '%u' .`
  8. if [[ "$NEWUID" == "0" ]]; then
  9. echo "Are you running this on Docker for Mac? Owner UID is 0, going to use 501 instead."
  10. NEWUID=501
  11. fi
  12. # Create a fake user with this name
  13. useradd -u $NEWUID local
  14. # Map the build tools
  15. ln -s /root/gcc_local util/local
  16. # Run make as local
  17. runuser -u local -- sh -c 'make base/lib/libc.so && make -j4' || exit 1
  18. # Remove the build tools
  19. rm util/local