slackbuilds/d/UNUSED/go/go.SlackBuild
Gwenhael Le Moine 0da671b6e8 big spring cleanup, putting aside currently unused scripts
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
2013-03-25 22:41:45 +01:00

115 lines
2.7 KiB
Bash
Executable file

#!/bin/sh -x
# variables
VERSION=go1
BUILD=1
TAG=cyco
OUTPUT=/tmp
TMP=/tmp/$TAG
CWD=$(pwd)
PRGNAM=$(basename $CWD)
PKG=$TMP/pkg-$PRGNAM
ARCH=$(uname -m)
PREFIX=/usr
# nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM-$VERSION
mkdir -p $PKG
GOARCH=amd64
case $ARCH in
x86_64)
GOARCH=amd64
;;
"i?86")
GOARCH=386
;;
*)
GOARCH=arm
esac
# mise en place
cd $TMP
[ ! -e $CWD/$PRGNAM.$VERSION.linux-$GOARCH.tar.gz ] && wget -c http://$PRGNAM.googlecode.com/files/$PRGNAM.$VERSION.linux-$GOARCH.tar.gz -O $CWD/$PRGNAM.$VERSION.linux-$GOARCH.tar.gz
mkdir -p $PKG$PREFIX/
cd $PKG$PREFIX/
tar xf $CWD/$PRGNAM.$VERSION.linux-$GOARCH.tar.gz
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 640 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
cd $PRGNAM/misc/emacs
find . -type f -name \*.el -exec emacs -batch -f batch-byte-compile {} \;
mkdir -p $PKG$PREFIX/share/emacs/site-lisp/
cd $PKG$PREFIX/share/emacs/site-lisp/
ln -s ../../../$PRGNAM/misc/emacs golang
mkdir -p $PKG/etc/profile.d
cat <<EOF > $PKG/etc/profile.d/$PRGNAM.sh
#!/bin/sh
export GOROOT=$PREFIX/$PRGNAM
export GOBIN=\$GOROOT/bin
export GOOS=linux
export GOARCH=$GOARCH
export PATH=\$PATH:\$GOBIN
EOF
chmod +x $PKG/etc/profile.d/$PRGNAM.sh
cat <<EOF > $PKG/etc/profile.d/$PRGNAM.csh
#!/bin/csh
setenv GOROOT $PREFIX/$PRGNAM
setenv GOBIN \$GOROOT/bin
setenv GOOS linux
setenv GOARCH $GOARCH
setenv PATH \$PATH:\$GOBIN
EOF
chmod +x $PKG/etc/profile.d/$PRGNAM.csh
mkdir -p $PKG$PREFIX/doc
cd $PKG$PREFIX/doc
ln -s ../$PRGNAM/doc $PRGNAM-$VERSION
# correction
cd $PKG
chown -R root:root *
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: $PRGNAM (a systems programming language)
$PRGNAM:
$PRGNAM: Go is…
$PRGNAM: …simple
$PRGNAM: …fast
$PRGNAM: …safe
$PRGNAM: …concurrent
$PRGNAM: …fun
$PRGNAM: …open source
$PRGNAM:
$PRGNAM: http://weekly.golang.org/
EOF
# empaquetage
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr - .)-$ARCH-$BUILD$TAG.txz