FS#46219 - [go] Overhaul PKGBUILD

Attached to Project: Community Packages
Opened by Pierre Neidhardt (Ambrevar) - Monday, 07 September 2015, 13:42 GMT
Last edited by Alexander F. Rødseth (xyproto) - Saturday, 12 September 2015, 21:36 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Vesa Kaihlavirta (vegai)
Alexander F. Rødseth (xyproto)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Go 1.5 PKGBUILD is quite outdated.

* makedepends: Mercurial is not needed.

* 'Enable ARM crosscompilation for linux': the exports and the following `bash make.bash` are not needed. It closes  FS#46066  as well.

* Replace `if [ "$CARCH" == 'x86_64' ]; then...` by a `case "$CARCH" in` as in the code above. This is shorter and more idiomatic.

* Empty `etc/profile.d` is not needed.

* Copying src/cmd is redundant. The other commented copies can be discarded.

* The `sql.go` fix is no longer necessary.

* `get.gin` does not exist anymore.

* No need to remove C object files as there is no C code anymore. Remove obsolete comments on C headers.

* Executable files: some makefiles need to be executable as pointed out near the end. This create a tension with the few lines above that make sure no executable are to be found in GOROOT. For the sake of simplicity and consistency, I suggest we leave the exec bit as provided by the go distribution.

* We should leave the makefiles. (They allow for generating new GOARCH std libraries.) We can safely remove the Windows *.bat files however.

* The '!strip' option is used since Go libraries cannot be stripped by the `strip` program. Since the few Go binaries take a lot of space, we can strip them manually.

* No need for the final `touch`: this used to be a dirty work around for the stale files, the properly way to do it is `go install std` in post_upgrade (already done).

* Crossplatform support: the new `go` command-line tool is able to cross-compile by itself, without any extra compiler nor pkg files. Indeed, if a std pkg is missing, it will build one temporarily.
This takes more time however. Besides, `go get` will fail for some odd reason (this should be reported upstream).
Anyhow, the 386 and arm `go*` tools are useless, and their std libraries are really space consuming. I believe they are not needed for most users, and to be consistent with gcc multilibs it would more convenient to have a go-386 and a go-arm package containing the pkg/linux_$GOARCH folders.
The Arch Wiki page should be updated accordingly.

Find my patched PKGBUILD attached. Final size is 235 MB, so ~300 MB less than current package.
   PKGBUILD (4.2 KiB)
This task depends upon

Closed by  Alexander F. Rødseth (xyproto)
Saturday, 12 September 2015, 21:36 GMT
Reason for closing:  Implemented
Comment by Alexander F. Rødseth (xyproto) - Thursday, 10 September 2015, 19:29 GMT
Thanks for reporting! Will overhaul in connection with the 1.5.1 release.
Comment by Alexander F. Rødseth (xyproto) - Saturday, 12 September 2015, 09:05 GMT
The updated package will appear in [community] shortly. Thanks for the improvements.
Comment by Alexander F. Rødseth (xyproto) - Saturday, 12 September 2015, 09:36 GMT
The stripping in the PKGBUILD did not work for i686, though, but I'm finding a solution for that.
Comment by Pierre Neidhardt (Ambrevar) - Saturday, 12 September 2015, 09:43 GMT
Well, there is one line that should be changed in my PKGBUILD:

"$pkgdir/usr/lib/go/pkg/tool/linux_amd64/"*; do

Use a `case "$CARCH"` like before to replace amd64 dynamically.
Comment by Alexander F. Rødseth (xyproto) - Saturday, 12 September 2015, 12:08 GMT
That is a possibility.
Comment by Pierre Neidhardt (Ambrevar) - Saturday, 12 September 2015, 15:00 GMT
Thanks for the update!
I am not sure I understand your choice for the stripping: Non x64 arch won't have stripped binaries, will they?
I thought of something like this:

case "$CARCH" in
x86_64) GOARCH=amd64 ;;
i686) GOARCH=386 ;;
esac

for i in "$pkgdir/usr/bin/"* \
"$pkgdir/usr/lib/go/pkg/bootstrap/bin/"* \
"$pkgdir/usr/lib/go/pkg/tool/linux_${GOARCH}/"*; do
strip -s "$i"
done
Comment by Alexander F. Rødseth (xyproto) - Saturday, 12 September 2015, 18:50 GMT
Both would work. The default is to provide the binaries that a vanilla build process provides, as defined by upstream.

There were problems with stripping go binaries in the past, so just skipping stripping is a safe alternative that is also close to what upstream provides. Saving a couple of MB is not that important.

I'll consider using your proposed alternative for stripping for the next release. Thanks again for the work you put into improving the PKGBUILD!

Loading...