Use named variable instead of $2
[harbours.git] / libmpc / HARBOUR
blobdcface30e31a2a6e000992a88799dc54213887f3
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.
29 shipname=libmpc
30 shipname_=mpc
31 shipversion=1.0.1
32 shipsources="http://www.multiprecision.org/${shipname_}/download/${shipname_}-${shipversion}.tar.gz"
33 shiptugs="libgmp libmpfr"
34 shipfunnels=4
36 build() {
37         run tar xzf ${shipname_}-${shipversion}.tar.gz
38         cd ${shipname_}-${shipversion}
39         
40         # We shall define this macro somewhere, this is not the first
41         # harbour we are defining this macro in
42         extra_cflags="-DCHAR_BIT=8"
43         
44         # Use the not-that-precise constants from float.h
45         extra_cflags="$extra_cflags -DFLOAT_H_YES_I_REALLY_WANT_LIMITS"
46         
47         # Where libgmp and libmpfr is supposed to be residing
48         extra_cflags="$extra_cflags -I$HSCT_INCLUDE_DIR -L$HSCT_LIB_DIR"
49         
50         run ./configure \
51                 --disable-shared \
52                 --host="$HSCT_GNU_TARGET" \
53                 CC="$HSCT_CC" \
54                 CFLAGS="$HSCT_CFLAGS $HSCT_LDFLAGS_FOR_CC $extra_cflags" \
55                 LD="$HSCT_LD" \
56                 || return 1
57         
58         msg "Building the library..."
59         run make -j$shipfunnels
60         
61         msg "Building the tests..."
62         run make check || true
63         
64         (
65                 cd tests
66                 find tabs tacos tacosh tadd tadd_fr tadd_si tadd_ui targ tasin    \
67                         tasinh tatan tatanh tconj tcos tcosh tdiv tdiv_2si tdiv_2ui tdiv_fr tdiv_ui   \
68                         texp tfma tfr_div tfr_sub timag tio_str tlog tlog10                           \
69                         tmul tmul_2si tmul_2ui tmul_fr tmul_i tmul_si tmul_ui                         \
70                         tneg tnorm tpow tpow_ld tpow_d tpow_fr tpow_si tpow_ui tpow_z                 \
71                         tprec tproj treal treimref tset tsin tsin_cos tsinh tsqr tsqrt tstrtoc tsub   \
72                         tsub_fr tsub_ui tswap ttan ttanh tui_div tui_ui_sub tget_version
73                 exit $?
74         )
77 package() {
78         cd ${shipname_}-${shipversion}
79         
80         msg "Pretending standard Unix installation..."
81         run make install DESTDIR=$PWD/PKG
82         
83         # Copy the headers and static library
84         msg "Copying relevant files to the coast..."
85         run cp PKG/usr/local/include/mpc.h "$HSCT_INCLUDE_DIR/"
86         run cp PKG/usr/local/lib/libmpc.a "$HSCT_LIB_DIR/"
87         
88         run mkdir -p "$HSCT_MY_DIR/inc/c"
89         run cp PKG/usr/local/include/mpc.h "$HSCT_MY_DIR/inc/c"
90         
91         run mkdir -p "$HSCT_MY_DIR/lib"
92         run cp PKG/usr/local/lib/libmpc.a "$HSCT_MY_DIR/lib"
93         
94         # Copy the tests
95         (
96                 msg "Preparing tests..."
97                 run mkdir -p "$HSCT_MY_DIR/tests/${shipname}/"
98                 cd tests
99                 echo "echo Running ${shipname} tests..." >"$HSCT_MY_DIR/tests/run_${shipname}.bdsh"
100                 find . -executable -type f | while read testname; do
101                         run cp "$testname" "$HSCT_MY_DIR/tests/${shipname}/$testname" || exit 1
102                         echo "/tests/${shipname}/$testname" | sed 's#\./##' >>"$HSCT_MY_DIR/tests/run_${shipname}.bdsh"
103                 done || exit 1
104         )