xref: /freebsd/contrib/bc/build.gaml (revision fdc4a7c8012b214986cfa2e2fb6d99731f004b1b)
1/*
2 * *****************************************************************************
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 *
6 * Copyright (c) 2018-2025 Gavin D. Howard and contributors.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * * Redistributions of source code must retain the above copyright notice, this
12 *   list of conditions and the following disclaimer.
13 *
14 * * Redistributions in binary form must reproduce the above copyright notice,
15 *   this list of conditions and the following disclaimer in the documentation
16 *   and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 *
30 * *****************************************************************************
31 *
32 * The build options file.
33 *
34 */
35
36project: @com.gavinhoward.bc
37
38language: @C11
39
40version: {
41	min: @24.04.05
42}
43
44mode: {
45	language: @iterative
46	stampers: @metadata
47	dependencies: @dynamic
48}
49
50default_target: @all
51
52presets: {
53	debug: {
54		debug: true
55		optimization: "0"
56		memcheck: true
57		devtools: true
58		strip: false
59	}
60	release: {
61		optimization: "3"
62		lto: true
63	}
64	// This is the predefined build for BSDs.
65	bsd: {
66		optimization: "3"
67		history: @editline
68		generated_tests: false
69		install_manpages: false
70		install_locales: @system
71		strip: true
72		bc_default_banner: false
73		bc_default_sigint_reset: true
74		dc_default_sigint_reset: true
75		bc_default_tty_mode: true
76		dc_default_tty_mode: false
77		bc_default_prompt: @off
78		dc_default_prompt: @off
79		bc_default_expr_exit: true
80		dc_default_expr_exit: true
81		bc_default_digit_clamp: false
82		dc_default_digit_clamp: false
83	}
84	// This is the predefined build to match the GNU bc/dc.
85	gnu: {
86		optimization: "3"
87		generated_tests: false
88		install_manpages: true
89		install_locales: @system
90		strip: true
91		bc_default_banner: true
92		bc_default_sigint_reset: true
93		dc_default_sigint_reset: false
94		bc_default_tty_mode: true
95		dc_default_tty_mode: false
96		bc_default_prompt: @tty_mode
97		dc_default_prompt: @tty_mode
98		bc_default_expr_exit: true
99		dc_default_expr_exit: true
100		bc_default_digit_clamp: false
101		dc_default_digit_clamp: false
102	}
103	// This is the preferred release build of the author, Gavin D. Howard.
104	gdh: {
105		optimization: "3"
106		install_manpages: true
107		install_locales: @none
108		bc/default_banner: true
109		bc/default_sigint_reset: true
110		dc/default_sigint_reset: true
111		bc/default_tty_mode: true
112		dc/default_tty_mode: true
113		bc/default_prompt: @tty_mode
114		dc/default_prompt: @tty_mode
115		bc/default_expr_exit: false
116		dc/default_expr_exit: false
117		bc/default_digit_clamp: true
118		dc/default_digit_clamp: true
119	}
120	// This is the preferred debug build of the author, Gavin D. Howard.
121	dbg: {
122		optimization: "0"
123		debug: true
124		strip: false
125		install_manpages: true
126		install_locales: @system
127		bc/default_banner: true
128		bc/default_sigint_reset: true
129		dc/default_sigint_reset: true
130		bc/default_tty_mode: true
131		dc/default_tty_mode: true
132		bc/default_prompt: @tty_mode
133		dc/default_prompt: @tty_mode
134		bc/default_expr_exit: false
135		dc/default_expr_exit: false
136		bc/default_digit_clamp: true
137		dc/default_digit_clamp: true
138	}
139}
140
141default_development: @debug
142default_release: @release
143
144options: {
145	build_mode: {
146		type: @option
147		options: [
148			@both
149			@bc
150			@dc
151			@library
152		]
153		default: @both
154		desc: "Which of the executables or library to build."
155	}
156	extra_math: {
157		type: @bool
158		default: true
159		desc: "Enable the extra math extensions."
160	}
161	history: {
162		type: @option
163		options: [
164			@none
165			@builtin
166			@editline
167			@readline
168		]
169		default: @builtin
170		desc: "Which history implementation should be used, if any."
171	}
172	locales: {
173		type: @option
174		options: [
175			@none
176			@system
177			@all
178		]
179		default: @system
180		desc: "Whether to disable locales, use just the system ones, or use all (for building a package)."
181	}
182	bc/default_banner: {
183		type: @bool
184		default: false
185		desc: "Whether to display the bc version banner by default when in interactive mode."
186	}
187	bc/default_sigint_reset: {
188		type: @bool
189		default: true
190		desc: "Whether SIGINT will reset bc by default, instead of exiting, when in interactive mode."
191	}
192	dc/default_sigint_reset: {
193		type: @bool
194		default: true
195		desc: "Whether SIGINT will reset dc by default, instead of exiting, when in interactive mode."
196	}
197	bc/default_tty_mode: {
198		type: @bool
199		default: true
200		desc: "Whether TTY mode for bc should be on by default when available."
201	}
202	dc/default_tty_mode: {
203		type: @bool
204		default: false
205		desc: "Whether TTY mode for dc should be on by default when available."
206	}
207	bc/default_prompt: {
208		type: @option
209		options: [
210			@off
211			@tty_mode
212			@on
213		]
214		default: @tty_mode
215		desc: "Whether the prompt for bc should be on by default in TTY mode. This defaults to match TTY mode."
216	}
217	dc/default_prompt: {
218		type: @option
219		options: [
220			@off
221			@tty_mode
222			@on
223		]
224		default: @tty_mode
225		desc: "Whether the prompt for dc should be on by default in TTY mode. This defaults to match TTY mode."
226	}
227	bc/default_expr_exit: {
228		type: @bool
229		default: true
230		desc: "Whether to exit bc by default if an expression or expression file is given with the -e or -f options."
231	}
232	dc/default_expr_exit: {
233		type: @bool
234		default: true
235		desc: "Whether to exit dc by default if an expression or expression file is given with the -e or -f options."
236	}
237	bc/default_digit_clamp: {
238		type: @bool
239		default: false
240		desc: "Whether to have bc, by default, clamp digits that are greater than or equal to the current ibase when parsing numbers."
241	}
242	dc/default_digit_clamp: {
243		type: @bool
244		default: false
245		desc: "Whether to have dc, by default, clamp digits that are greater than or equal to the current ibase when parsing numbers."
246	}
247	karatsuba_len: {
248		type: @num
249		default: 32
250		desc: "Set the Karatsuba length (default is 32). Must be a number and greater than or equal to 16."
251	}
252	execprefix: {
253		type: @string
254		default: ""
255		desc: "The prefix to prepend to the executable names, to prevent collisions."
256	}
257	execsuffix: {
258		type: @string
259		default: ""
260		desc: "The suffix to append to the executable names, to prevent collisions."
261	}
262	debug: {
263		type: @bool
264		default: false
265		desc: "Enable debug info."
266	}
267	optimization: {
268		type: @string
269		default: "0"
270		desc: "The optimization level for the C compiler."
271	}
272	lto: {
273		type: @bool
274		default: false
275		desc: "Build with link-time optimization, if available."
276	}
277	strip: {
278		type: @bool
279		default: true
280		desc: "Strip any binaries."
281	}
282	strict: {
283		type: @bool
284		default: true
285		desc: "Build with strict compiler options."
286	}
287	force: {
288		type: @bool
289		default: false
290		desc: "Force options that don't work. THIS IS FOR DEV ONLY!"
291	}
292	memcheck: {
293		type: @bool
294		default: false
295		desc: "Enable memcheck mode, to check for memory leaks."
296	}
297	valgrind: {
298		type: @bool
299		default: false
300		desc: "Enable Valgrind mode, to check for memory bugs."
301	}
302	afl: {
303		type: @bool
304		default: false
305		desc: "Enable AFL++ mode."
306	}
307	ossfuzz: {
308		type: @bool
309		default: false
310		desc: "Enable OSSFUZZ mode."
311	}
312	generated_tests: {
313		type: @bool
314		default: true
315		desc: "Enable tests generated from a GNU bc-compatible program."
316	}
317	problematic_tests: {
318		type: @bool
319		default: true
320		desc: "Enable tests that may be problematic."
321	}
322	coverage: {
323		type: @bool
324		default: false
325		desc: "Enable code coverage (only works on GCC)."
326	}
327	install_manpages: {
328		type: @bool
329		default: true
330		desc: "Whether to install manpages or not."
331	}
332	cflags: {
333		type: @list
334		default: []
335		desc: "The command-line flags for the C compiler."
336	}
337	ldflags: {
338		type: @list
339		default: []
340		desc: "The command-line flags for the C linker."
341	}
342	destdir: {
343		type: @path
344		default: ""
345		desc: "The equivalent of $DESTDIR in other build systems."
346	}
347	prefix: {
348		type: @path
349		default: "/usr/local"
350		desc: "The default prefix to install everything into."
351	}
352	bindir: {
353		type: @path
354		default: ""
355		desc: "The directory to install executables into. Defaults to \"$prefix/bin\"."
356	}
357	libdir: {
358		type: @path
359		default: ""
360		desc: "The directory to install libraries into. Defaults to \"$prefix/lib\"."
361	}
362	includedir: {
363		type: @path
364		default: ""
365		desc: "The location to install headers in. Defaults to \"$prefix/include\"."
366	}
367	nlspath: {
368		type: @path
369		default: "/usr/share/locale/%L/%N"
370		desc: "The location to install locales."
371	}
372	pc_path: {
373		type: @path
374		default: ""
375		desc: "The location to pkg-config files to. Defaults to the output of `pkg-config --variable=pc_path pkg-config`."
376	}
377	datarootdir: {
378		type: @path
379		default: ""
380		desc: "The root directory for data files. Defaults to `$prefix/share`."
381	}
382	datadir: {
383		type: @path
384		default: ""
385		desc: "The directory for data files. Defaults to `$datarootdir`."
386	}
387	mandir: {
388		type: @path
389		default: ""
390		desc: "The root directory for manpages. Defaults to `$datadir/man`."
391	}
392	man1dir: {
393		type: @path
394		default: ""
395		desc: "The directory for manpages in section 1. Defaults to `$mandir/man1`."
396	}
397	man3dir: {
398		type: @path
399		default: ""
400		desc: "The directory for manpages in section 3. Defaults to `$mandir/man3`."
401	}
402}
403