2010-02-19 05:41:29 +01:00
|
|
|
#!/bin/sh -x
|
|
|
|
|
|
|
|
# variables
|
2010-11-05 09:55:46 +01:00
|
|
|
VERSION=hg$(date +"%Y.%m.%d_%H.%M")
|
2010-02-19 05:41:29 +01:00
|
|
|
BUILD=1
|
|
|
|
|
2011-02-17 05:54:04 +01:00
|
|
|
|
|
|
|
TAG=cyco
|
|
|
|
OUTPUT=/tmp
|
2011-02-17 05:58:04 +01:00
|
|
|
TMP=/tmp/$TAG
|
2010-02-19 05:41:29 +01:00
|
|
|
CWD=$(pwd)
|
|
|
|
|
|
|
|
PRGNAM=$(basename $CWD)
|
2011-02-17 05:58:04 +01:00
|
|
|
PKG=$TMP/pkg-$PRGNAM
|
2010-02-19 05:41:29 +01:00
|
|
|
|
|
|
|
ARCH=$(uname -m)
|
|
|
|
|
|
|
|
REPOSITORY=/home/cycojesus/projets/packages/repositories/$PRGNAM
|
|
|
|
PREFIX=/usr
|
|
|
|
|
|
|
|
# nettoyage préalable
|
|
|
|
rm -fr $PKG $TMP/$PRGNAM-$VERSION
|
|
|
|
|
|
|
|
mkdir -p $PKG
|
|
|
|
|
|
|
|
# mise en place
|
|
|
|
cd $TMP
|
|
|
|
if [ ! -e $REPOSITORY ] ; then
|
|
|
|
mkdir -p $(dirname $REPOSITORY)
|
2010-11-17 07:36:35 +01:00
|
|
|
hg clone -r release https://go.googlecode.com/hg/ $(dirname $REPOSITORY)/$PRGNAM
|
|
|
|
else
|
|
|
|
( cd $REPOSITORY
|
|
|
|
hg pull -u
|
|
|
|
)
|
2010-02-19 05:41:29 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $PKG$PREFIX/libexec/ $PREFIX/libexec/
|
2011-02-15 04:31:01 +01:00
|
|
|
cp -R $REPOSITORY $PREFIX/libexec/
|
2010-02-19 05:41:29 +01:00
|
|
|
( cd $PREFIX/libexec/$PRGNAM
|
|
|
|
GOROOT=$(pwd)
|
|
|
|
GOBIN=$GOROOT/bin
|
|
|
|
GOOS=linux
|
|
|
|
case $ARCH in
|
|
|
|
x86_64)
|
|
|
|
GOARCH=amd64
|
|
|
|
;;
|
|
|
|
"i?86")
|
|
|
|
GOARCH=386
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
GOARCH=arm
|
|
|
|
esac
|
|
|
|
mkdir -p $GOBIN
|
|
|
|
find $GOROOT -name ".hg*" -exec rm -fr {} \;
|
|
|
|
cd $GOROOT/src
|
|
|
|
GOROOT=$GOROOT GOBIN=$GOBIN GOOS=$GOOS GOARCH=$GOARCH bash ./all.bash
|
|
|
|
|
|
|
|
mv $PREFIX/libexec/$PRGNAM $PKG$PREFIX/libexec/
|
2010-11-17 08:37:03 +01:00
|
|
|
rm -fr $PKG$PREFIX/libexec/go/src
|
2010-11-09 08:52:41 +01:00
|
|
|
|
2010-11-17 10:39:13 +01:00
|
|
|
( cd misc/emacs
|
|
|
|
find . -type f -name \*.el -exec emacs -batch -f batch-byte-compile {} \;
|
|
|
|
)
|
|
|
|
|
2010-02-19 05:41:29 +01:00
|
|
|
mkdir -p $PKG$PREFIX/bin
|
|
|
|
( cd $PKG$PREFIX/bin
|
|
|
|
for i in ../libexec/$PRGNAM/bin/* ; do
|
|
|
|
ln -s $i ;
|
|
|
|
done
|
|
|
|
)
|
|
|
|
|
2010-11-17 10:39:13 +01:00
|
|
|
mkdir -p $PKG$PREFIX/share/emacs/site-lisp/
|
|
|
|
( cd $PKG$PREFIX/share/emacs/site-lisp/
|
|
|
|
ln -s ../../../libexec/$PRGNAM/misc/emacs golang
|
|
|
|
)
|
|
|
|
|
2010-02-19 05:41:29 +01:00
|
|
|
mkdir -p $PKG/etc/profile.d
|
|
|
|
cat <<EOF > $PKG/etc/profile.d/go.sh
|
|
|
|
GOROOT=$PREFIX/libexec/$PRGNAM
|
|
|
|
GOBIN=\$GOROOT/bin
|
|
|
|
GOOS=linux
|
2010-11-17 07:37:47 +01:00
|
|
|
case \$(uname -m) in
|
2010-02-19 05:41:29 +01:00
|
|
|
x86_64)
|
|
|
|
GOARCH=amd64
|
|
|
|
;;
|
|
|
|
"i?86")
|
|
|
|
GOARCH=386
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
GOARCH=arm
|
|
|
|
esac
|
|
|
|
|
|
|
|
export GOROOT GOBIN GOOS GOARCH
|
|
|
|
EOF
|
|
|
|
chmod +x $PKG/etc/profile.d/go.sh
|
|
|
|
|
|
|
|
mkdir -p $PKG$PREFIX/doc
|
|
|
|
( cd $PKG$PREFIX/doc
|
|
|
|
ln -s ../libexec/$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 {} \;
|
|
|
|
[ -d $PKG/usr/info ] && find $PKG/usr/info -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://golang.org/
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# empaquetage
|
|
|
|
cd $PKG
|
2011-02-17 05:54:04 +01:00
|
|
|
makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz
|