2 # Copyright (c) 2013 Vojtech Horky
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
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.
32 shipsources="http://www.multiprecision.org/${shipname_}/download/${shipname_}-${shipversion}.tar.gz"
33 shiptugs="libgmp libmpfr"
37 run tar xzf ${shipname_}-${shipversion}.tar.gz
38 cd ${shipname_}-${shipversion}
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"
44 # Use the not-that-precise constants from float.h
45 extra_cflags="$extra_cflags -DFLOAT_H_YES_I_REALLY_WANT_LIMITS"
47 # Where libgmp and libmpfr is supposed to be residing
48 extra_cflags="$extra_cflags -I$HSCT_INCLUDE_DIR -L$HSCT_LIB_DIR"
52 --host="$HSCT_GNU_TARGET" \
54 CFLAGS="$HSCT_CFLAGS $HSCT_LDFLAGS_FOR_CC $extra_cflags" \
58 msg "Building the library..."
59 run make -j$shipfunnels
61 msg "Building the tests..."
62 run make check || true
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
78 cd ${shipname_}-${shipversion}
80 msg "Pretending standard Unix installation..."
81 run make install DESTDIR=$PWD/PKG
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/"
88 run mkdir -p "$HSCT_MY_DIR/inc/c"
89 run cp PKG/usr/local/include/mpc.h "$HSCT_MY_DIR/inc/c"
91 run mkdir -p "$HSCT_MY_DIR/lib"
92 run cp PKG/usr/local/lib/libmpc.a "$HSCT_MY_DIR/lib"
96 msg "Preparing tests..."
97 run mkdir -p "$HSCT_MY_DIR/tests/${shipname}/"
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"