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 f7b57281 2022-07-27 crossd PLAN9_TARGET=$1
22 89ec3cde 2011-06-02 rsc echo 'usage: INSTALL [-b | -c] [-r path]' 1>&2
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"
30 952a9afa 2020-01-14 rsc echo "* Resetting $PLAN9/config"
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 f7b57281 2022-07-27 crossd [ -z "$PLAN9_TARGET" ] && PLAN9_TARGET="$PLAN9"
36 f7b57281 2022-07-27 crossd export PLAN9_TARGET
38 80c90f27 2010-04-09 rsc case `uname` in
42 cf6b7787 2020-01-07 crossd DragonFly|*BSD)
43 cf6b7787 2020-01-07 crossd case `cc -v 2>&1` in
45 cf6b7787 2020-01-07 crossd echo "CC9=clang" >> $PLAN9/config
48 cf6b7787 2020-01-07 crossd echo "CC9=gcc" >> $PLAN9/config
51 cf6b7787 2020-01-07 crossd echo "* Running on" `uname`", adjusting linker flags"
52 cf6b7787 2020-01-07 crossd case `uname` in
54 cf6b7787 2020-01-07 crossd echo "LDFLAGS='-L/usr/X11R6/lib -pthread'" >> $PLAN9/config
57 cf6b7787 2020-01-07 crossd echo "LDFLAGS='-L/usr/X11R7/lib -pthread'" >> $PLAN9/config
60 cf6b7787 2020-01-07 crossd echo "LDFLAGS='-L/usr/local/lib -pthread'" >> $PLAN9/config
63 cf6b7787 2020-01-07 crossd echo "CFLAGS='-pthread'" >> $PLAN9/config
72 e78ed7a6 2014-03-05 minux.ma if [ `uname` = SunOS ]; then
73 e78ed7a6 2014-03-05 minux.ma # On Solaris x86, uname -p cannot be trusted.
74 9c38253d 2018-11-14 rsc echo "* Running on Solaris: checking architecture..."
75 9c38253d 2018-11-14 rsc case "$(isainfo -n)" in
76 e78ed7a6 2014-03-05 minux.ma *amd64*)
77 99dee78c 2020-12-30 rsc echo " x86-64 found; using gcc."
78 e78ed7a6 2014-03-05 minux.ma echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/amd64
81 99dee78c 2020-12-30 rsc echo " i386 found; using gcc."
82 e78ed7a6 2014-03-05 minux.ma echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/i386
85 e78ed7a6 2014-03-05 minux.ma echo " Sparc found."
90 fc567f47 2011-08-02 rsc if [ `uname` = Darwin ]; then
91 ad2d4950 2018-11-16 rsc export NPROC=$(sysctl hw.ncpu | sed 's/hw.ncpu: //')
92 fc567f47 2011-08-02 rsc # On Darwin, uname -m -p cannot be trusted.
93 99dee78c 2020-12-30 rsc echo "* Running on Darwin..."
94 fc567f47 2011-08-02 rsc rm -f ./a.out
95 99dee78c 2020-12-30 rsc if ! xcrun --sdk macosx clang lib/darwin-main.c >/dev/null 2>&1; then
96 99dee78c 2020-12-30 rsc echo "Cannot find 'xcrun --sdk macosx clang'." >&2
97 99dee78c 2020-12-30 rsc echo "You may need to install the command-line tools using Xcode." >&2
98 baf127ad 2014-01-22 rsc echo "See http://swtch.com/go/xcodegcc for details." >&2
101 bab7b73b 2022-01-24 rsc CC9="xcrun --sdk macosx clang"
102 bab7b73b 2022-01-24 rsc case "$(uname -a)" in
104 bab7b73b 2022-01-24 rsc CC9="$CC9 -arch arm64"
105 bab7b73b 2022-01-24 rsc echo ' Forcing arm64 binaries with clang.'
109 bab7b73b 2022-01-24 rsc echo "CC9='$CC9'" >>$PLAN9/config
110 fc567f47 2011-08-02 rsc rm -f ./a.out
113 cb71c0bd 2012-12-18 rsc if [ `uname` != Darwin ]; then
114 cb71c0bd 2012-12-18 rsc # Determine whether fontsrv X11 files are available.
116 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 \
117 cf6b7787 2020-01-07 crossd -I/usr/X11R7/include -I/usr/X11R7/include/freetype2 \
118 8ee5da7c 2015-11-10 rsc -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 src/cmd/fontsrv/x11.c >/dev/null 2>&1
119 cb71c0bd 2012-12-18 rsc if [ -f a.out ]; then
120 cb71c0bd 2012-12-18 rsc echo " fontsrv dependencies found."
121 cb71c0bd 2012-12-18 rsc echo "FONTSRV=fontsrv" >>$PLAN9/config
123 cb71c0bd 2012-12-18 rsc echo " fontsrv dependencies not found."
124 cb71c0bd 2012-12-18 rsc echo "FONTSRV=" >>$PLAN9/config
125 cb71c0bd 2012-12-18 rsc rm -f bin/fontsrv
130 52fdc1a5 2005-02-02 devnull if [ -f LOCAL.config ]; then
131 52fdc1a5 2005-02-02 devnull echo Using LOCAL.config options:
132 52fdc1a5 2005-02-02 devnull sed 's/^/ /' LOCAL.config
133 52fdc1a5 2005-02-02 devnull cat LOCAL.config >>config
136 9c38253d 2018-11-14 rsc echo "* Compiler version:"
137 9c38253d 2018-11-14 rsc 9c -v 2>&1 | grep -v 'Configured with:' | grep -i version | sed 's/^/ /'
140 df29f2ce 2005-12-30 devnull if $dobuild; then
141 06687f70 2020-05-18 rsc echo "* Building mk..."
142 06687f70 2020-05-18 rsc ../dist/buildmk 2>&1 | sed 's/^[+] //'
144 df29f2ce 2005-12-30 devnull if [ ! -x ../bin/mk ]; then
145 df29f2ce 2005-12-30 devnull echo "* Error: mk failed to build."
149 df29f2ce 2005-12-30 devnull echo "* Building everything (be patient)..."
150 df29f2ce 2005-12-30 devnull mk clean
151 df29f2ce 2005-12-30 devnull mk libs-nuke
152 df29f2ce 2005-12-30 devnull mk all || exit 1
153 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/src/cmd/o.cleanname -o ! -x $PLAN9/src/cmd/acme/o.acme ]; then
154 df29f2ce 2005-12-30 devnull echo "* Warning: not all binaries built successfully."
156 df29f2ce 2005-12-30 devnull echo "* Installing everything in $PLAN9/bin..."
157 c49b45ed 2011-10-03 rsc mk -k install || exit 1
158 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/acme -o ! -x $PLAN9/bin/sam ]; then
159 6637b803 2005-11-28 devnull echo " "
160 df29f2ce 2005-12-30 devnull echo "* Warning: not all binaries built successfully."
162 734ca635 2014-11-07 0intro if [ -f $PLAN9/bin/quote1 ]; then
163 734ca635 2014-11-07 0intro cp $PLAN9/bin/quote1 $PLAN9/bin/'"'
164 734ca635 2014-11-07 0intro cp $PLAN9/bin/quote2 $PLAN9/bin/'""'
166 df29f2ce 2005-12-30 devnull echo "* Cleaning up..."
167 df29f2ce 2005-12-30 devnull mk clean
170 df29f2ce 2005-12-30 devnull if $doinstall; then
171 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/sam ]; then
172 df29f2ce 2005-12-30 devnull # Cleanname and sam are needed for moveplan9.sh and the man updates.
173 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/cleanname ]; then
174 df29f2ce 2005-12-30 devnull echo " "
175 df29f2ce 2005-12-30 devnull echo "* Installation failed: $PLAN9/bin/cleanname does not exist."
178 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/sam ]; then
179 df29f2ce 2005-12-30 devnull echo " "
180 df29f2ce 2005-12-30 devnull echo "* Installation failed: $PLAN9/bin/sam does not exist."
183 df29f2ce 2005-12-30 devnull echo "* NOT renaming hard-coded /usr/local/plan9 paths."
184 df29f2ce 2005-12-30 devnull echo "* NOT building web manual."
186 df29f2ce 2005-12-30 devnull echo "* Renaming hard-coded /usr/local/plan9 paths..."
187 df29f2ce 2005-12-30 devnull cd $PLAN9
188 df29f2ce 2005-12-30 devnull sh lib/moveplan9.sh
189 df29f2ce 2005-12-30 devnull echo "* Building web manual..."
191 df29f2ce 2005-12-30 devnull cd $PLAN9/dist
192 df29f2ce 2005-12-30 devnull echo cd `pwd`';' mk man
197 df29f2ce 2005-12-30 devnull if [ -x LOCAL.INSTALL ]; then
198 df29f2ce 2005-12-30 devnull echo "* Running local modifications..."
199 df29f2ce 2005-12-30 devnull echo cd `pwd`';' ./LOCAL.INSTALL
200 df29f2ce 2005-12-30 devnull ./LOCAL.INSTALL
203 df29f2ce 2005-12-30 devnull echo "* Done. "
204 df29f2ce 2005-12-30 devnull echo " "
205 df29f2ce 2005-12-30 devnull echo "* Add these to your profile environment."
206 df29f2ce 2005-12-30 devnull echo " PLAN9=$PLAN9 export PLAN9"
207 df29f2ce 2005-12-30 devnull echo ' PATH=$PATH:$PLAN9/bin export PATH'
209 80c90f27 2010-04-09 rsc ) 2>&1 | tee install.log | $awk -f $PLAN9/dist/isum.awk -v 'copy='install.sum