github.com/axw/llgo@v0.0.0-20160805011314-95b5fe4dca20/update_third_party.sh (about) 1 #!/bin/sh -e 2 3 scriptpath=$(readlink -f "$0") 4 llgosrcdir=$(dirname "$scriptpath") 5 cd $llgosrcdir 6 7 gofrontendrepo=https://go.googlesource.com/gofrontend 8 gofrontendrev=81eb6a3f425b2158c67ee32c0cc973a72ce9d6be 9 10 gccrepo=svn://gcc.gnu.org/svn/gcc/trunk 11 gccrev=219477 12 13 gotoolsrepo=https://go.googlesource.com/tools 14 gotoolsrev=d4e70101500b43ffe705d4c45e50dd4f1c8e3b2e 15 16 linerrepo=https://github.com/peterh/liner.git 17 linerrev=4d47685ab2fd2dbb46c66b831344d558bc4be5b9 18 19 tempdir=$(mktemp -d /tmp/update_third_party.XXXXXX) 20 gofrontenddir=$tempdir/gofrontend 21 gotoolsdir=$tempdir/go.tools 22 linerdir=third_party/liner 23 24 rm -rf third_party 25 mkdir -p third_party/gofrontend third_party/gotools 26 27 git_clone() { 28 repo=$1 29 dir=$2 30 rev=$3 31 git clone $repo $dir 32 ( 33 cd $dir 34 git checkout $rev 35 rm -fr .git 36 ) 37 } 38 39 # --------------------- gofrontend --------------------- 40 41 git_clone $gofrontendrepo $gofrontenddir $gofrontendrev 42 43 cp -r $gofrontenddir/LICENSE $gofrontenddir/libgo third_party/gofrontend 44 45 # Apply a diff that eliminates use of the unnamed struct extension beyond what 46 # -fms-extensions supports. 47 (cd third_party/gofrontend && patch -p1) < libgo-noext.diff 48 # Apply a diff that disables testing of packages known to fail. 49 (cd third_party/gofrontend && patch -p1) < libgo-check-failures.diff 50 find third_party/gofrontend -name '*.orig' -exec rm \{\} \; 51 52 # Remove GPL licensed files. 53 rm \ 54 third_party/gofrontend/libgo/testsuite/libgo.testmain/testmain.exp \ 55 third_party/gofrontend/libgo/testsuite/lib/libgo.exp \ 56 third_party/gofrontend/libgo/testsuite/config/default.exp 57 58 # --------------------- gcc --------------------- 59 60 # Some dependencies are stored in the gcc repository. 61 # TODO(pcc): Ask iant about mirroring these dependencies into gofrontend. 62 63 for f in config-ml.in depcomp install-sh ltmain.sh missing ; do 64 svn cat -r $gccrev $gccrepo/$f > third_party/gofrontend/$f 65 done 66 67 mkdir -p third_party/gofrontend/include third_party/gofrontend/libgcc 68 69 # Copy in our versions of GCC files. 70 cp include/dwarf2.h third_party/gofrontend/include/ 71 cp include/filenames.h third_party/gofrontend/include/ 72 cp include/unwind-pe.h third_party/gofrontend/libgcc/ 73 74 # Note: this expects the llgo source tree to be located at llvm/tools/llgo. 75 cp ../../cmake/config.guess third_party/gofrontend/ 76 cp autoconf/config.sub third_party/gofrontend/ 77 78 for d in libbacktrace libffi ; do 79 svn export -r $gccrev $gccrepo/$d third_party/gofrontend/$d 80 done 81 82 # Remove GPL licensed files, and files that confuse our license check. 83 rm \ 84 third_party/gofrontend/libffi/ChangeLog \ 85 third_party/gofrontend/libffi/doc/libffi.texi \ 86 third_party/gofrontend/libffi/msvcc.sh \ 87 third_party/gofrontend/libffi/testsuite/config/default.exp \ 88 third_party/gofrontend/libffi/testsuite/libffi.call/call.exp \ 89 third_party/gofrontend/libffi/testsuite/libffi.complex/complex.exp \ 90 third_party/gofrontend/libffi/testsuite/libffi.go/go.exp \ 91 third_party/gofrontend/libffi/testsuite/libffi.special/special.exp \ 92 third_party/gofrontend/libffi/testsuite/lib/libffi.exp \ 93 third_party/gofrontend/libffi/testsuite/lib/target-libpath.exp \ 94 third_party/gofrontend/libffi/testsuite/lib/wrapper.exp 95 96 # The build requires these files to exist. 97 touch \ 98 third_party/gofrontend/include/dwarf2.def \ 99 third_party/gofrontend/libffi/doc/libffi.texi 100 101 # --------------------- go.tools --------------------- 102 103 git_clone $gotoolsrepo $gotoolsdir $gotoolsrev 104 105 cp -r $gotoolsdir/LICENSE $gotoolsdir/go third_party/gotools 106 107 # Vendor the go.tools repository. 108 find third_party/gotools -name '*.go' | xargs sed -i -e \ 109 's,"golang.org/x/tools/,"llvm.org/llgo/third_party/gotools/,g' 110 111 # --------------------- peterh/liner ----------------- 112 113 git_clone $linerrepo $linerdir $linerrev 114 115 # --------------------- license check --------------------- 116 117 # We don't want any GPL licensed code without an autoconf/libtool 118 # exception, or any GPLv3 licensed code. 119 120 for i in `grep -lr 'General Public License' third_party` ; do 121 if grep -q 'configuration script generated by Autoconf, you may include it under' $i || \ 122 grep -q 'is built using GNU Libtool, you may include this file under the' $i ; then 123 : 124 else 125 echo "$i: license check failed" 126 exit 1 127 fi 128 done 129 130 if grep -qr GPLv3 third_party ; then 131 echo "`grep -lr GPLv3 third_party`: license check failed" 132 exit 1 133 fi 134 135 rm -rf $tempdir