-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[wrap-file] | ||
directory = kafel-20231004 | ||
source_url = https://github.com/google/kafel/archive/20231004.tar.gz | ||
source_filename = 231004.tar.gz | ||
source_hash = b5fe85ad72070844dc24474a036f3b909c3f604b69c616d124793c37df7a9d7f | ||
patch_directory = kafel | ||
|
||
[provide] | ||
dependency_names = kafel | ||
program_names = dump_policy_bpf |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
project('kafel', 'c', | ||
version: '2023.10.10', | ||
default_options: [ | ||
'c_std=gnu11', | ||
]) | ||
|
||
flex = find_program('flex') | ||
bison = find_program('bison') | ||
pkgconf = import('pkgconfig') | ||
|
||
run_command(flex, '--outfile=lexer.c', 'src/lexer.l', check: true) | ||
run_command(bison, '-o=parser.c', 'src/parser.y', check: true) | ||
|
||
kafel_sources = files( | ||
'src/kafel.c', | ||
'src/context.c', | ||
'src/codegen.c', | ||
'src/expression.c', | ||
'src/includes.c', | ||
'src/parser_types.c', | ||
'src/policy.c', | ||
'src/range_rules.c', | ||
'src/syscall.c', | ||
'src/syscalls/amd64_syscalls.c', | ||
'src/syscalls/i386_syscalls.c', | ||
'src/syscalls/aarch64_syscalls.c', | ||
'src/syscalls/mipso32_syscalls.c', | ||
'src/syscalls/mips64_syscalls.c', | ||
'src/syscalls/riscv64_syscalls.c', | ||
'src/syscalls/arm_syscalls.c', | ||
'lexer.c', | ||
'parser.c' | ||
Comment on lines
+31
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then you'll want to use the |
||
) | ||
|
||
kafel_inc = include_directories('include', 'src') | ||
|
||
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 commentThe 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. |
||
) | ||
|
||
kafel_dep = declare_dependency( | ||
include_directories: kafel_inc, | ||
link_with: kafel_lib | ||
) | ||
|
||
dump_policy_bpf_sources = files( | ||
'tools/dump_policy_bpf/disasm.c', | ||
'tools/dump_policy_bpf/main.c', | ||
'tools/dump_policy_bpf/print.c', | ||
) | ||
|
||
dump_policy_bpf_exe = executable('dump_policy_bpf', | ||
sources: dump_policy_bpf_sources, | ||
dependencies: [kafel_dep], | ||
install: true | ||
) | ||
|
||
install_headers('include/kafel.h', subdir: 'kafel') | ||
|
||
meson.override_find_program('dump_policy_bpf', dump_policy_bpf_exe) | ||
meson.override_dependency('kafel', kafel_dep) | ||
|
||
pkgconf.generate( | ||
name : 'kafel', | ||
description : 'Kafel - seccomp filter generator', | ||
version : meson.project_version(), | ||
filebase : 'kafel', | ||
subdirs : 'kafel', | ||
libraries : kafel_lib | ||
Comment on lines
+66
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can pass |
||
) |
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 whatcustom_target
is for: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