URI: 
       tINSTALL - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tINSTALL (4924B)
       ---
            1 #!/bin/sh
            2 
            3 dobuild=true
            4 doinstall=true
            5 
            6 case "x$1" in
            7 x)
            8         ;;
            9 x-b)
           10         dobuild=true
           11         doinstall=false
           12         ;;
           13 x-c)
           14         dobuild=false
           15         doinstall=true
           16         ;;
           17 x-r)
           18         shift
           19         PLAN9_TARGET=$1 export PLAN9_TARGET
           20         ;;
           21 *)
           22         echo 'usage: INSTALL [-b | -c] [-r path]' 1>&2
           23         exit 1
           24 esac
           25 
           26 echo "+ Mailing list: https://groups.google.com/group/plan9port-dev"
           27 echo "+ Issue tracker: https://github.com/9fans/plan9port/issues/"
           28 echo "+ Submitting changes: https://github.com/9fans/plan9port/pulls"
           29 echo " "
           30 echo "* Resetting $PLAN9/config"
           31 rm -f config
           32 
           33 PLAN9=`pwd` export PLAN9
           34 PATH=/bin:/usr/bin:$PLAN9/bin:$PATH export PATH
           35 case `uname` in
           36 SunOS)
           37         awk=nawk
           38         ;;
           39 DragonFly|*BSD)
           40         case `cc -v 2>&1` in
           41         *clang*)
           42                 echo "CC9=clang" >> $PLAN9/config
           43                 ;;
           44         *gcc*)
           45                 echo "CC9=gcc" >> $PLAN9/config
           46                 ;;
           47         esac
           48         echo "* Running on" `uname`", adjusting linker flags"
           49         case `uname` in
           50         OpenBSD)
           51                 echo "LDFLAGS='-L/usr/X11R6/lib -pthread'" >> $PLAN9/config
           52                 ;;
           53         NetBSD)
           54                 echo "LDFLAGS='-L/usr/X11R7/lib -pthread'" >> $PLAN9/config
           55                 ;;
           56         *)
           57                 echo "LDFLAGS='-L/usr/local/lib -pthread'" >> $PLAN9/config
           58                 ;;
           59         esac
           60         echo "CFLAGS='-pthread'" >> $PLAN9/config
           61         awk=awk
           62         ;;
           63 *)
           64         awk=awk
           65         ;;
           66 esac
           67 
           68 (
           69 if [ `uname` = SunOS ]; then
           70         # On Solaris x86, uname -p cannot be trusted.
           71         echo "* Running on Solaris: checking architecture..."
           72         case "$(isainfo -n)" in
           73         *amd64*)
           74                 echo "        x86-64 found; using gcc."
           75                 echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/amd64
           76                 ;;
           77         *i386*)
           78                 echo "        i386 found; using gcc."
           79                 echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/i386
           80                 ;;
           81         *sparc*)
           82                 echo "        Sparc found."
           83                 ;;
           84         esac
           85 fi
           86 
           87 if [ `uname` = Darwin ]; then
           88         export NPROC=$(sysctl hw.ncpu | sed 's/hw.ncpu: //')
           89         # On Darwin, uname -m -p cannot be trusted.
           90         echo "* Running on Darwin..."
           91         rm -f ./a.out
           92         if ! xcrun --sdk macosx clang lib/darwin-main.c >/dev/null 2>&1; then
           93                 echo "Cannot find 'xcrun --sdk macosx clang'." >&2
           94                 echo "You may need to install the command-line tools using Xcode." >&2
           95                 echo "See http://swtch.com/go/xcodegcc for details." >&2
           96                 exit 1
           97         fi
           98         CC9="xcrun --sdk macosx clang"
           99         case "$(uname -a)" in
          100         *ARM64*)
          101                 CC9="$CC9 -arch arm64"
          102                 echo '        Forcing arm64 binaries with clang.'
          103                 ;;
          104         esac
          105 
          106         echo "CC9='$CC9'" >>$PLAN9/config
          107         rm -f ./a.out
          108 fi
          109 
          110 if [ `uname` != Darwin ]; then
          111         # Determine whether fontsrv X11 files are available.
          112         rm -f a.out
          113         cc -o a.out -c -Iinclude -I/usr/include -I/usr/local/include -I/usr/include/freetype2 -I/usr/local/include/freetype2 \
          114             -I/usr/X11R7/include -I/usr/X11R7/include/freetype2 \
          115             -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 src/cmd/fontsrv/x11.c >/dev/null 2>&1
          116         if [ -f a.out ]; then
          117                 echo "        fontsrv dependencies found."
          118                 echo "FONTSRV=fontsrv" >>$PLAN9/config
          119         else
          120                 echo "        fontsrv dependencies not found."
          121                 echo "FONTSRV=" >>$PLAN9/config
          122                 rm -f bin/fontsrv
          123         fi
          124         rm -f a.out
          125 fi
          126 
          127 if [ -f LOCAL.config ]; then
          128         echo Using LOCAL.config options:
          129         sed 's/^/        /' LOCAL.config
          130         cat LOCAL.config >>config
          131 fi
          132 
          133 echo "* Compiler version:"
          134 9c -v 2>&1 | grep -v 'Configured with:' | grep -i version | sed 's/^/        /'
          135 
          136 cd src
          137 if $dobuild; then
          138         echo "* Building mk..."
          139         ../dist/buildmk 2>&1 | sed 's/^[+] //'
          140 
          141         if [ ! -x ../bin/mk ]; then
          142                 echo "* Error: mk failed to build."
          143                 exit 1
          144         fi
          145 
          146         echo "* Building everything (be patient)..."
          147         mk clean
          148         mk libs-nuke
          149         mk all || exit 1
          150         if [ ! -x $PLAN9/src/cmd/o.cleanname -o ! -x $PLAN9/src/cmd/acme/o.acme ]; then
          151                 echo "* Warning: not all binaries built successfully."
          152         fi
          153         echo "* Installing everything in $PLAN9/bin..."
          154         mk -k install || exit 1
          155         if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/acme -o ! -x $PLAN9/bin/sam ]; then
          156                 echo " "
          157                 echo "* Warning: not all binaries built successfully."
          158         fi
          159         if [ -f $PLAN9/bin/quote1 ]; then
          160                 cp $PLAN9/bin/quote1 $PLAN9/bin/'"'
          161                 cp $PLAN9/bin/quote2 $PLAN9/bin/'""'
          162         fi
          163         echo "* Cleaning up..."
          164         mk clean
          165 fi
          166 
          167 if $doinstall; then
          168         if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/sam ]; then
          169                 # Cleanname and sam are needed for moveplan9.sh and the man updates.
          170                 if [ ! -x $PLAN9/bin/cleanname ]; then
          171                         echo " "
          172                         echo "* Installation failed: $PLAN9/bin/cleanname does not exist."
          173                         exit 1
          174                 fi
          175                 if [ ! -x $PLAN9/bin/sam ]; then
          176                         echo " "
          177                         echo "* Installation failed: $PLAN9/bin/sam does not exist."
          178                         exit 1
          179                 fi
          180                 echo "* NOT renaming hard-coded /usr/local/plan9 paths."
          181                 echo "* NOT building web manual."
          182         else
          183                 echo "* Renaming hard-coded /usr/local/plan9 paths..."
          184                 cd $PLAN9
          185                 sh lib/moveplan9.sh
          186                 echo "* Building web manual..."
          187                 (
          188                         cd $PLAN9/dist
          189                         echo cd `pwd`';' mk man
          190                         mk man
          191                 )
          192         fi
          193 
          194         if [ -x LOCAL.INSTALL ]; then
          195                 echo "* Running local modifications..."
          196                 echo cd `pwd`';' ./LOCAL.INSTALL
          197                 ./LOCAL.INSTALL
          198         fi
          199 
          200         echo "* Done. "
          201         echo "        "
          202         echo "* Add these to your profile environment."
          203         echo "        PLAN9=$PLAN9 export PLAN9"
          204         echo '        PATH=$PATH:$PLAN9/bin export PATH'
          205 fi
          206 ) 2>&1 | tee install.log | $awk -f $PLAN9/dist/isum.awk -v 'copy='install.sum
          207