-
Notifications
You must be signed in to change notification settings - Fork 14
/
bootstrap
executable file
·622 lines (492 loc) · 18.4 KB
/
bootstrap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
#!/bin/bash
#
#******************************************************************************
# bootstrap (Seq66)
#------------------------------------------------------------------------------
##
# \file bootstrap
# \library Seq66
# \author Chris Ahlstrom
# \date 2018-11-09
# \update 2024-11-23
# \version $Revision$
# \license $XPC_SUITE_GPL_LICENSE$
#
# The above is modified by the following to remove even the mild GPL
# restrictions:
#
# Use this script in any manner whatsoever. You don't even need to give
# me any credit. However, keep in mind the value of the GPL in keeping
# software and its descendant modifications available to the community for
# all time. Runs the configure script by default.
#
# This file provides the functionality we expect to find in an autogen.sh
# script. Also see contrib/scripts/reconf, which is less comprehensive
# but more standard.
#
# Also see the helper functions in contrib/scripts/strap_functions.
#
#------------------------------------------------------------------------------
#******************************************************************************
# Provide a sane environment, just in case it is needed.
#------------------------------------------------------------------------------
LANG=C
export LANG
CYGWIN=binmode
export CYGWIN
export SEQ66_BOOTSTRAP_EDIT_DATE="2024-11-23"
export SEQ66_LIBRARY_API_VERSION="0.99"
export SEQ66_LIBRARY_VERSION="$SEQ66_LIBRARY_API_VERSION.15"
#******************************************************************************
# Version info
#------------------------------------------------------------------------------
if [ "$1" == "--version" ] || [ "$1" == "-v" ] ; then
echo "Seq66 version $SEQ66_LIBRARY_VERSION $SEQ66_BOOTSTRAP_EDIT_DATE"
exit 0
fi
#******************************************************************************
# Set up for local bootstrapping
#------------------------------------------------------------------------------
source contrib/scripts/strap_functions
if [ $? != 0 ] ; then
echo "'source strap_functions' failed. Must abort."
exit 255
fi
checkdir libseq66
#******************************************************************************
# Option settings
#------------------------------------------------------------------------------
DOAUTOCONF_ONLY="no"
DOBOOTSTRAP="yes"
DOCLEAN="no"
DOCONFIGURE="no"
DODEBUG="no"
DOFULLCLEAN="no"
DOJACK="yes"
DOMINGW="no"
DONSM="yes"
DOPORTMIDI="no"
DOPORTREFRESH="no"
DOPROFILING="no"
DORELEASE="yes"
DORTCLI="no"
DORTMIDI="no"
DOSTATIC="no"
DOTESTING="no"
DOVERSION="no"
CLANGSET=""
LOGFILENAME=""
M4DIR="m4"
#******************************************************************************
# Default boostrap build when not using Windows/MSYS2. Note that MSYS2
# autotools build support is still in progress.
#------------------------------------------------------------------------------
if [ "$MSYS2_PATH" == "" ] ; then
echo "Assuming a Linux environment..."
DORTMIDI="yes"
DOJACK="yes"
EXTRAFLAGS=""
else
echo "Assuming an MSYS2 environment..."
DOPORTMIDI="yes"
DOCONFIGURE="yes"
EXTRAFLAGS=" --enable-portmidi --disable-rtmidi"
fi
#******************************************************************************
# Help
#------------------------------------------------------------------------------
if [ "$1" == "--help" ] ; then
cat << E_O_F
Usage: ./bootstrap [options] ($SEQ66_LIBRARY_VERSION-$SEQ66_BOOTSTRAP_EDIT_DATE)
'bootstrap' sets up GNU automake and libtool support for the Seq66 project
and creates the 'configure' script. It can super-clean the project, removing
all generated files and directories. It provides options to save trouble
passing long options to the configure script for some canned setups.
--autoconf Just create the autoconf/automake setup and exit.
--clean Delete the usual derived files from the project.
--full-clean Delete all derived and configure-related files. The
bootstrap script will need to be run again.
--debug, -ed Configure for debugging and disable shared libraries for
easier debugging. Also: --enable-debug=gdb
--clang Use the clang++ compiler when bootstrapping the
configuration.
--release, -er Configure for release. Sets up a 'silent' build as well.
Equivalent to --enable-release; defaults to 'release'.
--static Do a static release build.
--portmidi, -pm Configure for qpseq66 (--enable-portmidi).
--rtmidi, -rm Configure for qseq66 (ALSA/JACK version, the default).
Implies --enable-rtmidi. The official GUI is Qt 5.
--port-refresh, -pr Enables the port-refresh feature for JACK. Will be
the default once it works.
--disable-jack, -dj Disables JACK support, enables rtmidi.
--no-metadata Disable JACK metadata support.
--cli, -cli Configure for seq66cli (command-line rtmidi version).
--both Build qseq66 and seq66cli in one pass.
--no-nsm Disable Non Session Manager support. Saves some code.
--profile, -prof Enable profiling and debugging.
--help Show this help text.
There are other options too rare to document here. Read the bootstrap script.
The default (no options) bootstraps the project (e.g. runs 'autoheader'.)
Then one must run 'configure', which sets up for a normal release build.
A common option for 'bootstrap' is --enable-debug (-ed), which adds
--disable-shared and sets up the configure script for debugging without
needing "libtool --mode=execute gdb qseq66". The most common command
sequence would be:
$ ./bootstrap -er
$ make &> make.log
E_O_F
exit 1
fi
#******************************************************************************
# Brute-force options loop
#------------------------------------------------------------------------------
if [ $# -ge 1 ] ; then
while [ "$1" != "" ] ; do
case "$1" in
--autoconf)
DOAUTOCONF_ONLY="yes"
DOCONFIGURE="no"
;;
--no-bootstrap | -nb)
DOBOOTSTRAP="no"
DOCONFIGURE="no"
;;
--clean | clean)
DOBOOTSTRAP="no"
DOCONFIGURE="no"
DOCLEAN="yes"
;;
--full-clean | --super-clean)
DOBOOTSTRAP="no"
DOCONFIGURE="no"
DOFULLCLEAN="yes"
DOCLEAN="yes"
;;
--debug | -ed | --enable-debug)
DODEBUG="yes"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --disable-shared --enable-static"
;;
--clang)
DOCONFIGURE="yes"
CLANGSET="CC=clang CXX=clang++"
;;
--profile | -prof | --prof)
DODEBUG="yes"
DOPROFILING="yes"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --enable-profile --disable-shared"
;;
--release | -er | --enable-release)
DORELEASE="yes"
DOCONFIGURE="yes"
;;
--static)
DORELEASE="yes"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --disable-shared --enable-static"
;;
--no-nsm)
DONSM="no"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --disable-nsm"
;;
--portmidi | -pm | --pm)
DOPORTMIDI="yes"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --enable-portmidi --disable-rtmidi"
;;
--rtmidi | -rm | --rm)
DORTMIDI="yes"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --enable-rtmidi"
;;
--port-refresh | -pr | --pr)
DOPORTREFRESH="yes"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --enable-port-refresh"
;;
--disable-jack | -dj)
DOJACK="no"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --disable-jack --enable-rtmidi"
;;
--no-metadata | --disable-jack-metadata)
DOCONFIGURE="yes"
EXTRAFLAGS+=" --disable-jack-metadata"
;;
--cli | -cli)
DORTCLI="yes"
DORELEASE="yes"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --enable-cli"
;;
--both | -both)
DORTCLI="yes"
DORELEASE="yes"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --enable-rtmidi --enable-both"
;;
--testing | -stt)
DOTESTING="yes"
DOCONFIGURE="yes"
EXTRAFLAGS+=" --enable-testing"
;;
--version)
DOVERSION="yes"
DOBOOTSTRAP="no"
;;
*)
echo "? Unsupported bootstrap option $1; --help for more information"
exit $EXIT_ERROR_NO_SUCH_OPTION
;;
esac
shift
done
fi
if [ "$EXTRAFLAGS" == "" ] ; then
EXTRAFLAGS="--enable-rtmidi"
fi
echo "EXTRAFLAGS = $EXTRAFLAGS"
#******************************************************************************
# Implement the clean option.
#------------------------------------------------------------------------------
#
# This goes well beyond "make clean" and "make distclean". It cleans
# out /everything/ that gets created by bootstrapping and building the
# library and test application.
#
#------------------------------------------------------------------------------
if [ $DOCLEAN == "yes" ] ; then
make clean
clean_gnufiles
clean_tempfiles
clean_m4
clean_qt5files
rm -f include/seq66-config.h
echo " Config, GNU, temp, m4, and Qt 5 generated files removed."
fi
if [ $DOFULLCLEAN == "yes" ] ; then
rm -rf config
rm -f include/config.h
rm -f include/stamp-h1
rm -f include/seq66-config.h
rm -rf po
clean_debfiles
echo " All junk files removed."
fi
if [ $DOBOOTSTRAP == "yes" ] ; then
#************************************************************************
# Set up GNU Autotools
#------------------------------------------------------------------------
AUTOMAKE_BAD=no
INSTALL_BAD=no
ACVERSION=
ACLOCAL=aclocal${ACVERSION}
AUTOCONF=autoconf
AUTOHEADER=autoheader
AUTOMAKE=automake
LIBTOOLIZE=libtoolize
# Exit if a simple command exits with a non-zero status.
set -e
# After expanding a simple command, display PS4 and the command with its
# expanded arguments. This setting makes any error messages too
# difficult to read:
#
# set -x
# Check Autoconf version and perform clean ups if all is well.
if [ -x `which autoconf` ] ; then
AC_VER=`autoconf --version | head -1 | sed 's/^[^0-9]*//'`
AC_VER_MAJOR=`echo $AC_VER | cut -f1 -d'.'`
AC_VER_MINOR=`echo $AC_VER | cut -f2 -d'.' | sed 's/[^0-9]*$//'`
if [ "$AC_VER_MAJOR" -lt "2" ] ; then
echo
echo "Autoconf 2.13 or greater may be needed to build configure."
echo "Edit the bootstrap file to ignore this test, if desired."
echo
exit $EXIT_ERROR_AUTOCONF_VERSION
fi
if [ "$AC_VER_MINOR" -lt "13" ] ; then
echo
echo "Autoconf 2.13 or greater may be needed to build configure."
echo "Edit the bootstrap file to ignore this test, if desired."
echo
exit $EXIT_ERROR_AUTOCONF_VERSION_2
fi
if [ "$AC_VER_MINOR" -lt "50" ] ; then
if [ -e configure.ac ] ; then
if [ ! -e configure.in ] ; then
ln -s configure.ac configure.in
fi
fi
echo "Some warnings about cross-compiling are normal."
else
rm -f configure.in
if [ $DOCONFIGURE == "yes" ] ; then
if [ -x configure ] ; then
echo The Seq66 configure script already exists. Replacing it.
fi
fi
fi
else
cat << E_O_F
The GNU autoconf application was not found. This project requires GNU
autoconf (and automake, and ac-autoconf-archive) in order to
bootstrap itself.
E_O_F
exit $EXIT_ERROR_AUTOCONF_VERSION_3
fi
# Check for automake.
amvers="none"
if automake-1.8 --version >/dev/null 2>&1; then
amvers="-1.8"
# If we also have 1.6 (>> 1.6.1), use it instead because it is faster
if automake-1.6 --version >/dev/null 2>&1; then
if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
amvers="-1.6"
fi
fi
elif automake-1.7 --version >/dev/null 2>&1; then
amvers="-1.7"
# If we also have 1.6 (>> 1.6.1), use it instead because it is faster
if automake-1.6 --version >/dev/null 2>&1; then
if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
amvers="-1.6"
fi
fi
elif automake-1.6 --version >/dev/null 2>&1; then
amvers="-1.6"
if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
AUTOMAKE_BAD=yes
fi
elif automake-1.5 --version >/dev/null 2>&1; then
INSTALL_BAD=yes
amvers="-1.5"
elif automake --version > /dev/null 2>&1; then
amvers=""
case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
0|0.*|1|1.[01234]|1.[01234][-.]*)
amvers="none" ;;
1.5|1.5.*)
INSTALL_BAD=yes ;;
1.6|1.6.0|1.6.1)
AUTOMAKE_BAD=yes ;;
esac
fi
#******************************************************************************
# Check for the installation of the GNU gettext facility.
# Autopoint is available from 0.11.3, but we need at least 0.11.5
#------------------------------------------------------------------------------
# Check for pkg-config
if pkg-config --version >/dev/null 2>&1; then
PKGCONFIG=yes
else
PKGCONFIG=no
fi
#************************************************************************
# Create config and m4 directories. Note that they might be empty for
# this project. Also create an include directory, mainly for "config.h"
# stuff.
#------------------------------------------------------------------------
mkdir -p aux-files
mkdir -p config
mkdir -p m4
mkdir -p po
mkdir -p include
#************************************************************************
# Call a number of "auto" programs in the strict order shown below. Note:
# Earlier versions of auto-tools don't ignore duplicate definitions of
# macros. (The system normally provides m4 macros in /usr/share/aclocal,
# but the project also provides them in the project's m4 directory.)
#------------------------------------------------------------------------
# We still need to make aux-files/config.rpath and some other files
# available, since they are listed in configure.ac, and not provided by
# autoconf:
cp contrib/config.rpath aux-files
run_cmd ${ACLOCAL} -I ${M4DIR} --install
run_cmd ${AUTOCONF}
run_cmd ${AUTOHEADER}
# The LT_INIT macro of libtool 2.0 (formerly called AC_PROG_LIBTOOL)
# would do this, but Debian ships with version 1.5 libtool, so we have
# to do things the old-fashioned way.
run_cmd ${LIBTOOLIZE} --automake --force --copy
run_cmd ${AUTOMAKE} --foreign --add-missing --copy
# Automake seems to need this one, but doesn't provide it!
cp contrib/mkinstalldirs-1.10 aux-files/mkinstalldirs
if [ $DOAUTOCONF_ONLY == "yes" ] ; then
echo "Autoconf is set up, exiting..."
exit 0
fi
# At this point, remove files which always need to be regenerated.
# Right now, this is done with the --clean option.
case "$PKGCONFIG" in
yes) ;;
no) cat << E_O_F
=============================================================================
NOTE: The "pkg-config" utility is not installed on your system; detection of
the gtk-2.0 and GNOME 2.0 libraries will not be reliable.
E_O_F
;;
esac
case "$AUTOMAKE_BAD" in
no) ;;
yes) cat << E_O_F
=============================================================================
NOTE: Your version of automake has a bug which prevents proper plugin
compilation. Either compile Seq66 with the --disable-plugins flag, or
use a version of automake newer than 1.6.1 (1.6.2 is OK, and so are
the 1.5 series).
E_O_F
;;
esac
case "$INSTALL_BAD" in
no) ;;
yes) cat << E_O_F
=============================================================================
NOTE: Your version of automake has a bug which prevents proper installation.
Do not use "make install" with this version of automake, or use a
version of automake newer than 1.5 (such as 1.6 or 1.7).
E_O_F
;;
esac
if [ -x /usr/bin/dot ] ; then
echo "Graphviz package found, can build diagrams in Doxygen."
else
echo "! To build the documentation, you need to install graphviz."
fi
if [ -x /usr/bin/doxygen ] ; then
echo "Doxygen package found, can build the reference manual."
else
echo "! To build the documentation, you need to install doxygen."
fi
echo "Bootstrap complete at `date`" >> bootstrap.stamp
#************************************************************************
# --configure
#------------------------------------------------------------------------
if [ "$DOBOOTSTRAP" == "yes" ] ; then
echo "Bootstrapping enabled...."
if [ "$DOCONFIGURE" == "yes" ] ; then
if [ "$DODEBUG" == "yes" ] ; then
echo "Running '$CLANGSET ./configure --enable-debug=gdb $EXTRAFLAGS'"
env $CLANGSET ./configure --enable-debug=gdb $EXTRAFLAGS
elif [ "$DORELEASE" == "yes" ] ; then
echo "Running '$CLANGSET ./configure --enable-silent-rules $EXTRAFLAGS'"
env $CLANGSET ./configure --enable-silent-rules $EXTRAFLAGS
echo "Running 'make V=1' will turn on full command output."
fi
else
cat << E_O_F
Run './configure' to configure Seq66 for compilation, or
'./configure --help' for configuration options. Useful options:
--enable-debug=gdb --enable-calls --disable-shared --enable-silent-rules
--enable-rtmidi (default) --enable-cli (no GUI) --enable-portmidi
--enable-both (both Qt and CLI versions)
E_O_F
fi
fi
fi
#******************************************************************************
# bootstrap (Seq66)
#------------------------------------------------------------------------------
# vim: ts=3 sw=3 wm=4 et ft=sh
#------------------------------------------------------------------------------