Limit profiles used by the pcc harbour
[harbours.git] / pcc / HARBOUR
blob176e8ed82b0033205ea7d7ce54ebb7f57c774857
2 # Copyright (c) 2014 Jakub Jermar
3 # Copyright (c) 2017 Vojtech Horky
4 # All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
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.
30 shipname=pcc
31 shipversion=1.0.0
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"
35 shiptugs=""
36 shipfunnels=1
38 build() {
39         run tar xzf ${shipname}-${shipversion}.tgz
40         
41         msg "Patching sources..."
42         patch -p0 <pcc-helenos.patch
43         
44         msg "Providing HelenOS configuration..."
45         run mkdir ${shipname}-${shipversion}/os/helenos
46         run cp ccconfig.h ${shipname}-${shipversion}/os/helenos
47                 
48         cd ${shipname}-${shipversion}
49         
50         msg "Configuring..."
51         cp $HSCT_CONFIG_SUB .
53         # FIXME: We pretend we are targeting Linux. PCC should be patched
54         # so that we don't need that.
56         run ./configure \
57                 $HSCT_CONFIGURE_ARGS \
58                 --target="$HSCT_CCROSS_TARGET" \
59                 --program-prefix="" \
60                 --bindir=/app \
61                 --libexecdir=/app \
62                 --with-incdir=/inc/c \
63                 --with-libdir=/lib/ \
64                 --with-assembler=/app/as \
65                 --with-linker=/app/ld \
66                 || return 1
67         
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
70         
71         msg "Fixing in-build CC invocation..."
72         run sed '/CC_FOR_BUILD/s/[$](CFLAGS)//g' -i cc/ccom/Makefile
74         msg "Building..."
75         make -j$shipfunnels
78 package() {
79         cd "${shipname}-${shipversion}"
80         
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
86         done