commit
e38e72c0d4
@ -0,0 +1 @@
|
|||||||
|
build/**
|
@ -0,0 +1,74 @@
|
|||||||
|
golang_version := 1.12.7
|
||||||
|
|
||||||
|
golang_tarball := go$(golang_version).src.tar.gz
|
||||||
|
golang_tarball_path := src/$(golang_tarball)
|
||||||
|
|
||||||
|
golang_bin_tarball := go$(golang_version).linux-amd64.tar.gz
|
||||||
|
golang_bin_tarball_path := src/$(golang_bin_tarball)
|
||||||
|
|
||||||
|
build_dir := build/$(arch)
|
||||||
|
golang_bin_dir := $(build_dir)/go
|
||||||
|
golang_src_dir := $(build_dir)/go/src
|
||||||
|
golang_src_build_dir := $(build_dir)/target/src
|
||||||
|
|
||||||
|
prefix := $(arch)-linux-musl-
|
||||||
|
|
||||||
|
bin := $(build_dir)/target/bin/go
|
||||||
|
|
||||||
|
ifeq ($(arch), mipsel)
|
||||||
|
prefix := mipsel-linux-musln32-
|
||||||
|
go_arch := mipsle
|
||||||
|
else ifeq ($(arch), aarch64)
|
||||||
|
go_arch := arm64
|
||||||
|
else ifeq ($(arch), x86_64)
|
||||||
|
go_arch := amd64
|
||||||
|
endif
|
||||||
|
|
||||||
|
cc := $(prefix)gcc
|
||||||
|
cxx := $(prefix)g++
|
||||||
|
strip := $(prefix)strip
|
||||||
|
|
||||||
|
$(golang_bin_tarball_path):
|
||||||
|
wget https://dl.google.com/go/$(golang_bin_tarball) -O $(golang_bin_tarball_path)
|
||||||
|
|
||||||
|
$(golang_bin_dir): $(golang_bin_tarball_path)
|
||||||
|
mkdir -p $(build_dir)
|
||||||
|
cd $(build_dir) && tar xvf ../../$(golang_bin_tarball_path)
|
||||||
|
cd $(build_dir)/go && patch -p1 < ../../../set-external-linker.patch
|
||||||
|
touch $(golang_bin_dir)
|
||||||
|
|
||||||
|
$(golang_src_build_dir): $(golang_src_dir)
|
||||||
|
mkdir -p $(build_dir)/target
|
||||||
|
cp -r $(golang_src_dir) $(golang_src_build_dir)
|
||||||
|
|
||||||
|
$(bin): $(golang_bin_dir) $(golang_src_build_dir)
|
||||||
|
cd $(golang_src_build_dir) && \
|
||||||
|
GOROOT_BOOTSTRAP=`realpath ../../go` \
|
||||||
|
GOROOT_FINAL=/golang \
|
||||||
|
GOOS=linux \
|
||||||
|
GOARCH=$(go_arch) \
|
||||||
|
CC_FOR_TARGET=$(cc) \
|
||||||
|
CXX_FOR_TARGET=$(cxx) \
|
||||||
|
CC=x86_64-linux-musl-gcc \
|
||||||
|
CXX=x86_64-linux-musl-g++ \
|
||||||
|
LD=x86_64-linux-musl-ld \
|
||||||
|
GO_LDFLAGS="-buildmode=pie" \
|
||||||
|
CGO_ENABLED=1 \
|
||||||
|
./make.bash
|
||||||
|
|
||||||
|
# if [ "$(arch)" != "x86_64" ]; then \
|
||||||
|
# mv $(build_dir)/target/bin/*_*/* $(build_dir)/target/bin; \
|
||||||
|
# rm -rf $(build_dir)/target/bin/*_*; \
|
||||||
|
# rm -rf $(build_dir)/target/pkg/linux_amd64; \
|
||||||
|
# rm -rf $(build_dir)/target/pkg/tool/linux_amd64; \
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# rm -rf $(build_dir)/target/pkg/obj
|
||||||
|
# rm -rf $(build_dir)/target/pkg/bootstrap
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(bin)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build/$(arch)
|
@ -0,0 +1,106 @@
|
|||||||
|
This patch is intended to fix https://github.com/golang/go/issues/18243
|
||||||
|
|
||||||
|
diff --git a/src/cmd/link/internal/amd64/obj.go b/src/cmd/link/internal/amd64/obj.go
|
||||||
|
index 87e8091..4470e05 100644
|
||||||
|
--- a/src/cmd/link/internal/amd64/obj.go
|
||||||
|
+++ b/src/cmd/link/internal/amd64/obj.go
|
||||||
|
@@ -62,7 +62,7 @@ func Init() (*sys.Arch, ld.Arch) {
|
||||||
|
PEreloc1: pereloc1,
|
||||||
|
TLSIEtoLE: tlsIEtoLE,
|
||||||
|
|
||||||
|
- Linuxdynld: "/lib64/ld-linux-x86-64.so.2",
|
||||||
|
+ Linuxdynld: "/lib/ld-musl-x86_64.so.1",
|
||||||
|
Freebsddynld: "/libexec/ld-elf.so.1",
|
||||||
|
Openbsddynld: "/usr/libexec/ld.so",
|
||||||
|
Netbsddynld: "/libexec/ld.elf_so",
|
||||||
|
diff --git a/src/cmd/link/internal/arm/obj.go b/src/cmd/link/internal/arm/obj.go
|
||||||
|
index da16f92..fd14940 100644
|
||||||
|
--- a/src/cmd/link/internal/arm/obj.go
|
||||||
|
+++ b/src/cmd/link/internal/arm/obj.go
|
||||||
|
@@ -58,7 +58,7 @@ func Init() (*sys.Arch, ld.Arch) {
|
||||||
|
Gentext: gentext,
|
||||||
|
Machoreloc1: machoreloc1,
|
||||||
|
|
||||||
|
- Linuxdynld: "/lib/ld-linux.so.3", // 2 for OABI, 3 for EABI
|
||||||
|
+ Linuxdynld: "/lib/ld-musl-armhf.so.1",
|
||||||
|
Freebsddynld: "/usr/libexec/ld-elf.so.1",
|
||||||
|
Openbsddynld: "/usr/libexec/ld.so",
|
||||||
|
Netbsddynld: "/libexec/ld.elf_so",
|
||||||
|
diff --git a/src/cmd/link/internal/arm64/obj.go b/src/cmd/link/internal/arm64/obj.go
|
||||||
|
index 6b386ad..9986371 100644
|
||||||
|
--- a/src/cmd/link/internal/arm64/obj.go
|
||||||
|
+++ b/src/cmd/link/internal/arm64/obj.go
|
||||||
|
@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
|
||||||
|
Gentext: gentext,
|
||||||
|
Machoreloc1: machoreloc1,
|
||||||
|
|
||||||
|
- Linuxdynld: "/lib/ld-linux-aarch64.so.1",
|
||||||
|
+ Linuxdynld: "/lib/ld-musl-aarch64.so.1",
|
||||||
|
|
||||||
|
Freebsddynld: "XXX",
|
||||||
|
Openbsddynld: "XXX",
|
||||||
|
diff --git a/src/cmd/link/internal/mips/obj.go b/src/cmd/link/internal/mips/obj.go
|
||||||
|
index c5d3451..fd85e63 100644
|
||||||
|
--- a/src/cmd/link/internal/mips/obj.go
|
||||||
|
+++ b/src/cmd/link/internal/mips/obj.go
|
||||||
|
@@ -60,7 +60,7 @@ func Init() (*sys.Arch, ld.Arch) {
|
||||||
|
Gentext: gentext,
|
||||||
|
Machoreloc1: machoreloc1,
|
||||||
|
|
||||||
|
- Linuxdynld: "/lib/ld.so.1",
|
||||||
|
+ Linuxdynld: "/lib/ld-musl-mipsle.so.1",
|
||||||
|
|
||||||
|
Freebsddynld: "XXX",
|
||||||
|
Openbsddynld: "XXX",
|
||||||
|
diff --git a/src/cmd/link/internal/mips64/obj.go b/src/cmd/link/internal/mips64/obj.go
|
||||||
|
index 83974e5..0f65647 100644
|
||||||
|
--- a/src/cmd/link/internal/mips64/obj.go
|
||||||
|
+++ b/src/cmd/link/internal/mips64/obj.go
|
||||||
|
@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
|
||||||
|
Gentext: gentext,
|
||||||
|
Machoreloc1: machoreloc1,
|
||||||
|
|
||||||
|
- Linuxdynld: "/lib64/ld64.so.1",
|
||||||
|
+ Linuxdynld: "/lib/ld-musl-mips64le.so.1",
|
||||||
|
Freebsddynld: "XXX",
|
||||||
|
Openbsddynld: "XXX",
|
||||||
|
Netbsddynld: "XXX",
|
||||||
|
diff --git a/src/cmd/link/internal/ppc64/obj.go b/src/cmd/link/internal/ppc64/obj.go
|
||||||
|
index 273d9b4..abe257d 100644
|
||||||
|
--- a/src/cmd/link/internal/ppc64/obj.go
|
||||||
|
+++ b/src/cmd/link/internal/ppc64/obj.go
|
||||||
|
@@ -62,7 +62,7 @@ func Init() (*sys.Arch, ld.Arch) {
|
||||||
|
Machoreloc1: machoreloc1,
|
||||||
|
|
||||||
|
// TODO(austin): ABI v1 uses /usr/lib/ld.so.1,
|
||||||
|
- Linuxdynld: "/lib64/ld64.so.1",
|
||||||
|
+ Linuxdynld: "/lib/ld-musl-powerpc64le.so.1",
|
||||||
|
|
||||||
|
Freebsddynld: "XXX",
|
||||||
|
Openbsddynld: "XXX",
|
||||||
|
diff --git a/src/cmd/link/internal/s390x/obj.go b/src/cmd/link/internal/s390x/obj.go
|
||||||
|
index 9ac7eb8..b3f7a66 100644
|
||||||
|
--- a/src/cmd/link/internal/s390x/obj.go
|
||||||
|
+++ b/src/cmd/link/internal/s390x/obj.go
|
||||||
|
@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
|
||||||
|
Gentext: gentext,
|
||||||
|
Machoreloc1: machoreloc1,
|
||||||
|
|
||||||
|
- Linuxdynld: "/lib64/ld64.so.1",
|
||||||
|
+ Linuxdynld: "/lib/ld-musl-s390x.so.1",
|
||||||
|
|
||||||
|
// not relevant for s390x
|
||||||
|
Freebsddynld: "XXX",
|
||||||
|
diff --git a/src/cmd/link/internal/x86/obj.go b/src/cmd/link/internal/x86/obj.go
|
||||||
|
index 6a744dc..d81f392 100644
|
||||||
|
--- a/src/cmd/link/internal/x86/obj.go
|
||||||
|
+++ b/src/cmd/link/internal/x86/obj.go
|
||||||
|
@@ -58,7 +58,7 @@ func Init() (*sys.Arch, ld.Arch) {
|
||||||
|
Machoreloc1: machoreloc1,
|
||||||
|
PEreloc1: pereloc1,
|
||||||
|
|
||||||
|
- Linuxdynld: "/lib/ld-linux.so.2",
|
||||||
|
+ Linuxdynld: "/lib/ld-musl-i386.so.1",
|
||||||
|
Freebsddynld: "/usr/libexec/ld-elf.so.1",
|
||||||
|
Openbsddynld: "/usr/libexec/ld.so",
|
||||||
|
Netbsddynld: "/usr/libexec/ld.elf_so",
|
@ -0,0 +1 @@
|
|||||||
|
*.tar.gz
|
@ -0,0 +1,48 @@
|
|||||||
|
python_version := 3.7.0
|
||||||
|
python_tarball := Python-$(python_version).tar.xz
|
||||||
|
python_tarball_path := src/$(python_tarball)
|
||||||
|
build_dir := build/$(arch)
|
||||||
|
python_dir := $(build_dir)/Python-$(python_version)
|
||||||
|
prefix := $(arch)-linux-musl-
|
||||||
|
prefix_dir := build/$(arch)/target
|
||||||
|
bin_unstripped := $(prefix_dir)/bin/python3.7_unstripped
|
||||||
|
bin := $(prefix_dir)/bin/python3.7
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(arch), mipsel)
|
||||||
|
prefix := mipsel-linux-musln32-
|
||||||
|
endif
|
||||||
|
|
||||||
|
cc := $(prefix)gcc
|
||||||
|
strip := $(prefix)strip
|
||||||
|
|
||||||
|
$(python_tarball_path):
|
||||||
|
wget https://www.python.org/ftp/python/$(python_version)/$(python_tarball) -O $(python_tarball_path)
|
||||||
|
|
||||||
|
$(python_dir): $(python_tarball_path)
|
||||||
|
mkdir -p $(build_dir)
|
||||||
|
cd $(build_dir) && tar xvf ../../$(python_tarball_path)
|
||||||
|
|
||||||
|
$(bin): $(python_dir)
|
||||||
|
cd $(python_dir) && ./configure \
|
||||||
|
CC=$(cc) \
|
||||||
|
--host=$(arch)-linux-musl \
|
||||||
|
--target=$(arch)-linux-musl \
|
||||||
|
--build=x86_64-linux-gnu \
|
||||||
|
--disable-ipv6 \
|
||||||
|
--without-ensurepip \
|
||||||
|
ac_cv_file__dev_ptmx=no \
|
||||||
|
ac_cv_file__dev_ptc=no \
|
||||||
|
ac_cv_have_long_long_format=yes \
|
||||||
|
--prefix=`realpath ../target`
|
||||||
|
|
||||||
|
cd $(python_dir) && make -j8 build_all
|
||||||
|
mkdir -p $(prefix_dir)
|
||||||
|
cd $(python_dir) && make -j8 altinstall
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(bin)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build/$(arch)
|
@ -0,0 +1 @@
|
|||||||
|
*.tar.xz
|
Loading…
Reference in new issue