3 df29f2ce 2005-12-30 devnull dobuild=true
4 df29f2ce 2005-12-30 devnull doinstall=true
6 df29f2ce 2005-12-30 devnull case "x$1" in
10 df29f2ce 2005-12-30 devnull dobuild=true
11 df29f2ce 2005-12-30 devnull doinstall=false
14 df29f2ce 2005-12-30 devnull dobuild=false
15 df29f2ce 2005-12-30 devnull doinstall=true
19 9c38253d 2018-11-14 rsc PLAN9_TARGET=$1 export PLAN9_TARGET
22 89ec3cde 2011-06-02 rsc echo 'usage: INSTALL [-b | -c] [-r path]' 1>&2
26 b4e0c548 2004-02-29 devnull PLAN9=`pwd` export PLAN9
27 90550261 2005-07-22 devnull PATH=/bin:/usr/bin:$PLAN9/bin:$PATH export PATH
28 80c90f27 2010-04-09 rsc case `uname` in
37 a3993885 2017-09-01 rsc echo "+ Mailing list: https://groups.google.com/group/plan9port-dev"
38 a3993885 2017-09-01 rsc echo "+ Issue tracker: https://github.com/9fans/plan9port/issues/"
39 a3993885 2017-09-01 rsc echo "+ Submitting changes: https://github.com/9fans/plan9port/pulls"
41 7495a529 2005-11-26 devnull echo "* Resetting $PLAN9/config"
42 52fdc1a5 2005-02-02 devnull rm -f config
45 dad9d0ac 2013-01-31 rsc if [ `uname` = FreeBSD ]; then
46 9c38253d 2018-11-14 rsc case `cc -v 2>&1` in
48 9c38253d 2018-11-14 rsc echo "CC9=clang" >> $PLAN9/config
53 9c38253d 2018-11-14 rsc echo "* Running on FreeBSD, adjusting linker flags"
54 9c38253d 2018-11-14 rsc echo "LDFLAGS='-L/usr/local/lib'" >> $PLAN9/config
57 20035ed4 2014-02-28 minux.ma if [ `uname` = DragonFly ]; then
58 9c38253d 2018-11-14 rsc echo "* Running on DragonFly BSD, adjusting linker flags"
59 9c38253d 2018-11-14 rsc echo "LDFLAGS='-L/usr/local/lib -pthread'" >> $PLAN9/config
60 9c38253d 2018-11-14 rsc echo "CFLAGS='-pthread'" >> $PLAN9/config
63 1a512ec0 2012-12-11 rsc if [ `uname` = OpenBSD ]; then
64 9c38253d 2018-11-14 rsc echo "* Running on OpenBSD, adjusting linker flags"
65 9c38253d 2018-11-14 rsc echo "LDFLAGS='-L/usr/X11R6/lib -pthread'" >> $PLAN9/config
68 7a2c8850 2005-01-17 devnull if [ `uname` = Linux ]; then
69 7a2c8850 2005-01-17 devnull # On Linux, we use the kernel version to decide whether
70 7a2c8850 2005-01-17 devnull # to use pthreads or not. On 2.6 versions that aren't
71 7a2c8850 2005-01-17 devnull # linking with NPTL by default, pretend to be an older kernel.
72 7495a529 2005-11-26 devnull echo "* Running on Linux: checking for NPTL..."
73 d338028e 2005-01-17 devnull gcc lib/linux-isnptl.c -lpthread
74 8327d419 2005-01-23 devnull if ./a.out >/dev/null
76 7a2c8850 2005-01-17 devnull echo " NPTL found."
77 fc567f47 2011-08-02 rsc echo "SYSVERSION=2.6.x" >>$PLAN9/config
79 7a2c8850 2005-01-17 devnull echo " NPTL not found."
80 fc567f47 2011-08-02 rsc echo "SYSVERSION=2.4.x" >>$PLAN9/config
82 b04c42e9 2005-01-17 devnull rm -f ./a.out
85 e78ed7a6 2014-03-05 minux.ma if [ `uname` = SunOS ]; then
86 e78ed7a6 2014-03-05 minux.ma # On Solaris x86, uname -p cannot be trusted.
87 9c38253d 2018-11-14 rsc echo "* Running on Solaris: checking architecture..."
88 9c38253d 2018-11-14 rsc case "$(isainfo -n)" in
89 e78ed7a6 2014-03-05 minux.ma *amd64*)
90 e78ed7a6 2014-03-05 minux.ma echo " x86-64 found."
91 e78ed7a6 2014-03-05 minux.ma echo "OBJTYPE=x86_64" >>$PLAN9/config
92 e78ed7a6 2014-03-05 minux.ma echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/amd64
95 e78ed7a6 2014-03-05 minux.ma echo " i386 found."
96 e78ed7a6 2014-03-05 minux.ma echo "OBJTYPE=386" >>$PLAN9/config
97 e78ed7a6 2014-03-05 minux.ma echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/i386
100 e78ed7a6 2014-03-05 minux.ma echo " Sparc found."
101 e78ed7a6 2014-03-05 minux.ma echo "OBJTYPE=sparc" >>$PLAN9/config
106 fc567f47 2011-08-02 rsc if [ `uname` = Darwin ]; then
107 fc567f47 2011-08-02 rsc # On Darwin, uname -m -p cannot be trusted.
108 fc567f47 2011-08-02 rsc echo "* Running on Darwin: checking architecture..."
109 fc567f47 2011-08-02 rsc rm -f ./a.out
110 baf127ad 2014-01-22 rsc if ! gcc lib/darwin-main.c >/dev/null 2>&1; then
111 baf127ad 2014-01-22 rsc echo "Cannot find gcc. You may need to install the command-line tools using Xcode." >&2
112 baf127ad 2014-01-22 rsc echo "See http://swtch.com/go/xcodegcc for details." >&2
115 fc567f47 2011-08-02 rsc case "$(file ./a.out 2>/dev/null)" in
117 fc567f47 2011-08-02 rsc echo " x86-64 found."
118 fc567f47 2011-08-02 rsc echo "OBJTYPE=x86_64" >>$PLAN9/config
119 fe92b4a0 2018-11-16 rsc echo "CC9='xcrun --sdk macosx clang'" >>$PLAN9/config
122 fc567f47 2011-08-02 rsc echo " i386 found."
123 fc567f47 2011-08-02 rsc echo "OBJTYPE=386" >>$PLAN9/config
126 9c38253d 2018-11-14 rsc echo " power found."
127 813b3eea 2011-10-23 rsc echo "OBJTYPE=power" >>$PLAN9/config
130 fc567f47 2011-08-02 rsc rm -f ./a.out
133 cb71c0bd 2012-12-18 rsc if [ `uname` != Darwin ]; then
134 cb71c0bd 2012-12-18 rsc # Determine whether fontsrv X11 files are available.
136 8ee5da7c 2015-11-10 rsc gcc -o a.out -c -Iinclude -I/usr/include -I/usr/local/include -I/usr/include/freetype2 -I/usr/local/include/freetype2 \
137 8ee5da7c 2015-11-10 rsc -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 src/cmd/fontsrv/x11.c >/dev/null 2>&1
138 cb71c0bd 2012-12-18 rsc if [ -f a.out ]; then
139 cb71c0bd 2012-12-18 rsc echo " fontsrv dependencies found."
140 cb71c0bd 2012-12-18 rsc echo "FONTSRV=fontsrv" >>$PLAN9/config
142 cb71c0bd 2012-12-18 rsc echo " fontsrv dependencies not found."
143 cb71c0bd 2012-12-18 rsc echo "FONTSRV=" >>$PLAN9/config
144 cb71c0bd 2012-12-18 rsc rm -f bin/fontsrv
149 52fdc1a5 2005-02-02 devnull if [ -f LOCAL.config ]; then
150 52fdc1a5 2005-02-02 devnull echo Using LOCAL.config options:
151 52fdc1a5 2005-02-02 devnull sed 's/^/ /' LOCAL.config
152 52fdc1a5 2005-02-02 devnull cat LOCAL.config >>config
155 9c38253d 2018-11-14 rsc echo "* Compiler version:"
156 9c38253d 2018-11-14 rsc 9c -v 2>&1 | grep -v 'Configured with:' | grep -i version | sed 's/^/ /'
159 df29f2ce 2005-12-30 devnull if $dobuild; then
160 df29f2ce 2005-12-30 devnull if [ ! -x ../bin/mk ]; then
161 df29f2ce 2005-12-30 devnull echo "* Building mk..."
162 df29f2ce 2005-12-30 devnull ../dist/buildmk 2>&1 | sed 's/^[+] //'
164 df29f2ce 2005-12-30 devnull if [ ! -x ../bin/mk ]; then
165 df29f2ce 2005-12-30 devnull echo "* Error: mk failed to build."
169 df29f2ce 2005-12-30 devnull echo "* Building everything (be patient)..."
170 df29f2ce 2005-12-30 devnull mk clean
171 df29f2ce 2005-12-30 devnull mk libs-nuke
172 df29f2ce 2005-12-30 devnull mk all || exit 1
173 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/src/cmd/o.cleanname -o ! -x $PLAN9/src/cmd/acme/o.acme ]; then
174 df29f2ce 2005-12-30 devnull echo "* Warning: not all binaries built successfully."
176 df29f2ce 2005-12-30 devnull echo "* Installing everything in $PLAN9/bin..."
177 c49b45ed 2011-10-03 rsc mk -k install || exit 1
178 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/acme -o ! -x $PLAN9/bin/sam ]; then
179 6637b803 2005-11-28 devnull echo " "
180 df29f2ce 2005-12-30 devnull echo "* Warning: not all binaries built successfully."
182 734ca635 2014-11-07 0intro if [ -f $PLAN9/bin/quote1 ]; then
183 734ca635 2014-11-07 0intro cp $PLAN9/bin/quote1 $PLAN9/bin/'"'
184 734ca635 2014-11-07 0intro cp $PLAN9/bin/quote2 $PLAN9/bin/'""'
186 df29f2ce 2005-12-30 devnull echo "* Cleaning up..."
187 df29f2ce 2005-12-30 devnull mk clean
190 df29f2ce 2005-12-30 devnull if $doinstall; then
191 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/sam ]; then
192 df29f2ce 2005-12-30 devnull # Cleanname and sam are needed for moveplan9.sh and the man updates.
193 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/cleanname ]; then
194 df29f2ce 2005-12-30 devnull echo " "
195 df29f2ce 2005-12-30 devnull echo "* Installation failed: $PLAN9/bin/cleanname does not exist."
198 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/sam ]; then
199 df29f2ce 2005-12-30 devnull echo " "
200 df29f2ce 2005-12-30 devnull echo "* Installation failed: $PLAN9/bin/sam does not exist."
203 df29f2ce 2005-12-30 devnull echo "* NOT renaming hard-coded /usr/local/plan9 paths."
204 df29f2ce 2005-12-30 devnull echo "* NOT building web manual."
206 df29f2ce 2005-12-30 devnull echo "* Renaming hard-coded /usr/local/plan9 paths..."
207 df29f2ce 2005-12-30 devnull cd $PLAN9
208 df29f2ce 2005-12-30 devnull sh lib/moveplan9.sh
209 df29f2ce 2005-12-30 devnull echo "* Building web manual..."
211 df29f2ce 2005-12-30 devnull cd $PLAN9/dist
212 df29f2ce 2005-12-30 devnull echo cd `pwd`';' mk man
217 df29f2ce 2005-12-30 devnull if [ -x LOCAL.INSTALL ]; then
218 df29f2ce 2005-12-30 devnull echo "* Running local modifications..."
219 df29f2ce 2005-12-30 devnull echo cd `pwd`';' ./LOCAL.INSTALL
220 df29f2ce 2005-12-30 devnull ./LOCAL.INSTALL
223 df29f2ce 2005-12-30 devnull echo "* Done. "
224 df29f2ce 2005-12-30 devnull echo " "
225 df29f2ce 2005-12-30 devnull echo "* Add these to your profile environment."
226 df29f2ce 2005-12-30 devnull echo " PLAN9=$PLAN9 export PLAN9"
227 df29f2ce 2005-12-30 devnull echo ' PATH=$PATH:$PLAN9/bin export PATH'
229 80c90f27 2010-04-09 rsc ) 2>&1 | tee install.log | $awk -f $PLAN9/dist/isum.awk -v 'copy='install.sum