| 1 |
#! /bin/sh |
| 2 |
set -e -f -u |
| 3 |
|
| 4 |
# (automatic update) |
| 5 |
VERSION=8.14.18 |
| 6 |
VDATE=2026-01-28 |
| 7 |
|
| 8 |
# Variables may be set, by order of precedence: |
| 9 |
# * in the environment, |
| 10 |
# * in ./custom if it exists, |
| 11 |
# * or on the command line. |
| 12 |
|
| 13 |
if test -f ./custom; then |
| 14 |
. ./custom |
| 15 |
fi |
| 16 |
|
| 17 |
for c in "$@"; do |
| 18 |
case "$c" in |
| 19 |
--*=*) |
| 20 |
c="${c#--}" |
| 21 |
eval "${c%%=*}='${c#*=}'" |
| 22 |
;; |
| 23 |
*) |
| 24 |
echo "$0: unknown argument: $c" |
| 25 |
;; |
| 26 |
esac |
| 27 |
done |
| 28 |
|
| 29 |
# Most variables are just passed to sed, but the following ones are |
| 30 |
# also expanded by the shell and need a default value. |
| 31 |
: "${PKG_CONFIG=${host+$host-}pkg-config}" |
| 32 |
: "${prefix=/usr/local}" |
| 33 |
: "${srcdir=$(realpath --relative-to=. $(dirname $0))}" |
| 34 |
|
| 35 |
case "$srcdir" in |
| 36 |
*\ *) |
| 37 |
echo "srcpath cannot contain spaces" |
| 38 |
exit 1 |
| 39 |
esac |
| 40 |
|
| 41 |
if ! $PKG_CONFIG --exists freetype2 ; then |
| 42 |
echo "pkg-config/freetype2 not found - no pango support" |
| 43 |
elif ! $PKG_CONFIG --exists pangocairo ; then |
| 44 |
echo "pangocairo not found - no pango support" |
| 45 |
else |
| 46 |
pango_cflags="-DHAVE_PANGO=1 `$PKG_CONFIG pango cairo freetype2 --cflags`" |
| 47 |
pango_libs="`$PKG_CONFIG pangocairo pangoft2 freetype2 --libs`" |
| 48 |
fi |
| 49 |
|
| 50 |
sed " |
| 51 |
s+@CC@+${CC-${host+$host-}gcc}+ |
| 52 |
# -I.: ./config.h will not be found in srcdir. |
| 53 |
s+@CPPFLAGS@+${CPPFLAGS-} ${pango_cflags-} -I.+ |
| 54 |
s+@CFLAGS@+-g -O2 -Wall -pipe ${CFLAGS-}+ |
| 55 |
s+@LDFLAGS@+${LDFLAGS-}+ |
| 56 |
# -lm: useful on some architectures. |
| 57 |
s+@LDLIBS@+${pango_libs-} ${LDLIBS-} -lm+ |
| 58 |
s+@INSTALL@+${INSTALL-/usr/bin/install -c}+ |
| 59 |
s+@INSTALL_DATA@+${INSTALL_DATA-\$(INSTALL) -m 644}+ |
| 60 |
s+@INSTALL_PROGRAM@+${INSTALL_PROGRAM-\$(INSTALL)}+ |
| 61 |
s+@prefix@+$prefix+ |
| 62 |
s+@exec_prefix@+${exec_prefix-\$(prefix)}+ |
| 63 |
s+@srcdir@+$srcdir+ |
| 64 |
s+@bindir@+${bindir-\$(exec_prefix)/bin}+ |
| 65 |
s+@datarootdir@+${datarootdir-\$(prefix)/share}+ |
| 66 |
s+@mandir@+${mandir-\$(prefix)/share/man}+ |
| 67 |
s+@docdir@+${docdir-\$(prefix)/share/doc}+ |
| 68 |
" "$srcdir/Makefile.in" > Makefile |
| 69 |
echo "Makefile created" |
| 70 |
|
| 71 |
sed " |
| 72 |
s/@VERSION@/$VERSION/ |
| 73 |
s/@VDATE@/$VDATE/ |
| 74 |
s+@DEFAULT_FDIR@+${DEFAULT_FDIR-$prefix/share/abcm2ps}+ |
| 75 |
" "$srcdir/config.h.in" > config.h |
| 76 |
echo "config.h created" |