Blame


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