Commits

Rodrigo Bistolfi committed 97361ab

Added Go Lang

  • Participants
  • Parent commits 0476f89

Comments (0)

Files changed (1)

var/vabs/go/src/go.SlackBuild

+#!/usr/bin/bash
+# This script assumes it will be launched within "/NAME/VERSION/src" dir.
+# With all sources in "src" Your Vector Linux .txz package, slack-desc,
+# and slack-required will be found in "VERSION" dir. The extraction and
+# build will be in a temp dir created in "NAME" dir, and then removed on exit.
+# Comment out second to last line to keep this dir intact.
+#
+# This Template was compiled from the contributions of many users of the Vector
+# Linux forum at http://forum.vectorlinux.com and from tidbits collected 
+# from all over the internet. 
+#
+# Generated by sbbuilder-0.4.15, written by Rodrigo Bistolfi 
+# (rbistolfi) and Raimon Grau Cuscó (Kidd) for VectorLinux.
+#
+# Please put your name below if you add some original scripting lines.
+# AUTHORS = Eric Schultz, Vincent Batts, adapted for VL by Rodrigo Bitolfi
+
+# Written by Eric Schultz eric at schultzter.ca
+# Taken over by Vincent Batts vbatts@hashbangbash.com
+
+# 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.
+
+
+NAME="go"            #Enter package Name!
+VERSION=${VERSION:-"1.0.3"}      #Enter package Version!
+VER=$(echo $VERSION|sed 's/-/_/') #this fixes - in version
+VL_PACKAGER=${VL_PACKAGER:-"rbistolfi"}   #Enter your Name!
+LINK=${LINK:-"http://go.googlecode.com/files/${NAME}${VERSION}.src.tar.gz"}  #Enter URL for package here!
+
+
+#SYSTEM VARIABLES
+#----------------------------------------------------------------------------
+BUILDNUM=${BUILDNUM:-"1"}
+VL_VERSION=${VL_VERSION:-"$(ls /var/log/packages/|grep vlconfig2|cut -d "-" -f4|cut -c 2-5)"}
+BUILD=${BUILD:-"$BUILDNUM""$VL_VERSION"}
+ARCH=${ARCH:-"$(uname -m)"}
+CONFIG_OPTIONS=${CONFIG_OPTIONS:-""}
+LDFLAG_OPTIONS=${LDFLAG_OPTIONS:-""}
+ADDRB=${ADDRB:-""} #Add deps that need to be added to the slack-required file here
+EXRB=${EXRB:-""} #Add deps that need to be excluded from the slack-required file here
+MAKEDEPENDS=${MAKEDEPENDS:-""} #Add deps needed TO BUILD this package here.
+#----------------------------------------------------------------------------
+
+# DO NOT EXECUTE if NORUN is set to 1
+if [ "$NORUN" != "1" ]; then
+
+#SETUP PACKAGING ENVIRONMENT
+#--------------------------------------------
+CWD=$(pwd)
+cd ../
+RELEASEDIR=$(pwd)
+cd $CWD
+mkdir -p $RELEASEDIR/tmp
+TMP=$RELEASEDIR/tmp
+PKG=$TMP/package-$NAME
+#--------------------------------------------
+
+
+
+if [ $UID != 0 ]; then
+   echo "You are not authorized to run this script. Please login as root"
+   exit 1
+fi
+
+if [ ! -x /usr/bin/requiredbuilder ]; then
+   echo "Requiredbuilder not installed, or not executable."
+   exit 1
+fi
+
+if [ $VL_PACKAGER = "YOURNAME" ]; then
+   echo 'Who are you?
+   Please edit VL_PACKAGER=${VL_PACKAGER:-YOURNAME} in this script.
+   Change the word "YOURNAME" to your VectorLinux packager name.
+   You may also export VL_PACKAGER, or call this script with
+   VL_PACKAGER="YOUR NAME HERE"'
+   exit 1
+fi
+
+
+#CFLAGS SETUP
+#--------------------------------------------
+if [[ "$ARCH" = i?86 ]]; then
+  ARCH=i586
+  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+  CONFIGURE_TRIPLET="i486-vector-linux"
+  LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+  SLKCFLAGS="-O2 -fpic"
+  CONFIGURE_TRIPLET="x86_64-vlocity-linux"
+  LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "powerpc" ]; then
+  SLKCFLAGS="-O2"
+  CONFIGURE_TRIPLET="powerpc-vlocity-linux"
+  LIBDIRSUFFIX=""
+fi
+
+export CFLAGS="$SLKCFLAGS $CFLAG_OPTIONS"
+export CXXFLAGS=$CFLAGS
+export LDFLAGS="$LDFLAGS $LDFLAG_OPTIONS"
+#--------------------------------------------
+
+
+#GET THE SOURCE
+#--------------------------------------------
+for SRC in $(echo $LINK);do
+if [ ! -f $CWD/$(basename $SRC) ]
+then
+        wget --no-check-certificate -c $SRC
+fi
+done
+#--------------------------------------------
+
+
+rm -rf $PKG
+cd $TMP
+rm -rf $NAME-$VERSION
+
+
+#EXTRACT SOURCES
+#-----------------------------------------------------
+echo "Extracting source..."
+tar xvf $CWD/go$VERSION.src.tar.* || exit 1
+mkdir -p $PKG
+#-----------------------------------------------------
+
+
+cd $TMP/$NAME
+
+
+#PATCHES
+#-----------------------------------------------------
+# Put any Patches here *NOTE this only works if all 
+# your patches use the -p1 strip option!
+#-----------------------------------------------------
+for i in $CWD/patches/*;do
+  patch -p1 <$i
+  mkdir -p $PKG/usr/doc/$NAME-$VERSION/patches/
+  cp $i $PKG/usr/doc/$NAME-$VERSION/patches/
+done
+#-----------------------------------------------------
+ 
+ 
+
+#SET PERMISSIONS
+#-----------------------------------------
+echo "Setting permissions..."
+chown -R root:root .
+find . -perm 664 -exec chmod 644 {} \;
+find . -perm 777 -exec chmod 755 {} \;
+find . -perm 2777 -exec chmod 755 {} \;
+find . -perm 775 -exec chmod 755 {} \;
+find . -perm 2755 -exec chmod 755 {} \;
+find . -perm 774 -exec chmod 644 {} \;
+find . -perm 666 -exec chmod 644 {} \;
+find . -perm 600 -exec chmod 644 {} \;
+find . -perm 444 -exec chmod 644 {} \;
+find . -perm 400 -exec chmod 644 {} \;
+find . -perm 440 -exec chmod 644 {} \;
+find . -perm 511 -exec chmod 755 {} \;
+find . -perm 711 -exec chmod 755 {} \;
+find . -perm 555 -exec chmod 755 {} \;
+#-----------------------------------------
+
+
+
+#CONFIGURE & MAKE
+#----------------------------------------------------------------------
+# If you are building a KDE-related app, then change the following
+# arguments in the script below:
+# --prefix=$(kde-config -prefix) \
+# --sysconfdir=/etc/kde \
+#
+# Making these changes will ensure that your package will build in the
+# correct path and that it will work seamlessly within the KDE environment.
+#
+#-----------------------------------------------------------------------
+
+export GOSRC=$(pwd)
+export GOROOT=$(pwd)
+export GOROOT_FINAL="/usr/lib${LIBDIRSUFFIX}/go"
+export GOOS="linux"
+export GOBIN="${GOROOT}/bin"
+export GOARCH="${GARCH}"
+
+mkdir -p "${GOBIN}"
+cd src
+
+LC_ALL=C \
+    PATH="$PATH:$GOBIN" \
+    ./all.bash
+
+cd ..
+
+install -Dm644 misc/bash/go $PKG/etc/bash_completion.d/go
+
+install -Dm644 misc/emacs/go-mode-load.el $PKG/usr/share/emacs/site-lisp/go-mode-load.el
+install -Dm644 misc/emacs/go-mode.el $PKG/usr/share/emacs/site-lisp/go-mode.el
+
+install -Dm644 misc/vim/syntax/go.vim $PKG/usr/share/vim/vimfiles/syntax/go.vim
+install -Dm644 misc/vim/ftdetect/gofiletype.vim $PKG/usr/share/vim/vimfiles/ftdetect/gofiletype.vim
+install -Dm644 misc/vim/ftplugin/go/fmt.vim $PKG/usr/share/vim/vimfiles/ftplugin/go/fmt.vim
+install -Dm644 misc/vim/ftplugin/go/import.vim $PKG/usr/share/vim/vimfiles/ftplugin/go/import.vim
+install -Dm644 misc/vim/indent/go.vim $PKG/usr/share/vim/vimfiles/indent/go.vim
+
+GOPKG=$PKG/usr/lib${LIBDIRSUFFIX}
+mkdir -p $GOPKG
+cp -r $TMP/go $GOPKG
+mkdir -p $PKG/usr/bin
+
+ln -sf /usr/lib${LIBDIRSUFFIX}/go/bin/go $PKG/usr/bin/go
+ln -sf /usr/lib${LIBDIRSUFFIX}/go/bin/godoc $PKG/usr/bin/godoc
+ln -sf /usr/lib${LIBDIRSUFFIX}/go/bin/gofmt $PKG/usr/bin/gofmt
+
+ln -sf /usr/lib${LIBDIRSUFFIX}/go/pkg/tool/linux_${GOARCH}/cgo $PKG/usr/bin/cgo
+ln -sf /usr/lib${LIBDIRSUFFIX}/go/pkg/tool/linux_${GOARCH}/ebnflint $PKG/usr/bin/ebnflint
+
+# we'll just check for all of they're compilers :-)
+for tool in 8a 8c 8g 8l 6a 6c 6g 6l 5a 5c 5g 5l ; do
+      if [ -x $PKG/usr/lib${LIBDIRSUFFIX}/go/pkg/tool/linux_${GOARCH}/${tool} ]; then
+      ln -sf /usr/lib${LIBDIRSUFFIX}/go/pkg/tool/linux_${GOARCH}/${tool} $PKG/usr/bin/${tool}
+    fi
+done
+
+# Put the profile scripts for setting PATH and env variables
+mkdir -p $PKG/etc/profile.d
+cat > $PKG/etc/profile.d/go.csh.new << EOF
+#!/bin/csh
+setenv GOOS linux
+setenv GOARCH \${GOARCH}
+setenv GOROOT /usr/lib\${LIBDIRSUFFIX}/go
+EOF
+cat > $PKG/etc/profile.d/go.sh.new << EOF
+#!/bin/sh
+export GOOS="linux"
+export GOARCH="\${GOARCH}"
+export GOROOT="/usr/lib\${LIBDIRSUFFIX}/go"
+export GOPATH="\${GOPATH}:~/go"
+EOF
+
+chmod 0755 $PKG/etc/profile.d/go.csh.new
+chmod 0755 $PKG/etc/profile.d/go.sh.new
+
+
+#######################################################################
+#Miscellenious tweaks and things outside a normal ./configure go here #
+#######################################################################
+
+
+
+mkdir -p $PKG/usr/doc/$NAME-$VERSION
+cp -a AUTHORS COPYING ChangeLog Credits MANIFEST README TODO \
+$PKG/usr/doc/$NAME-$VERSION
+cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild
+
+#----------------------------------------------------------------------
+
+
+mkdir -p $PKG/install
+
+
+#if there is a slack-desc in src dir use it
+if test -f $CWD/slack-desc; then
+cp $CWD/slack-desc $RELEASEDIR/slack-desc
+else
+# This creates the white space in front of "handy-ruler" in slack-desc below.
+
+LENGTH=$(expr length "$NAME")
+SPACES=0
+SHIM=""
+until [ "$SPACES" = "$LENGTH" ]; do
+SHIM="$SHIM "
+let SPACES=$SPACES+1
+done
+
+# Fill in the package summary between the () below.
+# Then package the description, License, Author and Website.
+# There may be no more then 11 $NAME: lines in a valid slack-desc.
+
+cat > $RELEASEDIR/slack-desc << EOF
+# 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 ':'.
+
+$SHIM|-----handy-ruler------------------------------------------------------|
+$NAME: The Go programming language
+$NAME:
+$NAME: Go is an open source programming environment that makes it easy to 
+$NAME: build simple, reliable, and efficient software. 
+$NAME: 
+$NAME: 
+$NAME:
+$NAME:
+$NAME: License: BSD
+$NAME: Authors: Rob Pike
+$NAME: Website: http://golang.org
+
+EOF
+fi
+cat >> $RELEASEDIR/slack-desc << EOF
+
+
+
+#----------------------------------------
+BUILDDATE: $(date)
+PACKAGER:  $VL_PACKAGER
+HOST:      $(uname -srm)
+DISTRO:    $(cat /etc/vector-version)
+CFLAGS:    $CFLAGS
+LDFLAGS:   $LDFLAGS
+CONFIGURE: $(awk "/\\$\ \.\/configure\ /" $TMP/$DIRNAME/config.log)
+
+EOF
+
+cat $RELEASEDIR/slack-desc > $PKG/install/slack-desc
+
+#STRIPPING
+#------------------------------------------------------------------------------------------------------------------
+cd $PKG
+echo " "
+echo "Stripping...."
+echo " "
+find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+#------------------------------------------------------------------------------------------------------------------
+
+
+#FINISH PACKAGE
+#--------------------------------------------------------------
+echo "Finding dependencies..."
+ADD="$ADDRB" EXCLUDE="$EXRB" requiredbuilder -v -y -s $RELEASEDIR $PKG
+echo "Creating package $NAME-$VERSION-$ARCH-$BUILD.txz"
+makepkg -l y -c n $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.txz
+
+cd $CWD
+echo "Cleaning up temp files..." && rm -rf $TMP
+echo "Package Complete"
+fi
+#--------------------------------------------------------------
+
+# vim: set tabstop=4 shiftwidth=4 foldmethod=marker : ##