|
| 1 | +#/bin/sh -e |
| 2 | +# |
| 3 | +# (C) 2014 Kai Pastor |
| 4 | +# |
| 5 | +# This file is part of OpenOrienteering. |
| 6 | +# |
| 7 | +# OpenOrienteering is free software: you can redistribute it and/or modify |
| 8 | +# it under the terms of the GNU General Public License as published by |
| 9 | +# the Free Software Foundation, either version 3 of the License, or |
| 10 | +# (at your option) any later version. |
| 11 | +# |
| 12 | +# OpenOrienteering is distributed in the hope that it will be useful, |
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +# GNU General Public License for more details. |
| 16 | +# |
| 17 | +# You should have received a copy of the GNU General Public License |
| 18 | +# along with OpenOrienteering. If not, see <http://www.gnu.org/licenses/>. |
| 19 | + |
| 20 | +LANG=C |
| 21 | +MXE_TARGET="i686-w64-mingw32.shared x86_64-w64-mingw32.shared" |
| 22 | +MXE_DIR=gcc-mxe-$(date +%Y%m%d) |
| 23 | +PKG_LIST="binutils cloog gcc gcc-cloog gcc-isl gcc-gmp gcc-mpc gcc-mpfr gmp isl mingw-w64 mpc mpfr pkgconf" |
| 24 | +PKG_LIST="$PKG_LIST gdb expat libiconv pdcurses readline zlib" |
| 25 | + |
| 26 | +git clone -b master https://github.com/mxe/mxe.git $MXE_DIR |
| 27 | + |
| 28 | +( cd $MXE_DIR ; git show-branch --list --reflog=1 ) > $MXE_DIR/GIT_SHOW_BRANCH |
| 29 | + |
| 30 | +for I in $MXE_DIR/.git* $MXE_DIR/assets $MXE_DIR/doc $MXE_DIR/tools/* src/cmake |
| 31 | +do |
| 32 | + echo $I |
| 33 | + case "$I" in |
| 34 | + */tools/compat-init.sh) |
| 35 | + ;; # keep it |
| 36 | + */tools/make-shared-from-static) |
| 37 | + ;; # keep it |
| 38 | + */tools/update-*) |
| 39 | + ;; # keep it |
| 40 | + *) |
| 41 | + rm -Rf "$I" |
| 42 | + ;; |
| 43 | + esac |
| 44 | +done |
| 45 | + |
| 46 | +for I in $(sed -n 's/^.* class="package">\([^<]*\)<.*$/\1/p' "$MXE_DIR/index.html") |
| 47 | +do |
| 48 | + echo " $PKG_LIST " | grep " $I " > /dev/null && I= |
| 49 | + if [ -n "$I" ] |
| 50 | + then |
| 51 | + rm $MXE_DIR/src/$I.mk $MXE_DIR/src/$I-* 2>/dev/null || true |
| 52 | + sed -i -e '/<tr>/N;/^.* class="package">'"$I"'</{N;N;d}' "$MXE_DIR/index.html" |
| 53 | + fi |
| 54 | +done |
| 55 | + |
| 56 | +sed -i -e '/enable-languages/{s/,objc//;s/,fortran//};/addprefix/s/ gfortran//' $MXE_DIR/src/gcc.mk |
| 57 | + |
| 58 | +sed -i -e "1ifirst: gcc" $MXE_DIR/Makefile |
| 59 | +sed -i -e "s/git show-branch --list --reflog=1/echo '$MXE_DIR'/" $MXE_DIR/Makefile |
| 60 | + |
| 61 | +cat > $MXE_DIR/settings.mk << END_SETTINGS |
| 62 | +MXE_TARGETS := $MXE_TARGET |
| 63 | +#JOBS := 6 |
| 64 | +
|
| 65 | +END_SETTINGS |
| 66 | + |
| 67 | +mkdir $MXE_DIR/OpenOrienteering |
| 68 | +cp "$0" $MXE_DIR/OpenOrienteering/ |
| 69 | +cat > $MXE_DIR/README << END_README |
| 70 | +$(LANG=C date) OpenOrienteering |
| 71 | +
|
| 72 | +This is a clone of MXE.cc modified to fulfil the sole purpose of a controlled |
| 73 | +build of a $(echo ${MXE_TARGET} | sed -e 's/ /\//') C/C++ toolchain. |
| 74 | +See OpenOrienteering/make-source.sh for the modifications. |
| 75 | +
|
| 76 | +To build gcc and its dependencies, run |
| 77 | +
|
| 78 | + make gcc |
| 79 | +
|
| 80 | +This will use existing sources which came with this package. |
| 81 | +
|
| 82 | +To build gdb, run |
| 83 | +
|
| 84 | + make gdb |
| 85 | +
|
| 86 | +The sources of gdb and of its dependencies will be downloaded on first build. |
| 87 | +
|
| 88 | +END_README |
| 89 | + |
| 90 | +make -C $MXE_DIR download-gcc |
| 91 | + |
| 92 | +fakeroot tar cvzf $MXE_DIR-src.tar.gz $MXE_DIR |
| 93 | + |
0 commit comments