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 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 80c90f27 2010-04-09 rsc case `uname` in
39 cf6b7787 2020-01-07 crossd DragonFly|*BSD)
40 cf6b7787 2020-01-07 crossd case `cc -v 2>&1` in
42 cf6b7787 2020-01-07 crossd echo "CC9=clang" >> $PLAN9/config
45 cf6b7787 2020-01-07 crossd echo "CC9=gcc" >> $PLAN9/config
48 cf6b7787 2020-01-07 crossd echo "* Running on" `uname`", adjusting linker flags"
49 cf6b7787 2020-01-07 crossd case `uname` in
51 cf6b7787 2020-01-07 crossd echo "LDFLAGS='-L/usr/X11R6/lib -pthread'" >> $PLAN9/config
54 cf6b7787 2020-01-07 crossd echo "LDFLAGS='-L/usr/X11R7/lib -pthread'" >> $PLAN9/config
57 cf6b7787 2020-01-07 crossd echo "LDFLAGS='-L/usr/local/lib -pthread'" >> $PLAN9/config
60 cf6b7787 2020-01-07 crossd echo "CFLAGS='-pthread'" >> $PLAN9/config
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
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
82 e78ed7a6 2014-03-05 minux.ma echo " Sparc found."
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
98 99dee78c 2020-12-30 rsc echo "CC9='xcrun --sdk macosx clang'" >>$PLAN9/config
99 fc567f47 2011-08-02 rsc rm -f ./a.out
102 cb71c0bd 2012-12-18 rsc if [ `uname` != Darwin ]; then
103 cb71c0bd 2012-12-18 rsc # Determine whether fontsrv X11 files are available.
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
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
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
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/^/ /'
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/^[+] //'
133 df29f2ce 2005-12-30 devnull if [ ! -x ../bin/mk ]; then
134 df29f2ce 2005-12-30 devnull echo "* Error: mk failed to build."
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."
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."
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/'""'
155 df29f2ce 2005-12-30 devnull echo "* Cleaning up..."
156 df29f2ce 2005-12-30 devnull mk clean
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."
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."
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."
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..."
180 df29f2ce 2005-12-30 devnull cd $PLAN9/dist
181 df29f2ce 2005-12-30 devnull echo cd `pwd`';' mk man
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
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'
198 80c90f27 2010-04-09 rsc ) 2>&1 | tee install.log | $awk -f $PLAN9/dist/isum.awk -v 'copy='install.sum