#! /bin/sh # This script has been known to work with iForth 6.9.35, Linux Mint 19.3, # and gcc 7.4.0. --dnw 03-Feb-2021 # Compile, link, and install for linux the dynamic library # libmpfr_iforth.so from the source file in the current directory, # libmpfr-iforth.c: ### PATHS SOURCE=libmpfr-iforth.c LIBNAME=libmpfr_iforth CC=gcc # CC=/usr/local/bin/gcc INSTALL=install # INSTALL=/usr/bin/install PREFIX=/usr/local # PREFIX=$HOME # These directories must already exist. INCLUDEDIR=$PREFIX/include LIBDIR=$PREFIX/lib ### COMPILE $CC -I. -I$INCLUDEDIR -I. \ -O2 -fomit-frame-pointer -frounding-math -fno-common -m64 \ -Wall -pipe -funsigned-char -Wno-char-subscripts -Wwrite-strings \ -c $SOURCE -fPIC -DPIC -o $LIBNAME.o ### LINK $CC -shared $LIBNAME.o -m64 -ldl -lm -L$LIBDIR -lgmp -lmpfr \ -Wl,-soname -Wl,$LIBNAME.so -o $LIBNAME.so ### INSTALL # cp -p $LIBNAME.so $LIBDIR $INSTALL -p $LIBNAME.so $LIBDIR