Browse Source

d/golang: Added golang-1.8.

slackware-14.2
Damien Goutte-Gattat 5 years ago
parent
commit
673f5f3d4d
  1. 1
      d/golang/go-1.8.tar.gz.sha1
  2. 1
      d/golang/go1.4-bootstrap-20161024.tar.gz.sha1
  3. 123
      d/golang/golang.SlackBuild
  4. 2
      d/golang/golang.csh
  5. 2
      d/golang/golang.sh
  6. 12
      d/golang/slack-desc

1
d/golang/go-1.8.tar.gz.sha1

@ -0,0 +1 @@
cdb8b91840293afe0957e927fa323d163a64b1ab go-1.8.tar.gz

1
d/golang/go1.4-bootstrap-20161024.tar.gz.sha1

@ -0,0 +1 @@
47e02e41aa99dea899b65ebf7b50ec706141be8c go1.4-bootstrap-20161024.tar.gz

123
d/golang/golang.SlackBuild

@ -0,0 +1,123 @@
#!/bin/bash
# Build script for Slackware
# Copyright (C) 2017 Damien Goutte-Gattat
#
# Redistribution and use of this script, with or without modifications,
# is permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Contact: Damien Goutte-Gattat <dgouttegattat@incenp.org>
#
# Latest go sourcecode is available at: <https://golang.org/>.
# Source package infos
NAMESRC=${NAMESRC:-go}
VERSION=${VERSION:-1.8}
ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.gz}
GITREPO=${GITREPO:-https://go.googlesource.com/go}
BOOTSTRAP_ARCHIVE=${BOOTSTRAP_ARCHIVE:-go1.4-bootstrap-20161024.tar.gz}
BOOTSTRAP_WGET=${BOOTSTRAP_WGET:-https://storage.googleapis.com/golang/$BOOTSTRAP_ARCHIVE}
# Build infos
NAMEPKG=${NAMEPKG:-golang}
BUILD=${BUILD:-1GGD}
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
EXT=${EXT:-txz}
# Directories
TMP=${TMP:-/tmp}
OUT=${OUT:-$TMP/build}
PKG=${PKG:-$OUT/$NAMEPKG}
CWD=$(pwd)
set -e # Quit if a command returns non-zero
# Sanity checks
if [ $UID -eq 0 ]; then
echo "You should NOT run this script as ROOT!"
exit 1
fi
if [ ! -d $TMP ]; then
echo "$TMP does not exists or is not a directory!"
exit 1
fi
# Bootstrap?
if [ -f /opt/go/bin/go ]; then
GOROOT_BOOTSTRAP=/opt/go
else
if [ ! -r $BOOTSTRAP_ARCHIVE ]; then
wget -c -O $BOOTSTRAP_ARCHIVE.part "$BOOTSTRAP_WGET"
mv $BOOTSTRAP_ARCHIVE.part $BOOTSTRAP_ARCHIVE
fi
sha1sum -c $BOOTSTRAP_ARCHIVE.sha1
cd $TMP
echo "Building $BOOTSTRAP_ARCHIVE..."
tar xf $CWD/$BOOTSTRAP_ARCHIVE
cd go/src
./make.bash
GOROOT_BOOTSTRAP=$TMP/go
cd $CWD
fi
# Get and verify the source archive
if [ ! -r $ARCHIVE ]; then
git clone $GITREPO gosrc
cd gosrc
git archive --prefix=go-$VERSION/ go$VERSION | gzip -c > ../$ARCHIVE
cd ..
rm -rf gosrc
fi
sha1sum -c $ARCHIVE.sha1
# Compile
cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd go-$VERSION/src
export GOROOT_BOOTSTRAP
TMPDIR=$TMP GOROOT_FINAL=/opt/go ./all.bash
cd ../..
mkdir -p $PKG/opt
mv go-$VERSION $PKG/opt/go
# Strip binaries
find $PKG | xargs file | grep "ELF \(32\|64\)-bit LSB" | cut -d : -f 1 | \
xargs strip --strip-unneeded 2> /dev/null || /bin/true
# Install profile scripts
install -D -m 755 $CWD/golang.sh $PKG/etc/profile.d/golang.sh
install -D -m 755 $CWD/golang.csh $PKG/etc/profile.d/golang.csh
# Copy slack-desc file
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
# Package the tree
cd $PKG
mkdir -p $OUT
PACKAGING="
chown root:root . -R
/sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
rm -rf $PKG
rm -rf $TMP/go $TMP/go-$VERSION
"
if type -p fakeroot ; then
echo "$PACKAGING" | fakeroot
else
su -c "$PACKAGING"
fi

2
d/golang/golang.csh

@ -0,0 +1,2 @@
#!/bin/csh
setenv PATH ${PATH}:/opt/go/bin

2
d/golang/golang.sh

@ -0,0 +1,2 @@
#!/bin/sh
export PATH=$PATH:/opt/go/bin

12
d/golang/slack-desc

@ -0,0 +1,12 @@
|-----handy-ruler-----------------------------------------------------|
golang: golang (the Go programming language)
golang:
golang: Go is an open source programming language that makes it easy to
golang: build simple, reliable, and efficient software.
golang:
golang:
golang:
golang:
golang:
golang:
golang:
Loading…
Cancel
Save