Skip to content

Commit

Permalink
[build] Add --ldflags to _build/oils.sh
Browse files Browse the repository at this point in the history
Based on Zulip feedback.
  • Loading branch information
Andy C committed Jan 22, 2025
1 parent fd1942c commit 8529f0f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build/ninja_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def ShellFunctions(cc_sources, f, argv0):

print(' echo "LINK $out"', file=f)
# note: can't have spaces in filenames
print(' link "$compiler" "$variant" "" "$out" \\', file=f)
print(' link "$compiler" "$variant" "$FLAG_ldflags" "$out" \\', file=f)
# put each object on its own line, and indent by 4
print(' %s' % (' \\\n '.join(objects)), file=f)
print('', file=f)
Expand Down
12 changes: 12 additions & 0 deletions build/oils-preamble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Flags:
--variant ARG [default 'opt']
The build variant, e.g. dbg, opt, asan
--ldflags LDFLAGS [default '']
Space-separated list of additional linker flags.
--translator ARG [default 'mycpp']
Which bundle of translated source code to compile: mycpp, mycpp-souffle
Expand All @@ -42,6 +45,7 @@ EOF

FLAG_cxx=cxx # default is system compiler
FLAG_variant=opt # default is optimized build
FLAG_ldflags= # default is no flags

FLAG_translator=mycpp # or mycpp-souffle
FLAG_skip_rebuild='' # false
Expand Down Expand Up @@ -69,6 +73,14 @@ parse_flags() {
FLAG_cxx=$1
;;

--ldflags)
if test $# -eq 1; then
die "--ldflags requires an argument"
fi
shift
FLAG_ldflags=$1
;;

--variant)
if test $# -eq 1; then
die "--variant requires an argument"
Expand Down

0 comments on commit 8529f0f

Please sign in to comment.