# Getting the libraries installed by a port



## jrd1 (Apr 8, 2012)

Hi FreeBSD Community,

[Apologies to the admins, because this is more of an open-ended question and this seemed to be the best place to place this topic.]

My problem is what some could consider to be fairly simple, but it is one that I have, (for the moment) obtained no solution:

Is there a way to find out what libraries will be supplied to the overall FreeBSD system if you were to install a port?

I know you can *ldd* an installed program to find out what dependencies that particular binary has and so on. But, I am unaware of any way to find out what libraries can be installed by a port.

Does anyone have any ideas how to do this?


----------



## falkman (Apr 8, 2012)

I didn't know what you were asking, so I'll answer both.

Showing dependencies of a port/package:

ports(7)():

[CMD=]cd /usr/ports/xxx/xxx
make all-depends-list[/CMD]

pkg_info(1)() (installed packages):

[CMD=]pkg_info -r <package_name>[/CMD]

pkg_add(1)() (to-be-installed packages):

[CMD=]pkg_add -nr <package_name>[/CMD]

-------------------

Listing 'actual' libraries recursively installed by a port (*.so*):

cd into a port's directory and run the following script:


```
#!/bin/csh

foreach a ( `make all-depends-list` )
	cd $a
	if( -e pkg-plist ) then
		cat pkg-plist | grep "\.so"
	endif
end
```

Example output on x11/xorg: http://www.brandonfa.lk/xorglist.txt

Regards,
Brandon


----------



## DutchDaemon (Apr 8, 2012)

And reasoned from the other end: if you see a library (any file, actually) living under /usr/local/ and have no idea how it got there, run *pkg_info -W* on it.


----------



## jrd1 (Apr 8, 2012)

Thank you both: *DutchDaemon* and *falkman* for your replies.

Apologies, if I wasn't clear enough earlier. What I wanted to know a way of determining what libraries will be installed by a particular port (preferably, without having to install the port).

From both of your replies, it seems there is no clear-cut method of doing so - until you have actually installed the port.

Nevertheless, both pieces of information are very useful, especially: 
	
	



```
pkg_info -W
```


----------



## falkman (Apr 8, 2012)

My little script does not require the port to be installed. Perhaps it's not what you wanted though? (My Xorg example printout was on a fresh install of FreeBSD with nothing installed)

-Brandon


----------



## jrd1 (Apr 8, 2012)

Hi *falkman*, I tried running your script on an uninstalled port, (in my case, /usr/ports/x11/xorg, since I run a headless server), and I obtained no results. Although, I did obtain this message:


```
if: Empty if.
```

And, yes - I want to know what .so files will be installed by a port (without having to install it).


----------



## wblock@ (Apr 8, 2012)

Look in pkg-plist.  For example:


```
% grep '\.so' /usr/ports/x11-wm/xfce4-session/pkg-plist
lib/libxfsm-%%VERSION%%.so
lib/libxfsm-%%VERSION%%.so.0
lib/xfce4/panel/plugins/libxfsm-logout-plugin.so
lib/xfce4/session/splash-engines/libbalou.so
lib/xfce4/session/splash-engines/libmice.so
lib/xfce4/session/splash-engines/libsimple.so
```


----------



## falkman (Apr 8, 2012)

Terribly sorry, I forgot to put a then in the if statement. (Copied by hand from an 80x25 terminal).

Here's the actual script:


```
#!/bin/csh

foreach a ( `make all-depends-list` )
	cd $a
	if( -e pkg-plist ) then
		cat pkg-plist | grep "\.so"
	endif
end
```

-Brandon


----------



## jrd1 (Apr 9, 2012)

Thank you both *wblock@* and *falkman*! That is precisely what I needed!

And, the script works perfectly now *falkman*. Thank you very much!


----------

