Skip to content

Commit

Permalink
Choice of installing in place or system wide.
Browse files Browse the repository at this point in the history
Signed-off-by: Yannick Cote <yanick@divyan.org>
  • Loading branch information
Yannick Cote committed Jun 11, 2015
1 parent 988c4ba commit 2798291
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set -e
#
TOP=`git rev-parse --show-toplevel`
PLAN9C=$TOP/plan9c; export PLAN9C
INSTALLDIR=/usr/local/plan9c

# build dist
echo "===> building go dist tool"
Expand Down Expand Up @@ -57,6 +58,29 @@ else
RELFLAGS="-Og -ggdb"
fi

echo -n "keep local (l) or install system wide (s) in /usr/local/plan0c [L/s]? "
read ans
if [ "X$ans" = "Xs" ]; then
cat <<EOF > Makefile.p9c
#
# Builds C programs with plan9 C and link them statically with musl libc on
# Linux if available, for a fast clean and compact freestanding executable
# binary.
#
CC=${CC}
CFLAGS= -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare
CFLAGS+= -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas
CFLAGS+= -Wno-switch -Wno-comment -Wno-missing-field-initializers
CFLAGS+= -Werror -fno-common
CFLAGS+= $RELFLAGS -pipe -Wuninitialized -fmessage-length=0
CPPFLAGS= -I ${INSTALLDIR}/include
LDFLAGS= -static -L ${INSTALLDIR}/lib -lbio -l9
EOF
else
cat <<EOF > Makefile.p9c
#
# Builds C programs with plan9 C and link them statically with musl libc on
Expand All @@ -76,5 +100,42 @@ CPPFLAGS= -I ${PLAN9C}/include
LDFLAGS= -static -L ${PLAN9C}/lib -lbio -l9
EOF
fi

if [ "X$ans" = "Xs" ]; then
echo "===> installing plan9c into $INSTALLDIR ..."
install -d -o root -g bin -m 755 $INSTALLDIR
install -d -o root -g bin -m 755 $INSTALLDIR/lib
install -m 444 ${PLAN9C}/lib/lib9.a $INSTALLDIR/lib
install -m 444 ${PLAN9C}/lib/libbio.a $INSTALLDIR/lib
install -m 444 ${PLAN9C}/lib/libcc.a $INSTALLDIR/lib
install -m 444 ${PLAN9C}/lib/libgc.a $INSTALLDIR/lib
install -m 444 ${PLAN9C}/lib/liblink.a $INSTALLDIR/lib
install -d -o root -g bin -m 755 $INSTALLDIR/include
install -d -o root -g bin -m 755 $INSTALLDIR/include/plan9
install -d -o root -g bin -m 755 $INSTALLDIR/include/plan9/386
install -d -o root -g bin -m 755 $INSTALLDIR/include/plan9/amd64
install -d -o root -g bin -m 755 $INSTALLDIR/include/plan9/arm
install -m 444 ${PLAN9C}/include/ar.h $INSTALLDIR/include
install -m 444 ${PLAN9C}/include/bio.h $INSTALLDIR/include
install -m 444 ${PLAN9C}/include/fmt.h $INSTALLDIR/include
install -m 444 ${PLAN9C}/include/libc.h $INSTALLDIR/include
install -m 444 ${PLAN9C}/include/link.h $INSTALLDIR/include
install -m 444 ${PLAN9C}/include/u.h $INSTALLDIR/include
install -m 444 ${PLAN9C}/src/lib9/utf/utf.h $INSTALLDIR/include
install -m 444 ${PLAN9C}/include/plan9/bio.h $INSTALLDIR/include/plan9
install -m 444 ${PLAN9C}/include/plan9/errno.h $INSTALLDIR/include/plan9
install -m 444 ${PLAN9C}/include/plan9/fmt.h $INSTALLDIR/include/plan9
install -m 444 ${PLAN9C}/include/plan9/libc.h $INSTALLDIR/include/plan9
install -m 444 ${PLAN9C}/include/plan9/link.h $INSTALLDIR/include/plan9
install -m 444 ${PLAN9C}/include/plan9/stdarg.h $INSTALLDIR/include/plan9
install -m 444 ${PLAN9C}/include/plan9/utf.h $INSTALLDIR/include/plan9
install -m 444 ${PLAN9C}/include/plan9/386/u.h $INSTALLDIR/include/plan9/386/u.h
install -m 444 ${PLAN9C}/include/plan9/amd64/u.h $INSTALLDIR/include/plan9/amd64/u.h
install -m 444 ${PLAN9C}/include/plan9/arm/u.h $INSTALLDIR/include/plan9/arm/u.h
install -d -o root -g bin -m 755 $INSTALLDIR/share
install -m 444 ${TOP}/README $INSTALLDIR/share
install -m 444 ${TOP}/Makefile.p9c $INSTALLDIR/share
fi

echo ""; echo "Success ! Makefile.p9c ready for use !"

0 comments on commit 2798291

Please sign in to comment.