pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to force using clang for a package?



On Sun, 26 Dec 2021 17:02:01 +0000 (UTC)
Benny Siegert <bsiegert%gmail.com@localhost> wrote:

> I am working on a package that needs clang to build -- at least it does 
> not build on the built-in gcc 7.5.
> 
> I thought including lang/clang/buildlink3.mk would use clang as the 
> default compiler. It does give me a .cwrapper/bin/clang, but that just 
> runs gcc instead.
> 
> Overriding PKGSRC_COMPILER in the package's makefile seems wrong to me.

It is wrong but there's currently no better way. We should maybe have
CLANG_REQD like GCC_REQD. Base clang may or may not be sufficient
depending on the package but we currently force pkgsrc clang regardless
due to lack of infrastructure. It's easier to create the infrastructure
after we have some example packages. Do you know the reason why the
package requires clang?

> I noticed www/firefox/mozilla-common.mk does some manual fiddling with 
> clang wrappers to make them actually run clang.

Firefox is a bad example and I removed those wrapper hacks the other day.
It only needs clang for a few things. most of Firefox uses GCC.

Try this recipe:

.include "../../mk/bsd.prefs.mk"
PKGSRC_COMPILER=clang
CLANGBASE=${PREFIX}
.include "../../lang/llvm/buildlink3.mk"
BUILDLINK_DEPMETHOD.llvm=build
.include "../../lang/clang/buildlink3.mk"
BUILDLINK_DEPMETHOD.clang=build

-Tobias


Home | Main Index | Thread Index | Old Index