devtools: remove useless files from ABI reference

Message ID 20200421020455.505176-1-thomas@monjalon.net (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series devtools: remove useless files from ABI reference |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot warning Travis build: failed
ci/iol-testing fail Testing issues

Commit Message

Thomas Monjalon April 21, 2020, 2:04 a.m. UTC
  When building an ABI reference with meson, some static libraries
are built and linked in apps. They are useless and take a lot of space.
Those binaries, and other useless files (examples and doc files)
in the share/ directory, are removed after being installed.

In order to save time when building the ABI reference,
the examples (which are not installed anyway) are not compiled.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 devtools/test-meson-builds.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

David Marchand April 21, 2020, 7:49 a.m. UTC | #1
On Tue, Apr 21, 2020 at 4:05 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> When building an ABI reference with meson, some static libraries
> are built and linked in apps. They are useless and take a lot of space.
> Those binaries, and other useless files (examples and doc files)
> in the share/ directory, are removed after being installed.
>
> In order to save time when building the ABI reference,
> the examples (which are not installed anyway) are not compiled.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  devtools/test-meson-builds.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index e8df017596..16271e057d 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -141,10 +141,15 @@ build () # <directory> <target compiler> <meson options>
>                         fi
>
>                         rm -rf $abirefdir/build
> -                       config $abirefdir/src $abirefdir/build $*
> +                       config $abirefdir/src $abirefdir/build -Dexamples= $*
>                         compile $abirefdir/build
>                         install_target $abirefdir/build $abirefdir/$targetdir
>                         $srcdir/devtools/gen-abi.sh $abirefdir/$targetdir
> +
> +                       # save disk space by removing static libs and apps
> +                       rm $abirefdir/$targetdir/usr/local/lib/*.a

The install directory for libraries is not lib/ in all cases.
This breaks the ABI generation for gcc-shared:

DESTDIR=/home/dmarchan/abi/v20.02/build-gcc-shared ninja -C
/home/dmarchan/abi/v20.02/build install >/dev/null
rm: cannot remove
'/home/dmarchan/abi/v20.02/build-gcc-shared/usr/local/lib/*.a': No
such file or directory

$ ls ~/abi/v20.02/build-gcc-shared/usr/local/
bin  include  lib64  share
  
Thomas Monjalon April 21, 2020, 9:22 a.m. UTC | #2
21/04/2020 09:49, David Marchand:
> On Tue, Apr 21, 2020 at 4:05 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > +                       rm $abirefdir/$targetdir/usr/local/lib/*.a
> 
> The install directory for libraries is not lib/ in all cases.
> This breaks the ABI generation for gcc-shared:
> 
> DESTDIR=/home/dmarchan/abi/v20.02/build-gcc-shared ninja -C
> /home/dmarchan/abi/v20.02/build install >/dev/null
> rm: cannot remove
> '/home/dmarchan/abi/v20.02/build-gcc-shared/usr/local/lib/*.a': No
> such file or directory
> 
> $ ls ~/abi/v20.02/build-gcc-shared/usr/local/
> bin  include  lib64  share

Is it enough to change lib to lib* ?
  
David Marchand April 21, 2020, 9:26 a.m. UTC | #3
On Tue, Apr 21, 2020 at 11:22 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 21/04/2020 09:49, David Marchand:
> > On Tue, Apr 21, 2020 at 4:05 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > > +                       rm $abirefdir/$targetdir/usr/local/lib/*.a
> >
> > The install directory for libraries is not lib/ in all cases.
> > This breaks the ABI generation for gcc-shared:
> >
> > DESTDIR=/home/dmarchan/abi/v20.02/build-gcc-shared ninja -C
> > /home/dmarchan/abi/v20.02/build install >/dev/null
> > rm: cannot remove
> > '/home/dmarchan/abi/v20.02/build-gcc-shared/usr/local/lib/*.a': No
> > such file or directory
> >
> > $ ls ~/abi/v20.02/build-gcc-shared/usr/local/
> > bin  include  lib64  share
>
> Is it enough to change lib to lib* ?

I can see only lib/ or lib64/ so ok for me.
  
Bruce Richardson April 21, 2020, 10:33 a.m. UTC | #4
On Tue, Apr 21, 2020 at 11:26:58AM +0200, David Marchand wrote:
> On Tue, Apr 21, 2020 at 11:22 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > 21/04/2020 09:49, David Marchand:
> > > On Tue, Apr 21, 2020 at 4:05 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > > > +                       rm $abirefdir/$targetdir/usr/local/lib/*.a
> > >
> > > The install directory for libraries is not lib/ in all cases.
> > > This breaks the ABI generation for gcc-shared:
> > >
> > > DESTDIR=/home/dmarchan/abi/v20.02/build-gcc-shared ninja -C
> > > /home/dmarchan/abi/v20.02/build install >/dev/null
> > > rm: cannot remove
> > > '/home/dmarchan/abi/v20.02/build-gcc-shared/usr/local/lib/*.a': No
> > > such file or directory
> > >
> > > $ ls ~/abi/v20.02/build-gcc-shared/usr/local/
> > > bin  include  lib64  share
> >
> > Is it enough to change lib to lib* ?
> 
> I can see only lib/ or lib64/ so ok for me.
> 
If it's using lib, then the .a files could be in /lib/x86_64-linux-gnu/,
rather than in lib directly.  Therefore I think it's better to use find or
similar to remove the .a files from /usr/local/:

find /usr/local -name 'librte*.a' -exec rm -f {}
  

Patch

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index e8df017596..16271e057d 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -141,10 +141,15 @@  build () # <directory> <target compiler> <meson options>
 			fi
 
 			rm -rf $abirefdir/build
-			config $abirefdir/src $abirefdir/build $*
+			config $abirefdir/src $abirefdir/build -Dexamples= $*
 			compile $abirefdir/build
 			install_target $abirefdir/build $abirefdir/$targetdir
 			$srcdir/devtools/gen-abi.sh $abirefdir/$targetdir
+
+			# save disk space by removing static libs and apps
+			rm $abirefdir/$targetdir/usr/local/lib/*.a
+			rm -rf $abirefdir/$targetdir/usr/local/bin
+			rm -rf $abirefdir/$targetdir/usr/local/share
 		fi
 
 		install_target $builds_dir/$targetdir \