summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/golang/_metadata/depends1
-rw-r--r--data/golang/_metadata/description1
-rw-r--r--data/golang/_metadata/homepage1
-rw-r--r--data/golang/_metadata/in.1443.000
l---------data/golang/_metadata/maintainer1
-rw-r--r--data/golang/_metadata/name1
-rw-r--r--data/golang/_metadata/priority1
-rw-r--r--data/golang/_metadata/role1
-rw-r--r--data/golang/_metadata/section1
-rw-r--r--data/golang/_metadata/tags1
-rw-r--r--data/golang/_metadata/version1
-rwxr-xr-xdata/golang/bootstrap.sh25
-rw-r--r--data/golang/defaultcc.diff12
-rw-r--r--data/golang/gcc_darwin_arm64.diff67
-rwxr-xr-xdata/golang/go.sh.in2
-rw-r--r--data/golang/golang-1.11_1.11.6.orig.tar.gzbin0 -> 21113406 bytes
-rw-r--r--data/golang/ldid.diff47
-rw-r--r--data/golang/make.sh58
-rw-r--r--data/golang/validLinkerFlags.diff19
19 files changed, 240 insertions, 0 deletions
diff --git a/data/golang/_metadata/depends b/data/golang/_metadata/depends
new file mode 100644
index 000000000..a24981c37
--- /dev/null
+++ b/data/golang/_metadata/depends
@@ -0,0 +1 @@
+llvm-clang
diff --git a/data/golang/_metadata/description b/data/golang/_metadata/description
new file mode 100644
index 000000000..98236f41f
--- /dev/null
+++ b/data/golang/_metadata/description
@@ -0,0 +1 @@
+Static compiled language that makes it easy to build simple, reliable, and efficient software.
diff --git a/data/golang/_metadata/homepage b/data/golang/_metadata/homepage
new file mode 100644
index 000000000..a865d8b29
--- /dev/null
+++ b/data/golang/_metadata/homepage
@@ -0,0 +1 @@
+https://golang.org
diff --git a/data/golang/_metadata/in.1443.00 b/data/golang/_metadata/in.1443.00
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/data/golang/_metadata/in.1443.00
diff --git a/data/golang/_metadata/maintainer b/data/golang/_metadata/maintainer
new file mode 120000
index 000000000..0c538aadb
--- /dev/null
+++ b/data/golang/_metadata/maintainer
@@ -0,0 +1 @@
+../../../people/mac \ No newline at end of file
diff --git a/data/golang/_metadata/name b/data/golang/_metadata/name
new file mode 100644
index 000000000..8b1a7da4c
--- /dev/null
+++ b/data/golang/_metadata/name
@@ -0,0 +1 @@
+Go
diff --git a/data/golang/_metadata/priority b/data/golang/_metadata/priority
new file mode 100644
index 000000000..134d9bc32
--- /dev/null
+++ b/data/golang/_metadata/priority
@@ -0,0 +1 @@
+optional
diff --git a/data/golang/_metadata/role b/data/golang/_metadata/role
new file mode 100644
index 000000000..52b4d7301
--- /dev/null
+++ b/data/golang/_metadata/role
@@ -0,0 +1 @@
+hacker
diff --git a/data/golang/_metadata/section b/data/golang/_metadata/section
new file mode 100644
index 000000000..ddc7f1fd8
--- /dev/null
+++ b/data/golang/_metadata/section
@@ -0,0 +1 @@
+Scripting
diff --git a/data/golang/_metadata/tags b/data/golang/_metadata/tags
new file mode 100644
index 000000000..ad5d50831
--- /dev/null
+++ b/data/golang/_metadata/tags
@@ -0,0 +1 @@
+purpose::console
diff --git a/data/golang/_metadata/version b/data/golang/_metadata/version
new file mode 100644
index 000000000..6b37cb71c
--- /dev/null
+++ b/data/golang/_metadata/version
@@ -0,0 +1 @@
+1.11.6
diff --git a/data/golang/bootstrap.sh b/data/golang/bootstrap.sh
new file mode 100755
index 000000000..3cf75814d
--- /dev/null
+++ b/data/golang/bootstrap.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Bootstraps go to compile go.
+set -e
+
+darwin='https://storage.googleapis.com/golang/go1.11.10.darwin-amd64.tar.gz'
+linux='https://storage.googleapis.com/golang/go1.11.10.linux-amd64.tar.gz'
+url=''
+
+case "$(uname)" in
+ Linux)
+ url=${linux}
+ ;;
+ Darwin)
+ url=${darwin}
+ ;;
+ *)
+ echo "$0 - Unknown system."
+ exit 1
+ ;;
+esac
+
+cd $(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
+wget ${url} >/dev/null
+tar xvf ${url##*/} >/dev/null
+echo $PWD/go/
diff --git a/data/golang/defaultcc.diff b/data/golang/defaultcc.diff
new file mode 100644
index 000000000..13dd53389
--- /dev/null
+++ b/data/golang/defaultcc.diff
@@ -0,0 +1,12 @@
+diff -ur go/src/cmd/dist/buildgo.go go+iPhone/src/cmd/dist/buildgo.go
+--- go/src/cmd/dist/buildgo.go 2019-04-11 23:35:26.000000000 +0000
++++ go+iPhone/src/cmd/dist/buildgo.go 2019-05-09 16:49:19.806434227 +0000
+@@ -67,7 +67,7 @@
+ fmt.Fprintf(&buf, "\tcase %q:\n\t\treturn %q\n", k, defaultcc[k])
+ }
+ fmt.Fprintf(&buf, "\t}\n")
+- fmt.Fprintf(&buf, "\treturn %q\n", defaultcc[""])
++ fmt.Fprintf(&buf, "\treturn %q\n", "clang")
+ fmt.Fprintf(&buf, "}\n")
+
+ return buf.String()
diff --git a/data/golang/gcc_darwin_arm64.diff b/data/golang/gcc_darwin_arm64.diff
new file mode 100644
index 000000000..efd8e7391
--- /dev/null
+++ b/data/golang/gcc_darwin_arm64.diff
@@ -0,0 +1,67 @@
+--- A/src/runtime/cgo/gcc_darwin_arm64.c 2018-11-02 21:23:31.000000000 +0000
++++ B/src/runtime/cgo/gcc_darwin_arm64.c 2018-12-05 00:04:32.054969341 +0000
+@@ -93,58 +93,6 @@
+ return nil;
+ }
+
+-// init_working_dir sets the current working directory to the app root.
+-// By default darwin/arm processes start in "/".
+-static void
+-init_working_dir()
+-{
+- CFBundleRef bundle = CFBundleGetMainBundle();
+- if (bundle == NULL) {
+- fprintf(stderr, "runtime/cgo: no main bundle\n");
+- return;
+- }
+- CFURLRef url_ref = CFBundleCopyResourceURL(bundle, CFSTR("Info"), CFSTR("plist"), NULL);
+- if (url_ref == NULL) {
+- fprintf(stderr, "runtime/cgo: no Info.plist URL\n");
+- return;
+- }
+- CFStringRef url_str_ref = CFURLGetString(url_ref);
+- char buf[MAXPATHLEN];
+- Boolean res = CFStringGetCString(url_str_ref, buf, sizeof(buf), kCFStringEncodingUTF8);
+- CFRelease(url_ref);
+- if (!res) {
+- fprintf(stderr, "runtime/cgo: cannot get URL string\n");
+- return;
+- }
+-
+- // url is of the form "file:///path/to/Info.plist".
+- // strip it down to the working directory "/path/to".
+- int url_len = strlen(buf);
+- if (url_len < sizeof("file://")+sizeof("/Info.plist")) {
+- fprintf(stderr, "runtime/cgo: bad URL: %s\n", buf);
+- return;
+- }
+- buf[url_len-sizeof("/Info.plist")+1] = 0;
+- char *dir = &buf[0] + sizeof("file://")-1;
+-
+- if (chdir(dir) != 0) {
+- fprintf(stderr, "runtime/cgo: chdir(%s) failed\n", dir);
+- }
+-
+- // The test harness in go_darwin_arm_exec passes the relative working directory
+- // in the GoExecWrapperWorkingDirectory property of the app bundle.
+- CFStringRef wd_ref = CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("GoExecWrapperWorkingDirectory"));
+- if (wd_ref != NULL) {
+- if (!CFStringGetCString(wd_ref, buf, sizeof(buf), kCFStringEncodingUTF8)) {
+- fprintf(stderr, "runtime/cgo: cannot get GoExecWrapperWorkingDirectory string\n");
+- return;
+- }
+- if (chdir(buf) != 0) {
+- fprintf(stderr, "runtime/cgo: chdir(%s) failed\n", buf);
+- }
+- }
+-}
+-
+ void
+ x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase)
+ {
+@@ -164,5 +112,4 @@
+ darwin_arm_init_mach_exception_handler();
+ darwin_arm_init_thread_exception_port();
+
+- init_working_dir();
+ }
diff --git a/data/golang/go.sh.in b/data/golang/go.sh.in
new file mode 100755
index 000000000..ca1882072
--- /dev/null
+++ b/data/golang/go.sh.in
@@ -0,0 +1,2 @@
+# Report any issues to the maintainer of this package.
+export PATH="${HOME}/go/bin:@PREFIX@/bin:${PATH}"
diff --git a/data/golang/golang-1.11_1.11.6.orig.tar.gz b/data/golang/golang-1.11_1.11.6.orig.tar.gz
new file mode 100644
index 000000000..e6b955962
--- /dev/null
+++ b/data/golang/golang-1.11_1.11.6.orig.tar.gz
Binary files differ
diff --git a/data/golang/ldid.diff b/data/golang/ldid.diff
new file mode 100644
index 000000000..96a0a80b0
--- /dev/null
+++ b/data/golang/ldid.diff
@@ -0,0 +1,47 @@
+diff -ur go/src/cmd/go/internal/work/buildid.go go+iPhone/src/cmd/go/internal/work/buildid.go
+--- go/src/cmd/go/internal/work/buildid.go 2019-03-14 19:59:48.000000000 +0000
++++ go+iPhone/src/cmd/go/internal/work/buildid.go 2019-05-10 06:06:28.663451891 +0000
+@@ -660,6 +660,15 @@
+ if err := w.Close(); err != nil {
+ return err
+ }
++
++ // MCApollo: Rehash/sign binary (again) because it has changed.
++ // Hacky workaround for iOS codesigning.
++ if strings.Contains(target, "a.out") {
++ cmd := exec.Command("ldid", "-S/usr/share/entitlements/global.xml", target)
++ if err := cmd.Run(); err != nil {
++ fmt.Errorf("Failed to rehash binary with ldid.")
++ }
++ }
+ }
+
+ // Cache package builds, but not binaries (link steps).
+diff -ur go/src/cmd/link/internal/ld/main.go go+iPhone/src/cmd/link/internal/ld/main.go
+--- go/src/cmd/link/internal/ld/main.go 2019-03-14 19:59:48.000000000 +0000
++++ go+iPhone/src/cmd/link/internal/ld/main.go 2019-05-10 06:01:34.695262524 +0000
+@@ -38,6 +38,7 @@
+ "flag"
+ "log"
+ "os"
++ "os/exec"
+ "runtime"
+ "runtime/pprof"
+ "strings"
+@@ -246,6 +247,16 @@
+
+ ctxt.Bso.Flush()
+
++ // MCApollo: A dirty hack for native compiling
++ if nerrors == 0 && ctxt.HeadType == objabi.Hdarwin {
++ Outfile := *flagOutfile
++ // Maybe I should provide the file instead of hoping it's there?
++ cmd := exec.Command("ldid", "-S/usr/share/entitlements/global.xml", Outfile)
++ if err := cmd.Run(); err != nil && ctxt.Debugvlog != 0 {
++ ctxt.Logf("Failed to sign with ldid!\n")
++ }
++ }
++
+ errorexit()
+ }
+
diff --git a/data/golang/make.sh b/data/golang/make.sh
new file mode 100644
index 000000000..dd0fa5ded
--- /dev/null
+++ b/data/golang/make.sh
@@ -0,0 +1,58 @@
+pkg:setup
+
+if [[ -z "$(which go)" ]]; then
+ echo "************************" 1>&2
+ echo "Downloading a bootstrap." 1>&2
+ echo "************************" 1>&2
+ export GOROOT_BOOTSTRAP="$(${PKG_DATA}/bootstrap.sh)"
+ export PATH="${GOROOT_BOOTSTRAP}/bin:${PATH}"
+fi
+
+export GOARCH=arm64
+export GOOS=darwin
+export GOROOT_FINAL="${PKG_TAPF}/lib/go"
+export CGO_ENABLED=1
+export CC_FOR_TARGET="${PKG_TARG}-gcc"
+export CXX_FOR_TARGET="${PKG_TARG}-g++"
+
+pushd src
+./make.bash --no-clean
+popd
+
+for file in \
+ pkg/obj \
+ pkg/bootstrap \
+ bin/go \
+ bin/gofmt \
+ favicon.ico \
+ AUTHORS \
+ CONTRIBUTING.md \
+ CONTRIBUTORS \
+ README.md \
+ robots.txt \
+ misc/android \
+ misc/arm \
+ misc/git \
+ misc/ios \
+ misc/trace \
+ misc/swig \
+ pkg/tool/linux_amd64 \
+ pkg/tool/darwin_amd64 \
+ pkg/linux_amd64 \
+ pkg/darwin_amd64
+do
+ rm -rf ${file} || :
+done
+ln -rsf bin/*/go* bin/
+
+
+pkg: mkdir -p "${GOROOT_FINAL}"
+pkg: mkdir -p /etc/profile.d
+pkg: mkdir -p "${PKG_TAPF}"/bin
+
+cp -r * "${PKG_DEST}"/"${GOROOT_FINAL}"
+cp "${PKG_DATA}"/go.sh.in "${PKG_DEST}"/etc/profile.d/go.sh
+pkg: sed -i "s|@PREFIX@|${GOROOT_FINAL}|" /etc/profile.d/go.sh
+pkg: ln -rsf "${GOROOT_FINAL}"/bin/go "${PKG_TAPF}"/bin/
+pkg: ln -rsf "${GOROOT_FINAL}"/bin/gofmt "${PKG_TAPF}"/bin/
+
diff --git a/data/golang/validLinkerFlags.diff b/data/golang/validLinkerFlags.diff
new file mode 100644
index 000000000..c09dab02a
--- /dev/null
+++ b/data/golang/validLinkerFlags.diff
@@ -0,0 +1,19 @@
+--- A/src/cmd/go/internal/work/security.go 2018-11-02 21:23:31.000000000 +0000
++++ B/src/cmd/go/internal/work/security.go 2018-12-05 03:19:39.493257546 +0000
+@@ -41,6 +41,7 @@
+
+ var validCompilerFlags = []*regexp.Regexp{
+ re(`-D([A-Za-z_].*)`),
++ re(`-L([^@\-].*)`),
+ re(`-F([^@\-].*)`),
+ re(`-I([^@\-].*)`),
+ re(`-O`),
+@@ -128,6 +129,8 @@
+ }
+
+ var validLinkerFlags = []*regexp.Regexp{
++ re(`-I([^@\-].*)`),
++ re(`--sysroot=([^@\-].*)`),
+ re(`-F([^@\-].*)`),
+ re(`-l([^@\-].*)`),
+ re(`-L([^@\-].*)`),