link_graph.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. ### This script is run by Free Oberon on Linux
  3. ### to link a graphics program.
  4. ### When it is being run, the current directory
  5. ### must be the root directory of Free Oberon.
  6. # Set DIR = directory of this script
  7. SOURCE=${BASH_SOURCE[0]}
  8. while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  9. DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
  10. SOURCE=$(readlink "$SOURCE")
  11. [[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
  12. done
  13. DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
  14. cd _Build
  15. THENAME="${1%.*}"
  16. ONAME="${THENAME##*/}"
  17. FOBDIR="$DIR/../.."
  18. OFRDIR="$DIR/OfrontPlus"
  19. OFRTAR="$OFRDIR/Target/Linux_amd64"
  20. PATH="$OFRTAR:$PATH"
  21. CC="gcc"
  22. shift
  23. $CC -O0 -fno-exceptions \
  24. -I $FOBDIR/src \
  25. -I $OFRDIR/Mod/Lib \
  26. -I $OFRTAR/Lib/Obj \
  27. $ONAME.c -o $ONAME \
  28. $@ \
  29. $FOBDIR/Data/bin/libFreeOberon.a \
  30. $OFRTAR/Lib/libOfront.a \
  31. $(pkg-config \
  32. allegro_primitives-5 allegro_image-5 allegro_audio-5 \
  33. allegro_acodec-5 allegro_font-5 allegro_dialog-5 \
  34. allegro-5 --libs --cflags)
  35. retcode=$?
  36. cd ..
  37. exit $retcode