Wrapper script that needs paths to in-project executable #10981
-
My project has a wrapper script that uses objcopy to strip an executable to a raw binary, and then runs a locally-built 'fixup' program on it, meant for use with meson.build: objcopy = find_program('objcopy')
gbafix = executable('gbafix', 'gbafix.c', native: true)
makerom = configure_file(
input: 'makerom.in',
output: 'makerom',
configuration: {
'OBJCOPY': objcopy.full_path(),
'GBAFIX': gbafix.full_path(),
})
exe = executable(...)
custom_target(
'rom',
input: exe,
output: exe.name() + '.rom',
command: [makerom, '@INPUT@', '@OUTPUT@'],
build_by_default: true) makerom.in: #!/usr/bin/env python3
OBJCOPY = '@OBJCOPY@'
GBAFIX = '@GBAFIX@'
import subprocess
from sys import argv
subprocess.call([OBJCOPY, '-O', 'binary'] + argv[1:3])
subprocess.call([GBAFIX] + argv[2:]) However, this can lead to build failures when the Is there a way to solve this? I would find combining |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 15 replies
-
You could add gbafix as one of the inputs to |
Beta Was this translation helpful? Give feedback.
-
Ended up solving it like so:
#!/usr/bin/env python3
import shutil
from sys import argv
shutil.copy(argv[1], argv[2])
objcopy = find_program('objcopy')
gbafix = executable('gbafix', 'gbafix.c', native: true)
makerom = configure_file(
input: 'makerom.in',
output: 'makerom.in',
configuration: {
'OBJCOPY': objcopy.full_path(),
'GBAFIX': gbafix.full_path(),
})
makerom = custom_target('makerom',
input: makerom,
output: 'makerom',
command: ['copy', '@INPUT@', '@OUTPUT@'],
depends: [gbafix],
build_by_default: true) It's a hack, but it's the only reasonable way to let downstream projects use |
Beta Was this translation helpful? Give feedback.
Ended up solving it like so:
tools/copy
tools/meson.build
It's a hack, but it's the only reasonable way to let downstream projects use
makerom
without needing to worry about the impl…