# make PREFIX is not repected in ports



## icecoke (Nov 16, 2012)

Hello everyone!

I already looked around, googled and (so what I believe) did my homework before I'm now stepping on your nervs 

I have a fresh installed FreeBSD 9.0, installed ezjail for setting up some jails and - to save as much space as possible - want to install as many ports as possible into the basejail of for the jails, which is mounted into the jails ro.

Reading all the  manuals around, it should be possible to install everything into the basejail as root by DESTDIR=basjail_path and than it 'should' be possible again to use PREFIX to have everything installed into /usr instead of /usr/local which is not mounted into the jail.

I can do what I want, but the 'PREFIX' is allways ignored. According the the howtos for creating ports, this should NOT be the case except for some very rare cases with much perl involved. I tried by now these three ports: 'proftpd, nano and sudo' and wanted to ask the experts here, before I try out all ports of interest.

I would be pleased if anyone can point me to my error.

Many thanks!
Jimmy


----------



## SirDice (Nov 16, 2012)

icecoke said:
			
		

> Reading all the  manuals around, it should be possible to install everything into the basejail as root by DESTDIR=basjail_path and than it 'should' be possible again to use PREFIX to have everything installed into /usr instead of /usr/local which is not mounted into the jail.


Don't. There's a strict seperation between the base OS and third party software. It's there for a reason, don't break it.


----------



## icecoke (Nov 16, 2012)

SirDice said:
			
		

> Don't. There's a strict seperation between the base OS and third party software. It's there for a reason, don't break it.



Thanks a lot for your hint, but I'm not going this way to much. If you look e.g. at redhat or similar linux distributions, an apache is always installed /usr not /usr/local.

These jails we are talking about have to share as much compiled data as possible - one important reason is, it's a managed system were the jailed users shouldn't do to much. And if we run an update of important binaries, it should be done in a row.

So if there is a reason you know and I don't, please let me know. I'm higly interested. In addtion I'm still interested in the reason why it does not work, even if the Makefiles of the ports should be created to respect the PREFIX according the freeBSD manuals.

Many thanks again!
Jimmy


----------



## SirDice (Nov 16, 2012)

icecoke said:
			
		

> Thanks a lot for your hint, but I'm not going this way to much. If you look e.g. at redhat or similar linux distributions, an apache is always installed /usr not /usr/local.


Yes, and they're all a mess. That's why there's a stict seperation of the base OS and third party software on FreeBSD.



> So if there is a reason you know and I don't, please let me know. I'm higly interested.


See hier(7).


----------



## kpa (Nov 16, 2012)

To make the point more clear, www/apache22 is an application that is ported to FreeBSD. It's not part of the FreeBSD operating system and it should not be. Just because Linux distributions don't make this distinction doesn't mean we have to make the same mistake.

To show you why it would be a bad idea to include a web server in the base system let's look at the dependencies of www/apache22:


```
% pkg info -d apache22
apache22-2.2.23 depends on:
apr-1.4.6.1.4.1_1
db42-4.2.52_5
expat-2.0.1_2
gdbm-1.9.1
libiconv-1.14
pcre-8.31_1
perl-5.14.2_2
```

FreeBSD has something called "ABI stability" and it states that the binary compatibility must be maintained troughout every minor version (8.0, 8.1, etc) of the same major version (FreeBSD 8 in this example). This compatibility includes shared libraries and so all shared libraries in the base system are "set to stone" for the lifetime of the major version of the OS. There can be minor fixes to them but it's impossible to update them to newer versions that might have changes in their API because of the ABI stability requirement.


----------



## icecoke (Nov 16, 2012)

Ok, I didnt really wanted such discussion, but why not 

I know hier of course and you can see what I see: the user executed daemons, common applications and daemons - ALL are located in /usr NOT /usr/local - just except for the ports stuff, but with no really explanation.
So if the base FreeBSD system is placing tcp based servers like named, sendmail, ntpd into /usr/sbin, tell me why not the ftp or webservers. These are system services started from the rc.d and not user tools.
We don't talk about pointing ports applications into /bin or /sbin - THAT is system in hier's opinion.

Beside repeating written things, let me now real reasons for placing a system service into /usr/local and not /usr - I'm still interested in reasons. Just because they are ported is the only reason?

But anyway, for everyone who read my initial question and wants to follow the idea of http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html in jails, I find out that placing the PREFIX var into the chrooted /etc/make.conf is working in the most cases I had here, using it as a parameter not. Sometimes a simple ln -s for eg. hardcoded libtool paths are enough to overcome Makefiles not done correct to respect the vars.

thanks
Jimmy


----------



## SirDice (Nov 16, 2012)

icecoke said:
			
		

> So if the base FreeBSD system is placing tcp based servers like named, sendmail, ntpd into /usr/sbin, tell me why not the ftp or webservers.


Because they are either part of the base OS or not. If they're not part of the base OS the PREFIX is /usr/local/. 



> These are system services started from the rc.d and not user tools.


And that's why there's a /usr/local/etc/rc.d/.



> Beside repeating written things, let me now real reasons for placing a system service into /usr/local and not /usr - I'm still interested in reasons. Just because they are ported is the only reason?


Everybody that knows FreeBSD is going to expect them in /usr/local/.


----------



## icecoke (Nov 16, 2012)

Thanks a lot kpa!

The ABI and pointing me to the dependency that could hasle with system libs is the answer and reason I really respect and wanted to here. Thanks again.

I'm new to FreeBSD and the conecpt of ABI is just not referenced in hier(7) and other explanations I found about the path preferences for ports. So, I need to find a way to give the jails a different structure, mounting the needed core tcpservices seperatly but not just into /usr.

@SirDice: Maybe I'm one of these guys asking to much, but I hope you don't mind.....

thanks again
Jimmy


----------



## SirDice (Nov 16, 2012)

icecoke said:
			
		

> So, I need to find a way to give the jails a different structure, mounting the needed core tcpservices seperatly but not just into /usr.


You might want to take a look at sysutils/ezjail.



> @SirDice: Maybe I'm one of these guys asking to much, but I hope you don't mind.....


Absolutely not. I never mind a good discussion, as long as it stays civilized


----------



## icecoke (Nov 16, 2012)

SirDice said:
			
		

> You might want to take a look at sysutils/ezjail.



Yep, it's a nice tool, but does not solve the the path problems. But anyway, now I'm just going to install all port things in something like /usr/iports (like installed ports) or something to have a path I can mount ro to administrate it more easily. This should respect ABI (my new friend  ), saves good space and gives the user to install own things under /usr/local without running in problems with my ro base installations.

Thanks for giving such a good support! There will be more questions to come in the future, be sure 

Jimmy


(I saw a 'solved' previx option in my first post - this could be set now  )


----------

