Hash :
f798f56a
Author :
Thomas de Grivel
Date :
2021-02-22T14:11:15
remove autotools
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
#!/bin/sh
VER=0.4
o_rule() {
$CC $CPPFLAGS -M "$1"
}
lo_rule() {
o_rule "$1" | sed -e 's/[.]o:/.lo:/'
}
prog_rule() {
o_rule "$1" | sed -e 's/[.]o:/:/'
}
c2prog() {
echo "$@" | sed -e 's/[.]c$//' -e 's/[.]c / /g'
}
c2o() {
echo "$@" | sed -e 's/[.]c$/.o/' -e 's/[.]c /.o /g'
}
c2lo() {
echo "$@" | sed -e 's/[.]c$/.lo/' -e 's/[.]c /.lo /g'
}
c2la() {
echo "$@" | sed -e 's/[.]c$/.la/' -e 's/[.]c /.la /g'
}
require_pkg_config() {
if ! which pkg-config >/dev/null; then
echo "please install pkg-config" >&2
exit 1
fi
}
CONFIG_MK=config.mk
echo "$PWD/${CONFIG_MK}"
echo "# config.mk generated by configure" > ${CONFIG_MK}
if test -z "$CC"; then
if test -n $(which cc); then
CC=cc
elif test -n $(which gcc); then
CC=gcc
fi
fi
echo "CC = $CC" >> ${CONFIG_MK}
if test -z "$LIBTOOL"; then
if test -x /usr/local/bin/libtool; then
LIBTOOL=/usr/local/bin/libtool
else
LIBTOOL=libtool
fi
fi
echo "LIBTOOL = $LIBTOOL" >> ${CONFIG_MK}
if test -z "$INSTALL"; then
if test -x "$(which install)"; then
INSTALL=install
fi
fi
echo "INSTALL = $INSTALL" >> ${CONFIG_MK}
if test -z "$PREFIX"; then
if test -d /usr/local; then
PREFIX=/usr/local
elif test -d /usr; then
PREFIX=/usr
elif test -d /opt/local; then
PREFIX=/opt/local
elif test -d /opt; then
PREFIX=/opt
fi
fi
echo "PREFIX = $PREFIX" >> ${CONFIG_MK}
if test -z "$OWNER"; then
OWNER="$(stat $PREFIX | cut -d\ -f 5)"
fi
echo "OWNER = $OWNER" >> ${CONFIG_MK}
if test -z "$GROUP"; then
GROUP="$(stat $PREFIX | cut -d\ -f 6)"
fi
echo "GROUP = $GROUP" >> ${CONFIG_MK}
if test -z "$BINDIR"; then
BINDIR=${PREFIX}/bin
fi
echo "BINDIR = $BINDIR" >> ${CONFIG_MK}
if test -z "$LIBDIR"; then
LIBDIR=${PREFIX}/lib
fi
echo "LIBDIR = $LIBDIR" >> ${CONFIG_MK}
if test -z "$RTBUF_LIBDIR"; then
RTBUF_LIBDIR=${LIBDIR}/rtbuf/${VER}
fi
echo "RTBUF_LIBDIR = $RTBUF_LIBDIR" >> ${CONFIG_MK}
rtbuf_library() {
RTBUF_MODULE_LIBDIR="${RTBUF_LIBDIR}/$1"
echo "RTBUF_MODULE_LIBDIR = $RTBUF_MODULE_LIBDIR" >> ${CONFIG_MK}
LIBRARIES=
for SRC in $SOURCES; do
SRC_LO="$(c2lo "$SRC")"
echo >> ${CONFIG_MK}
lo_rule "$SRC" >> ${CONFIG_MK}
echo "\t${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
SRC_LA="$(c2la "$SRC")"
echo >> ${CONFIG_MK}
echo "$SRC_LA: $SRC_LO" >> ${CONFIG_MK}
echo "\t${LIBTOOL} --tag=CC --mode=link \${CC} -no-undefined -module \${LDFLAGS} $SRC_LO \${LIBS} -o $SRC_LA -rpath ${RTBUF_MODULE_LIBDIR}" >> ${CONFIG_MK}
LIBRARIES="$LIBRARIES $SRC_LA"
done
echo >> ${CONFIG_MK}
echo "libraries:${LIBRARIES}" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "install:${LIBRARIES}" >> ${CONFIG_MK}
for LIB in $LIBRARIES; do
echo "\t\${INSTALL} -o \${OWNER} -g \${GROUP} -m 0755 -d \${RTBUF_MODULE_LIBDIR}" >> ${CONFIG_MK}
echo "\t\${LIBTOOL} --tag=CC --mode=install \${INSTALL} -o \${OWNER} -g \${GROUP} -m 0755 $LIB \${RTBUF_MODULE_LIBDIR}/$LIB" >> ${CONFIG_MK}
done
}