[imapfilter-devel] buildroot variable in makefile/configure
Michael Skibbe
mskibbe at suse.de
Fri Feb 16 11:36:38 EET 2007
Hi,
I propose to add a variable called "buildroot" in the makefile and configure.
This variable should handle install into a specific directory and is only a
prefix to all directories. By default empty.
here is my patch to integrate this "feature"
--- Makefile
+++ Makefile
@@ -2,6 +2,7 @@
BINDIR = /usr/local/bin
SHAREDIR = /usr/local/share/imapfilter
MANDIR = /usr/local/man
+BUILDROOT =
INCDIRS = -I/usr/local/include
LIBDIRS = -L/usr/local/lib
@@ -43,29 +44,29 @@
imapfilter.o: version.h
install: $(BIN)
- if test ! -d $(BINDIR); then mkdir -p $(BINDIR); fi
- cp -f $(BIN) $(BINDIR) && chmod 0755 $(BINDIR)/$(BIN)
- if test ! -d $(SHAREDIR); then mkdir -p $(SHAREDIR); fi
- cp -f $(INTERFACE_LUA) $(SHAREDIR) && \
- chmod 0644 $(SHAREDIR)/$(INTERFACE_LUA)
- cp -f $(AUXILIARY_LUA) $(SHAREDIR) && \
- chmod 0644 $(SHAREDIR)/$(AUXILIARY_LUA)
- cp -f $(REGEX_LUA) $(SHAREDIR) && \
- chmod 0644 $(SHAREDIR)/$(REGEX_LUA)
- if test ! -d $(MANDIR)/man1; then mkdir -p $(MANDIR)/man1; fi
- cp -f $(MAN_BIN) $(MANDIR)/man1 && \
- chmod 0644 $(MANDIR)/man1/$(MAN_BIN)
- if test ! -d $(MANDIR)/man5; then mkdir -p $(MANDIR)/man5; fi
- cp -f $(MAN_CONFIG) $(MANDIR)/man5 && \
- chmod 0644 $(MANDIR)/man5/$(MAN_CONFIG)
+ if test ! -d $(BUILDROOT)$(BINDIR); then mkdir -p $(BUILDROOT)$(BINDIR); fi
+ cp -f $(BIN) $(BUILDROOT)$(BINDIR) && chmod 0755
$(BUILDROOT)$(BINDIR)/$(BIN)
+ if test ! -d $(BUILDROOT)$(SHAREDIR); then mkdir -p $(BUILDROOT)$(SHAREDIR);
fi
+ cp -f $(INTERFACE_LUA) $(BUILDROOT)$(SHAREDIR) && \
+ chmod 0644 $(BUILDROOT)$(SHAREDIR)/$(INTERFACE_LUA)
+ cp -f $(AUXILIARY_LUA) $(BUILDROOT)$(SHAREDIR) && \
+ chmod 0644 $(BUILDROOT)$(SHAREDIR)/$(AUXILIARY_LUA)
+ cp -f $(REGEX_LUA) $(BUILDROOT)$(SHAREDIR) && \
+ chmod 0644 $(BUILDROOT)$(SHAREDIR)/$(REGEX_LUA)
+ if test ! -d $(BUILDROOT)$(MANDIR)/man1; then mkdir -p
$(BUILDROOT)$(MANDIR)/man1; fi
+ cp -f $(MAN_BIN) $(BUILDROOT)$(MANDIR)/man1 && \
+ chmod 0644 $(BUILDROOT)$(MANDIR)/man1/$(MAN_BIN)
+ if test ! -d $(BUILDROOT)$(MANDIR)/man5; then mkdir -p
$(BUILDROOT)$(MANDIR)/man5; fi
+ cp -f $(MAN_CONFIG) $(BUILDROOT)$(MANDIR)/man5 && \
+ chmod 0644 $(BUILDROOT)$(MANDIR)/man5/$(MAN_CONFIG)
deinstall:
- rm -f $(BINDIR)/$(BIN) \
- $(SHAREDIR)/$(INTERFACE_LUA) \
- $(SHAREDIR)/$(AUXILIARY_LUA) \
- $(SHAREDIR)/$(REGEX_LUA) \
- $(MANDIR)/man1/$(MAN_BIN) \
- $(MANDIR)/man5/$(MAN_CONFIG)
+ rm -f $(BUILDROOT)$(BINDIR)/$(BIN) \
+ $(BUILDROOT)$(SHAREDIR)/$(INTERFACE_LUA) \
+ $(BUILDROOT)$(SHAREDIR)/$(AUXILIARY_LUA) \
+ $(BUILDROOT)$(SHAREDIR)/$(REGEX_LUA) \
+ $(BUILDROOT)$(MANDIR)/man1/$(MAN_BIN) \
+ $(BUILDROOT)$(MANDIR)/man5/$(MAN_CONFIG)
uninstall: deinstall
--- configure
+++ configure
@@ -6,6 +6,7 @@
bindir="$destdir/bin"
sharedir="$destdir/share/imapfilter"
mandir="$destdir/man"
+buildroot=""
lua="5.1"
ssltls="yes"
@@ -24,16 +25,19 @@
libcrypto="-lcrypto"
libpcre="-lpcre"
-defs="-DMAKEFILE_SHAREDIR='\"\$(SHAREDIR)\"'"
+defs="-DMAKEFILE_SHAREDIR='\"\$(BUILDROOT)$(SHAREDIR)\"'"
bin="imapfilter"
# Get options and arguments
-while getopts "d:b:s:m:o:h" opt
+while getopts "d:b:s:m:o:r:h" opt
do
case $opt in
+ r)
+ buildroot=$OPTARG
+ ;;
d)
destdir=$OPTARG
bindir=$destdir/bin
@@ -85,6 +89,7 @@
-b bindir Installation path for binaries [$bindir]
-s sharedir Installation path for libraries [$sharedir]
-m mandir Installation path for manual pages [$mandir]
+ -r buildroot BUILDROOT [$buildroot]
-o option=argument Enabling/disabling of program's compilation options.
Options:
@@ -226,47 +231,47 @@
imapfilter.o: version.h
install: \$(BIN)
- if test ! -d \$(BINDIR); then mkdir -p \$(BINDIR); fi
- cp -f \$(BIN) \$(BINDIR) && chmod 0755 \$(BINDIR)/\$(BIN)
- if test ! -d \$(SHAREDIR); then mkdir -p \$(SHAREDIR); fi
- cp -f \$(INTERFACE_LUA) \$(SHAREDIR) && \\
- chmod 0644 \$(SHAREDIR)/\$(INTERFACE_LUA)
- cp -f \$(AUXILIARY_LUA) \$(SHAREDIR) && \\
- chmod 0644 \$(SHAREDIR)/\$(AUXILIARY_LUA)
+ if test ! -d \$(BUILDROOT)\$(BINDIR); then mkdir -p \$(BUILDROOT)\$(BINDIR);
fi
+ cp -f \$(BIN) \$(BUILDROOT)\$(BINDIR) && chmod 0755
\$(BUILDROOT)\$(BINDIR)/\$(BIN)
+ if test ! -d \$(BUILDROOT)\$(SHAREDIR); then mkdir -p
\$(BUILDROOT)\$(SHAREDIR); fi
+ cp -f \$(INTERFACE_LUA) \$(BUILDROOT)\$(SHAREDIR) && \\
+ chmod 0644 \$(BUILDROOT)\$(SHAREDIR)/\$(INTERFACE_LUA)
+ cp -f \$(AUXILIARY_LUA) \$(BUILDROOT)\$(SHAREDIR) && \\
+ chmod 0644 \$(BUILDROOT)\$(SHAREDIR)/\$(AUXILIARY_LUA)
EOF
if [ $pcre = "yes" ]
then
cat >> Makefile << EOF
- cp -f \$(REGEX_LUA) \$(SHAREDIR) && \\
- chmod 0644 \$(SHAREDIR)/\$(REGEX_LUA)
+ cp -f \$(REGEX_LUA) \$(BUILDROOT)\$(SHAREDIR) && \\
+ chmod 0644 \$(BUILDROOT)\$(SHAREDIR)/\$(REGEX_LUA)
EOF
fi
cat >> Makefile << EOF
- if test ! -d \$(MANDIR)/man1; then mkdir -p \$(MANDIR)/man1; fi
- cp -f \$(MAN_BIN) \$(MANDIR)/man1 && \\
- chmod 0644 \$(MANDIR)/man1/\$(MAN_BIN)
- if test ! -d \$(MANDIR)/man5; then mkdir -p \$(MANDIR)/man5; fi
- cp -f \$(MAN_CONFIG) \$(MANDIR)/man5 && \\
- chmod 0644 \$(MANDIR)/man5/\$(MAN_CONFIG)
+ if test ! -d \$(BUILDROOT)\$(MANDIR)/man1; then mkdir -p
\$(BUILDROOT)\$(MANDIR)/man1; fi
+ cp -f \$(MAN_BIN) \$(BUILDROOT)\$(MANDIR)/man1 && \\
+ chmod 0644 \$(BUILDROOT)\$(MANDIR)/man1/\$(MAN_BIN)
+ if test ! -d \$(BUILDROOT)\$(MANDIR)/man5; then mkdir -p
\$(BUILDROOT)\$(MANDIR)/man5; fi
+ cp -f \$(MAN_CONFIG) \$(BUILDROOT)\$(MANDIR)/man5 && \\
+ chmod 0644 \$(BUILDROOT)\$(MANDIR)/man5/\$(MAN_CONFIG)
deinstall:
- rm -f \$(BINDIR)/\$(BIN) \\
- \$(SHAREDIR)/\$(INTERFACE_LUA) \\
- \$(SHAREDIR)/\$(AUXILIARY_LUA) \\
+ rm -f \$(BUILDROOT)\$(BINDIR)/\$(BIN) \\
+ \$(BUILDROOT)\$(SHAREDIR)/\$(INTERFACE_LUA) \\
+ \$(BUILDROOT)\$(SHAREDIR)/\$(AUXILIARY_LUA) \\
EOF
if [ $pcre = "yes" ]
then
cat >> Makefile << EOF
- \$(SHAREDIR)/\$(REGEX_LUA) \\
+ \$(BUILDROOT)\$(SHAREDIR)/\$(REGEX_LUA) \\
EOF
fi
cat >> Makefile << EOF
- \$(MANDIR)/man1/\$(MAN_BIN) \\
- \$(MANDIR)/man5/\$(MAN_CONFIG)
+ \$(BUILDROOT)\$(MANDIR)/man1/\$(MAN_BIN) \\
+ \$(BUILDROOT)\$(MANDIR)/man5/\$(MAN_CONFIG)
uninstall: deinstall
Greetings
Michael
--
Michael Skibbe <mskibbe at suse.de>
Core Services
SUSE Linux Products GmbH GF: Markus Rex
Nuernberg, Germany HRB 16746 (AG Nuernberg)
More information about the Imapfilter-devel
mailing list