[arch-dev-public] RFC: go-pie removal in favour of GOFLAGS

Morten Linderud foxboron at archlinux.org
Wed May 13 20:16:38 UTC 2020


Yo!

After another few lazy weeks I have finished up the new Go packaging guidelines.

https://wiki.archlinux.org/index.php/User:Foxboron/Go_packaging_guidelines#Flags_and_build_options

The changes that has been done since last time is some structing of the page,
added a list explaining all the flags that have been added to `GOFLAGS`, and the
addition of `-mod=readonly`. 

The intention of adding this flag is to prevent Makefiles or build systems to
silently modify the lockfile of the source code after checkout. This is
to ensure reproducible build.

If there are no objections, I'll probably merge the guidelines this weekend
section-by-section to make the wiki admins happy. The new package should land
sometime nextweek.

At the end of the month I'll make a todo with the remaining packages depending
on `go-pie`.

The complete future Go PKGBUILD is attached to this email below.

-- 
Morten Linderud
PGP: 9C02FF419FECBE16


# Go PKBUILD

pkgname=go
epoch=2
pkgver=1.14.2
pkgrel=2
pkgdesc='Core compiler tools for the Go programming language'
arch=(x86_64)
url='https://golang.org/'
license=(BSD)
makedepends=(git go perl)
replaces=(go-pie)
provides=(go-pie)
options=(!strip staticlibs)
source=(https://storage.googleapis.com/golang/go$pkgver.src.tar.gz{,.asc})
validpgpkeys=('EB4C1BFD4F042F6DDDCCEC917721F63BD38B4796')
sha256sums=('98de84e69726a66da7b4e58eac41b99cbe274d7e8906eeb8a5b7eb0aadee7f7c'
            'SKIP')

build() {
  export GOARCH=amd64
  export GOROOT_FINAL=/usr/lib/go
  export GOROOT_BOOTSTRAP=/usr/lib/go
  export GOPATH="$srcdir/"
  export GOROOT="$srcdir/$pkgname"
  export GOBIN="$GOROOT/bin"

  cd "$pkgname/src"
  ./make.bash --no-clean -v

  PATH="$GOBIN:$PATH" go install -v -race std
  PATH="$GOBIN:$PATH" go install -v -buildmode=shared std
}

check() {
  export GOARCH=amd64
  export GOROOT_FINAL=/usr/lib/go
  export GOROOT_BOOTSTRAP=/usr/lib/go
  export GOROOT="$srcdir/$pkgname"
  export GOBIN="$GOROOT/bin"
  export PATH="$srcdir/$pkgname/bin:$PATH"
  export GO_TEST_TIMEOUT_SCALE=2

  cd $pkgname/src
  ./run.bash --no-rebuild -v -v -v -k
}

package() {
  cd "$pkgname"

  install -d "$pkgdir/usr/bin" "$pkgdir/usr/lib/go" "$pkgdir/usr/share/doc/go"
  cp -a bin pkg src lib misc api test "$pkgdir/usr/lib/go"
  cp -r doc/* "$pkgdir/usr/share/doc/go"

  ln -sf /usr/lib/go/bin/go "$pkgdir/usr/bin/go"
  ln -sf /usr/lib/go/bin/gofmt "$pkgdir/usr/bin/gofmt"
  ln -sf /usr/share/doc/go "$pkgdir/usr/lib/go/doc"

  install -Dm644 VERSION "$pkgdir/usr/lib/go/VERSION"

  rm -rf "$pkgdir/usr/lib/go/pkg/bootstrap" "$pkgdir/usr/lib/go/pkg/tool/*/api"

  # TODO: Figure out if really needed
  rm -rf "$pkgdir"/usr/lib/go/pkg/obj/go-build/*

  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.archlinux.org/pipermail/arch-dev-public/attachments/20200513/93562ecf/attachment.sig>


More information about the arch-dev-public mailing list