Skip to content

Commit

Permalink
Merge pull request #537 from mariux64/fix-go
Browse files Browse the repository at this point in the history
go: build go with cgo support
  • Loading branch information
david authored Nov 27, 2017
2 parents 55dbc05 + 03a18df commit 69eadc3
Showing 1 changed file with 43 additions and 30 deletions.
73 changes: 43 additions & 30 deletions go.be0
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env beesh

# BEE_VERSION go-1.9.2-0
# BEE_VERSION go-1.9.2-1

SRCURL[0]="https://redirector.gvt1.com/edgedl/go/go${PKGVERSION}.src.tar.gz"
SRCURL[0]="https://storage.googleapis.com/golang/go1.4-bootstrap-20170531.tar.gz"
SRCURL[1]="https://redirector.gvt1.com/edgedl/go/go${PKGVERSION}.src.tar.gz"

# PATCHURL+=()

Expand All @@ -12,10 +13,13 @@ build_in_sourcedir

sourcesubdir_append src


#mee_extract() {
# bee_extract "${@}"
#}
mee_extract() {
# extract bootstrap version of go-1.4 to arbitrary location
mkdir ${S}/bootstrap
bee_extract_do_tar "${1}" ${S}/bootstrap --strip-components 1
shift
bee_extract "${@}"
}

#mee_patch() {
# bee_patch "${@}"
Expand All @@ -26,39 +30,48 @@ sourcesubdir_append src
#}

mee_build() {
export GOROOT_BOOTSTRAP=${PREFIX} \
GOROOT_FINAL=${LIBDIR}/go-${PKGVERSION}
start_cmd ${S}/make.bash #${BEE_MAKEFLAGS}
exit

cd ${S}/../bootstrap/src
./make.bash

cd ${S}

export GOROOT_BOOTSTRAP=${S}/../bootstrap
export GOROOT_FINAL=${LIBDIR}/go

./make.bash
}


mee_install() {
# Install Binaries
start_cmd mkdir -p ${D}${BINDIR}
start_cmd mkdir -p ${D}${LIBDIR}/go-${PKGVERSION}
start_cmd cp -r ${S}/../bin ${D}${LIBDIR}/go-${PKGVERSION}
cd ${D}${BINDIR}
start_cmd ln -s ../lib/go-${PKGVERSION}/bin/go go
start_cmd ln -s ../lib/go-${PKGVERSION}/bin/gofmt gofmt
# The binaries expect /scratch/local/bee-root/go/go-1.9.2-1/source to be copied or moved to /usr/lib/go
mkdir -p ${D}${BINDIR}

cp -r ${S}/../bin/. ${D}${BINDIR}

mkdir -p ${D}${LIBDIR}/go

# strace -s 200 -e file ${S}/../bin/go install -buildmode=shared std

# Install standardlibs https://golang.org/pkg/#stdlib
LIBS="archive bufio builtin bytes compress container context crypto database \
debug encoding errors expvar flag fmt go hash html image index internal io \
log math mime net os path plugin reflect regexp runtime sort strconv strings \
sync syscall testing text time unicode unsafe"

start_cmd ${S}/../bin/go install -buildmode=shared std
LIBS="builtin context debug expvar go image io math \
path runtime strings testing unicode bufio bytes \
compress crypto encoding flag hash index mime net plugin reflect \
sort sync text unsafe archive cmd container database errors \
fmt html internal log os regexp strconv syscall time vendor"

start_cmd mkdir -p ${D}${LIBDIR}/go-${PKGVERSION}/src
echo "LIBS=${LIBS}"

mkdir -p ${D}${LIBDIR}/go/src
for i in $LIBS; do
start_cmd cp -r ${S}/${i} ${D}${LIBDIR}/go-${PKGVERSION}/src
cp -r ${S}/${i} ${D}${LIBDIR}/go/src
done

#Install tools for go
start_cmd mkdir -p ${D}${LIBDIR}/go-${PKGVERSION}/pkg
start_cmd cp -r ${S}/../pkg/tool ${D}${LIBDIR}/go-${PKGVERSION}/pkg
start_cmd cp -r ${S}/../pkg/include ${D}${LIBDIR}/go-${PKGVERSION}/pkg
start_cmd cp -r ${S}/../pkg/linux_amd64 ${D}${LIBDIR}/go-${PKGVERSION}/pkg
start_cmd cp -r ${S}/../pkg/linux_amd64_dynlink ${D}${LIBDIR}/go-${PKGVERSION}/pkg
mkdir -p ${D}${LIBDIR}/go/pkg
cp -r ${S}/../pkg/tool ${D}${LIBDIR}/go/pkg
cp -r ${S}/../pkg/include ${D}${LIBDIR}/go/pkg
cp -r ${S}/../pkg/linux_amd64 ${D}${LIBDIR}/go/pkg

}
## by default this may be 'make install DESTDIR="${D}"'

0 comments on commit 69eadc3

Please sign in to comment.