2 # Copyright (c) 2014 Jakub Jermar
3 # Copyright (c) 2017 Vojtech Horky
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
10 # - Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # - Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 # - The name of the author may not be used to endorse or promote products
16 # derived from this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 mirror_="ftp://pcc.ludd.ltu.se/pub/pcc-releases"
33 shipsources="$mirror_/$shipname-$shipversion.tgz pcc-helenos.patch ccconfig.h"
34 shipprofiles="amd64 ia32 mips32/malta-be mips32/malta-le mips32/msim ppc32"
39 run tar xzf ${shipname}-${shipversion}.tgz
41 msg "Patching sources..."
42 patch -p0 <pcc-helenos.patch
44 msg "Providing HelenOS configuration..."
45 run mkdir ${shipname}-${shipversion}/os/helenos
46 run cp ccconfig.h ${shipname}-${shipversion}/os/helenos
48 cd ${shipname}-${shipversion}
53 # FIXME: We pretend we are targeting Linux. PCC should be patched
54 # so that we don't need that.
57 $HSCT_CONFIGURE_ARGS \
58 --target="$HSCT_CCROSS_TARGET" \
62 --with-incdir=/inc/c \
64 --with-assembler=/app/as \
65 --with-linker=/app/ld \
68 msg "Setting PCC version manually..."
69 run sed "s:#define VERSSTR.*:#define VERSSTR \"$shipname $shipversion for HelenOS, built at \" __DATE__ \", \" __TIME__:" -i config.h
71 msg "Fixing in-build CC invocation..."
72 run sed '/CC_FOR_BUILD/s/[$](CFLAGS)//g' -i cc/ccom/Makefile
79 cd "${shipname}-${shipversion}"
81 run make install "DESTDIR=$PWD/PKG"
83 mkdir -p "$HSCT_MY_DIR/app"
84 for app in pcc cpp ccom; do
85 run cp "PKG/app/$HSCT_CCROSS_TARGET-$app" "$HSCT_MY_DIR/app/$app" || return 1