[build2] Building objective C code

Boris Kolpackov boris at codesynthesis.com
Mon May 9 11:31:58 UTC 2022


Fabian Meyer <fabian.meyer at posteo.de> writes:

> However, I'm not really happy with build2 code.
> I had to replicate the adhoc recipes for obj-c and obj-c++ files, which
> makes a total of 4 pretty similar recipes. I am not familiar enough with the
> capabilities of the build2 language, so I have no clue on how to reduce this
> redundancy.

I think currently it's best to just keep the 4 similar rules since
there is no mechanisms that will allow you to reduce this without
things turning quite messy. But perhaps you could factor some
common options (like all those -I's) into shared variables to
streamline things a bit.


> Are there any resources that I can consult to get the bigger picture? Like
> how can I create my own rules?

There is currently no documentation on this other than what's in the
release notes (but there are plans to improve this after the 0.15.0
release):

https://build2.org/release/0.14.0.xhtml#adhoc-rules

https://build2.org/release/0.13.0.xhtml#adhoc-recipe

What you have in your buildfile are actually rules, more precisely,
"ad hoc regex pattern rules".


> Or is there the possibility for macros or functions in build2?

There are already functions and there is thought of adding a macro
facility. But, at least based on the current thinking, they are
unlikely to help you here (their implementation are/will be in C++).

I think the proper way to solve this particular case is for build2
to provide built-in support for Objective-C/C++ compilation, which
we plan to do as soon as we are done with more pressing issues.



More information about the users mailing list