Simplify configuration and building

Remove the configuration bash script, simplify the makefile and add new
target, and update the installation instructions.
This commit is contained in:
Lefteris Chatzimparmpas 2011-04-04 23:19:35 +02:00
parent 4fe1a3d649
commit ae4b3e094e
4 changed files with 51 additions and 347 deletions

View File

@ -1,2 +1,2 @@
all install deinstall uninstall clean distclean:
all nossl install uninstall clean:
cd src && $(MAKE) $@

9
README
View File

@ -25,17 +25,12 @@ Changes
Installation
Compile time requirements are Lua (5.1 or later), the PCRE library, and
Compile time requirements are Lua (version 5.1), the PCRE library, and
optionally the OpenSSL library (for SSL/TLS and CRAM-MD5 support).
Optionally, configure installation options using the supplied shell script.
To see usage details:
./configure -h
Compile and install the program:
make
make all
make install

255
configure vendored
View File

@ -1,255 +0,0 @@
#!/bin/sh
# Default values
prefix="/usr/local"
bindir="$prefix/bin"
sharedir="$prefix/share/imapfilter"
mandir="$prefix/man"
ssltls="yes"
crammd5="yes"
incdirs="-I/usr/local/include"
libdirs="-L/usr/local/lib"
mycflags="$CFLAGS -Wall -O"
myldflags="$LDFLAGS"
libs="-lm -llua -lpcre"
libssl="-lssl"
libcrypto="-lcrypto"
defs="-DMAKEFILE_SHAREDIR='\"\$(SHAREDIR)\"'"
bin="imapfilter"
# Get options and arguments
while getopts "d:p:b:s:m:o:h" opt
do
case $opt in
d | p)
prefix=$OPTARG
bindir=$prefix/bin
sharedir=$prefix/share/imapfilter
mandir=$prefix/man
;;
b)
bindir=$OPTARG
;;
s)
sharedir=$OPTARG
;;
m)
mandir=$OPTARG
;;
o)
head=`echo $OPTARG | cut -d= -f1`
body=`echo $OPTARG | cut -d= -f2`
if [ $head = "ssltls" ]
then
if [ $body = "yes" ]; then ssltls="yes"
elif [ $body = "no" ]; then ssltls="no"
fi
elif [ $head = "crammd5" ]
then
if [ $body = "yes" ]; then crammd5="yes"
elif [ $body = "no" ]; then crammd5="no"
fi
fi
;;
h | *)
cat << EOF
Usage:
configure [-h] [-p prefix] [-b bindir] [-s sharedir] [-m mandir]
[-o option=argument]
Description:
-h This brief usage and description message.
-p prefix Installation path for program's files [$prefix]
-b bindir Installation path for binaries [$bindir]
-s sharedir Installation path for libraries [$sharedir]
-m mandir Installation path for manual pages [$mandir]
-o option=argument Enabling/disabling of program's compilation options.
Options:
ssltls Secure Socket Layer and Transport Layer Security \
[$ssltls]
crammd5 Challenge-Response Authentication Mechanism [$crammd5]
EOF
exit 1
;;
esac
done
# Print values
cat << EOF
Installation directory: $prefix
Binaries directory: $bindir
Architecture independent libraries: $sharedir
Manual pages directory: $mandir
Secure Socket Layer and Transport Layer Security: $ssltls
Challenge-Response Authentication Mechanism: $crammd5
EOF
# Defines
if [ $ssltls = "no" ]
then
defs="$defs -DNO_SSLTLS"
fi
if [ $crammd5 = "no" ]
then
defs="$defs -DNO_CRAMMD5"
fi
# Libraries
if [ $ssltls = "yes" ]
then
libs="$libs $libssl $libcrypto"
elif [ $crammd5 = "yes" ]
then
libs="$libs $libcrypto"
fi
# Binary name
uname -a | grep -qi cygwin
if [ $? = 0 ]
then
bin="imapfilter.exe"
fi
# Change to the source directory
cd src
# Backup of original Makefile
if [ ! -f .Makefile ]; then cp -f Makefile .Makefile; fi
# Write Makefile
mv -f Makefile Makefile~
cat > Makefile << EOF
DESTDIR =
BINDIR = $bindir
SHAREDIR = $sharedir
MANDIR = $mandir
INCDIRS = $incdirs
LIBDIRS = $libdirs
MYCFLAGS = $mycflags
MYLDFLAGS = $myldflags
DEFS = $defs
CFLAGS = \$(MYCFLAGS) \$(DEFS) \$(INCDIRS)
LDFLAGS = \$(MYLDFLAGS) \$(LIBDIRS)
LIBS = $libs
MAN_BIN = imapfilter.1
MAN_CONFIG = imapfilter_config.5
COMMON_LUA = common.lua
SET_LUA = set.lua
REGEX_LUA = regex.lua
ACCOUNT_LUA = account.lua
MAILBOX_LUA = mailbox.lua
MESSAGE_LUA = message.lua
OPTIONS_LUA = options.lua
AUXILIARY_LUA = auxiliary.lua
DEPRECATED_LUA = deprecated.lua
BIN = $bin
OBJ = auth.o buffer.o cert.o core.o file.o imap.o imapfilter.o list.o log.o \\
lua.o memory.o misc.o namespace.o pcre.o regexp.o request.o \\
response.o session.o signal.o socket.o system.o
all: \$(BIN)
\$(BIN): \$(OBJ)
\$(CC) -o \$(BIN) \$(LDFLAGS) \$(OBJ) \$(LIBS)
\$(OBJ): imapfilter.h
buffer.o imap.o imapfilter.o namespace.o request.o response.o: buffer.h
cert.o file.o imapfilter.o log.o lua.o: pathnames.h
imapfilter.o log.o session.o: list.h
imapfilter.o regexp.o response.o: regexp.h
auth.o cert.o imap.o imapfilter.o log.o request.o response.o session.o \\
socket.o: session.h
imapfilter.o: version.h
install: \$(BIN)
if test ! -d \$(DESTDIR)\$(BINDIR); then \\
mkdir -p \$(DESTDIR)\$(BINDIR); fi
cp -f \$(BIN) \$(DESTDIR)\$(BINDIR) && \\
chmod 0755 \$(DESTDIR)\$(BINDIR)/\$(BIN)
if test ! -d \$(DESTDIR)\$(SHAREDIR); then \\
mkdir -p \$(DESTDIR)\$(SHAREDIR); fi
cp -f \$(COMMON_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(COMMON_LUA)
cp -f \$(SET_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(SET_LUA)
cp -f \$(REGEX_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(REGEX_LUA)
cp -f \$(ACCOUNT_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(ACCOUNT_LUA)
cp -f \$(MAILBOX_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(MAILBOX_LUA)
cp -f \$(MESSAGE_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(MESSAGE_LUA)
cp -f \$(OPTIONS_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(OPTIONS_LUA)
cp -f \$(AUXILIARY_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(AUXILIARY_LUA)
cp -f \$(DEPRECATED_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(DEPRECATED_LUA)
if test ! -d \$(DESTDIR)\$(MANDIR)/man1; then \\
mkdir -p \$(DESTDIR)\$(MANDIR)/man1; fi
cp -f ../doc/\$(MAN_BIN) \$(DESTDIR)\$(MANDIR)/man1 && \\
chmod 0644 \$(DESTDIR)\$(MANDIR)/man1/\$(MAN_BIN)
if test ! -d \$(DESTDIR)\$(MANDIR)/man5; then \\
mkdir -p \$(DESTDIR)\$(MANDIR)/man5; fi
cp -f ../doc/\$(MAN_CONFIG) \$(DESTDIR)\$(MANDIR)/man5 && \\
chmod 0644 \$(DESTDIR)\$(MANDIR)/man5/\$(MAN_CONFIG)
deinstall:
rm -f \$(DESTDIR)\$(BINDIR)/\$(BIN) \\
\$(DESTDIR)\$(SHAREDIR)/\$(COMMON_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(SET_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(REGEX_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(ACCOUNT_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(MAILBOX_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(MESSAGE_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(OPTIONS_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(AUXILIARY_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(DEPRECATED_LUA) \\
\$(DESTDIR)\$(MANDIR)/man1/\$(MAN_BIN) \\
\$(DESTDIR)\$(MANDIR)/man5/\$(MAN_CONFIG)
uninstall: deinstall
clean:
rm -f \$(OBJ) \$(BIN) imapfilter.core core *.orig *.BAK *~
distclean: clean
@if test -f .Makefile; then mv -f .Makefile Makefile; fi
EOF
exit 0

View File

@ -1,105 +1,69 @@
DESTDIR =
BINDIR = /usr/local/bin
SHAREDIR = /usr/local/share/imapfilter
MANDIR = /usr/local/man
INCDIRS = -I/usr/local/include
LIBDIRS = -L/usr/local/lib
MYCFLAGS = -Wall -O
MYLDFLAGS =
DEFS = -DMAKEFILE_SHAREDIR='"$(SHAREDIR)"'
CFLAGS = $(MYCFLAGS) $(DEFS) $(INCDIRS)
LDFLAGS = $(MYLDFLAGS) $(LIBDIRS)
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
SHAREDIR = $(PREFIX)/share/imapfilter
MANDIR = $(PREFIX)/man
CFLAGS = -Wall -O -DMAKEFILE_SHAREDIR='"$(SHAREDIR)"'
LDFLAGS =
LIBS = -lm -llua -lpcre -lssl -lcrypto
MAN_BIN = imapfilter.1
MAN_CONFIG = imapfilter_config.5
MAN1 = imapfilter.1
MAN5 = imapfilter_config.5
COMMON_LUA = common.lua
SET_LUA = set.lua
REGEX_LUA = regex.lua
ACCOUNT_LUA = account.lua
MAILBOX_LUA = mailbox.lua
MESSAGE_LUA = message.lua
OPTIONS_LUA = options.lua
AUXILIARY_LUA = auxiliary.lua
DEPRECATED_LUA = deprecated.lua
LUA = common.lua set.lua regex.lua account.lua mailbox.lua message.lua \
options.lua auxiliary.lua deprecated.lua
BIN = imapfilter
OBJ = auth.o buffer.o cert.o core.o file.o imap.o imapfilter.o list.o log.o \
lua.o memory.o misc.o namespace.o pcre.o regexp.o request.o \
response.o session.o signal.o socket.o system.o
lua.o memory.o misc.o namespace.o pcre.o regexp.o request.o response.o \
session.o signal.o socket.o system.o
all: $(BIN)
nossl:
$(MAKE) $(BIN) CFLAGS="-Wall -O -DMAKEFILE_SHAREDIR='\"$(SHAREDIR)\"' \
-DNO_SSLTLS -DNO_CRAMMD5" LIBS="-lm -llua -lpcre"
$(BIN): $(OBJ)
$(CC) -o $(BIN) $(LDFLAGS) $(OBJ) $(LIBS)
$(OBJ): imapfilter.h
buffer.o imap.o imapfilter.o namespace.o request.o response.o: buffer.h
cert.o file.o imapfilter.o log.o lua.o: pathnames.h
imapfilter.o log.o session.o: list.h
imapfilter.o regexp.o response.o: regexp.h
auth.o cert.o imap.o imapfilter.o log.o request.o response.o session.o \
socket.o: session.h
imapfilter.o: version.h
auth.o: session.h
buffer.o: buffer.h
cert.o: pathnames.h session.h
file.o: pathnames.h
imap.o: buffer.h session.h
imapfilter.o: buffer.h list.h pathnames.h regexp.h session.h version.h
list.o: list.h
log.o: list.h pathnames.h session.h
lua.o: pathnames.h
namespace.o: buffer.h
regexp.o: regexp.h
request.o: buffer.h session.h
response.o: buffer.h regexp.h session.h
session.o: list.h session.h
socket.o: session.h
install: $(BIN)
if test ! -d $(DESTDIR)$(BINDIR); then \
mkdir -p $(DESTDIR)$(BINDIR); fi
mkdir -p $(DESTDIR)$(BINDIR) && \
cp -f $(BIN) $(DESTDIR)$(BINDIR) && \
chmod 0755 $(DESTDIR)$(BINDIR)/$(BIN)
if test ! -d $(DESTDIR)$(SHAREDIR); then \
mkdir -p $(DESTDIR)$(SHAREDIR); fi
cp -f $(COMMON_LUA) $(DESTDIR)$(SHAREDIR) && \
chmod 0644 $(DESTDIR)$(SHAREDIR)/$(COMMON_LUA)
cp -f $(SET_LUA) $(DESTDIR)$(SHAREDIR) && \
chmod 0644 $(DESTDIR)$(SHAREDIR)/$(SET_LUA)
cp -f $(REGEX_LUA) $(DESTDIR)$(SHAREDIR) && \
chmod 0644 $(DESTDIR)$(SHAREDIR)/$(REGEX_LUA)
cp -f $(ACCOUNT_LUA) $(DESTDIR)$(SHAREDIR) && \
chmod 0644 $(DESTDIR)$(SHAREDIR)/$(ACCOUNT_LUA)
cp -f $(MAILBOX_LUA) $(DESTDIR)$(SHAREDIR) && \
chmod 0644 $(DESTDIR)$(SHAREDIR)/$(MAILBOX_LUA)
cp -f $(MESSAGE_LUA) $(DESTDIR)$(SHAREDIR) && \
chmod 0644 $(DESTDIR)$(SHAREDIR)/$(MESSAGE_LUA)
cp -f $(OPTIONS_LUA) $(DESTDIR)$(SHAREDIR) && \
chmod 0644 $(DESTDIR)$(SHAREDIR)/$(OPTIONS_LUA)
cp -f $(AUXILIARY_LUA) $(DESTDIR)$(SHAREDIR) && \
chmod 0644 $(DESTDIR)$(SHAREDIR)/$(AUXILIARY_LUA)
cp -f $(DEPRECATED_LUA) $(DESTDIR)$(SHAREDIR) && \
chmod 0644 $(DESTDIR)$(SHAREDIR)/$(DEPRECATED_LUA)
if test ! -d $(DESTDIR)$(MANDIR)/man1; then \
mkdir -p $(DESTDIR)$(MANDIR)/man1; fi
cp -f ../doc/$(MAN_BIN) $(DESTDIR)$(MANDIR)/man1 && \
chmod 0644 $(DESTDIR)$(MANDIR)/man1/$(MAN_BIN)
if test ! -d $(DESTDIR)$(MANDIR)/man5; then \
mkdir -p $(DESTDIR)$(MANDIR)/man5; fi
cp -f ../doc/$(MAN_CONFIG) $(DESTDIR)$(MANDIR)/man5 && \
chmod 0644 $(DESTDIR)$(MANDIR)/man5/$(MAN_CONFIG)
chmod 0755 $(DESTDIR)$(BINDIR)/$(BIN)
mkdir -p $(DESTDIR)$(SHAREDIR) && \
cp -f $(LUA) $(DESTDIR)$(SHAREDIR) && \
chmod 0644 $(DESTDIR)$(SHAREDIR)/$(LUA)
mkdir -p $(DESTDIR)$(MANDIR)/man1 && \
cp -f ../doc/$(MAN1) $(DESTDIR)$(MANDIR)/man1 && \
chmod 0644 $(DESTDIR)$(MANDIR)/man1/$(MAN1)
mkdir -p $(DESTDIR)$(MANDIR)/man5 && \
cp -f ../doc/$(MAN5) $(DESTDIR)$(MANDIR)/man5 && \
chmod 0644 $(DESTDIR)$(MANDIR)/man5/$(MAN5)
deinstall:
rm -f $(DESTDIR)$(BINDIR)/$(BIN) \
$(DESTDIR)$(SHAREDIR)/$(COMMON_LUA) \
$(DESTDIR)$(SHAREDIR)/$(SET_LUA) \
$(DESTDIR)$(SHAREDIR)/$(REGEX_LUA) \
$(DESTDIR)$(SHAREDIR)/$(ACCOUNT_LUA) \
$(DESTDIR)$(SHAREDIR)/$(MAILBOX_LUA) \
$(DESTDIR)$(SHAREDIR)/$(MESSAGE_LUA) \
$(DESTDIR)$(SHAREDIR)/$(OPTIONS_LUA) \
$(DESTDIR)$(SHAREDIR)/$(AUXILIARY_LUA) \
$(DESTDIR)$(SHAREDIR)/$(DEPRECATED_LUA) \
$(DESTDIR)$(MANDIR)/man1/$(MAN_BIN) \
$(DESTDIR)$(MANDIR)/man5/$(MAN_CONFIG)
uninstall: deinstall
uninstall:
rm -f $(DESTDIR)$(BINDIR)/$(BIN)
cd $(DESTDIR)$(SHAREDIR) && rm -f $(LUA)
rm -f $(DESTDIR)$(MANDIR)/man1/$(MAN1)
rm -f $(DESTDIR)$(MANDIR)/man5/$(MAN5)
clean:
rm -f $(OBJ) $(BIN) imapfilter.core core *.orig *.BAK *~
distclean: clean
@if test -f .Makefile; then mv -f .Makefile Makefile; fi
rm -f $(OBJ) $(BIN) *~