* [PATCH] Use the original install-sh file from SGI
@ 2018-05-03 5:07 Theodore Ts'o
2018-05-04 15:12 ` Eryu Guan
2018-05-05 1:36 ` Dave Chinner
0 siblings, 2 replies; 4+ messages in thread
From: Theodore Ts'o @ 2018-05-03 5:07 UTC (permalink / raw)
To: fstests; +Cc: Theodore Ts'o
The install-sh file is much more efficient than the libtool version
(50% faster wall clock time; much more than that when running in a
qemu emulation build environment). There doesn't seem to be any real
need for the libtool version, so bring back the original install-sh
script.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
A very large amount of time when running "make install" in a build
chroot using qemu emulation, such as constructed by running "sudo
setup-buildchroot --arch-armhf" using the script found here[1] is in
running the install-sh provided by libtool, which is amazing bloated
and forks a crazy number of processes to do something very simple.
As near as I can tell there is zero benefit in using the install-sh
provided by libtool, so restore the version that SGI originally used.
[1] https://github.com/tytso/xfstests-bld/blob/master/setup-buildchroot
.gitignore | 1 -
install-sh | 351 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 351 insertions(+), 1 deletion(-)
create mode 100755 install-sh
diff --git a/.gitignore b/.gitignore
index 192ca35e..dfd3da7d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,7 +24,6 @@
# libtool
/libtool
-/install-sh
/ltmain.sh
# build system
diff --git a/install-sh b/install-sh
new file mode 100755
index 00000000..9fa706d9
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,351 @@
+#! /bin/bash
+#
+# Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
+#
+# This script emulates bsd install and also recognises
+# two environment variables, with the following semantics :-
+#
+# $DIST_MANIFEST - if set, the name of the file to append manifest
+# information in the following format:
+# File : f mode owner group src target
+# Directory: d mode owner group target
+# Symlink : l linkval target
+#
+# $DIST_ROOT - if set, prepend to target
+#
+# The sematics of all combinations of these two variables
+# are as follows:
+#
+# $DIST_MANIFEST? $DIST_ROOT? | Copy? Append Manifest?
+# -----------------------------+--------------------------
+# not set not set | yes no
+# not set set | yes no
+# set not set | no yes
+# set set | yes yes
+#
+_usage() {
+ echo "Usage: $prog [-o owner] [-g group] [-m mode] -d directory"
+ echo "or $prog [-D] [-o owner] [-g group] [-m mode] file directory/file"
+ echo "or $prog [-o owner] [-g group] [-m mode] file [file ...] directory"
+ echo "or $prog -S file target (creates \"target\" symlink)"
+ echo "or $prog -T lt_arg [-o owner] [-g group] [-m mode] libtool.lai directory"
+ echo ""
+ echo "The \$DIST_MANIFEST and \$DIST_ROOT environment variables affect the"
+ echo "behaviour of this command - see comments in the script."
+ echo "The -D flag is only available for the second usage, and causes"
+ echo "the target directory to be created before installing the file."
+ echo ""
+ exit 1
+}
+
+_chown ()
+{
+ _st=255
+ if [ $# -eq 3 ] ; then
+ chown $1:$2 $3
+ _st=$?
+ if [ $_st -ne 0 ] ; then
+ if [ $REAL_UID != '0' ] ; then
+ if [ ! -f $DIST_ROOT/.chown.quiet ] ; then
+ echo '==============================================='
+ echo Ownership of files under ${DIST_ROOT:-/}
+ echo cannot be changed
+ echo '==============================================='
+ if [ -n "$DIST_ROOT" ] ; then
+ touch $DIST_ROOT/.chown.quiet
+ fi
+ fi
+ _st=0
+ fi
+ fi
+ fi
+
+ return $_st
+}
+
+
+_manifest ()
+{
+ echo $* | sed -e 's/\/\//\//g' >>${DIST_MANIFEST:-/dev/null}
+}
+
+prog=`basename $0`
+HERE=`pwd`
+dflag=false
+Dflag=false
+Sflag=false
+Tflag=false
+DIRMODE=755
+FILEMODE=644
+OWNER=`id -u`
+GROUP=`id -g`
+REAL_UID=$OWNER
+
+# default is to install and don't append manifest
+INSTALL=true
+MANIFEST=:
+
+: ${DIST_ROOT:=${DESTDIR}}
+
+[ -n "$DIST_MANIFEST" -a -z "$DIST_ROOT" ] && INSTALL=false
+[ -n "$DIST_MANIFEST" ] && MANIFEST="_manifest"
+
+[ $# -eq 0 ] && _usage
+
+if $INSTALL
+then
+ CP=cp; LN=ln; MKDIR=mkdir; CHMOD=chmod; CHOWN=_chown
+else
+ CP=true; LN=true; MKDIR=true; CHMOD=true; CHOWN=true
+fi
+
+[ -n "$DIST_ROOT" -a $REAL_UID -ne 0 ] && CHOWN=true
+
+while getopts "Dcm:d:S:o:g:T:" c $*
+do
+ case $c in
+ c)
+ ;;
+ g)
+ GROUP=$OPTARG
+ ;;
+ o)
+ OWNER=$OPTARG
+ ;;
+ m)
+ DIRMODE=`expr $OPTARG`
+ FILEMODE=$DIRMODE
+ ;;
+ D)
+ Dflag=true
+ ;;
+ S)
+ symlink=$OPTARG
+ Sflag=true
+ ;;
+ d)
+ dir=$DIST_ROOT/$OPTARG
+ dflag=true
+ ;;
+ T)
+ lt_install=$OPTARG
+ Tflag=true
+ ;;
+ *)
+ _usage
+ ;;
+ esac
+done
+
+shift `expr $OPTIND - 1`
+
+status=0
+if $dflag
+then
+ #
+ # first usage
+ #
+ $MKDIR -p $dir
+ status=$?
+ if [ $status -eq 0 ]
+ then
+ $CHMOD $DIRMODE $dir
+ status=$?
+ fi
+ if [ $status -eq 0 ]
+ then
+ $CHOWN $OWNER $GROUP $dir
+ status=$?
+ fi
+ $MANIFEST d $DIRMODE $OWNER $GROUP ${dir#$DIST_ROOT}
+elif $Sflag
+then
+ #
+ # fourth usage (symlink)
+ #
+ if [ $# -ne 1 ]
+ then
+ _usage
+ else
+ target=$DIST_ROOT/$1
+ fi
+ $LN -s -f $symlink $target
+ status=$?
+ $MANIFEST l $symlink ${target#$DIST_ROOT}
+elif $Tflag
+then
+ #
+ # -T (install libs built by libtool)
+ #
+ if [ $# -ne 2 ]
+ then
+ _usage
+ else
+ libtool_lai=$1
+ # source the libtool variables
+ if [ ! -f $libtool_lai ]
+ then
+ echo "$prog: Unable to find libtool library file $libtool_lai"
+ exit 2
+ fi
+ . ./$libtool_lai
+ target=$DIST_ROOT/$2
+ fi
+ case $lt_install in
+ so_dot_version)
+ # Loop until we find libfoo.so.x.y.z, then break out.
+ for solib in $library_names
+ do
+ # does it have enough parts? libfoo.so.x.y.z == 5
+ cnt=`echo "$solib" | sed -e 's/\./ /g' | wc -w`
+ if [ $cnt -eq 5 ]
+ then
+ install_name=$target/$solib
+ $CP $solib $install_name
+ status=$?
+ $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$solib ${install_name#$DIST_ROOT}
+ break
+ fi
+ done
+ ;;
+
+ so_*)
+ case $lt_install in
+ so_dot_current)
+ # ln -s libfoo.so.x.y.z to libfoo.so.x
+ from_parts=5 # libfoo.so.x.y.z
+ to_parts=3 # libfoo.so.x
+ ;;
+ so_base)
+ # ln -s libfoo.so.x to libfoo.so
+ from_parts=3 # libfoo.so.x
+ to_parts=2 # libfoo.so
+ ;;
+ *)
+ echo "$prog: -T $lt_install invalid"
+ exit 2
+ ;;
+ esac
+
+ # Loop until we find the names, then break out.
+ for solib in $library_names
+ do
+ # does it have enough parts?
+ cnt=`echo "$solib" | sed -e 's/\./ /g' | wc -w`
+ if [ $cnt -eq $from_parts ]
+ then
+ from_name=$solib
+ elif [ $cnt -eq $to_parts ]
+ then
+ to_name=$solib
+ fi
+
+ if [ -n "$from_name" ] && [ -n "$to_name" ]
+ then
+ install_name=$target/$to_name
+ $LN -s -f $from_name $install_name
+ status=$?
+ $MANIFEST l $from_name ${install_name#$DIST_ROOT}
+ break
+ fi
+ done
+ ;;
+ old_lib)
+ install_name=$target/$old_library
+ $CP $old_library $install_name
+ status=$?
+ $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$old_library ${install_name#$DIST_ROOT}
+ ;;
+ *)
+ echo "$prog: -T $lt_install invalid"
+ exit 2
+ ;;
+ esac
+
+ case $lt_install in
+ old_lib|so_dot_version)
+ if [ $status -eq 0 ]
+ then
+ $CHMOD $FILEMODE $install_name
+ $CHOWN $OWNER $GROUP $install_name
+ fi
+ ;;
+ esac
+
+else
+ list=""
+ dir=""
+ if [ $# -eq 2 ]
+ then
+ #
+ # second usage
+ #
+ f=$1
+ dir=$DIST_ROOT/$2
+ if $Dflag
+ then
+ mkdir -p `dirname $dir`
+ fi
+ $CP $f $dir
+ status=$?
+ if [ $status -eq 0 ]
+ then
+ if [ -f $dir/$f ]
+ then
+ $CHMOD $FILEMODE $dir/$f
+ status=$?
+ if [ $status -eq 0 ]
+ then
+ $CHOWN $OWNER $GROUP $dir/$f
+ status=$?
+ fi
+ $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$f ${dir#$DIST_ROOT}/$f
+ else
+ $CHMOD $FILEMODE $dir
+ status=$?
+ if [ $status -eq 0 ]
+ then
+ $CHOWN $OWNER $GROUP $dir
+ status=$?
+ fi
+ $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$dir ${dir#$DIST_ROOT}
+ fi
+ fi
+ else
+ #
+ # third usage
+ #
+ n=1
+ while [ $# -gt 0 ]
+ do
+ if [ $# -gt 1 ]
+ then
+ list="$list $1"
+ else
+ dir=$DIST_ROOT/$1
+ fi
+ shift
+ done
+
+ # echo DIR=$dir list=\"$list\"
+ for f in $list
+ do
+ $CP $f $dir
+ status=$?
+ if [ $status -eq 0 ]
+ then
+ $CHMOD $FILEMODE $dir/$f
+ status=$?
+ if [ $status -eq 0 ]
+ then
+ $CHOWN $OWNER $GROUP $dir/$f
+ status=$?
+ fi
+ $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$f ${dir#$DIST_ROOT}/$f
+ fi
+ [ $status -ne 0 ] && break
+ done
+ fi
+fi
+
+exit $status
--
2.16.1.72.g5be1f00a9a
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Use the original install-sh file from SGI
2018-05-03 5:07 [PATCH] Use the original install-sh file from SGI Theodore Ts'o
@ 2018-05-04 15:12 ` Eryu Guan
2018-05-04 21:15 ` Theodore Y. Ts'o
2018-05-05 1:36 ` Dave Chinner
1 sibling, 1 reply; 4+ messages in thread
From: Eryu Guan @ 2018-05-04 15:12 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: fstests
On Thu, May 03, 2018 at 01:07:28AM -0400, Theodore Ts'o wrote:
> The install-sh file is much more efficient than the libtool version
> (50% faster wall clock time; much more than that when running in a
> qemu emulation build environment). There doesn't seem to be any real
> need for the libtool version, so bring back the original install-sh
> script.
>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
>
> A very large amount of time when running "make install" in a build
> chroot using qemu emulation, such as constructed by running "sudo
> setup-buildchroot --arch-armhf" using the script found here[1] is in
> running the install-sh provided by libtool, which is amazing bloated
> and forks a crazy number of processes to do something very simple.
>
> As near as I can tell there is zero benefit in using the install-sh
> provided by libtool, so restore the version that SGI originally used.
This saves me 8s on 'make install' (23s -> 15s).
But one problem with this is that after every 'make', install-sh is
overwritten & modified by 'libtoolize -cfi', and git diff complains
about the change.
I think we could follow what xfsprogs does on this, that puts install-sh
in include dir and copy it from there after it's overwritten by
libtoolize.
>
> [1] https://github.com/tytso/xfstests-bld/blob/master/setup-buildchroot
>
>
> .gitignore | 1 -
> install-sh | 351 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 351 insertions(+), 1 deletion(-)
> create mode 100755 install-sh
>
> diff --git a/.gitignore b/.gitignore
> index 192ca35e..dfd3da7d 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -24,7 +24,6 @@
>
> # libtool
> /libtool
> -/install-sh
Then we don't need this change.
So the patch would be like:
diff --git a/Makefile b/Makefile
index d97385f90142..1064984573be 100644
--- a/Makefile
+++ b/Makefile
@@ -80,6 +80,7 @@ endif
configure: configure.ac
libtoolize -cfi
+ cp include/install-sh .
aclocal -I m4
autoheader
autoconf
diff --git a/include/install-sh b/include/install-sh
new file mode 100755
index 000000000000..06d8aa9b6b9c
--- /dev/null
+++ b/include/install-sh
<new file content here>
This looks like a straightforward change, I can fix it on commit if the
change looks sane to you.
Thanks,
Eryu
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Use the original install-sh file from SGI
2018-05-04 15:12 ` Eryu Guan
@ 2018-05-04 21:15 ` Theodore Y. Ts'o
0 siblings, 0 replies; 4+ messages in thread
From: Theodore Y. Ts'o @ 2018-05-04 21:15 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests
On Fri, May 04, 2018 at 11:12:32PM +0800, Eryu Guan wrote:
> I think we could follow what xfsprogs does on this, that puts install-sh
> in include dir and copy it from there after it's overwritten by
> libtoolize.
>
> This looks like a straightforward change, I can fix it on commit if the
> change looks sane to you.
Sounds good to me. Thanks!!
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use the original install-sh file from SGI
2018-05-03 5:07 [PATCH] Use the original install-sh file from SGI Theodore Ts'o
2018-05-04 15:12 ` Eryu Guan
@ 2018-05-05 1:36 ` Dave Chinner
1 sibling, 0 replies; 4+ messages in thread
From: Dave Chinner @ 2018-05-05 1:36 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: fstests
On Thu, May 03, 2018 at 01:07:28AM -0400, Theodore Ts'o wrote:
> The install-sh file is much more efficient than the libtool version
> (50% faster wall clock time; much more than that when running in a
> qemu emulation build environment). There doesn't seem to be any real
> need for the libtool version, so bring back the original install-sh
> script.
>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
>
> A very large amount of time when running "make install" in a build
> chroot using qemu emulation, such as constructed by running "sudo
> setup-buildchroot --arch-armhf" using the script found here[1] is in
> running the install-sh provided by libtool, which is amazing bloated
> and forks a crazy number of processes to do something very simple.
>
> As near as I can tell there is zero benefit in using the install-sh
> provided by libtool, so restore the version that SGI originally used.
>
> [1] https://github.com/tytso/xfstests-bld/blob/master/setup-buildchroot
Does this break cross-compilation for chromeeOS?
I ask, because that is why the hard coded install-sh was originally
replaced by the libtool provided one last year:
commit 5d20084fefaf09e86be26d7c71bd1c7ac2a2b35c
Author: Gwendal Grignou <gwendal@chromium.org>
Date: Wed Apr 19 16:33:48 2017 -0700
build: allow cros-compilation on chromeOS
- Request LIBTOOL to be used
- Set topbuildir based on a Makefile variable to call libtool
- Use /usr/local instead of /var for xfstest final location
- Move macros from aclocal.m4 to acinclude.m4, aclocal.m4 is autogenerated.
- Use autoconf variables @prefix@, @exec_prefix@.
The regular way of compiling xfstests - make - remains.
But it now runs autoreconf and libtoolize -i to produce a valid
configure.
Verified with 'make install --dry-run' that files are installed at the
same place.
Verified compiling in chromeOS chroot works as well.
[eguan: resolve merge conflicts and update .gitignore and remove
generated files by realclean]
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-05 1:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 5:07 [PATCH] Use the original install-sh file from SGI Theodore Ts'o
2018-05-04 15:12 ` Eryu Guan
2018-05-04 21:15 ` Theodore Y. Ts'o
2018-05-05 1:36 ` Dave Chinner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.