Skip to contentSkip to conversation

devtools: reduce examples in static builds

PATCH Superseded Thomas Monjalon 2 participants 7 messages Apr 18, 2020 – Apr 21, 2020 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: reduce examples in static builds

Static builds can take a lot of space, so reduce the number of examples built when testing those static builds.

As makefile-based build is close to end of life, completely skip examples in case of static linkage with make.

---
 devtools/test-build.sh        | 1 +
 devtools/test-meson-builds.sh | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
devtools/test-build.sh +1 -0
index e6e40588c6..a298115002 100755
@@ -257,6 +257,7 @@ for conf in $configs ; do
 	echo "================== Build examples for $conf"
 	export RTE_SDK=$(readlink -f $dir)/install/share/dpdk
 	ln -sTf $(pwd)/lib $RTE_SDK/lib # workaround for vm_power_manager
+	grep -q 'SHARED_LIB=n' $dir/.config || # skip examples with static libs
 	${MAKE} -j$J -sC examples \
 		EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose \
 		O=$(readlink -f $dir)/examples
devtools/test-meson-builds.sh +6 -1
index c1ff2bb50a..b1c0380809 100755
@@ -74,7 +74,12 @@ config () # <dir> <builddir> <meson options>
 		return
 	fi
 	options=
-	options="$options --werror -Dexamples=all"
+	options="$options --werror"
+	if echo $* | grep -qw -- '--default-library=static' ; then
+		options="$options -Dexamples=l3fwd"
+	else
+		options="$options -Dexamples=all"
+	fi
 	options="$options --buildtype=debugoptimized"
 	for option in $DPDK_MESON_OPTIONS ; do
 		options="$options -D$option"
Signature · 1 line
2.26.0
#1 lore raw
Quoted 30 lines · Thomas Monjalon

Static builds can take a lot of space, so reduce the number of examples built when testing those static builds.

As makefile-based build is close to end of life, completely skip examples in case of static linkage with make.

---
 devtools/test-build.sh        | 1 +
 devtools/test-meson-builds.sh | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
devtools/test-build.sh +1 -0
index e6e40588c6..a298115002 100755
@@ -257,6 +257,7 @@ for conf in $configs ; do
        echo "================== Build examples for $conf"
        export RTE_SDK=$(readlink -f $dir)/install/share/dpdk
        ln -sTf $(pwd)/lib $RTE_SDK/lib # workaround for vm_power_manager
+       grep -q 'SHARED_LIB=n' $dir/.config || # skip examples with static libs
        ${MAKE} -j$J -sC examples \
                EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose \
                O=$(readlink -f $dir)/examples
devtools/test-meson-builds.sh +0 -0
index c1ff2bb50a..b1c0380809 100755

devtools/test-meson-builds.sh config () # <dir> <builddir> <meson options> · line 82

Quoted 10 lines
devtools/test-meson-builds.sh +6 -1
@@ -74,7 +74,12 @@ config () # <dir> <builddir> <meson options>
                return
        fi
        options=
-       options="$options --werror -Dexamples=all"
+       options="$options --werror"
+       if echo $* | grep -qw -- '--default-library=static' ; then
+               options="$options -Dexamples=l3fwd"
+       else
+               options="$options -Dexamples=all"
+       fi

Ok, this is hypothetical, but this would not work when no default-library option is passed (static is the default value). How about inverting the check and look for default-library=shared ?

Besides, you won't catch already configured directories. While for make environments, this change will have an effect right away.

Signature · 1 line
David Marchand
#2 lore raw

19/04/2020 09:08, David Marchand:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines
devtools/test-meson-builds.sh +1 -1
-       options="$options --werror -Dexamples=all"
+       options="$options --werror"
Quoted 8 lines

devtools/test-meson-builds.sh config () # <dir> <builddir> <meson options> · line 82

Quoted 5 lines
devtools/test-meson-builds.sh +5 -0
+       if echo $* | grep -qw -- '--default-library=static' ; then
+               options="$options -Dexamples=l3fwd"
+       else
+               options="$options -Dexamples=all"
+       fi

Ok, this is hypothetical, but this would not work when no default-library option is passed (static is the default value).

No, with meson, shared is the default:
https://mesonbuild.com/Builtin-options.html#core-options

Quoted 4 lines

How about inverting the check and look for default-library=shared ?

Besides, you won't catch already configured directories. While for make environments, this change will have an effect right away.

Yes, I think it is OK to keep old configuration in meson builds until the build directories are trashed.

#3 lore raw

19/04/2020 16:29, Thomas Monjalon:

Quoted 15 lines

19/04/2020 09:08, David Marchand:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines
devtools/test-meson-builds.sh +1 -1
-       options="$options --werror -Dexamples=all"
+       options="$options --werror"
Quoted 8 lines

devtools/test-meson-builds.sh config () # <dir> <builddir> <meson options> · line 82

Quoted 5 lines
devtools/test-meson-builds.sh +5 -0
+       if echo $* | grep -qw -- '--default-library=static' ; then
+               options="$options -Dexamples=l3fwd"
+       else
+               options="$options -Dexamples=all"
+       fi

Ok, this is hypothetical, but this would not work when no default-library option is passed (static is the default value).

Quoted 2 lines

No, with meson, shared is the default:
https://mesonbuild.com/Builtin-options.html#core-options

Thanks to an offline explanation, it appears I'm wrong.
The default value is changed in our root meson.build file:
default_options: ['buildtype=release', 'default_library=static'],

Quoted 1 line
Quoted 1 line

How about inverting the check and look for default-library=shared ?

Yes I will invert the check in v2.

Quoted 5 lines
Quoted 2 lines

Besides, you won't catch already configured directories. While for make environments, this change will have an effect right away.

Yes, I think it is OK to keep old configuration in meson builds until the build directories are trashed.

#4 lore raw

PATCH v2 1/1 devtools: reduce examples in static builds

In reply to Thomas Monjalon

Static builds can take a lot of space, so reduce the number of examples built when testing those static builds.

As makefile-based build is close to end of life, completely skip examples in case of static linkage with make.

---

v2: invert logic with meson because static is the default

---
 devtools/test-build.sh        | 1 +
 devtools/test-meson-builds.sh | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
devtools/test-build.sh +1 -0
index e6e40588c6..a298115002 100755
@@ -257,6 +257,7 @@ for conf in $configs ; do
 	echo "================== Build examples for $conf"
 	export RTE_SDK=$(readlink -f $dir)/install/share/dpdk
 	ln -sTf $(pwd)/lib $RTE_SDK/lib # workaround for vm_power_manager
+	grep -q 'SHARED_LIB=n' $dir/.config || # skip examples with static libs
 	${MAKE} -j$J -sC examples \
 		EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose \
 		O=$(readlink -f $dir)/examples
devtools/test-meson-builds.sh +6 -1
index c1ff2bb50a..e8df017596 100755
@@ -74,7 +74,12 @@ config () # <dir> <builddir> <meson options>
 		return
 	fi
 	options=
-	options="$options --werror -Dexamples=all"
+	options="$options --werror"
+	if echo $* | grep -qw -- '--default-library=shared' ; then
+		options="$options -Dexamples=all"
+	else
+		options="$options -Dexamples=l3fwd" # save disk space
+	fi
 	options="$options --buildtype=debugoptimized"
 	for option in $DPDK_MESON_OPTIONS ; do
 		options="$options -D$option"
Signature · 1 line
2.26.0