Commit cae50ffc authored by Eddie Kohler's avatar Eddie Kohler

Linuxmodule install: "Install -C" is painful on CentOS, so replace it.

With a hand-written "installtree" addition to click-buildtool. Which
depends on md5sum existing, oh well.
Signed-off-by: default avatarEddie Kohler <ekohler@gmail.com>
parent 1bd80185
......@@ -212,6 +212,92 @@ if test "$1" = compile-shortensyms; then
fi
###############
# INSTALLTREE #
###############
installtree_usage () {
echo "Usage: click-buildtool installtree SRC DST" 1>&2
echo "Try 'click-buildtool installtree --help' for more information." 1>&2
exit 1
}
do_installtree () {
src="$1"; dst="$2"; mode="$3"
found=0
tty=; if test -t 1; then tty=y; fi
while read file; do
found=`expr $found + 1`
prfile=`echo "$dst/$file" | sed 's,/\./,/,g'`
if test -n "$tty"; then
echo " ... $prfile" | tr -d '\012'
else
echo " ... $prfile"
fi
if test ! -f "$src/$file"; then
if ! rm -f "$dst/$file"; then echo; exit 1; fi
else
dir=`echo "$dst/$file" | sed 's,/*[^/]*$,,'`
if test ! -d "$dir" && ! mkdir -p "$dir"; then echo; exit 1; fi
if ! cp "$src/$file" "$dst/$file"; then echo; exit 1; fi
if ! chmod $mode "$dst/$file"; then echo; exit 1; fi
fi
done
if test "$found" != 0 -a -n "$tty"; then
echo " ... $found" `if test $found = 0; then echo file; else echo files; fi` installed
fi
}
installtree () {
mode=755
src=
dst=
while [ x"$1" != x ]; do
case $1 in
-m|--m|--mo|--mod|--mode)
if test $# -lt 2; then installtree_usage; fi
mode="$2"; shift 2;;
-m*)
mode="`echo "$1" | sed 's/^-m//'`"; shift 1;;
--m=*|--mo=*|--mod=*|--mode=*)
mode="`echo "$1" | sed 's/^[^=]*=//'`"; shift 1;;
-h|--h|--he|--hel|--help)
cat <<'EOF' 1>&2
'Click-buildtool installtree' installs many files into a directory. The
files to install should be supplied, one to a line, on standard input.
Usage: click-buildtool installtree SRC DEST
Options:
-m, --mode MODE Installation mode.
-h, --help Print this message and exit.
Report bugs to <click@pdos.lcs.mit.edu>.
EOF
exit 0;;
-*)
installtree_usage;;
*)
if test -z "$src"; then src="$1"; elif test -z "$dst"; then dst="$1"; else installtree_usage; fi
shift 1;;
esac
done
if test -z "$dst"; then installtree_usage; fi
if test -z "$MD5SUM"; then MD5SUM="@MD5SUM@"; fi
if test -z "$MD5SUM" && echo | sum >/dev/null; then MD5SUM=sum; fi
if test -z "$MD5SUM"; then
echo "Sorry, 'click-buildtool installtree' requires a working 'md5sum' program." 1>&2
exit 1
fi
( ( cd $src; find . -type f -print | xargs -L 100 $MD5SUM )
( cd $dst; find . -type f -print | xargs -L 100 $MD5SUM )
) | sort | uniq -u | awk '{ print $2 }' | sort | uniq \
| do_installtree "$src" "$dst" "$mode"
}
############
# FINDELEM #
############
......@@ -1606,6 +1692,7 @@ Usage: click-buildtool elem2make [-V] [-p PREFIX] < [ELEMENTS]
or: click-buildtool ksyms OBJS > KSYMSFILE
or: click-buildtool shortensyms OBJS
or: click-buildtool compile-shortensyms [BUILD COMMAND]
or: click-buildtool installtree DIR < FILELIST
or: click-buildtool [--cflags | --otherlibs | --toolcflags | --toollibs]
Options:
......@@ -1643,6 +1730,8 @@ EOF
shift 1; shortensyms "$@"; exit 0;;
compile-shortensyms)
shift 1; compile_shortensyms "$@"; exit 0;;
installtree)
shift 1; installtree "$@"; exit 0;;
--cf|--cfl|--cfla|--cflag|--cflags|--d|--de|--def|--defs)
echo @PROPER_INCLUDES@ @PCAP_INCLUDES@ @NETMAP_INCLUDES@ -I@includedir@; exit 0;;
--o|--ot|--oth|--othe|--other|--otherl|--otherli|--otherlib|--otherlibs)
......
......@@ -209,21 +209,9 @@ install-local: Makefile $(ELEMENTSCONF).mk $(ELEMENTSCONF).cc all
$(CLICKmkinstalldirs) $(DESTDIR)$(libdir)
for i in $(patsubst %.o,%.ko,$(INSTALLOBJS)); do $(CLICK_BUILD_INSTALL_DATA) $$i $(DESTDIR)$(libdir)/$$i; done
$(CLICK_BUILD_INSTALL_DATA) Module.symvers $(DESTDIR)$(libdir)/click.symvers
install-include:
/bin/rm -f .install-include*
install-include: $(top_builddir)/click-buildtool
$(CLICKmkinstalldirs) $(DESTDIR)$(includedir)/click-linuxmodule
(cd $(DESTDIR)$(includedir)/click-linuxmodule; find . -type d -print | grep /) >.install-include0 || true
(cd $(top_builddir)/include/click-linuxmodule; find . -type d -print | grep /) >.install-include1 || true
cat .install-include0 .install-include1 | sort | uniq -u >.install-include2
cat .install-include0 .install-include2 | sort | uniq -d | sed 's ^\.\(.*\) '"$(DESTDIR)$(includedir)/click-linuxmodule"'\1 ' | xargs -L 1 /bin/rm -rf
cat .install-include1 .install-include2 | sort | uniq -d | sed 's ^\.\(.*\) '"$(DESTDIR)$(includedir)/click-linuxmodule"'\1 ' | xargs -L 1 $(CLICKmkinstalldirs)
/bin/rm -f .install-include*
(cd $(DESTDIR)$(includedir)/click-linuxmodule; find . -type f -print | grep /) >.install-include0 || true
(cd $(top_builddir)/include/click-linuxmodule; find . -type f -print | grep /) >.install-include1 || true
cat .install-include0 .install-include1 | sort | uniq -u >.install-include2
cat .install-include0 .install-include2 | sort | uniq -d | sed 's ^\.\(.*\) '"$(DESTDIR)$(includedir)/click-linuxmodule"'\1 ' | xargs -L 1 /bin/rm -f
cat .install-include1 | sed 's ^\.\(.*\) '"$(top_builddir)/include/click-linuxmodule"'\1'" $(DESTDIR)$(includedir)/click-linuxmodule"'\1 ' | xargs -L 1 $(CLICK_BUILD_INSTALL_DATA_IF_CHANGED)
/bin/rm -f .install-include*
$(call verbose_cmd,$(top_builddir)/click-buildtool installtree -m 644 "$(top_builddir)/include/click-linuxmodule" "$(DESTDIR)$(includedir)/click-linuxmodule",INSTALL $(DESTDIR)$(includedir)/click-linuxmodule)
install-man:
@:
uninstall:
......
......@@ -471,20 +471,20 @@ AC_DEFUN([CLICK_PROG_INSTALL], [
AC_MSG_CHECKING(whether install accepts -C)
echo X > conftest.1
if $INSTALL -C conftest.1 conftest.2 >/dev/null 2>&1; then
INSTALL_IF_CHANGED='$(INSTALL) -C'
INSTALL_IF_CHANGED='${INSTALL} -C'
AC_MSG_RESULT(yes)
else
INSTALL_IF_CHANGED='$(top_builddir)/installch'
INSTALL_IF_CHANGED='${top_builddir}/installch'
AC_MSG_RESULT(no)
fi
rm -f conftest.1 conftest.2
AC_SUBST(INSTALL_IF_CHANGED)
CLICKINSTALL=`echo "$INSTALL" | sed 's|^\$(.*)/|\$(clickdatadir)/|'`
AC_SUBST(CLICKINSTALL)
AC_SUBST([INSTALL_IF_CHANGED])
CLICKINSTALL=`echo "$INSTALL" | sed 's|^\$(.*)/|\${clickdatadir}/|'`
AC_SUBST([CLICKINSTALL])
CLICK_BUILD_INSTALL="$INSTALL"
AC_SUBST(CLICK_BUILD_INSTALL)
CLICK_BUILD_INSTALL_IF_CHANGED="`echo "$INSTALL_IF_CHANGED" | sed 's|(INSTALL)|(CLICK_BUILD_INSTALL)|'`"
AC_SUBST(CLICK_BUILD_INSTALL_IF_CHANGED)
AC_SUBST([CLICK_BUILD_INSTALL])
CLICK_BUILD_INSTALL_IF_CHANGED="`echo "$INSTALL_IF_CHANGED" | sed 's|{INSTALL}|{CLICK_BUILD_INSTALL}|'`"
AC_SUBST([CLICK_BUILD_INSTALL_IF_CHANGED])
])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment