Blob


1 #!/bin/sh
3 PLAN9=`pwd` export PLAN9
4 PATH=/bin:/usr/bin:$PLAN9/bin:$PATH export PATH
6 echo "* Resetting $PLAN9/config"
7 rm -f config
9 (
10 if [ `uname` = Linux ]; then
11 # On Linux, we use the kernel version to decide whether
12 # to use pthreads or not. On 2.6 versions that aren't
13 # linking with NPTL by default, pretend to be an older kernel.
14 echo "* Running on Linux: checking for NPTL..."
15 gcc lib/linux-isnptl.c -lpthread
16 if ./a.out >/dev/null
17 then
18 echo " NPTL found."
19 echo "SYSVERSION=2.6.x" >$PLAN9/config
20 else
21 echo " NPTL not found."
22 echo "SYSVERSION=2.4.x" >$PLAN9/config
23 fi
24 rm -f ./a.out
25 fi
27 if [ -f LOCAL.config ]; then
28 echo Using LOCAL.config options:
29 sed 's/^/ /' LOCAL.config
30 cat LOCAL.config >>config
31 fi
33 cd src
34 if [ ! -x ../bin/mk ]; then
35 echo "* Building mk..."
36 ../dist/buildmk 2>&1 | sed 's/^[+] //'
37 fi
38 if [ ! -x ../bin/mk ]; then
39 echo "* Error: mk failed to build."
40 exit 1
41 fi
43 echo "* Building everything (be patient)..."
44 mk clean
45 mk libs-nuke
46 mk all || exit 1
47 if [ ! -x $PLAN9/src/cmd/o.cleanname -o ! -x $PLAN9/src/cmd/acme/o.acme ]; then
48 echo "* Warning: not all binaries built successfully."
49 fi
50 echo "* Installing everything..."
51 mk install || exit 1
52 if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/acme -o ! -x $PLAN9/bin/sam ]; then
53 echo " "
54 echo "* Warning: not all binaries built successfully."
55 fi
56 echo "* Cleaning up..."
57 mk clean
58 if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/sam ]; then
59 # Cleanname and sam are needed for moveplan9.sh and the man updates.
60 if [ ! -x $PLAN9/bin/cleanname ]; then
61 echo " "
62 echo "* Installation failed: $PLAN9/bin/cleanname does not exist."
63 exit 1
64 fi
65 if [ ! -x $PLAN9/bin/sam ]; then
66 echo " "
67 echo "* Installation failed: $PLAN9/bin/sam does not exist."
68 exit 1
69 fi
70 echo "* NOT renaming hard-coded /usr/local/plan9 paths."
71 echo "* NOT building web manual."
72 else
73 echo "* Renaming hard-coded /usr/local/plan9 paths..."
74 cd $PLAN9
75 sh lib/moveplan9.sh
76 echo "* Building web manual..."
77 (
78 cd $PLAN9/dist
79 echo cd `pwd`';' mk man
80 mk man
81 )
82 fi
84 if [ -x LOCAL.INSTALL ]; then
85 echo "* Running local modifications..."
86 echo cd `pwd`';' ./LOCAL.INSTALL
87 ./LOCAL.INSTALL
88 fi
90 echo "* Done. "
91 echo " "
92 echo "* Add these to your profile environment."
93 echo " PLAN9=$PLAN9 export PLAN9"
94 echo ' PATH=$PATH:$PLAN9/bin export PATH'
96 ) 2>&1 | tee install.log | awk -f $PLAN9/dist/isum.awk | tee install.sum