# non-native builds by-pass make.conf and env settings



## Beeblebrox (Dec 18, 2011)

I have some small problems when building non-native apps (which are not as yet in the ports tree): Third party software that can be built on FreeBSD:
1. The build for the app will by-pass settings in /etc/make.conf (like gcc46 + ccache)
2. Build also by-passes env settings (like WRKDIRPREFIX=/usr/obj) and places the build in the same folder where Makefile is.

How do I get the build to adhere to and not ignore my make.conf and env settings?


----------



## darcsis (Dec 18, 2011)

There may be two methods to get things done.

1. Write your own BSD make script (i.e. Makefile). BSD makefile is very straightforward and simpler than GNU makefile.

2. Port your app to FreeBSD. i.e. Write a port for your app.

Once you use system's make command, you can use those *.mk files by adding a line 'include <xxx>' into your make script.


----------



## SirDice (Dec 19, 2011)

This might come in handy: Porter's Handbook


----------



## Beeblebrox (Dec 19, 2011)

I really can't believe that it would be that complicated...
The App is not mine btw, it is 3rd party so I have no control over it. I just want to build on my machine the FreeBSD version of the software, but have the Makefile recognize my personal settings / environment.

why would I try to port an app from a project I m not a part of?  The developers of whatever project have a lot more info and way more knowledge about their app anyway.


----------



## SirDice (Dec 19, 2011)

Beeblebrox said:
			
		

> why would I try to port an app from a project I m not a part of?  The developers of whatever project have a lot more info and way more knowledge about their app anyway.


There are a lot of porters that don't have any relation to the project they're porting.


----------



## Beeblebrox (Dec 19, 2011)

Well, here are the specifics then:  I am building mesa/dri from git source which is higher version than in ports tree.  I need to build it WITHOUT_NOUVEAU AFAIK since my card is a Radeon 3000.
Nouveau flag is in my etc/make.conf but build ignores it as well as the better gcc46 and builds using gcc42...


----------



## SirDice (Dec 19, 2011)

No need to build from source. Just set WITHOUT_NOUVEAU and rebuild Xorg.


```
root@j-build-amd64:/usr/ports#pkg_version -vIl'>'
dri-7.6.1,2                         >   succeeds index (index has 7.4.4,2)
libGL-7.6.1                         >   succeeds index (index has 7.4.4)
libGLU-7.6.1                        >   succeeds index (index has 7.4.4)
libdrm-2.4.17_1                     >   succeeds index (index has 2.4.12_1)
libglut-7.6.1                       >   succeeds index (index has 7.4.4)
```


----------



## adamk (Dec 19, 2011)

Beeblebrox said:
			
		

> Well, here are the specifics then:  I am building mesa/dri from git source which is higher version than in ports tree.  I need to build it WITHOUT_NOUVEAU AFAIK since my card is a Radeon 3000.
> Nouveau flag is in my etc/make.conf but build ignores it as well as the better gcc46 and builds using gcc42...




FYI, the r600 classic driver has been dropped from the mesa git tree.  If you want a newer driver than what's in ports, I suggest grabbing the 7.11 release.  You'll also need to update libdrm.  

There's also no need to worry about WITHOUT_NOUVEAU.  That simply tells the ports tree to *not* hold back the version of libdrm and mesa, but since you're building it outside the ports tree, they obviously won't be held back.

As for using gcc46...  You *probably* just need to set the CC environmental variable before running configure.


----------



## adamk (Dec 19, 2011)

SirDice said:
			
		

> No need to build from source. Just set WITHOUT_NOUVEAU and rebuild Xorg.
> 
> 
> ```
> ...



I think the point is that Mesa 7.6 is still much older than what's available.

Adam


----------



## Beeblebrox (Dec 19, 2011)

I was trying to post when the connection blacked out...

I'm building from the GIT source as explained here and from several git repos: git://anongit.freedesktop.org/git/xorg/proto/glproto (as example)

The version in git is 7.11.2, I think while ports version is 7.6, much farther behind than git. All depends have been built, but when I try to build mesa its self, it halts with a Nouveau error.  The WITHOUT_NOUVEAU option comes from your posts btw Adam, thanks.

I filed a bug which has been subsequently corrected, but not getting me "home" because:
1. make.conf is ignored
2. my preferences are ignored (gcc46, ccache, but also WRKDIRPREFIX=/usr/obj)

I tried below with no result, gave error saying option not recognized.
`mesa> # ./autogen.sh -DWITHOUT_NOUVEAU`


----------



## adamk (Dec 19, 2011)

Again, mesa from git has *no* driver for your GPU.  The r600 classic driver was dropped a while back.  

Use Mesa 7.11, and check the options to ./configure to see how to specify what options to use.  You probably need to use --with-dri-drivers=r600 --with-gallium-drivers=


----------



## Beeblebrox (Dec 19, 2011)

@ adamk:


> Again, mesa from git has no driver for your GPU


Sorry, I must have blacked out on the git part much like my internet connection.
1. This is not understood however; where is it if not in GIT?


> Use Mesa 7.11


2. The depends (libgl, dri2proto, glproto, etc) from the DRI wiki - should I keep them or revert to ports ver?
3. Do I need to re-build Xorg after mesa?


----------



## adamk (Dec 19, 2011)

Beeblebrox said:
			
		

> @ adamk:
> 
> Sorry, I must have blacked out on the git part much like my internet connection.
> 1. This is not understood however; where is it if not in GIT?



It's not developed or even maintained any more.  It is no longer in Mesa git.  I was wrong, however, in believing that Mesa 7.11 was the last version with the r600 classic driver.  The Mesa 7.11.2 release does still contain the r600 driver.  Just make sure you are using 7.11.2, and not the latest from git.



> 2. The depends (libgl, dri2proto, glproto, etc) from the DRI wiki - should I keep them or revert to ports ver?
> 3. Do I need to re-build Xorg after mesa?



You should use the versions from the wiki and you do not need to rebuild Xorg.

Adam


----------



## Beeblebrox (Dec 19, 2011)

> Just make sure you are using 7.11.2, and not the latest from git


Sorry Adam, but from where do I 
<southern accent>
git it
</southern accent>
 if not from GIT?


----------



## adamk (Dec 19, 2011)

ftp://ftp.freedesktop.org/pub/mesa/7.11.2


----------



## Beeblebrox (Dec 19, 2011)

Thanks Adam.
As far as I can understand, ftp and git actually carry the same versions (because the "Source Code Repository" menu on the site directs to: http://www.mesa3d.org/repository.html

So I really do not get the difference between the ftp source and the git source.
The difference from what I can tell is that I was running  autogen while you suggest running configure instead.


----------



## adamk (Dec 19, 2011)

git is the source code repository.  That's where all the ongoing development is done.  The r600 classic driver was removed from the git repository recently.

The ftp server contains only releases.  7.11.2 is a released version that still includes the r600 classic driver.


----------



## Beeblebrox (Dec 22, 2011)

Grrrr.

```
checking expat.h usability... no
checking expat.h presence... no
checking for expat.h... no
configure: error: Expat required for DRI.
```
textproc/expat2 is installed, but I get this error. Are my custom Kernel settings interfering with something that should be installed through /usr/src/contrib/expat?

I tried several folders using --with-expat= option, no good.  When using autoconf.sh, I had resolved this problem by running commands below first.
`# setenv LDFLAGS -L/usr/local/lib`
`# setenv CFLAGS -I/usr/local/include`


----------



## adamk (Dec 22, 2011)

--with-expat=/usr/local

Adam


----------

