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"
38 run tar xzf ${shipname}-${shipversion}.tgz
40 msg "Patching sources..."
41 patch -p0 <pcc-helenos.patch
43 msg "Providing HelenOS configuration..."
44 run mkdir ${shipname}-${shipversion}/os/helenos
45 run cp ccconfig.h ${shipname}-${shipversion}/os/helenos
47 cd ${shipname}-${shipversion}
52 # FIXME: We pretend we are targeting Linux. PCC should be patched
53 # so that we don't need that.
56 $HSCT_CONFIGURE_ARGS \
57 --target="$HSCT_CCROSS_TARGET" \
61 --with-incdir=/inc/c \
63 --with-assembler=/app/as \
64 --with-linker=/app/ld \
67 msg "Setting PCC version manually..."
68 run sed "s:#define VERSSTR.*:#define VERSSTR \"$shipname $shipversion for HelenOS, built at \" __DATE__ \", \" __TIME__:" -i config.h
70 msg "Fixing in-build CC invocation..."
71 run sed '/CC_FOR_BUILD/s/[$](CFLAGS)//g' -i cc/ccom/Makefile
78 cd "${shipname}-${shipversion}"
80 run make install "DESTDIR=$PWD/PKG"
82 mkdir -p "$HSCT_MY_DIR/app"
83 for app in pcc cpp ccom; do
84 run cp "PKG/app/$HSCT_CCROSS_TARGET-$app" "$HSCT_MY_DIR/app/$app" || return 1