aboutsummaryrefslogtreecommitdiff
path: root/INSTALL
blob: 05fa1bb9b26929c5e3ae6e37152b77e164a3dfb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/sh

PLAN9=`pwd` export PLAN9
PATH=/bin:/usr/bin:$PLAN9/bin:$PATH export PATH

echo "* Resetting $PLAN9/config"
rm -f config

(
if [ `uname` = Linux ]; then
	# On Linux, we use the kernel version to decide whether
	# to use pthreads or not.  On 2.6 versions that aren't
	# linking with NPTL by default, pretend to be an older kernel.
	echo "* Running on Linux: checking for NPTL..."
	gcc lib/linux-isnptl.c -lpthread
	if ./a.out >/dev/null
	then	
		echo "	NPTL found."
		echo "SYSVERSION=2.6.x" >$PLAN9/config
	else
		echo "	NPTL not found."
		echo "SYSVERSION=2.4.x" >$PLAN9/config
	fi
	rm -f ./a.out
fi

if [ -f LOCAL.config ]; then
	echo Using LOCAL.config options:
	sed 's/^/	/' LOCAL.config
	cat LOCAL.config >>config
fi

cd src
if [ ! -x ../bin/mk ]; then
	echo "* Building mk..."
	../dist/buildmk 2>&1 | sed 's/^[+] //'
fi
if [ ! -x ../bin/mk ]; then
	echo "* Error: mk failed to build."
	exit 1
fi

echo "* Building everything (be patient)..."
mk clean
mk libs-nuke
mk all || exit 1
if [ ! -x $PLAN9/src/cmd/o.cleanname -o ! -x $PLAN9/src/cmd/acme/o.acme ]; then
	echo "* Warning: not all binaries built successfully."
fi
echo "* Installing everything..."
mk install || exit 1
if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/acme -o ! -x $PLAN9/bin/sam ]; then
	echo " "
	echo "* Warning: not all binaries built successfully."
fi
echo "* Cleaning up..."
mk clean
if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/sam ]; then
	# Cleanname and sam are needed for moveplan9.sh and the man updates.
	if [ ! -x $PLAN9/bin/cleanname ]; then
		echo " "
		echo "* Installation failed: $PLAN9/bin/cleanname does not exist."
		exit 1
	fi
	if [ ! -x $PLAN9/bin/sam ]; then
		echo " "
		echo "* Installation failed: $PLAN9/bin/sam does not exist."
		exit 1
	fi
	echo "* NOT renaming hard-coded /usr/local/plan9 paths."
	echo "* NOT building web manual."
else
	echo "* Renaming hard-coded /usr/local/plan9 paths..."
	cd $PLAN9
	sh lib/moveplan9.sh
	echo "* Building web manual..."
	(
		cd $PLAN9/dist
		echo cd `pwd`';' mk man
		mk man
	)
fi

if [ -x LOCAL.INSTALL ]; then
	echo "* Running local modifications..."
	echo cd `pwd`';' ./LOCAL.INSTALL
	./LOCAL.INSTALL
fi

echo "* Done. "
echo "	"
echo "* Add these to your profile environment."
echo "	PLAN9=$PLAN9 export PLAN9"
echo '	PATH=$PATH:$PLAN9/bin export PATH'

) 2>&1 | tee install.log | awk -f $PLAN9/dist/isum.awk | tee install.sum