Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
aports
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alpine
aports
Commits
f5c4b298
Commit
f5c4b298
authored
8 years ago
by
Timo Teräs
Browse files
Options
Downloads
Patches
Plain Diff
community/go: cross-build support
parent
fb8794ef
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
community/go/APKBUILD
+30
-6
30 additions, 6 deletions
community/go/APKBUILD
scripts/bootstrap.sh
+5
-1
5 additions, 1 deletion
scripts/bootstrap.sh
with
35 additions
and
7 deletions
community/go/APKBUILD
+
30
−
6
View file @
f5c4b298
...
...
@@ -15,24 +15,37 @@ makedepends="bash go-bootstrap"
options
=
"!strip"
provides
=
"go-bootstrap=
$pkgver
-r
$pkgrel
"
install
=
""
subpackages
=
"
$pkgname
-doc
$pkgname
-tools
"
subpackages
=
"
$pkgname
-doc"
source
=
"http://golang.org/dl/go
${
pkgver
/_/
}
.src.tar.gz
$pkgname
-tools-
${
pkgver
/_/
}
.tar.gz::https://github.com/golang/tools/archive/
${
_toolsver
}
.tar.gz
go
-tools-
${
pkgver
/_/
}
.tar.gz::https://github.com/golang/tools/archive/
${
_toolsver
}
.tar.gz
default-buildmode-pie.patch
"
# NOTE: building go for x86 with grsec kernel requires:
# sysctl -w kernel.modify_ldt=1
_gotools
=
"cover godoc stringer"
_tooldir
=
"
$srcdir
"
/tools-
${
_toolsver
}
if
[
"
$CBUILD
"
=
"
$CTARGET
"
]
;
then
makedepends
=
"go-bootstrap
$makedepends
"
provides
=
"go-bootstrap=
$pkgver
-r
$pkgrel
"
subpackages
=
"
$subpackages
$pkgname
-tools"
_gotools
=
"cover godoc stringer"
_gocross
=
"darwin freebsd openbsd windows"
else
pkgname
=
"go-bootstrap"
makedepends
=
"go
$makedepends
"
# Go expect host linker instead of the cross-compiler
export
CC_FOR_TARGET
=
"
$CC
"
export
CC
=
"
${
HOSTLD
:-
gcc
}
"
export
CXX
=
"
${
HOSTLD
:-
g
++
}
"
export
LD
=
"
${
HOSTLD
:-
ld
}
"
fi
_
gocross
=
"darwin freebsd openbsd windows"
_
tooldir
=
"
$srcdir
"
/tools-
${
_toolsver
}
for
os
in
$_gocross
;
do
subpackages
=
"
$subpackages
$pkgname
-cross-
${
os
}
:_crosspkg"
done
builddir
=
"
$srcdir
"
/
$pkgname
builddir
=
"
$srcdir
"
/
go
build
()
{
cd
"
$builddir
/src"
...
...
@@ -46,6 +59,7 @@ build() {
*
)
die
"Unsupported arch"
;;
esac
export
GOOS
=
"linux"
export
GOPATH
=
"
$srcdir
"
export
GOROOT
=
"
$builddir
"
export
GOBIN
=
"
$GOROOT
"
/bin
...
...
@@ -64,6 +78,16 @@ build() {
done
done
# copied from bootstrap.bash to fixup cross-built bootstrap go
if
[
"
$CBUILD
"
!=
"
$CTARGET
"
]
;
then
local
gohostos
=
"
$(
../bin/go
env
GOHOSTOS
)
"
local
gohostarch
=
"
$(
../bin/go
env
GOHOSTARCH
)
"
mv
../bin/
*
_
*
/
*
../bin
rmdir
../bin/
*
_
*
rm
-rf
"../pkg/
${
gohostos
}
_
${
gohostarch
}
"
*
"../pkg/tool/
${
gohostos
}
_
${
gohostarch
}
"
*
rm
-rf
../pkg/bootstrap ../pkg/obj
fi
# FIXME some tests fail:
# PATH="$GOROOT/bin:$PATH" ./run.bash -no-rebuild || return 1
...
...
This diff is collapsed.
Click to expand it.
scripts/bootstrap.sh
+
5
−
1
View file @
f5c4b298
...
...
@@ -20,7 +20,10 @@ CBUILDROOT="$(CTARGET=$TARGET_ARCH . /usr/share/abuild/functions.sh ; echo $CBUI
[
-e
"
$APORTS
/main/build-base"
]
||
die
"Unable to deduce aports base checkout"
apkbuildname
()
{
echo
$APORTS
/main/
$1
/APKBUILD
local
repo
=
"
${
1
%%/*
}
"
local
pkg
=
"
${
1
##*/
}
"
[
"
$repo
"
=
"
$1
"
]
&&
repo
=
"main"
echo
$APORTS
/
$repo
/
$pkg
/APKBUILD
}
msg
()
{
...
...
@@ -100,6 +103,7 @@ for PKG in fortify-headers linux-headers musl libc-dev pkgconf zlib \
attr libcap patch
sudo
acl fakeroot
tar
\
pax-utils abuild openssh
\
ncurses util-linux lvm2 popt xz cryptsetup kmod lddtree mkinitfs
\
community/go
\
$KERNEL_PKG
;
do
CHOST
=
$TARGET_ARCH
BOOTSTRAP
=
bootimage
APKBUILD
=
$(
apkbuildname
$PKG
)
abuild
-r
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment