# Automatic LIB_DEPENDS detection?



## AntumDeluge (Jan 23, 2015)

I created a new port of the software MediInfo GUI, which depends on x11-toolkits/wxgtk30. I did not add the requisite libraries to LIB_DEPENDS in the Makefile, but after installing and running `pkg info mediainfo-gui` it lists the wx libs as dependencies:

```
$ pkg info mediainfo-gui
mediainfo-gui-0.7.72
Name  : mediainfo-gui
Version  : 0.7.72
Installed on  : Thu Jan 22 19:31:30 PST 2015
Origin  : multimedia/mediainfo-gui
Architecture  : freebsd:10:x86:64
Prefix  : /usr/local
Categories  : multimedia
Licenses  : BSD2CLAUSE
Maintainer  : antumdeluge@gmail.com
WWW  : http://mediainfo.sourceforge.net/
Comment  : Provides technical and tag information for video and audio files
Shared Libs required:
   libzen.so.0
   libwx_gtk2u_xrc-3.0.so.0
   libwx_gtk2u_webview-3.0.so.0
   libwx_gtk2u_qa-3.0.so.0
   libwx_gtk2u_html-3.0.so.0
   libwx_gtk2u_core-3.0.so.0
   libwx_gtk2u_adv-3.0.so.0
   libwx_baseu_xml-3.0.so.0
   libwx_baseu_net-3.0.so.0
   libwx_baseu-3.0.so.0
   libmediainfo.so.0
Annotations  :
Flat size  : 325KiB
Description  :
MediaInfo is a convenient unified display of the most relevant technical and
tag data for video and audio files.

Read http://mediaarea.net/en/MediaInfo/Support/Formats for supported formats.

WWW: http://mediainfo.sourceforge.net/
```
Does that mean the the dependencies were automatically detected and I do not need to add them to LIB_DEPENDS?

Here is the Makefile (mostly copied from multimedia/mediainfo):

```
# Created by: Jordan Irwin <antumdeluge@gmail.com>
# $FreeBSD$

PORTNAME=   mediainfo-gui
PORTVERSION=   0.7.72
CATEGORIES=   multimedia
MASTER_SITES=   http://mediaarea.net/download/binary/${PORTNAME}/${PORTVERSION}/
DISTNAME=   MediaInfo_GUI_${PORTVERSION}_GNU_FromSource

MAINTAINER=   antumdeluge@gmail.com
COMMENT=   Provides technical and tag information for video and audio files

LICENSE=   BSD2CLAUSE

LIB_DEPENDS=   libmediainfo.so:${PORTSDIR}/multimedia/libmediainfo \
     libzen.so:${PORTSDIR}/multimedia/libzen
RUN_DEPENDS=   mediainfo:${PORTSDIR}/multimedia/mediainfo

CPPFLAGS+=   -I${LOCALBASE}/include
GNU_CONFIGURE=   yes
USE_LDCONFIG=   yes
USES=     libtool pathfix pkgconfig tar:bzip2 \
     desktop-file-utils

PLIST_FILES=   bin/mediainfo-gui \
     share/applications/mediainfo-gui.desktop \
     share/pixmaps/mediainfo.png
     
WRKSRC=     ${WRKDIR}/MediaInfo_GUI_GNU_FromSource/MediaInfo/Project/GNU/GUI
IMGDIR=     ${WRKDIR}/MediaInfo_GUI_GNU_FromSource/MediaInfo/Source/Resource/Image

post-install:
   ${INSTALL_DATA} \
     ${WRKSRC}/${PORTNAME}.desktop \
     ${STAGEDIR}${LOCALBASE}/share/applications
   ${INSTALL_DATA} \
     ${IMGDIR}/MediaInfo.png \
     ${STAGEDIR}${LOCALBASE}/share/pixmaps/mediainfo.png

.include <bsd.port.mk>
```


----------



## uzsolt (Jan 26, 2015)

You can create similar list of required libraries with ldd() - maybe this list is generated with `ldd` too. It can be run when the binary is ready (after build).
It's a helpful utility to add all library dependencies to your Makefile.

_I think_ output of `pkg info --dependencies mediainfo-gui` doesn't contain x11-toolkits/wxgtk30 - only if you specify explicitly in Makefile.


----------

