~m-grant-prg/acmbuild/jammy

« back to all changes in this revision

Viewing changes to bootstrap.sh

  • Committer: Mark Grant
  • Date: 2022-08-29 08:33:32 UTC
  • mfrom: (100.1.4 jammy-trunk)
  • Revision ID: m.grant.prg@gmail.com-20220829083332-hj20nb2wilq39mi9
Merge from jammy-trunk.

New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#                               [ -b || --build ] ||                    #
23
23
#                               [ -c || --config ] ||                   #
24
24
#                               [ -C || --distcheck ] ||                #
 
25
#                               [       --CC] ||                        #
25
26
#                               [ -d || --debug ] ||                    #
26
27
#                               [ -D || --dist ] ||                     #
27
28
#                               [ -g || --gnulib ] ||                   #
28
29
#                               [ -h || --help ] ||                     #
29
30
#                               [ -H || --header-check ] ||             #
 
31
#                               [ -i || --iwyu ] ||                     #
30
32
#                               [ -K || --check ] ||                    #
31
33
#                               [ -m || --menu-config ] ||              #
32
34
#                               [ -p || --parallel-jobs ] ||            #
156
158
#                               from configurable-options.sh            #
157
159
# 21/11/2021    MG      1.4.10  Tighten SPDX tag.                       #
158
160
# 07/06/2022    MG      1.5.1   Add compiler option -A --analyzer.      #
 
161
# 28/08/2022    MG      1.5.2   Add --CC option for compiler. Same as   #
 
162
#                               bootstrap.sh -c . -- CC=clang           #
 
163
#                               Add option for include-what-you-use.    #
159
164
#                                                                       #
160
165
#########################################################################
161
166
 
164
169
# Init variables #
165
170
##################
166
171
 
167
 
readonly version=1.5.1                  # set version variable
168
 
readonly packageversion=1.3.13-2-g434aead6108a  # Version of the complete package
 
172
readonly version=1.5.2                  # set version variable
 
173
readonly packageversion=1.4.1-4-g43faa4806e08   # Version of the complete package
169
174
 
170
175
# Set defaults
171
176
atonly=""
172
177
analyzer=""
173
178
build=false
 
179
cc=""
174
180
check=false
175
181
config=false
176
182
debug=""
178
184
distcheck=false
179
185
gnulib=false
180
186
headercheck=""
 
187
iwyu=false
181
188
menuconfig=false
182
189
par_jobs=""
183
190
sparse=""
211
218
        -b or --build make the project
212
219
        -c or --config congigure the project
213
220
        -C or --distcheck perform normal distcheck
 
221
              --CC=compiler Compiler to use, eg gcc, clang etc
214
222
        -d or --debug build with appropriate debug flags
215
223
        -D or --dist perform a make dist
216
224
        -g or --gnulib run gnulib-tool --update
217
225
        -h or --help displays usage information
218
226
        -H or --header-check show include stack depth
 
227
        -i or --iwyu Use clang's include-what-you-use
219
228
        -K or --check run make check
220
229
        -m or --menu-config Invoke menu of configurable options
221
230
        -p[X] or --parallel-jobs[=X] number of jobs to pass to make as --jobs=
289
298
        local script_name="acmbuild.sh/bootstrap.sh"
290
299
        local tmp
291
300
 
292
 
        tmp="getopt -o aAbcCdDghHKmp::stTvV "
293
 
        tmp+="--long at-only,analyzer,build,check,config,distcheck,debug,dist"
294
 
        tmp+=",gnulib,help,header-check,menu-config,parallel-jobs::,sparse"
295
 
        tmp+=",source-tarball,testing-hacks,verbose,version"
 
301
        tmp="getopt -o aAbcCdDghHiKmp::stTvV "
 
302
        tmp+="--long at-only,analyzer,build,CC:,check,config,distcheck,debug"
 
303
        tmp+=",dist,gnulib,help,header-check,iwyu,menu-config,parallel-jobs::"
 
304
        tmp+=",sparse,source-tarball,testing-hacks,verbose,version"
296
305
        GETOPTTEMP=$($tmp -n "$script_name" -- "$@")
297
306
        std_cmd_err_handler $?
298
307
 
333
342
                        distcheck=true
334
343
                        shift
335
344
                        ;;
 
345
                --CC)
 
346
                        cc=" CC=$2"
 
347
                        shift 2
 
348
                        ;;
336
349
                -d|--debug)
337
350
                        debug=" --enable-debug=yes"
338
351
                        shift
360
373
                        headercheck=" --enable-headercheck=yes"
361
374
                        shift
362
375
                        ;;
 
376
                -i| --iwyu)
 
377
                        iwyu=true
 
378
                        shift
 
379
                        ;;
363
380
                -K|--check)
364
381
                        if $distcheck || $dist || $tarball; then
365
382
                                msg="Options C, D, K and T are mutually "
427
444
                esac
428
445
        done
429
446
 
430
 
        if [[ $atonly || $analyzer || $debug || $headercheck || $sparse \
431
 
                || $testinghacks ]] || $verbose ; then
 
447
        if [[ $atonly || $analyzer || $cc || $debug || $headercheck \
 
448
                || $sparse || $testinghacks ]] || $verbose ; then
432
449
                if ! $config ; then
433
 
                        msg="Options a, A, d, H, s, t and v require option c."
434
 
                        output "$msg" 1
435
 
                        script_exit 64
436
 
                fi
 
450
                        msg="Options a, A, CC, d, H, s, t and v require"
 
451
                        msg+=" option c."
 
452
                        output "$msg" 1
 
453
                        script_exit 64
 
454
                fi
 
455
        fi
 
456
 
 
457
        # include-what-you-use cannot be used with a number of other options.
 
458
        if [[ $atonly || $analyzer || $cc || $debug || $headercheck \
 
459
                || $sparse || $testinghacks ]] || $build || $check || $dist \
 
460
                || $distcheck || $gnulib || $menuconfig || $tarball \
 
461
                || $verbose ; then
 
462
                if $iwyu ; then
 
463
                        msg="Options a, A, b, C, CC, d, D, g, H, k, m, s, t"
 
464
                        msg+=", T and v cannot be used with option i"
 
465
                        output "$msg" 1
 
466
                        script_exit 64
 
467
                fi
 
468
        fi
 
469
 
 
470
        # Sparse and CC conflict, both setting the CC variable.
 
471
        if [[ $cc && $sparse ]]; then
 
472
                msg="Options CC and s are mutually exclusive."
 
473
                output "$msg" 1
 
474
                script_exit 64
437
475
        fi
438
476
 
439
477
        # One option has to be selected.
440
478
        if ! $build && ! $check && ! $config && ! $distcheck && ! $dist \
441
 
                && ! $gnulib && ! $tarball ; then
442
 
                output "Either b, c, C, D, g, K or T must be set." 1
 
479
                && ! $gnulib && ! $iwyu && ! $tarball ; then
 
480
                output "Either b, c, C, D, g, i, K or T must be set." 1
443
481
                script_exit 64
444
482
        fi
445
483
 
525
563
        output "$msg" $status
526
564
        std_cmd_err_handler $status
527
565
 
528
 
        cmdline="$basedir/configure$configcli_extra_args$verboseconfig"
 
566
        cmdline="$basedir/configure$cc$configcli_extra_args$verboseconfig"
529
567
        cmdline+="$atonly$analyzer$debug$headercheck$sparse$testinghacks"
530
568
 
531
569
        eval "$cmdline"
561
599
                cmdline="make"$verbosemake$par_jobs" dist clean"
562
600
        fi
563
601
 
 
602
        if $iwyu ; then
 
603
                cmdline="make -k CC=include-what-you-use$par_jobs"
 
604
        fi
 
605
 
564
606
        if $tarball ; then
565
607
                cmdline="make"$verbosemake$par_jobs" srctarball clean"
566
608
        fi