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 e78ed7a6 2014-03-05 minux.ma echo " x86-64 found."
75 e78ed7a6 2014-03-05 minux.ma echo "OBJTYPE=x86_64" >>$PLAN9/config
76 e78ed7a6 2014-03-05 minux.ma echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/amd64
77 e78ed7a6 2014-03-05 minux.ma ;;
78 e78ed7a6 2014-03-05 minux.ma *i386*)
79 e78ed7a6 2014-03-05 minux.ma echo " i386 found."
80 e78ed7a6 2014-03-05 minux.ma echo "OBJTYPE=386" >>$PLAN9/config
81 e78ed7a6 2014-03-05 minux.ma echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/i386
82 e78ed7a6 2014-03-05 minux.ma ;;
83 9c38253d 2018-11-14 rsc *sparc*)
84 e78ed7a6 2014-03-05 minux.ma echo " Sparc found."
85 e78ed7a6 2014-03-05 minux.ma echo "OBJTYPE=sparc" >>$PLAN9/config
86 e78ed7a6 2014-03-05 minux.ma ;;
87 e78ed7a6 2014-03-05 minux.ma esac
88 e78ed7a6 2014-03-05 minux.ma fi
89 e78ed7a6 2014-03-05 minux.ma
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 fc567f47 2011-08-02 rsc echo "* Running on Darwin: checking architecture..."
94 fc567f47 2011-08-02 rsc rm -f ./a.out
95 baf127ad 2014-01-22 rsc if ! gcc lib/darwin-main.c >/dev/null 2>&1; then
96 baf127ad 2014-01-22 rsc echo "Cannot find gcc. You may need to install the command-line tools using Xcode." >&2
97 baf127ad 2014-01-22 rsc echo "See http://swtch.com/go/xcodegcc for details." >&2
98 baf127ad 2014-01-22 rsc exit 1
99 baf127ad 2014-01-22 rsc fi
100 fc567f47 2011-08-02 rsc case "$(file ./a.out 2>/dev/null)" in
101 fc567f47 2011-08-02 rsc *x86_64*)
102 fc567f47 2011-08-02 rsc echo " x86-64 found."
103 fc567f47 2011-08-02 rsc echo "OBJTYPE=x86_64" >>$PLAN9/config
104 fe92b4a0 2018-11-16 rsc echo "CC9='xcrun --sdk macosx clang'" >>$PLAN9/config
105 fc567f47 2011-08-02 rsc ;;
106 fc567f47 2011-08-02 rsc *i386*)
107 fc567f47 2011-08-02 rsc echo " i386 found."
108 fc567f47 2011-08-02 rsc echo "OBJTYPE=386" >>$PLAN9/config
109 fc567f47 2011-08-02 rsc ;;
110 813b3eea 2011-10-23 rsc *ppc*)
111 9c38253d 2018-11-14 rsc echo " power found."
112 813b3eea 2011-10-23 rsc echo "OBJTYPE=power" >>$PLAN9/config
113 813b3eea 2011-10-23 rsc ;;
114 fc567f47 2011-08-02 rsc esac
115 fc567f47 2011-08-02 rsc rm -f ./a.out
116 fc567f47 2011-08-02 rsc fi
117 fc567f47 2011-08-02 rsc
118 cb71c0bd 2012-12-18 rsc if [ `uname` != Darwin ]; then
119 cb71c0bd 2012-12-18 rsc # Determine whether fontsrv X11 files are available.
120 cb71c0bd 2012-12-18 rsc rm -f a.out
121 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 \
122 cf6b7787 2020-01-07 crossd -I/usr/X11R7/include -I/usr/X11R7/include/freetype2 \
123 8ee5da7c 2015-11-10 rsc -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 src/cmd/fontsrv/x11.c >/dev/null 2>&1
124 cb71c0bd 2012-12-18 rsc if [ -f a.out ]; then
125 cb71c0bd 2012-12-18 rsc echo " fontsrv dependencies found."
126 cb71c0bd 2012-12-18 rsc echo "FONTSRV=fontsrv" >>$PLAN9/config
127 cb71c0bd 2012-12-18 rsc else
128 cb71c0bd 2012-12-18 rsc echo " fontsrv dependencies not found."
129 cb71c0bd 2012-12-18 rsc echo "FONTSRV=" >>$PLAN9/config
130 cb71c0bd 2012-12-18 rsc rm -f bin/fontsrv
131 cb71c0bd 2012-12-18 rsc fi
132 cb71c0bd 2012-12-18 rsc rm -f a.out
133 cb71c0bd 2012-12-18 rsc fi
134 cb71c0bd 2012-12-18 rsc
135 52fdc1a5 2005-02-02 devnull if [ -f LOCAL.config ]; then
136 52fdc1a5 2005-02-02 devnull echo Using LOCAL.config options:
137 52fdc1a5 2005-02-02 devnull sed 's/^/ /' LOCAL.config
138 52fdc1a5 2005-02-02 devnull cat LOCAL.config >>config
139 52fdc1a5 2005-02-02 devnull fi
140 52fdc1a5 2005-02-02 devnull
141 9c38253d 2018-11-14 rsc echo "* Compiler version:"
142 9c38253d 2018-11-14 rsc 9c -v 2>&1 | grep -v 'Configured with:' | grep -i version | sed 's/^/ /'
143 9c38253d 2018-11-14 rsc
144 b4e0c548 2004-02-29 devnull cd src
145 df29f2ce 2005-12-30 devnull if $dobuild; then
146 df29f2ce 2005-12-30 devnull if [ ! -x ../bin/mk ]; then
147 df29f2ce 2005-12-30 devnull echo "* Building mk..."
148 df29f2ce 2005-12-30 devnull ../dist/buildmk 2>&1 | sed 's/^[+] //'
149 df29f2ce 2005-12-30 devnull fi
150 df29f2ce 2005-12-30 devnull if [ ! -x ../bin/mk ]; then
151 df29f2ce 2005-12-30 devnull echo "* Error: mk failed to build."
152 6637b803 2005-11-28 devnull exit 1
153 6637b803 2005-11-28 devnull fi
154 cb8f7357 2020-01-20 rsc
155 df29f2ce 2005-12-30 devnull echo "* Building everything (be patient)..."
156 df29f2ce 2005-12-30 devnull mk clean
157 df29f2ce 2005-12-30 devnull mk libs-nuke
158 df29f2ce 2005-12-30 devnull mk all || exit 1
159 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/src/cmd/o.cleanname -o ! -x $PLAN9/src/cmd/acme/o.acme ]; then
160 df29f2ce 2005-12-30 devnull echo "* Warning: not all binaries built successfully."
161 df29f2ce 2005-12-30 devnull fi
162 df29f2ce 2005-12-30 devnull echo "* Installing everything in $PLAN9/bin..."
163 c49b45ed 2011-10-03 rsc mk -k install || exit 1
164 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/acme -o ! -x $PLAN9/bin/sam ]; then
165 6637b803 2005-11-28 devnull echo " "
166 df29f2ce 2005-12-30 devnull echo "* Warning: not all binaries built successfully."
167 6637b803 2005-11-28 devnull fi
168 734ca635 2014-11-07 0intro if [ -f $PLAN9/bin/quote1 ]; then
169 734ca635 2014-11-07 0intro cp $PLAN9/bin/quote1 $PLAN9/bin/'"'
170 734ca635 2014-11-07 0intro cp $PLAN9/bin/quote2 $PLAN9/bin/'""'
171 fbe3f344 2014-06-03 rsc fi
172 df29f2ce 2005-12-30 devnull echo "* Cleaning up..."
173 df29f2ce 2005-12-30 devnull mk clean
174 6637b803 2005-11-28 devnull fi
175 6637b803 2005-11-28 devnull
176 df29f2ce 2005-12-30 devnull if $doinstall; then
177 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/sam ]; then
178 df29f2ce 2005-12-30 devnull # Cleanname and sam are needed for moveplan9.sh and the man updates.
179 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/cleanname ]; then
180 df29f2ce 2005-12-30 devnull echo " "
181 df29f2ce 2005-12-30 devnull echo "* Installation failed: $PLAN9/bin/cleanname does not exist."
182 df29f2ce 2005-12-30 devnull exit 1
183 df29f2ce 2005-12-30 devnull fi
184 df29f2ce 2005-12-30 devnull if [ ! -x $PLAN9/bin/sam ]; then
185 df29f2ce 2005-12-30 devnull echo " "
186 df29f2ce 2005-12-30 devnull echo "* Installation failed: $PLAN9/bin/sam does not exist."
187 df29f2ce 2005-12-30 devnull exit 1
188 df29f2ce 2005-12-30 devnull fi
189 df29f2ce 2005-12-30 devnull echo "* NOT renaming hard-coded /usr/local/plan9 paths."
190 df29f2ce 2005-12-30 devnull echo "* NOT building web manual."
191 df29f2ce 2005-12-30 devnull else
192 df29f2ce 2005-12-30 devnull echo "* Renaming hard-coded /usr/local/plan9 paths..."
193 df29f2ce 2005-12-30 devnull cd $PLAN9
194 df29f2ce 2005-12-30 devnull sh lib/moveplan9.sh
195 df29f2ce 2005-12-30 devnull echo "* Building web manual..."
196 df29f2ce 2005-12-30 devnull (
197 df29f2ce 2005-12-30 devnull cd $PLAN9/dist
198 df29f2ce 2005-12-30 devnull echo cd `pwd`';' mk man
199 df29f2ce 2005-12-30 devnull mk man
200 df29f2ce 2005-12-30 devnull )
201 df29f2ce 2005-12-30 devnull fi
202 cb8f7357 2020-01-20 rsc
203 df29f2ce 2005-12-30 devnull if [ -x LOCAL.INSTALL ]; then
204 df29f2ce 2005-12-30 devnull echo "* Running local modifications..."
205 df29f2ce 2005-12-30 devnull echo cd `pwd`';' ./LOCAL.INSTALL
206 df29f2ce 2005-12-30 devnull ./LOCAL.INSTALL
207 df29f2ce 2005-12-30 devnull fi
208 cb8f7357 2020-01-20 rsc
209 df29f2ce 2005-12-30 devnull echo "* Done. "
210 df29f2ce 2005-12-30 devnull echo " "
211 df29f2ce 2005-12-30 devnull echo "* Add these to your profile environment."
212 df29f2ce 2005-12-30 devnull echo " PLAN9=$PLAN9 export PLAN9"
213 df29f2ce 2005-12-30 devnull echo ' PATH=$PATH:$PLAN9/bin export PATH'
214 3b1a43f3 2005-01-18 devnull fi
215 80c90f27 2010-04-09 rsc ) 2>&1 | tee install.log | $awk -f $PLAN9/dist/isum.awk -v 'copy='install.sum
216 7495a529 2005-11-26 devnull