2012-05-13 15:04:29 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for google-go-lang
|
|
|
|
|
|
|
|
# Written by Eric Schultz eric at schultzter.ca
|
2013-01-05 19:45:29 +01:00
|
|
|
# Taken over by Vincent Batts vbatts@hashbangbash.com
|
2012-05-13 15:04:29 +02:00
|
|
|
|
2017-10-30 13:21:58 +01:00
|
|
|
# Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 Vincent Batts
|
2012-05-13 15:04:29 +02:00
|
|
|
# Copyright (c) 2012 Eric Schultz
|
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
|
# this software and associated documentation files (the "Software"), to deal in
|
|
|
|
# the Software without restriction, including without limitation the rights to
|
|
|
|
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
|
|
# the Software, and to permit persons to whom the Software is furnished to do so,
|
|
|
|
# subject to the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included in all
|
|
|
|
# copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
# SOFTWARE.
|
|
|
|
|
|
|
|
PRGNAM=google-go-lang
|
2018-05-01 19:46:22 +02:00
|
|
|
VERSION=${VERSION:-1.10.2}
|
2016-08-24 13:29:33 +02:00
|
|
|
BUILD=${BUILD:-1}
|
2012-05-13 15:04:29 +02:00
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
|
|
|
RELEASE=${RELEASE:-linux}
|
|
|
|
|
2015-09-30 17:56:02 +02:00
|
|
|
RUN_TEST=${RUN_TEST:-false}
|
2014-10-30 21:48:13 +01:00
|
|
|
|
2013-01-05 19:45:29 +01:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2016-08-24 13:29:33 +02:00
|
|
|
i?86) ARCH=i586 ;;
|
2013-01-05 19:45:29 +01:00
|
|
|
arm*) ARCH=arm ;;
|
2012-07-27 21:42:50 +02:00
|
|
|
*) ARCH=$( uname -m ) ;;
|
2013-01-05 19:45:29 +01:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2016-08-24 13:29:33 +02:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
2013-01-05 19:45:29 +01:00
|
|
|
LIBDIRSUFFIX=""
|
2016-02-29 23:18:42 +01:00
|
|
|
GOARCH="386"
|
2013-01-05 19:45:29 +01:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
LIBDIRSUFFIX="64"
|
2016-02-29 23:18:42 +01:00
|
|
|
GOARCH="amd64"
|
2013-01-05 19:45:29 +01:00
|
|
|
elif [ "$ARCH" = "arm" ]; then
|
|
|
|
LIBDIRSUFFIX=""
|
2016-02-29 23:18:42 +01:00
|
|
|
GOARCH="arm"
|
2013-01-05 19:45:29 +01:00
|
|
|
export GOARM="6" # can be '5' as well, to use soft float instead of hardware
|
|
|
|
else
|
|
|
|
LIBDIRSUFFIX=""
|
2016-02-29 23:18:42 +01:00
|
|
|
GOARCH=386
|
2013-01-05 19:45:29 +01:00
|
|
|
fi
|
|
|
|
|
2012-05-13 15:04:29 +02:00
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rm -rf $PKG
|
2016-02-29 23:18:42 +01:00
|
|
|
mkdir -p $TMP $PKG/usr/lib${LIBDIRSUFFIX}/go${VERSION} $OUTPUT
|
|
|
|
cd $PKG/usr/lib${LIBDIRSUFFIX}/go${VERSION}
|
|
|
|
tar xvf $CWD/go${VERSION}.src.tar.gz
|
2013-01-05 19:45:29 +01:00
|
|
|
cd go
|
2012-05-13 15:04:29 +02:00
|
|
|
chown -R root:root .
|
2013-11-22 08:37:19 +01:00
|
|
|
find -L . \
|
2014-01-30 10:40:32 +01:00
|
|
|
\( -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 640 -o -perm 600 -o -perm 444 \
|
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
2012-05-13 15:04:29 +02:00
|
|
|
|
2016-02-29 23:18:42 +01:00
|
|
|
# as of >= go1.5, the cross-compiler does not need to be bootstrap, so the
|
|
|
|
# compiler need only be compiled for the host OS, which it detects
|
|
|
|
unset GOBIN GOPATH GOOS GOARCH
|
2014-01-30 20:16:33 +01:00
|
|
|
unset BASH_ENV # Not sure why, but this causes run.bash to fail --rworkman
|
|
|
|
|
2016-02-29 23:18:42 +01:00
|
|
|
export GOROOT_BOOTSTRAP="/usr" # gcc 5+ is go1.4 API, so we'll bootstrap with it
|
|
|
|
export GOROOT="$(pwd)"
|
|
|
|
export GOROOT_FINAL="/usr/lib${LIBDIRSUFFIX}/go${VERSION}/go"
|
|
|
|
|
2013-01-05 19:45:29 +01:00
|
|
|
cd src
|
|
|
|
|
2014-10-30 21:48:13 +01:00
|
|
|
if [ "x${RUN_TEST}" = "xtrue" ] ; then
|
|
|
|
LC_ALL=C \
|
|
|
|
./all.bash
|
|
|
|
else
|
|
|
|
LC_ALL=C \
|
|
|
|
./make.bash
|
|
|
|
fi
|
2013-01-05 19:45:29 +01:00
|
|
|
|
2016-02-29 23:18:42 +01:00
|
|
|
# As of go1.5, golang supports shared libraries, so generate them for use.
|
|
|
|
$GOROOT/bin/go install -buildmode=shared std
|
2013-01-05 19:45:29 +01:00
|
|
|
|
2016-02-29 23:18:42 +01:00
|
|
|
cd ..
|
2013-01-05 19:45:29 +01:00
|
|
|
|
2012-05-13 15:04:29 +02:00
|
|
|
# Put the profile scripts for setting PATH and env variables
|
|
|
|
mkdir -p $PKG/etc/profile.d
|
2016-08-24 13:29:33 +02:00
|
|
|
cat > $PKG/etc/profile.d/go.csh << EOF
|
2013-01-05 19:45:29 +01:00
|
|
|
#!/bin/csh
|
2016-02-29 23:18:42 +01:00
|
|
|
setenv GOROOT ${GOROOT_FINAL}
|
2016-07-26 01:26:33 +02:00
|
|
|
setenv PATH \${GOROOT}/bin:\${PATH}
|
2013-01-05 19:45:29 +01:00
|
|
|
EOF
|
2016-08-24 13:29:33 +02:00
|
|
|
cat > $PKG/etc/profile.d/go.sh << EOF
|
2013-01-05 19:45:29 +01:00
|
|
|
#!/bin/sh
|
2016-02-29 23:18:42 +01:00
|
|
|
export GOROOT="${GOROOT_FINAL}"
|
|
|
|
export PATH="\${GOROOT}/bin:\${PATH}"
|
2013-01-05 19:45:29 +01:00
|
|
|
EOF
|
|
|
|
|
2016-08-24 13:29:33 +02:00
|
|
|
chmod 0755 $PKG/etc/profile.d/go.csh
|
|
|
|
chmod 0755 $PKG/etc/profile.d/go.sh
|
2012-05-13 15:04:29 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cp -a \
|
2016-02-29 23:18:42 +01:00
|
|
|
AUTHORS CONTRIBUTING.md CONTRIBUTORS LICENSE PATENTS README.md VERSION \
|
2012-05-13 15:04:29 +02:00
|
|
|
$PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|