mesonbuild / mesonbuild/meson

Relative paths of files() are passed to a command when `custom_target` is used

Open
#3,589 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.6k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
33

Description

I tried to figure out why a switch from run_target to custom_target caused ctags to generate tags containing relative paths. I found https://github.com/mesonbuild/meson/pull/1011 where run_target had been fixed, but it seems that custom_target hasn't been changed similarly yet.

$ cat meson.build
project('test', 'c')

all_files = files('main.c')

custom_target(
	'custom',
	output : 'custom',
	command : ['echo'] + all_files)

run_target(
	'run',
	command : ['echo'] + all_files)

$ touch main.c

$ ../meson/meson.py build
The Meson build system
Version: 0.47.0.dev1
Source dir: /home/ubuntu/TEST
Build dir: /home/ubuntu/TEST/build
Build type: native build
Project name: test
Native C compiler: cc (gcc 5.4.0 "cc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Build targets in project: 2
Found ninja-1.7.2 at /usr/bin/ninja

$ ninja -C ./build/ custom
ninja: Entering directory `./build/'
[1/1] Generating custom with a custom command.
../main.c

$ ninja -C ./build/ run
ninja: Entering directory `./build/'
[0/1] Running external command run.
/home/ubuntu/TEST/build/../main.c

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example from meson.build, then run the custom and run targets with Ninja and compare the emitted paths. Read the existing handling for run_target and trace the corresponding custom_target path; done means both targets handle files('main.c') consistently and the behavior is covered by an appropriate regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.