Fix lua build
[harbours.git] / pcc / HARBOUR
blob9759135afb8d543b105354333c0f660125c0a4a6
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 shiptugs=""
35 shipfunnels=1
37 build() {
38         run tar xzf ${shipname}-${shipversion}.tgz
39         
40         msg "Patching sources..."
41         patch -p0 <pcc-helenos.patch
42         
43         msg "Providing HelenOS configuration..."
44         run mkdir ${shipname}-${shipversion}/os/helenos
45         run cp ccconfig.h ${shipname}-${shipversion}/os/helenos
46                 
47         cd ${shipname}-${shipversion}
48         
49         msg "Configuring..."
50         cp $HSCT_CONFIG_SUB .
52         # FIXME: We pretend we are targeting Linux. PCC should be patched
53         # so that we don't need that.
55         run ./configure \
56                 $HSCT_CONFIGURE_ARGS \
57                 --target="$HSCT_CCROSS_TARGET" \
58                 --program-prefix="" \
59                 --bindir=/app \
60                 --libexecdir=/app \
61                 --with-incdir=/inc/c \
62                 --with-libdir=/lib/ \
63                 --with-assembler=/app/as \
64                 --with-linker=/app/ld \
65                 || return 1
66         
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
69         
70         msg "Fixing in-build CC invocation..."
71         run sed '/CC_FOR_BUILD/s/[$](CFLAGS)//g' -i cc/ccom/Makefile
73         msg "Building..."
74         make -j$shipfunnels
77 package() {
78         cd "${shipname}-${shipversion}"
79         
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
85         done