| 1 |
#!/bin/sh |
| 2 |
if [ -f gcc111libbid.a ]; then exit 0; fi |
| 3 |
|
| 4 |
if [ -z $MK ]; then |
| 5 |
which gmake >/dev/null |
| 6 |
if [ $? -eq 0 ]; then |
| 7 |
MK=gmake |
| 8 |
else |
| 9 |
MK=make |
| 10 |
fi |
| 11 |
fi |
| 12 |
|
| 13 |
which gcc >/dev/null |
| 14 |
if [ $? -eq 0 ]; then |
| 15 |
CC=gcc |
| 16 |
else |
| 17 |
CC=cc |
| 18 |
fi |
| 19 |
|
| 20 |
# Hack to support FreeBSD; not 100% sure what this does, but it produces a |
| 21 |
# library that passes all tests. |
| 22 |
|
| 23 |
if [ `uname -s` = "FreeBSD" ]; then |
| 24 |
OS_ARG="CFLAGS_OPT=-DLINUX" |
| 25 |
else |
| 26 |
OS_ARG= |
| 27 |
fi |
| 28 |
|
| 29 |
# When building for big-endian targets, add "BID_BIG_ENDIAN=true" to the "make" |
| 30 |
# command line. The library will work even if you don't, but the state files |
| 31 |
# written by Free42 will only be compatible with those written on little-endian |
| 32 |
# platforms if you do. |
| 33 |
# Note that at the time of writing, I haven't created any successful big-endian |
| 34 |
# builds yet. I have tried on Fedora 12 on Qemu emulating 32-bit PowerPC, and |
| 35 |
# while the build succeeds and arithmetic and SQRT work, it crashes in the |
| 36 |
# transcendentals. |
| 37 |
|
| 38 |
if [ `echo ab | od -x | awk '{print $2}'` = "6162" ]; then |
| 39 |
ENDIAN_ARG="BID_BIG_ENDIAN=true" |
| 40 |
else |
| 41 |
ENDIAN_ARG= |
| 42 |
fi |
| 43 |
|
| 44 |
tar xvfz ../inteldecimal/IntelRDFPMathLib20U1.tar.gz |
| 45 |
cd IntelRDFPMathLib20U1 |
| 46 |
patch -p0 <../intel-lib-linux.patch |
| 47 |
|
| 48 |
# When building for architectures other than x86 or x86_64, I remove the |
| 49 |
# section titled "Determine host architecture" in |
| 50 |
# IntelRDFPMathLib20U1/LIBRARY/makefile.iml_head, and replace it with a simple |
| 51 |
# "_HOST_ARCH := x86" or "_HOST_ARCH := x86_64", depending on whether I'm |
| 52 |
# building for a 32-bit or 64-bit platform, respectively. The actual CPU you |
| 53 |
# specify seems to matter less than its word size. Thus, setting _HOST_ARCH |
| 54 |
# to x86 works when targeting armv7 and ppc, both 32-bit platforms, and setting |
| 55 |
# it to x86_64 works when targeting arm64, a 64-bit platform. |
| 56 |
# Of course, proceed with caution. Your mileage may vary. |
| 57 |
|
| 58 |
case `uname -m` in |
| 59 |
armv7|armv7l|i386|ppc) |
| 60 |
patch -p0 <../intel-lib-unknown-32bit.patch |
| 61 |
;; |
| 62 |
aarch64|arm64|i86pc) |
| 63 |
patch -p0 <../intel-lib-unknown-64bit.patch |
| 64 |
;; |
| 65 |
esac |
| 66 |
|
| 67 |
cd LIBRARY |
| 68 |
$MK $OS_ARG CC=$CC CALL_BY_REF=1 GLOBAL_RND=1 GLOBAL_FLAGS=1 UNCHANGED_BINARY_FLAGS=0 $ENDIAN_ARG |
| 69 |
mv libbid.a ../../gcc111libbid.a |
| 70 |
cd ../.. |
| 71 |
( echo '#ifdef FREE42_FPTEST'; echo 'const char *readtest_lines[] = {'; tr -d '\r' < IntelRDFPMathLib20U1/TESTS/readtest.in | sed 's/^\(.*\)$/"\1",/'; echo '0 };'; echo '#endif' ) > readtest_lines.cc |