Skip to content

Commit

Permalink
New package: go-pie-1.14
Browse files Browse the repository at this point in the history
This package makes it possible to build Go binaries with PIE.
  • Loading branch information
ericonr committed Mar 29, 2020
1 parent 3c4f982 commit af1ca56
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
12 changes: 12 additions & 0 deletions srcpkgs/go-pie/patches/default-buildmode-pie.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff go/src/cmd/go/internal/work/init.go go/src/cmd/go/internal/work/init.go
--- go/src/cmd/go/internal/work/init.go
+++ go/src/cmd/go/internal/work/init.go
@@ -131,7 +131,7 @@ func buildModeInit() {
ldBuildmode = "c-shared"
case "default":
switch cfg.Goos {
- case "android":
+ case "android", "linux":
codegenArg = "-shared"
ldBuildmode = "pie"
case "darwin":
80 changes: 80 additions & 0 deletions srcpkgs/go-pie/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Template file for 'go-pie'
pkgname=go-pie
version=1.14
revision=1
create_wrksrc=yes
build_wrksrc=go
build_style=go
hostmakedepends="go1.12-bootstrap"
short_desc="Go Programming Language"
maintainer="Michael Aldridge <[email protected]>"
license="BSD-3-Clause"
homepage="http://golang.org/"
distfiles="https://golang.org/dl/go${version}.src.tar.gz"
checksum=6d643e46ad565058c7a39dac01144172ef9bd476521f42148be59249e4b74389
conflicts="go"
noverifyrdeps=yes

if [ "$CROSS_BUILD" ]; then
if [ "${XBPS_MACHINE%%-musl}" = "${XBPS_TARGET_MACHINE%%-musl}" ]; then
broken="Cross-compiling to different libc is not supported"
fi
fi

do_configure() {
:
}

do_build() {
unset GCC CC CXX LD CFLAGS
# FIXME: work around leaking go build-style vars when built as a
# dependency
unset CGO_CXXFLAGS CGO_CFLAGS CGO_ENABLED

export GOROOT_BOOTSTRAP="/usr/lib/go1.12"
export GOROOT=$PWD
export GOROOT_FINAL="/usr/lib/go"
export GOARCH=${_goarch}

cd "src"

bash make.bash --no-clean -v
}

do_install() {
local bindir

if [ "$CROSS_BUILD" ]; then
bindir=bin/linux_${_goarch}
else
bindir=bin
fi

vmkdir usr/bin
vmkdir usr/lib/go
vmkdir usr/share/go
cp -d --preserve=all ${bindir}/* ${DESTDIR}/usr/bin || true
cp -a pkg src lib ${DESTDIR}/usr/lib/go
cp -r doc misc -t ${DESTDIR}/usr/share/go
ln -s /usr/share/go/doc ${DESTDIR}/usr/lib/go/doc

# This is to make go get code.google.com/p/go-tour/gotour and
# then running the gotour executable work out of the box.
#
# Also, /usr/bin is the place for system-wide executables,
# not /usr/lib/go/bin. Users should use different paths by
# setting the appropriate environment variables.
#
ln -sf /usr/bin ${DESTDIR}/usr/lib/go/bin

# <dominikh> sigh. well, someone fix the template and add
# a symlink, usr/lib/go/misc -> /usr/share/go/misc
ln -sfr ${DESTDIR}/usr/share/go/misc ${DESTDIR}/usr/lib/go/misc

rm -f ${DESTDIR}/usr/share/go/doc/articles/wiki/get.bin
rm -f ${DESTDIR}/usr/lib/go/pkg/tool/*/api
rm -rf ${DESTDIR}/usr/lib/go/pkg/bootstrap
rm -rf ${DESTDIR}/usr/lib/go/pkg/obj

vlicense LICENSE
}
1 change: 1 addition & 0 deletions srcpkgs/go-pie/update
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ignore="*beta* *rc*"

0 comments on commit af1ca56

Please sign in to comment.