# Can you override a Makefile USES macro with a specific version?



## Echoxxzz (Jun 16, 2021)

Is there a way to override a Makefile USES macro with a specific version?
For instance in the "net-p2p\sonarr" port the Makefile has a "USES Mono" macro. 
But the "Mono" package is defaulting to building the Mono package 5.10 and I want it to build 5.20.

Since there is no DEFAULT_VERSIONS variable for Mono the only way I have been able to get Sonarr to use Mono 5.20 is to comment out the USES variable in the Sonarr Makefile and I then manually build and install Mono 5.20.


----------



## SirDice (Jun 16, 2021)

Echoxxzz said:


> Since there is no DEFAULT_VERSIONS variable for Mono


Yes, there is?

```
# Possible values: 5.10, 5.20, 6.8
MONO_DEFAULT=		5.10
```


----------



## DutchDaemon (Jun 16, 2021)

/usr/ports//Mk/Uses/mono.mk appears to suggest that a specification exists:

```
Usage:        USES=mono:ARGS
```

Have you tried something like 
	
	



```
DEFAULT_VERSIONS= mono=5.20
```
 yet?


----------



## SirDice (Jun 16, 2021)

I did notice that it's defined as `MONO_DEFAULT=` while everything else is `SOMELANG_DEFAULT?=`. I'm wondering why that is. That might mean you can't override it?





__





						bsd.default-versions.mk « Mk - ports - FreeBSD ports tree
					






					cgit.freebsd.org


----------



## Echoxxzz (Jun 17, 2021)

DutchDaemon said:


> /usr/ports//Mk/Uses/mono.mk appears to suggest that a specification exists:
> 
> ```
> Usage:        USES=mono:ARGS
> ...


I originally tried: 
	
	



```
DEFAULT_VERSIONS+=mono=mono5.20
```
 but it didn't work but I will give it a go again with your method.


----------



## covacat (Jun 17, 2021)

it seems to default to lang/mono
mono and mono5.10 seem to be pretty much the same thing
what if you rename/lang mono and link it to mono5.20 ?


----------



## Echoxxzz (Jun 29, 2021)

So far I haven't found a clean way to do this. The only solution so far is to either hack the Makefile or use a suggestion to rename and relink mono to mono5.20. 

I'll try and e-mail the port maintainer and see he/she has any suggestions?


----------

