2004-02-29 22:53:01 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2005-12-30 18:52:40 +00:00
|
|
|
dobuild=true
|
|
|
|
doinstall=true
|
|
|
|
|
|
|
|
case "x$1" in
|
|
|
|
x)
|
|
|
|
;;
|
|
|
|
x-b)
|
|
|
|
dobuild=true
|
|
|
|
doinstall=false
|
|
|
|
;;
|
|
|
|
x-c)
|
|
|
|
dobuild=false
|
|
|
|
doinstall=true
|
|
|
|
;;
|
2011-06-02 13:28:23 +00:00
|
|
|
x-r)
|
2018-11-14 05:23:40 +00:00
|
|
|
shift
|
|
|
|
PLAN9_TARGET=$1 export PLAN9_TARGET
|
|
|
|
;;
|
2005-12-30 18:52:40 +00:00
|
|
|
*)
|
2011-06-02 13:28:23 +00:00
|
|
|
echo 'usage: INSTALL [-b | -c] [-r path]' 1>&2
|
2005-12-30 18:52:40 +00:00
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
2020-01-14 04:38:04 +00:00
|
|
|
echo "+ Mailing list: https://groups.google.com/group/plan9port-dev"
|
|
|
|
echo "+ Issue tracker: https://github.com/9fans/plan9port/issues/"
|
|
|
|
echo "+ Submitting changes: https://github.com/9fans/plan9port/pulls"
|
|
|
|
echo " "
|
|
|
|
echo "* Resetting $PLAN9/config"
|
|
|
|
rm -f config
|
|
|
|
|
2004-02-29 22:53:01 +00:00
|
|
|
PLAN9=`pwd` export PLAN9
|
2005-07-22 18:44:46 +00:00
|
|
|
PATH=/bin:/usr/bin:$PLAN9/bin:$PATH export PATH
|
2010-04-09 22:28:16 +00:00
|
|
|
case `uname` in
|
|
|
|
SunOS)
|
|
|
|
awk=nawk
|
|
|
|
;;
|
2020-01-07 19:51:42 +00:00
|
|
|
DragonFly|*BSD)
|
|
|
|
case `cc -v 2>&1` in
|
|
|
|
*clang*)
|
|
|
|
echo "CC9=clang" >> $PLAN9/config
|
|
|
|
;;
|
|
|
|
*gcc*)
|
|
|
|
echo "CC9=gcc" >> $PLAN9/config
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo "* Running on" `uname`", adjusting linker flags"
|
|
|
|
case `uname` in
|
|
|
|
OpenBSD)
|
|
|
|
echo "LDFLAGS='-L/usr/X11R6/lib -pthread'" >> $PLAN9/config
|
|
|
|
;;
|
|
|
|
NetBSD)
|
|
|
|
echo "LDFLAGS='-L/usr/X11R7/lib -pthread'" >> $PLAN9/config
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "LDFLAGS='-L/usr/local/lib -pthread'" >> $PLAN9/config
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo "CFLAGS='-pthread'" >> $PLAN9/config
|
|
|
|
awk=awk
|
|
|
|
;;
|
2010-04-09 22:28:16 +00:00
|
|
|
*)
|
|
|
|
awk=awk
|
|
|
|
;;
|
|
|
|
esac
|
2004-02-29 22:53:01 +00:00
|
|
|
|
2005-01-14 18:02:48 +00:00
|
|
|
(
|
2005-01-17 21:30:05 +00:00
|
|
|
if [ `uname` = Linux ]; then
|
|
|
|
# On Linux, we use the kernel version to decide whether
|
|
|
|
# to use pthreads or not. On 2.6 versions that aren't
|
|
|
|
# linking with NPTL by default, pretend to be an older kernel.
|
2005-11-26 15:39:46 +00:00
|
|
|
echo "* Running on Linux: checking for NPTL..."
|
2005-01-17 21:38:20 +00:00
|
|
|
gcc lib/linux-isnptl.c -lpthread
|
2005-01-23 01:55:42 +00:00
|
|
|
if ./a.out >/dev/null
|
2005-01-17 21:30:05 +00:00
|
|
|
then
|
|
|
|
echo " NPTL found."
|
2011-08-02 18:28:04 +00:00
|
|
|
echo "SYSVERSION=2.6.x" >>$PLAN9/config
|
2005-01-17 21:30:05 +00:00
|
|
|
else
|
|
|
|
echo " NPTL not found."
|
2011-08-02 18:28:04 +00:00
|
|
|
echo "SYSVERSION=2.4.x" >>$PLAN9/config
|
2005-01-17 21:30:05 +00:00
|
|
|
fi
|
2005-01-17 21:32:55 +00:00
|
|
|
rm -f ./a.out
|
2005-01-17 21:30:05 +00:00
|
|
|
fi
|
2005-02-02 22:08:10 +00:00
|
|
|
|
2014-03-05 21:43:20 +00:00
|
|
|
if [ `uname` = SunOS ]; then
|
|
|
|
# On Solaris x86, uname -p cannot be trusted.
|
2018-11-14 05:23:40 +00:00
|
|
|
echo "* Running on Solaris: checking architecture..."
|
|
|
|
case "$(isainfo -n)" in
|
2014-03-05 21:43:20 +00:00
|
|
|
*amd64*)
|
|
|
|
echo " x86-64 found."
|
|
|
|
echo "OBJTYPE=x86_64" >>$PLAN9/config
|
|
|
|
echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/amd64
|
|
|
|
;;
|
|
|
|
*i386*)
|
|
|
|
echo " i386 found."
|
|
|
|
echo "OBJTYPE=386" >>$PLAN9/config
|
|
|
|
echo "CC9=gcc" >>$PLAN9/config # defaults to gcc on Solaris/i386
|
|
|
|
;;
|
2018-11-14 05:23:40 +00:00
|
|
|
*sparc*)
|
2014-03-05 21:43:20 +00:00
|
|
|
echo " Sparc found."
|
|
|
|
echo "OBJTYPE=sparc" >>$PLAN9/config
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2011-08-02 18:28:04 +00:00
|
|
|
if [ `uname` = Darwin ]; then
|
2018-11-16 05:01:10 +00:00
|
|
|
export NPROC=$(sysctl hw.ncpu | sed 's/hw.ncpu: //')
|
2011-08-02 18:28:04 +00:00
|
|
|
# On Darwin, uname -m -p cannot be trusted.
|
|
|
|
echo "* Running on Darwin: checking architecture..."
|
|
|
|
rm -f ./a.out
|
2014-01-22 16:23:19 +00:00
|
|
|
if ! gcc lib/darwin-main.c >/dev/null 2>&1; then
|
|
|
|
echo "Cannot find gcc. You may need to install the command-line tools using Xcode." >&2
|
|
|
|
echo "See http://swtch.com/go/xcodegcc for details." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-08-02 18:28:04 +00:00
|
|
|
case "$(file ./a.out 2>/dev/null)" in
|
|
|
|
*x86_64*)
|
|
|
|
echo " x86-64 found."
|
|
|
|
echo "OBJTYPE=x86_64" >>$PLAN9/config
|
2018-11-16 01:34:32 +00:00
|
|
|
echo "CC9='xcrun --sdk macosx clang'" >>$PLAN9/config
|
2011-08-02 18:28:04 +00:00
|
|
|
;;
|
|
|
|
*i386*)
|
|
|
|
echo " i386 found."
|
|
|
|
echo "OBJTYPE=386" >>$PLAN9/config
|
|
|
|
;;
|
2011-10-23 21:55:23 +00:00
|
|
|
*ppc*)
|
2018-11-14 05:23:40 +00:00
|
|
|
echo " power found."
|
2011-10-23 21:55:23 +00:00
|
|
|
echo "OBJTYPE=power" >>$PLAN9/config
|
|
|
|
;;
|
2011-08-02 18:28:04 +00:00
|
|
|
esac
|
|
|
|
rm -f ./a.out
|
|
|
|
fi
|
|
|
|
|
2012-12-18 15:22:19 +00:00
|
|
|
if [ `uname` != Darwin ]; then
|
|
|
|
# Determine whether fontsrv X11 files are available.
|
|
|
|
rm -f a.out
|
2018-11-16 15:14:49 +00:00
|
|
|
cc -o a.out -c -Iinclude -I/usr/include -I/usr/local/include -I/usr/include/freetype2 -I/usr/local/include/freetype2 \
|
2020-01-07 19:51:42 +00:00
|
|
|
-I/usr/X11R7/include -I/usr/X11R7/include/freetype2 \
|
2015-06-10 16:02:40 +00:00
|
|
|
-I/usr/X11R6/include -I/usr/X11R6/include/freetype2 src/cmd/fontsrv/x11.c >/dev/null 2>&1
|
2012-12-18 15:22:19 +00:00
|
|
|
if [ -f a.out ]; then
|
|
|
|
echo " fontsrv dependencies found."
|
|
|
|
echo "FONTSRV=fontsrv" >>$PLAN9/config
|
|
|
|
else
|
|
|
|
echo " fontsrv dependencies not found."
|
|
|
|
echo "FONTSRV=" >>$PLAN9/config
|
|
|
|
rm -f bin/fontsrv
|
|
|
|
fi
|
|
|
|
rm -f a.out
|
|
|
|
fi
|
|
|
|
|
2005-02-02 22:08:10 +00:00
|
|
|
if [ -f LOCAL.config ]; then
|
|
|
|
echo Using LOCAL.config options:
|
|
|
|
sed 's/^/ /' LOCAL.config
|
|
|
|
cat LOCAL.config >>config
|
|
|
|
fi
|
|
|
|
|
2018-11-14 05:23:40 +00:00
|
|
|
echo "* Compiler version:"
|
|
|
|
9c -v 2>&1 | grep -v 'Configured with:' | grep -i version | sed 's/^/ /'
|
|
|
|
|
2004-02-29 22:53:01 +00:00
|
|
|
cd src
|
2005-12-30 18:52:40 +00:00
|
|
|
if $dobuild; then
|
|
|
|
if [ ! -x ../bin/mk ]; then
|
|
|
|
echo "* Building mk..."
|
|
|
|
../dist/buildmk 2>&1 | sed 's/^[+] //'
|
|
|
|
fi
|
|
|
|
if [ ! -x ../bin/mk ]; then
|
|
|
|
echo "* Error: mk failed to build."
|
2005-11-28 21:14:44 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2005-12-30 18:52:40 +00:00
|
|
|
|
|
|
|
echo "* Building everything (be patient)..."
|
|
|
|
mk clean
|
|
|
|
mk libs-nuke
|
|
|
|
mk all || exit 1
|
|
|
|
if [ ! -x $PLAN9/src/cmd/o.cleanname -o ! -x $PLAN9/src/cmd/acme/o.acme ]; then
|
|
|
|
echo "* Warning: not all binaries built successfully."
|
|
|
|
fi
|
|
|
|
echo "* Installing everything in $PLAN9/bin..."
|
2011-10-03 20:08:14 +00:00
|
|
|
mk -k install || exit 1
|
2005-12-30 18:52:40 +00:00
|
|
|
if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/acme -o ! -x $PLAN9/bin/sam ]; then
|
2005-11-28 21:14:44 +00:00
|
|
|
echo " "
|
2005-12-30 18:52:40 +00:00
|
|
|
echo "* Warning: not all binaries built successfully."
|
2005-11-28 21:14:44 +00:00
|
|
|
fi
|
2014-11-07 21:52:31 +00:00
|
|
|
if [ -f $PLAN9/bin/quote1 ]; then
|
|
|
|
cp $PLAN9/bin/quote1 $PLAN9/bin/'"'
|
|
|
|
cp $PLAN9/bin/quote2 $PLAN9/bin/'""'
|
2014-06-03 18:29:06 +00:00
|
|
|
fi
|
2005-12-30 18:52:40 +00:00
|
|
|
echo "* Cleaning up..."
|
|
|
|
mk clean
|
2005-11-28 21:14:44 +00:00
|
|
|
fi
|
|
|
|
|
2005-12-30 18:52:40 +00:00
|
|
|
if $doinstall; then
|
|
|
|
if [ ! -x $PLAN9/bin/cleanname -o ! -x $PLAN9/bin/sam ]; then
|
|
|
|
# Cleanname and sam are needed for moveplan9.sh and the man updates.
|
|
|
|
if [ ! -x $PLAN9/bin/cleanname ]; then
|
|
|
|
echo " "
|
|
|
|
echo "* Installation failed: $PLAN9/bin/cleanname does not exist."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ ! -x $PLAN9/bin/sam ]; then
|
|
|
|
echo " "
|
|
|
|
echo "* Installation failed: $PLAN9/bin/sam does not exist."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "* NOT renaming hard-coded /usr/local/plan9 paths."
|
|
|
|
echo "* NOT building web manual."
|
|
|
|
else
|
|
|
|
echo "* Renaming hard-coded /usr/local/plan9 paths..."
|
|
|
|
cd $PLAN9
|
|
|
|
sh lib/moveplan9.sh
|
|
|
|
echo "* Building web manual..."
|
|
|
|
(
|
|
|
|
cd $PLAN9/dist
|
|
|
|
echo cd `pwd`';' mk man
|
|
|
|
mk man
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -x LOCAL.INSTALL ]; then
|
|
|
|
echo "* Running local modifications..."
|
|
|
|
echo cd `pwd`';' ./LOCAL.INSTALL
|
|
|
|
./LOCAL.INSTALL
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "* Done. "
|
|
|
|
echo " "
|
|
|
|
echo "* Add these to your profile environment."
|
|
|
|
echo " PLAN9=$PLAN9 export PLAN9"
|
|
|
|
echo ' PATH=$PATH:$PLAN9/bin export PATH'
|
2005-01-18 20:17:42 +00:00
|
|
|
fi
|
2010-04-09 22:28:16 +00:00
|
|
|
) 2>&1 | tee install.log | $awk -f $PLAN9/dist/isum.awk -v 'copy='install.sum
|
2004-02-29 22:53:01 +00:00
|
|
|
|