# Default search path to include /usr/local/include and /usr/local/lib



## forkandwait (May 22, 2012)

Hi all,

I am (still) trying to build Julia, and I would like to set GCC (and gfortran and ld) to use /usr/local/* for linking and including search paths.  

How can I do that at the top level of the project, "outside" of updating any Makefiles, so that I can run gmake and have it apply every call of ld and gcc and gfortran?

I have tried exporting 
	
	



```
CPPFLAGS='-I/usr/local/lib -I/usr/lib'
```
 before calling gmake, but it doesn't seem to change anything when I run gmake from the top of the source directory.

I know I can set 
	
	



```
-l/usr/local/lib
```
 and 
	
	



```
-I/usr/local/include
```
 for a given invocation of gcc, but I need it to default to these for the multiple invocations.

Thanks everybody -- for both the great ideas and the patience!


----------



## SirDice (May 22, 2012)

Build a proper port for it. The ports system will take care of it.

FreeBSD Porter's Handbook


----------



## forkandwait (May 22, 2012)

I would like to build up to that, though I am sure the porters manual has great info...  Any ideas in the meantime?


----------



## SirDice (May 22, 2012)

Just start with a simple port skeleton. Most of the things you want done automatically are already automatically done by the ports system.

There are several steps you can use with a port

```
make extract # extracts the source
make patch   # applies the patches in the files/ directory
make configure # runs ./configure on the port (if it exists)
make         # starts the actual build
```

As you can see you can almost "single step" through the build process.


----------



## forkandwait (May 23, 2012)

Ok, so I will try to start a port for Julia.  

I read the porter's manual, but I am not quite sure on the step-by-step.  Here is what I think I should do, please correct:

`mkdir julia-port`
`cd julia-port`
copy some skeleton makefile, update it
download a tarball of julia into /usr/ports/distfiles (or whatever it is called).
run *make* in my ports directory
then start patching...
Does that sound right?


----------



## SirDice (May 23, 2012)

Don't copy the file to /usr/ports/distfiles/ just yet. Configure the Makefile to fetch it correctly.

But you have the basic gist of it.


----------



## wblock@ (May 23, 2012)

Also, verify that you have the right distfile, then run *make distinfo* to create the distinfo file for the port.


----------

