Download binutils from automatic mirror url.
[harbours.git] / binutils / HARBOUR
blobf290ae573c5ca4a7f524d3fac0a62c992d0f3efd
2 # Copyright (c) 2013 Vojtech Horky
3 # All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
9 # - Redistributions of source code must retain the above copyright
10 #   notice, this list of conditions and the following disclaimer.
11 # - Redistributions in binary form must reproduce the above copyright
12 #   notice, this list of conditions and the following disclaimer in the
13 #   documentation and/or other materials provided with the distribution.
14 # - The name of the author may not be used to endorse or promote products
15 #   derived from this software without specific prior written permission.
17 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 # This harbour is based on scripts and patches from HelenOS
31 # source tree. Thanks to Petr Koupy for creating the original
32 # binutils port and for figuring most of the difficult stuff out.
35 shipname=binutils
36 shipversion=2.21.1
37 mirror_="http://ftpmirror.gnu.org/binutils/"
38 shipsources="$mirror_/$shipname-$shipversion.tar.bz2 pex-helenos.c"
39 shiptugs=""
40 shipfunnels=4
43 build() {
44         run tar xjf ${shipname}-${shipversion}.tar.bz2
45         
46         msg "Weakening some symbols..."
47         # Prevent name clashes in getopt.c
48         run sed \
49                 -e '1i#pragma weak optind' \
50                 -e '1i#pragma weak optarg' \
51                 -e '1i#pragma weak opterr' \
52                 -e '1i#pragma weak optopt' \
53                 -e '1i#pragma weak getopt' \
54                 -i "${shipname}-${shipversion}/libiberty/getopt.c"
55         run sed \
56                 -e '1i#pragma weak getopt_long' \
57                 -i "${shipname}-${shipversion}/libiberty/getopt1.c"
58         run sed \
59                 -e '1i#pragma weak strncmp' \
60                 -i "${shipname}-${shipversion}/libiberty/strncmp.c"
61         run sed \
62                 -e '1i#pragma weak fnmatch' \
63                 -i "${shipname}-${shipversion}/libiberty/fnmatch.c"
64         
65         
66         # PEX implementation copied from GCC harbour
67         msg "Providing our pex implementation..."
68         run cp pex-helenos.c "${shipname}-${shipversion}/libiberty/"
69         run sed \
70                 -e 's/@pexecute@/pex-helenos/' \
71                 -e 's/pex-msdos/pex-helenos/g' \
72                 -i "${shipname}-${shipversion}/libiberty/Makefile.in"
73         
74         cd ${shipname}-${shipversion}
75         cp "$HSCT_CONFIG_SUB" .
77         run ./configure \
78                 $HSCT_CONFIGURE_ARGS \
79                 --target="$HSCT_CCROSS_TARGET" \
80                 --program-prefix="" \
81                 --disable-werror \
82                 --disable-nls \
83                 --disable-shared \
84                 --enable-static \
85                 --with-zlib=no \
86                 --with-ppl=no \
87                 --with-cloog=no \
88                 --with-gmp=no \
89                 --with-mpfr=no \
90                 --with-mpc=no
91         
92         run make all-gas all-ld -j$shipfunnels STATIC_ONLY=y
95 package() {
96         cd ${shipname}-${shipversion}
97         
98         run make install-gas install-ld "DESTDIR=$PWD/PKG"
99         
100         run mkdir -p "$HSCT_MY_DIR/app/"
101         for app in as ld; do
102                 run cp PKG/usr/local/bin/$app "$HSCT_MY_DIR/app/"
103         done