5 # Copyright 2015 6WIND S.A.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
11 # * Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in
15 # the documentation and/or other materials provided with the
17 # * Neither the name of 6WIND S.A. nor the names of its
18 # contributors may be used to endorse or promote products derived
19 # from this software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 # Load config options:
36 # - ARMV8_CRYPTO_LIB_PATH
37 # - DPDK_BUILD_TEST_CONFIGS (defconfig1+option1+option2 defconfig2)
41 # - DPDK_DEP_MLX (y/[n])
42 # - DPDK_DEP_NUMA ([y]/n)
43 # - DPDK_DEP_PCAP (y/[n])
44 # - DPDK_DEP_SSL (y/[n])
45 # - DPDK_DEP_IPSEC_MB (y/[n])
46 # - DPDK_DEP_SZE (y/[n])
47 # - DPDK_DEP_ZLIB (y/[n])
48 # - DPDK_MAKE_JOBS (int)
49 # - DPDK_NOTIFY (notify-send)
52 # - LIBSSO_SNOW3G_PATH
53 # - LIBSSO_KASUMI_PATH
55 . $(dirname $(readlink -e $0))/load-devel-config
58 echo "usage: $(basename $0) [-h] [-jX] [-s] [config1 [config2] ...]]"
62 echo 'Test building several targets with different options'
69 -jX use X parallel jobs in "make"
70 -s short test only first config without tests|examples|doc
73 config: defconfig[[~][+]option1[[~][+]option2...]]
74 Example: x86_64-native-linuxapp-gcc+debug~RXTX_CALLBACKS
75 The lowercase options are defined inside $(basename $0).
76 The uppercase options can be the end of a defconfig option
77 to enable if prefixed with '+' or to disable if prefixed with '~'.
78 Default is to automatically enable most of the options.
79 The external dependencies are setup with DPDK_DEP_* variables.
80 If no config on command line, DPDK_BUILD_TEST_CONFIGS is used.
88 while getopts hj:sv ARG ; do
93 h ) print_help ; exit 0 ;;
94 ? ) print_usage ; exit 1 ;;
97 shift $(($OPTIND - 1))
98 configs=${*:-$DPDK_BUILD_TEST_CONFIGS}
104 [ "$DPDK_NOTIFY" != notify-send ] || \
105 notify-send -u low --icon=dialog-information 'DPDK build' 'finished'
106 elif [ -z "$signal" ] ; then
107 [ -z "$dir" ] || echo "failed to build $dir" >&2
108 [ "$DPDK_NOTIFY" != notify-send ] || \
109 notify-send -u low --icon=dialog-error 'DPDK build' 'failed'
112 # catch manual interrupt to ignore notification
113 trap "signal=INT ; trap - INT ; kill -INT $$" INT
114 # notify result on exit
117 cd $(dirname $(readlink -m $0))/..
121 export PATH=$default_path
123 unset DPDK_DEP_ARCHIVE
124 unset DPDK_DEP_CFLAGS
125 unset DPDK_DEP_LDFLAGS
130 unset DPDK_DEP_IPSEC_MB
133 unset ARMV8_CRYPTO_LIB_PATH
136 unset LIBSSO_SNOW3G_PATH
137 unset LIBSSO_KASUMI_PATH
138 unset LIBSSO_ZUC_PATH
139 unset PQOS_INSTALL_PATH
142 config () # <directory> <target> <options>
145 if git rev-parse 2>&- && [ -n "$(git diff HEAD~ -- config)" ] ; then
146 echo 'Default config may have changed'
149 if [ ! -e $1/.config ] || $reconfig ; then
150 echo "================== Configure $1"
151 make T=$2 O=$1 config
153 echo 'Customize configuration'
154 # Built-in options (lowercase)
155 ! echo $3 | grep -q '+default' || \
156 sed -ri 's,(RTE_MACHINE=")native,\1default,' $1/.config
157 echo $3 | grep -q '+next' || \
158 sed -ri 's,(NEXT_ABI=)y,\1n,' $1/.config
159 ! echo $3 | grep -q '+shared' || \
160 sed -ri 's,(SHARED_LIB=)n,\1y,' $1/.config
161 ! echo $3 | grep -q '+debug' || ( \
162 sed -ri 's,(RTE_LOG_DP_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config
163 sed -ri 's,(_DEBUG.*=)n,\1y,' $1/.config
164 sed -ri 's,(_STAT.*=)n,\1y,' $1/.config
165 sed -ri 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config )
167 # Automatic configuration
168 test "$DPDK_DEP_NUMA" != n || \
169 sed -ri 's,(NUMA.*=)y,\1n,' $1/.config
170 sed -ri 's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config
171 sed -ri 's,(BYPASS=)n,\1y,' $1/.config
172 test "$DPDK_DEP_ARCHIVE" != y || \
173 sed -ri 's,(RESOURCE_TAR=)n,\1y,' $1/.config
174 test "$DPDK_DEP_MLX" != y || \
175 sed -ri 's,(MLX._PMD=)n,\1y,' $1/.config
176 test "$DPDK_DEP_SZE" != y || \
177 sed -ri 's,(PMD_SZEDATA2=)n,\1y,' $1/.config
178 test "$DPDK_DEP_ZLIB" != y || \
179 sed -ri 's,(BNX2X_PMD=)n,\1y,' $1/.config
180 sed -ri 's,(NFP_PMD=)n,\1y,' $1/.config
181 test "$DPDK_DEP_PCAP" != y || \
182 sed -ri 's,(PCAP=)n,\1y,' $1/.config
183 test -z "$ARMV8_CRYPTO_LIB_PATH" || \
184 sed -ri 's,(PMD_ARMV8_CRYPTO=)n,\1y,' $1/.config
185 test "$DPDK_DEP_IPSEC_MB" != y || \
186 sed -ri 's,(PMD_AESNI_MB=)n,\1y,' $1/.config
187 test "$DPDK_DEP_IPSEC_MB" != y || \
188 sed -ri 's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
189 test -z "$LIBSSO_SNOW3G_PATH" || \
190 sed -ri 's,(PMD_SNOW3G=)n,\1y,' $1/.config
191 test -z "$LIBSSO_KASUMI_PATH" || \
192 sed -ri 's,(PMD_KASUMI=)n,\1y,' $1/.config
193 test -z "$LIBSSO_ZUC_PATH" || \
194 sed -ri 's,(PMD_ZUC=)n,\1y,' $1/.config
195 test "$DPDK_DEP_SSL" != y || \
196 sed -ri 's,(PMD_CCP=)n,\1y,' $1/.config
197 test "$DPDK_DEP_SSL" != y || \
198 sed -ri 's,(PMD_OPENSSL=)n,\1y,' $1/.config
199 test "$DPDK_DEP_SSL" != y || \
200 sed -ri 's,(PMD_QAT=)n,\1y,' $1/.config
201 test -z "$FLEXRAN_SDK" || \
202 sed -ri 's,(BBDEV_TURBO_SW=)n,\1y,' $1/.config
203 sed -ri 's,(SCHED_.*=)n,\1y,' $1/.config
204 test -z "$LIBMUSDK_PATH" || \
205 sed -ri 's,(PMD_MRVL_CRYPTO=)n,\1y,' $1/.config
206 test -z "$LIBMUSDK_PATH" || \
207 sed -ri 's,(MVPP2_PMD=)n,\1y,' $1/.config
208 build_config_hook $1 $2 $3
210 # Explicit enabler/disabler (uppercase)
211 for option in $(echo $3 | sed 's,[~+], &,g') ; do
212 pattern=$(echo $option | cut -c2-)
213 if echo $option | grep -q '^~' ; then
214 sed -ri "s,($pattern=)y,\1n," $1/.config
215 elif echo $option | grep -q '^+' ; then
216 sed -ri "s,($pattern=)n,\1y," $1/.config
222 # default empty hook to override in devel config
223 build_config_hook () # <directory> <target> <options>
228 for conf in $configs ; do
229 target=$(echo $conf | sed 's,[~+].*,,')
230 # reload config with DPDK_TARGET set
233 . $(dirname $(readlink -e $0))/load-devel-config
235 options=$(echo $conf | sed 's,[^~+]*,,')
237 config $dir $target $options
239 echo "================== Build $dir"
240 make -j$J EXTRA_CFLAGS="$maxerr $DPDK_DEP_CFLAGS" \
241 EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose O=$dir
243 echo "================== Build tests for $dir"
244 make test-build -j$J EXTRA_CFLAGS="$maxerr $DPDK_DEP_CFLAGS" \
245 EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose O=$dir
246 echo "================== Build examples for $dir"
247 export RTE_SDK=$(pwd)
248 export RTE_TARGET=$dir
249 make -j$J -sC examples \
250 EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose \
251 O=$(readlink -m $dir/examples)
253 echo "################## $dir done."
259 echo "================== Build doxygen HTML API"
260 make doc-api-html >/dev/null 2>.check/doc.txt
261 echo "================== Build sphinx HTML guides"
262 make doc-guides-html >/dev/null 2>>.check/doc.txt
263 echo "================== Check docs"
264 diff -u /dev/null .check/doc.txt