DSCF

.co.uk

PC32

A ColorForth compiler and editor for x86-64
git clone https://dscf.co.uk/clone/PC32.git
Log | Files | Refs | README

PC32.in (1412B)


      1 #!/bin/sh
      2 # PC32 launcher (installed by `make install`).
      3 # Runs the installed 32-bit program in the CURRENT folder, so it uses that folder's data.blk
      4 # (and data/ for the examples).  The 32-bit loader and libraries it needs are installed with it.
      5 share=@SHAREDIR@
      6 
      7 usage() {
      8     cat <<USAGE
      9 usage: PC32 [--new | --help | ARG...]
     10   PC32          run in this folder (needs ./data.blk); starts maximized and borderless
     11   PC32 --new    create ./data.blk and ./data/MC.bin here from the installed copies, then exit
     12                 (never overwrites an existing file)
     13   PC32 ARG...   any other argument starts a normal, non-maximized window
     14 Installed in: $share
     15 USAGE
     16 }
     17 
     18 case "$1" in
     19     -h|--help) usage; exit 0 ;;
     20     --new)
     21         for f in data.blk data/MC.bin; do
     22             if [ -e "$f" ]; then echo "PC32: $f already exists, left alone"; continue; fi
     23             case "$f" in */*) mkdir -p "${f%/*}" ;; esac
     24             cp "$share/${f##*/}" "$f" && echo "PC32: created $f"
     25         done
     26         exit 0 ;;
     27 esac
     28 
     29 if [ ! -f data.blk ]; then
     30     echo "PC32: no data.blk in $(pwd)" >&2
     31     echo "      run PC32 from a folder that has one, or 'PC32 --new' to create a fresh one here" >&2
     32     exit 1
     33 fi
     34 
     35 export LIBGL_DRIVERS_PATH="$share/lib32/dri"
     36 export LIBGL_ALWAYS_SOFTWARE=1      # only the bundled 32-bit software driver exists
     37 exec "$share/lib32/ld-linux.so.2" --library-path "$share/lib32" "$share/a.out" "$@"