-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Wrap: Kafel #1917
base: master
Are you sure you want to change the base?
New Wrap: Kafel #1917
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't fully reviewed this, but I have some comments for you.
run_command(flex, '--outfile=lexer.c', 'src/lexer.l', check: true) | ||
run_command(bison, '-o=parser.c', 'src/parser.y', check: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't want to use run_command
for this, this is what custom_target
is for:
lexer = custom_target(
command : [flex, '--outfile=@OUTPUT0@', '--header-file=@OUTPUT1@', '@INPUT@'],
input : 'src/lexer.l',
output : ['@[email protected]', '@[email protected]'],
)
parser = custom_target(
command : [bison, '-o', '@OUTPUT0@', '--defines=@OUTPUT1@', '@INPUT@'],
input : 'src/parser.y',
output : ['@[email protected]', '@[email protected]'],
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I had already tried it that way, but it didn't work, so I resorted to using run_command. Many people who use flex and bison seem to face the same issue and end up resorting to this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this method it simply does not generate the .c files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won’t generate the c file if you don’t add the parser variable to the target, because custom targets are not built by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am adding it, and it still doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an example of how to do it: https://github.com/dcbaker/meson-plus-plus/blob/main/src/frontend/meson.build
'lexer.c', | ||
'parser.c' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then you'll want to use the parser
and lexer
variables instead of these.
kafel_lib = library('kafel', | ||
sources: kafel_sources, | ||
include_directories: kafel_inc, | ||
install: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gnu_symbol_visibility : 'hidden',
soversion : 1,
is also needed to match the makefile.
You'll need to double check that soversion though, and make sure it matches the makefile.
name : 'kafel', | ||
description : 'Kafel - seccomp filter generator', | ||
version : meson.project_version(), | ||
filebase : 'kafel', | ||
subdirs : 'kafel', | ||
libraries : kafel_lib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can pass kafel_lib
as a positional argument here, which will eliminate some of the need to repeat yourself, at least name
, filebase
, and libraries
can be dropped if you do that.
No description provided.