diff options
author | Andrew Clemons <andrew.clemons@gmail.com> | 2023-10-08 08:51:30 +0800 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-10-21 17:20:11 +0700 |
commit | 80519f5ce87ee005c4450082956911fde9b25c7a (patch) | |
tree | 5f8a66ba95ed595ac871fd24e5b6964e66f95f87 /development/google-go-lang | |
parent | 8f4672ae73d1d122f2dcb4055a52e5a8bd9c1545 (diff) | |
download | slackbuilds-80519f5ce87ee005c4450082956911fde9b25c7a.tar.gz slackbuilds-80519f5ce87ee005c4450082956911fde9b25c7a.tar.xz |
development/google-go-lang: Updated for version 1.21.2.
- Remove test files to reduce package size
(and make sbopkglint happier).
- Add cgo version check to avoid bootstrap compile on -current
Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'development/google-go-lang')
-rw-r--r-- | development/google-go-lang/google-go-lang.SlackBuild | 120 | ||||
-rw-r--r-- | development/google-go-lang/google-go-lang.info | 6 |
2 files changed, 72 insertions, 54 deletions
diff --git a/development/google-go-lang/google-go-lang.SlackBuild b/development/google-go-lang/google-go-lang.SlackBuild index 51b0398efa..5a9df9b3bd 100644 --- a/development/google-go-lang/google-go-lang.SlackBuild +++ b/development/google-go-lang/google-go-lang.SlackBuild @@ -29,7 +29,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=google-go-lang -VERSION=${VERSION:-1.21.1} +VERSION=${VERSION:-1.21.2} BOOTSTRAP_VERSION=${BOOTSTRAP_VERSION:-1.19.13} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -77,64 +77,68 @@ OUTPUT=${OUTPUT:-/tmp} set -e rm -rf $PKG -mkdir -p $TMP $PKG/usr/lib${LIBDIRSUFFIX}/go${BOOTSTRAP_VERSION} $OUTPUT -cd $PKG/usr/lib${LIBDIRSUFFIX}/go${BOOTSTRAP_VERSION} -tar xvf $CWD/go${BOOTSTRAP_VERSION}.src.tar.gz -cd go -chown -R root:root . -find -L . \ - \( -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 {} \; -# 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 +CGO_MINOR_VERSION="$(/usr/bin/go version | awk '{ print $3 }' | sed 's/go//' | awk -F. '{ print $2 }')" +if [[ $CGO_MINOR_VERSION -lt 18 ]] ; then + mkdir -p $TMP $PKG/usr/lib${LIBDIRSUFFIX}/go${BOOTSTRAP_VERSION} $OUTPUT + cd $PKG/usr/lib${LIBDIRSUFFIX}/go${BOOTSTRAP_VERSION} + tar xvf $CWD/go${BOOTSTRAP_VERSION}.src.tar.gz + cd go + chown -R root:root . + find -L . \ + \( -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 {} \; + + # 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 + + # Not sure why, but this causes run.bash to fail --rworkman + unset BASH_ENV + + # gcc 5+ is go1.4 API, so we'll bootstrap with it + export GOROOT_BOOTSTRAP="/usr" + + # Default GOROOT is the parent directory of all.bash, + # which is the current directory we're in. + # Defining it here means we can use it below when building + # shared libraries + GOROOT="$(pwd)" + export GOROOT + + # The value of GOROOT once the package is installed + export GOROOT_FINAL="/usr/lib${LIBDIRSUFFIX}/go${BOOTSTRAP_VERSION}/go" + + case "$ARCH" in + arm|i?86) export GOMAXPROCS=1 ;; + esac -# Not sure why, but this causes run.bash to fail --rworkman -unset BASH_ENV + cd src -# gcc 5+ is go1.4 API, so we'll bootstrap with it -export GOROOT_BOOTSTRAP="/usr" + if [[ "${RUN_TEST}" = "true" ]] ; then + LC_ALL=C \ + ./all.bash + else + LC_ALL=C \ + ./make.bash + fi -# Default GOROOT is the parent directory of all.bash, -# which is the current directory we're in. -# Defining it here means we can use it below when building -# shared libraries -GOROOT="$(pwd)" -export GOROOT + # As of go1.5, golang supports shared libraries, so generate them for use. + $GOROOT/bin/go install -buildmode=shared std -# The value of GOROOT once the package is installed -export GOROOT_FINAL="/usr/lib${LIBDIRSUFFIX}/go${BOOTSTRAP_VERSION}/go" + cd .. -case "$ARCH" in - arm|i?86) export GOMAXPROCS=1 ;; -esac + # remove Go build cache + rm -rf pkg/obj/go-build/* -cd src + # remove the doc Makefile + rm -f doc/Makefile -if [[ "${RUN_TEST}" = "true" ]] ; then - LC_ALL=C \ - ./all.bash -else - LC_ALL=C \ - ./make.bash + mkdir -p $PKG$GOROOT_FINAL fi -# As of go1.5, golang supports shared libraries, so generate them for use. -$GOROOT/bin/go install -buildmode=shared std - -cd .. - -# remove Go build cache -rm -rf pkg/obj/go-build/* - -# remove the doc Makefile -rm -f doc/Makefile - -mkdir -p $PKG$GOROOT_FINAL - mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/go${VERSION} $OUTPUT cd $PKG/usr/lib${LIBDIRSUFFIX}/go${VERSION} tar xvf $CWD/go${VERSION}.src.tar.gz @@ -154,7 +158,11 @@ unset GOBIN GOPATH GOOS GOARCH unset BASH_ENV # gcc 5+ is go1.4 API, so we'll bootstrap with it -export GOROOT_BOOTSTRAP="$PKG/usr/lib${LIBDIRSUFFIX}/go${BOOTSTRAP_VERSION}/go" +if [[ $CGO_MINOR_VERSION -lt 18 ]] ; then + export GOROOT_BOOTSTRAP="$PKG/usr/lib${LIBDIRSUFFIX}/go${BOOTSTRAP_VERSION}/go" +else + export GOROOT_BOOTSTRAP="/usr" +fi # Default GOROOT is the parent directory of all.bash, # which is the current directory we're in. @@ -183,6 +191,10 @@ fi # As of go1.5, golang supports shared libraries, so generate them for use. $GOROOT/bin/go install -buildmode=shared std +find $PKG/$GOROOT_FINAL -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +find $PKG/$GOROOT_FINAL -type f -name "*.so" -exec chmod +x {} \; 2> /dev/null || true + cd .. # remove Go build cache @@ -191,10 +203,16 @@ rm -rf pkg/obj/go-build/* # remove the doc Makefile rm -f doc/Makefile +# remove tests, nothing needs these at runtime +find $PKG/$GOROOT_FINAL/src -type d -name "testdata" -exec rm -rf {} + +find $PKG/$GOROOT_FINAL/src -type f -name "*_test.go" -exec rm -rf {} + + mkdir -p $PKG$GOROOT_FINAL # remove bootstrap -rm -rf $PKG/usr/lib$LIBDIRSUFFIX/go$BOOTSTRAP_VERSION +if [[ $CGO_MINOR_VERSION -lt 18 ]] ; then + rm -rf $PKG/usr/lib$LIBDIRSUFFIX/go$BOOTSTRAP_VERSION +fi # Put the profile scripts for setting PATH and env variables mkdir -p $PKG/etc/profile.d diff --git a/development/google-go-lang/google-go-lang.info b/development/google-go-lang/google-go-lang.info index e4cd7c0627..257f4c08ec 100644 --- a/development/google-go-lang/google-go-lang.info +++ b/development/google-go-lang/google-go-lang.info @@ -1,9 +1,9 @@ PRGNAM="google-go-lang" -VERSION="1.21.1" +VERSION="1.21.2" HOMEPAGE="http://golang.org" -DOWNLOAD="https://storage.googleapis.com/golang/go1.21.1.src.tar.gz \ +DOWNLOAD="https://storage.googleapis.com/golang/go1.21.2.src.tar.gz \ https://storage.googleapis.com/golang/go1.19.13.src.tar.gz" -MD5SUM="00ef7b2f4c47990c37dd60bd15fa8c0f \ +MD5SUM="18a5944a6492fa86a754558ef7499ca1 \ 6d3625cac26503932002b98eae2d0001" DOWNLOAD_x86_64="" MD5SUM_x86_64="" |