19 PLAN9_TARGET=$1 export PLAN9_TARGET
22 echo 'usage: INSTALL [-b | -c] [-r path]' 1>&2
26 echo "+ Mailing list: https://groups.google.com/group/plan9port-dev"
27 echo "+ Issue tracker: https://github.com/9fans/plan9port/issues/"
28 echo "+ Submitting changes: https://github.com/9fans/plan9port/pulls"
30 echo "* Resetting $PLAN9/config"
33 PLAN9=`pwd` export PLAN9
34 PATH=/bin:/usr/bin:$PLAN9/bin:$PATH export PATH
42 echo "CC9=clang" >> $PLAN9/config
45 echo "CC9=gcc" >> $PLAN9/config
48 echo "* Running on" `uname`", adjusting linker flags"
51 echo "LDFLAGS='-L/usr/X11R6/lib -pthread'" >> $PLAN9/config
54 echo "LDFLAGS='-L/usr/X11R7/lib -pthread'" >> $PLAN9/config
57 echo "LDFLAGS='-L/usr/local/lib -pthread'" >> $PLAN9/config
60 echo "CFLAGS='-pthread'" >> $PLAN9/config
69 if [ `uname` = SunOS ]; then
70 # On Solaris x86, uname -p cannot be trusted.
71 echo "* Running on Solaris: checking architecture..."
72 case "$(isainfo -n)" in
75 echo "OBJTYPE=x86_64" >>$PLAN9/config
76 echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/amd64
80 echo "OBJTYPE=386" >>$PLAN9/config
81 echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/i386
85 echo "OBJTYPE=sparc" >>$PLAN9/config
90 if [ `uname` = Darwin ]; then
91 export NPROC=$(sysctl hw.ncpu | sed 's/hw.ncpu: //')
92 # On Darwin, uname -m -p cannot be trusted.
93 echo "* Running on Darwin: checking architecture..."
95 if ! gcc lib/darwin-main.c >/dev/null 2>&1; then
96 echo "Cannot find gcc. You may need to install the command-line tools using Xcode." >&2
97 echo "See http://swtch.com/go/xcodegcc for details." >&2
100 case "$(file ./a.out 2>/dev/null)" in
102 echo " x86-64 found."
103 echo "OBJTYPE=x86_64" >>$PLAN9/config
104 echo "CC9='xcrun --sdk macosx clang'" >>$PLAN9/config
108 echo "OBJTYPE=386" >>$PLAN9/config
112 echo "OBJTYPE=power" >>$PLAN9/config
118 if [ `uname` != Darwin ]; then
119 # Determine whether fontsrv X11 files are available.
121 cc -o a.out -c -Iinclude -I/usr/include -I/usr/local/include -I/usr/include/freetype2 -I/usr/local/include/freetype2 \
122 -I/usr/X11R7/include -I/usr/X11R7/include/freetype2 \
123 -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 src/cmd/fontsrv/x11.c >/dev/null 2>&1
124 if [ -f a.out ]; then
125 echo " fontsrv dependencies found."
126 echo "FONTSRV=fontsrv" >>$PLAN9/config
128 echo " fontsrv dependencies not found."
129 echo "FONTSRV=" >>$PLAN9/config
135 if [ -f LOCAL.config ]; then
136 echo Using LOCAL.config options:
137 sed 's/^/ /' LOCAL.config
138 cat LOCAL.config >>config
141 echo "* Compiler version:"
142 9c -v 2>&1 | grep -v 'Configured with:' | grep -i version | sed 's/^/ /'
146 if [ ! -x ../bin/mk ]; then
147 echo "* Building mk..."
148 ../dist/buildmk 2>&1 | sed 's/^[+] //'
150 if [ ! -x ../bin/mk ]; then
151 echo "* Error: mk failed to build."
155 echo "* Building everything (be patient)..."
159 if [ ! -x $PLAN9/src/cmd/o.cleanname -o ! -x $PLAN9/src/cmd/acme/o.acme ]; then
160 echo "* Warning: not all binaries built successfully."
162 echo "* Installing everything in $PLAN9/bin..."
163 mk -k install || exit 1
164 if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/acme -o ! -x $PLAN9/bin/sam ]; then
166 echo "* Warning: not all binaries built successfully."
168 if [ -f $PLAN9/bin/quote1 ]; then
169 cp $PLAN9/bin/quote1 $PLAN9/bin/'"'
170 cp $PLAN9/bin/quote2 $PLAN9/bin/'""'
172 echo "* Cleaning up..."
177 if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/sam ]; then
178 # Cleanname and sam are needed for moveplan9.sh and the man updates.
179 if [ ! -x $PLAN9/bin/cleanname ]; then
181 echo "* Installation failed: $PLAN9/bin/cleanname does not exist."
184 if [ ! -x $PLAN9/bin/sam ]; then
186 echo "* Installation failed: $PLAN9/bin/sam does not exist."
189 echo "* NOT renaming hard-coded /usr/local/plan9 paths."
190 echo "* NOT building web manual."
192 echo "* Renaming hard-coded /usr/local/plan9 paths..."
195 echo "* Building web manual..."
198 echo cd `pwd`';' mk man
203 if [ -x LOCAL.INSTALL ]; then
204 echo "* Running local modifications..."
205 echo cd `pwd`';' ./LOCAL.INSTALL
211 echo "* Add these to your profile environment."
212 echo " PLAN9=$PLAN9 export PLAN9"
213 echo ' PATH=$PATH:$PLAN9/bin export PATH'
215 ) 2>&1 | tee install.log | $awk -f $PLAN9/dist/isum.awk -v 'copy='install.sum