Skip to content
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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

manipuladordedados
Copy link

No description provided.

Copy link
Member

@dcbaker dcbaker left a 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.

Comment on lines +11 to +12
run_command(flex, '--outfile=lexer.c', 'src/lexer.l', check: true)
run_command(bison, '-o=parser.c', 'src/parser.y', check: true)
Copy link
Member

@dcbaker dcbaker Feb 12, 2025

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]'],
)

Copy link
Author

@manipuladordedados manipuladordedados Feb 12, 2025

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.

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

@dcbaker dcbaker Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +31 to +32
'lexer.c',
'parser.c'
Copy link
Member

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
Copy link
Member

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.

Comment on lines +66 to +71
name : 'kafel',
description : 'Kafel - seccomp filter generator',
version : meson.project_version(),
filebase : 'kafel',
subdirs : 'kafel',
libraries : kafel_lib
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants