Installing 3rd Party Software on FreeBSD

FreeBSD offers a big load of third party software. From servers, to databases, to games, maintenance programes and much much more. Most probably in most cases, setting up the base system itself will not be enough. The user requires a desktop environment such as Gnome or KDE and whatever else he deems necessary for his everyday tasks. The system administrator has to install these from external sources.

There are two ways of installing that 3rd party software:

1) Compiling from source

and

2) Installing precompiled binaries

Here we will take a look at how FreeBSD handles the process of installing applications from source followed by an example port that I wrote for FreeBSD some time ago.

The ports collection is an assortment of around 24.000 applications that are divided into different categories and reside in the /usr/ports directory.

To install a port and thus an application, the user descend into the directory of the port he wants to install, becomes the superuser via su and types:

# make install clean

What happens under the hood is that a program called make is invoked, which in turn downloads the source code and along with the makefile scripts provided by the FreeBSD system compiles the sources and eventually installs them on the system. In the UNIX and Linux world make is a standard program to manage program dependencies.

The following files and folders are usually found in a ports directory:

1. The Makefile

2. The distinfo file

3. The pkg-descr file

4. The pkg-plist file

5. The files folder

Here is an example for a port that I wrote for Kamailio - An Open Source SIP Server.

It has been mapped to /usr/ports/net/kamailio


1. The Makefile

1       Created by: Oliver Mahmoudi <olivermahmoudi@gmail.com>
2 	# $FreeBSD$
3 	#
4 	
5 	PORTNAME=       kamailio
6 	PORTVERSION=    4.1.6
7 	CATEGORIES=     net
8 	MASTER_SITES=   http://www.kamailio.org/pub/kamailio/${PORTVERSION}/src/
9 	DISTNAME=       ${PORTNAME}-${PORTVERSION}_src
10 	
11 	MAINTAINER=     olivermahmoudi@gmail.com
12 	COMMENT=        Very fast and configurable open source SIP proxy
13 	
14 	LICENSE=        GPL2
15 	
16 	USES=           gmake shebangfix
17 	USE_LDCONFIG=   yes
18 	SHEBANG_FILES=  utils/kamctl/kamctl utils/kamctl/kamdbctl
19 	CFLAGS+=        -Wall
20 	
21 	LIB_DEPENDS+=   libexpat.so:${PORTSDIR}/textproc/expat2 \
22 	                libxml2.so:${PORTSDIR}/textproc/libxml2
23 	
24 	RUN_DEPENDS+=   ${LOCALBASE}/bin/bash:${PORTSDIR}/shells/bash
25 	
26 	WRKSRC=         ${WRKDIR}/${PORTNAME}-${PORTVERSION}
27 	
28 	USE_RC_SUBR=    kamailio
29 	
30 	USERS=          kamailio
31 	GROUPS=         kamailio
32 	
33 	OPTIONS_DEFINE= DOCS MYSQL PGSQL RADIUS JITSI JABBER TLS UNIXODBC
34 	OPTIONS_DEFAULT=        MYSQL RADIUS JABBER TLS
35 	OPTIONS_SUB=    YES
36 	
37 	JITSI_DESC=     VoIP Frontend GUI via Jitsi
38 	
39 	MYSQL_USE=      mysql=yes
40 	PGSQL_USES=     pgsql
41 	JITSI_RUN_DEPENDS=      jitsi:${PORTSDIR}/net-im/jitsi
42 	UNIXODBC_LIB_DEPENDS=   libodbc.so:${PORTSDIR}/databases/unixODBC
43 	RADIUS_LIB_DEPENDS=     libradiusclient-ng.so:${PORTSDIR}/net/radiusclient
44 	
45 	.include <bsd.port.options.mk>
46 	
47 	.if ${OPSYS} == FreeBSD && ${OSVERSION} < 900000
48 	BUILD_DEPENDS+= clang33:${PORTSDIR}/lang/clang33
49 	.endif
50 	
51 	.if ${PORT_OPTIONS:MMYSQL}
52 	EXTRA_MODULES+= db_mysql
53 	.endif
54 	
55 	.if ${PORT_OPTIONS:MPGSQL}
56 	EXTRA_MODULES+= db_postgres
57 	.endif
58 	
59 	.if ${PORT_OPTIONS:MUNIXODBC}
60 	EXTRA_MODULES+= db_unixodbc
61 	.endif
62 	
63 	.if ${PORT_OPTIONS:MRADIUS}
64 	EXTRA_MODULES+= auth_radius group_radius uri_radius
65 	.endif
66 	
67 	.if ${PORT_OPTIONS:MJABBER}
68 	EXTRA_MODULES+= jabber
69 	.endif
70 	
71 	.if ${PORT_OPTIONS:MTLS}
72 	EXTRA_MODULES+= tls
73 	.endif
74 	
75 	.if !empty (EXTRA_MODULES)
76 	MAKE_ARGS=      include_modules="${EXTRA_MODULES}"
77 	.endif
78 	
79 	post-patch:
80 	.if ! ${PORT_OPTIONS:MDOCS}
81 	        @${REINPLACE_CMD} -e 's#install-doc install-man#install-man#'   \
82 	                ${WRKSRC}/Makefile
83 	.endif
84 	.if ${OPSYS} == FreeBSD && ${OSVERSION} < 900000
85 	        ${REINPLACE_CMD} -e 's/clang/clang33/g' ${WRKSRC}/Makefile.defs
86 	.endif
87 	
88 	pre-build:
89 	        cd ${WRKSRC} && ${GMAKE} ${MAKE_ARGS} cfg
90 	
91 	do-build:
92 	        cd ${WRKSRC} && ${GMAKE} ${ALL_TARGET}
93 	
94 	post-stage:
95 	# Do not install anything beyond ${PREFIX}
96 	        ${RM} /root/.rnd
97 	
98 	# Strip modules in lib/kamailio/modules
99 	        @${ECHO_CMD} "Stripping modules in ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/modules/"
100 	
101 	.for i in db_mysql db_postgres db_unixodbc tls blst \
102 	        xhttp_rpc nat_traversal print msrp mi_datagram \
103 	        userblacklist msilo uid_uri_db drouting enum \
104 	        p_usrloc avpops matrix rr sst \
105 	        rtpproxy rtpproxy-ng mohqueue mqueue tmx sqlops dialog \
106 	        usrloc dispatcher auth_db uac permissions \
107 	        path tm mediaproxy nathelper print_lib \
108 	        mangler group textops rtimer db_cluster \
109 	        textopsx db_flatstore sl pipelimit counters \
110 	        mi_fifo statistics stun cnxcc corex debugger pv \
111 	        ratelimit ctl db2_ops mi_rpc tmrec \
112 	        benchmark domainpolicy acc exec siputils \
113 	        malloc_test kex cfg_rpc diversion ipops \
114 	        uid_auth_db imc cfg_db xhttp seas \
115 	        timer auth_diameter dmq uac_redirect pdt \
116 	        call_control uri_db alias_db sca avp \
117 	        cfgutils pike uid_domain domain maxfwd \
118 	        htable topoh auth sms async \
119 	        prefix_route speeddial registrar mtree uid_avp_db \
120 	        xlog sipt siptrace qos pdb xprint auth_radius \
121 	        sanity uid_gflags db_text sdpops sipcapture
122 	        @if [ -e ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/modules/${i}.so ]; then \
123 	                ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/modules/${i}.so; \
124 	        fi
125 	.endfor
126 	
127 	# Strip libraries in lib/kamailio
128 	        @${ECHO_CMD} "Stripping libraries in ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/"
129 	
130 	.for j in srdb2 srdb1 kcore srutils kmi trie print
131 	        @if [ -e ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/lib${j}.so.1 ]; then \
132 	                ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/lib${j}.so.1; \
133 	        fi
134 	.endfor
135 	
136 	# This is also part of lib/kamailio but ends in .so.0
137 	        @if [ -e ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/libbinrpc.so.0 ]; then \
138 	                ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/libbinrpc.so.0; \
139 	        fi
140 	
141 	# Strip binaries in sbin
142 	        @${ECHO_CMD} "Stripping binaries in ${STAGEDIR}${PREFIX}/sbin/"
143 	
144 	.for k in kamailio kamcmd
145 	        @${STRIP_CMD} ${STAGEDIR}${PREFIX}/sbin/${k}
146 	.endfor
147 	
148 	do-install:
149 	        cd ${WRKSRC} && ${GMAKE} ${INSTALL_TARGET}
150 	
151 	.include <bsd.port.mk>

2. The distinfo file

The distinfo file holds the size and the sha256 checksum of the tarball. This is what the distinfo file for kamailio looks like:

1 	SHA256 (kamailio-4.1.6_src.tar.gz) = 7aa15fb73f95b41a1cd0a2708fb29aec124d956a9f767588f12a60946c0bcb50
2 	SIZE (kamailio-4.1.6_src.tar.gz) = 10865531

3. The pkg-descr file

This file contains a little description of the program to let users know what is does

Kamailio is an open source SIP proxy server that is capable of
handling thousands of up calls in a second. Among the features
it provides, are support for TCP, UDP and SCTP, secure communication
via TLS for VoIP (voice, video), accounting, the most popular open
source databases and much more.

Originally starting out as the SIP Express Router (SER) project by
the Fraunhofer Society in 2001, the design team got together in
2008, merged old and new source code and rebranded SER to Kamailio.

WWW: http://www.kamailio.org/

4. The pkg-plist file pkg-plist lists all the files that are installed on the system. This serves several purposes.

1. When deinstalling the port, the system knows which files to delete.

2. When creating a package out of the port, make uses pkg-plist to know what it needs to include.

1 	sbin/kamailio
2 	sbin/kamcmd
3 	sbin/kamctl
4 	sbin/kamdbctl
5 	@unexec if cmp -s %D/etc/kamailio/dictionary.kamailio.sample %D/etc/kamailio/dictionary.kamailio; then rm -f %D/etc/kamailio/dictionary.kamailio; fi
6 	etc/kamailio/dictionary.kamailio.sample
7 	@exec if [ ! -f %D/etc/kamailio/dictionary.kamailio ] ; then cp -p %D/%F %B/dictionary.kamailio; fi
8 	@unexec if cmp -s %D/etc/kamailio/kamailio-advanced.cfg.sample %D/etc/kamailio/kamailio-advanced.cfg; then rm -f %D/etc/kamailio/kamailio-advanced.cfg; fi
9 	etc/kamailio/kamailio-advanced.cfg.sample
10 	@exec if [ ! -f %D/etc/kamailio/kamailio-advanced.cfg ] ; then cp -p %D/%F %B/kamailio-advanced.cfg; fi
11 	@unexec if cmp -s %D/etc/kamailio/kamailio-basic.cfg.sample %D/etc/kamailio/kamailio-advanced.cfg; then rm -f %D/etc/kamailio/kamailio-advanced.cfg; fi
12 	etc/kamailio/kamailio-basic.cfg.sample
13 	@exec if [ ! -f %D/etc/kamailio/kamailio-basic.cfg ] ; then cp -p %D/%F %B/kamailio-advanced.cfg; fi
14 	@unexec if cmp -s %D/etc/kamailio/kamailio.cfg.sample %D/etc/kamailio/kamailio.cfg; then rm -f %D/etc/kamailio/kamailio.cfg; fi
15 	etc/kamailio/kamailio.cfg.sample
16 	@exec if [ ! -f %D/etc/kamailio/kamailio.cfg ] ; then cp -p %D/%F %B/kamailio.cfg; fi
17 	@unexec if cmp -s %D/etc/kamailio/kamctlrc.sample %D/etc/kamailio/kamctlrc; then rm -f %D/etc/kamailio/kamctlrc; fi
18 	etc/kamailio/kamctlrc.sample
19 	@exec if [ ! -f %D/etc/kamailio/kamctlrc ] ; then cp -p %D/%F %B/kamctlrc; fi
20 	%%TLS%%@unexec if cmp -s %D/etc/kamailio/tls.cfg.sample %D/etc/kamailio/tls.cfg; then rm -f %D/etc/kamailio/tls.cfg; fi
21 	%%TLS%%etc/kamailio/tls.cfg.sample
22 	%%TLS%%@exec if [ ! -f %D/etc/kamailio/tls.cfg ] ; then cp -p %D/%F %B/tls.cfg; fi
23 	%%TLS%%etc/kamailio/kamailio-selfsigned.key
24 	%%TLS%%etc/kamailio/kamailio-selfsigned.pem
25 	lib/kamailio/libbinrpc.so
26 	lib/kamailio/libbinrpc.so.0
27 	lib/kamailio/libkcore.so
28 	lib/kamailio/libkcore.so.1
29 	lib/kamailio/libkmi.so
30 	lib/kamailio/libkmi.so.1
31 	lib/kamailio/libprint.so
32 	lib/kamailio/libprint.so.1
33 	lib/kamailio/libsrdb1.so
34 	lib/kamailio/libsrdb1.so.1
35 	lib/kamailio/libsrdb2.so
36 	lib/kamailio/libsrdb2.so.1
37 	lib/kamailio/libsrutils.so
38 	lib/kamailio/libsrutils.so.1
39 	lib/kamailio/libtrie.so
40 	lib/kamailio/libtrie.so.1
41 	lib/kamailio/kamctl/kamctl.base
42 	lib/kamailio/kamctl/kamctl.ctlbase
43 	lib/kamailio/kamctl/kamctl.dbtext
44 	lib/kamailio/kamctl/kamctl.fifo
45 	%%MYSQL%%lib/kamailio/kamctl/kamctl.mysql
46 	%%PGSQL%%lib/kamailio/kamctl/kamctl.pgsql
47 	lib/kamailio/kamctl/kamctl.ser
48 	lib/kamailio/kamctl/kamctl.ser_mi
49 	lib/kamailio/kamctl/kamctl.sqlbase
50 	lib/kamailio/kamctl/kamctl.unixsock
51 	lib/kamailio/kamctl/kamdbctl.base
52 	lib/kamailio/kamctl/kamdbctl.dbtext
53 	%%MYSQL%%lib/kamailio/kamctl/kamdbctl.mysql
54 	%%PGSQL%%lib/kamailio/kamctl/kamdbctl.pgsql
55 	lib/kamailio/kamctl/dbtextdb/dbtextdb.py
56 	lib/kamailio/modules/acc.so
57 	lib/kamailio/modules/alias_db.so
58 	lib/kamailio/modules/async.so
59 	lib/kamailio/modules/auth.so
60 	lib/kamailio/modules/auth_db.so
61 	lib/kamailio/modules/auth_diameter.so
62 	%%RADIUS%%lib/kamailio/modules/auth_radius.so
63 	lib/kamailio/modules/avp.so
64 	lib/kamailio/modules/avpops.so
65 	lib/kamailio/modules/benchmark.so
66 	lib/kamailio/modules/blst.so
67 	lib/kamailio/modules/call_control.so
68 	lib/kamailio/modules/cfg_db.so
69 	lib/kamailio/modules/cfg_rpc.so
70 	lib/kamailio/modules/cfgutils.so
71 	lib/kamailio/modules/cnxcc.so
72 	lib/kamailio/modules/corex.so
73 	lib/kamailio/modules/counters.so
74 	lib/kamailio/modules/ctl.so
75 	lib/kamailio/modules/db2_ops.so
76 	lib/kamailio/modules/db_cluster.so
77 	lib/kamailio/modules/db_flatstore.so
78 	%%MYSQL%%lib/kamailio/modules/db_mysql.so
79 	%%PGSQL%%lib/kamailio/modules/db_postgres.so
80 	%%UNIXODBC%%lib/kamailio/modules/db_unixodbc.so
81 	%%TLS%%lib/kamailio/modules/tls.so
82 	lib/kamailio/modules/db_text.so
83 	lib/kamailio/modules/debugger.so
84 	lib/kamailio/modules/dialog.so
85 	lib/kamailio/modules/dispatcher.so
86 	lib/kamailio/modules/diversion.so
87 	lib/kamailio/modules/dmq.so
88 	lib/kamailio/modules/domain.so
89 	lib/kamailio/modules/domainpolicy.so
90 	lib/kamailio/modules/drouting.so
91 	lib/kamailio/modules/enum.so
92 	lib/kamailio/modules/exec.so
93 	lib/kamailio/modules/group.so
94 	lib/kamailio/modules/htable.so
95 	lib/kamailio/modules/imc.so
96 	lib/kamailio/modules/ipops.so
97 	lib/kamailio/modules/kex.so
98 	lib/kamailio/modules/malloc_test.so
99 	lib/kamailio/modules/mangler.so
100 	lib/kamailio/modules/matrix.so
101 	lib/kamailio/modules/maxfwd.so
102 	lib/kamailio/modules/mediaproxy.so
103 	lib/kamailio/modules/mi_datagram.so
104 	lib/kamailio/modules/mi_fifo.so
105 	lib/kamailio/modules/mi_rpc.so
106 	lib/kamailio/modules/mohqueue.so
107 	lib/kamailio/modules/mqueue.so
108 	lib/kamailio/modules/msilo.so
109 	lib/kamailio/modules/msrp.so
110 	lib/kamailio/modules/mtree.so
111 	lib/kamailio/modules/nat_traversal.so
112 	lib/kamailio/modules/nathelper.so
113 	lib/kamailio/modules/p_usrloc.so
114 	lib/kamailio/modules/path.so
115 	lib/kamailio/modules/pdb.so
116 	lib/kamailio/modules/pdt.so
117 	lib/kamailio/modules/permissions.so
118 	lib/kamailio/modules/pike.so
119 	lib/kamailio/modules/pipelimit.so
120 	lib/kamailio/modules/prefix_route.so
121 	lib/kamailio/modules/print.so
122 	lib/kamailio/modules/print_lib.so
123 	lib/kamailio/modules/pv.so
124 	lib/kamailio/modules/qos.so
125 	lib/kamailio/modules/ratelimit.so
126 	lib/kamailio/modules/registrar.so
127 	lib/kamailio/modules/rr.so
128 	lib/kamailio/modules/rtimer.so
129 	lib/kamailio/modules/rtpproxy.so
130 	lib/kamailio/modules/rtpproxy-ng.so
131 	lib/kamailio/modules/sanity.so
132 	lib/kamailio/modules/sca.so
133 	lib/kamailio/modules/sdpops.so
134 	lib/kamailio/modules/seas.so
135 	lib/kamailio/modules/sipcapture.so
136 	lib/kamailio/modules/sipt.so
137 	lib/kamailio/modules/siptrace.so
138 	lib/kamailio/modules/siputils.so
139 	lib/kamailio/modules/sl.so
140 	lib/kamailio/modules/sms.so
141 	lib/kamailio/modules/speeddial.so
142 	lib/kamailio/modules/sqlops.so
143 	lib/kamailio/modules/sst.so
144 	lib/kamailio/modules/statistics.so
145 	lib/kamailio/modules/stun.so
146 	lib/kamailio/modules/textops.so
147 	lib/kamailio/modules/textopsx.so
148 	lib/kamailio/modules/timer.so
149 	lib/kamailio/modules/tm.so
150 	lib/kamailio/modules/tmrec.so
151 	lib/kamailio/modules/tmx.so
152 	lib/kamailio/modules/topoh.so
153 	lib/kamailio/modules/uac.so
154 	lib/kamailio/modules/uac_redirect.so
155 	lib/kamailio/modules/uid_auth_db.so
156 	lib/kamailio/modules/uid_avp_db.so
157 	lib/kamailio/modules/uid_domain.so
158 	lib/kamailio/modules/uid_gflags.so
159 	lib/kamailio/modules/uid_uri_db.so
160 	lib/kamailio/modules/uri_db.so
161 	lib/kamailio/modules/userblacklist.so
162 	lib/kamailio/modules/usrloc.so
163 	lib/kamailio/modules/xhttp.so
164 	lib/kamailio/modules/xhttp_rpc.so
165 	lib/kamailio/modules/xlog.so
166 	lib/kamailio/modules/xprint.so
167 	%%DATADIR%%/dbtext/kamailio/acc
168 	%%DATADIR%%/dbtext/kamailio/acc_cdrs
169 	%%DATADIR%%/dbtext/kamailio/active_watchers
170 	%%DATADIR%%/dbtext/kamailio/address
171 	%%DATADIR%%/dbtext/kamailio/aliases
172 	%%DATADIR%%/dbtext/kamailio/carrier_name
173 	%%DATADIR%%/dbtext/kamailio/carrierfailureroute
174 	%%DATADIR%%/dbtext/kamailio/carrierroute
175 	%%DATADIR%%/dbtext/kamailio/cpl
176 	%%DATADIR%%/dbtext/kamailio/dbaliases
177 	%%DATADIR%%/dbtext/kamailio/dialog
178 	%%DATADIR%%/dbtext/kamailio/dialog_vars
179 	%%DATADIR%%/dbtext/kamailio/dialplan
180 	%%DATADIR%%/dbtext/kamailio/dispatcher
181 	%%DATADIR%%/dbtext/kamailio/domain
182 	%%DATADIR%%/dbtext/kamailio/domain_attrs
183 	%%DATADIR%%/dbtext/kamailio/domain_name
184 	%%DATADIR%%/dbtext/kamailio/domainpolicy
185 	%%DATADIR%%/dbtext/kamailio/dr_gateways
186 	%%DATADIR%%/dbtext/kamailio/dr_groups
187 	%%DATADIR%%/dbtext/kamailio/dr_gw_lists
188 	%%DATADIR%%/dbtext/kamailio/dr_rules
189 	%%DATADIR%%/dbtext/kamailio/globalblacklist
190 	%%DATADIR%%/dbtext/kamailio/grp
191 	%%DATADIR%%/dbtext/kamailio/htable
192 	%%DATADIR%%/dbtext/kamailio/imc_members
193 	%%DATADIR%%/dbtext/kamailio/imc_rooms
194 	%%DATADIR%%/dbtext/kamailio/lcr_gw
195 	%%DATADIR%%/dbtext/kamailio/lcr_rule
196 	%%DATADIR%%/dbtext/kamailio/lcr_rule_target
197 	%%DATADIR%%/dbtext/kamailio/location
198 	%%DATADIR%%/dbtext/kamailio/location_attrs
199 	%%DATADIR%%/dbtext/kamailio/matrix
200 	%%DATADIR%%/dbtext/kamailio/missed_calls
201 	%%DATADIR%%/dbtext/kamailio/mohqcalls
202 	%%DATADIR%%/dbtext/kamailio/mohqueues
203 	%%DATADIR%%/dbtext/kamailio/mtree
204 	%%DATADIR%%/dbtext/kamailio/mtrees
205 	%%DATADIR%%/dbtext/kamailio/pdt
206 	%%DATADIR%%/dbtext/kamailio/pl_pipes
207 	%%DATADIR%%/dbtext/kamailio/presentity
208 	%%DATADIR%%/dbtext/kamailio/pua
209 	%%DATADIR%%/dbtext/kamailio/purplemap
210 	%%DATADIR%%/dbtext/kamailio/re_grp
211 	%%DATADIR%%/dbtext/kamailio/rls_presentity
212 	%%DATADIR%%/dbtext/kamailio/rls_watchers
213 	%%DATADIR%%/dbtext/kamailio/rtpproxy
214 	%%DATADIR%%/dbtext/kamailio/sca_subscriptions
215 	%%DATADIR%%/dbtext/kamailio/silo
216 	%%DATADIR%%/dbtext/kamailio/sip_trace
217 	%%DATADIR%%/dbtext/kamailio/speed_dial
218 	%%DATADIR%%/dbtext/kamailio/subscriber
219 	%%DATADIR%%/dbtext/kamailio/trusted
220 	%%DATADIR%%/dbtext/kamailio/uacreg
221 	%%DATADIR%%/dbtext/kamailio/uid_credentials
222 	%%DATADIR%%/dbtext/kamailio/uid_domain
223 	%%DATADIR%%/dbtext/kamailio/uid_domain_attrs
224 	%%DATADIR%%/dbtext/kamailio/uid_global_attrs
225 	%%DATADIR%%/dbtext/kamailio/uid_uri
226 	%%DATADIR%%/dbtext/kamailio/uid_uri_attrs
227 	%%DATADIR%%/dbtext/kamailio/uid_user_attrs
228 	%%DATADIR%%/dbtext/kamailio/uri
229 	%%DATADIR%%/dbtext/kamailio/userblacklist
230 	%%DATADIR%%/dbtext/kamailio/usr_preferences
231 	%%DATADIR%%/dbtext/kamailio/version
232 	%%DATADIR%%/dbtext/kamailio/watchers
233 	%%DATADIR%%/dbtext/kamailio/xcap
234 	%%MYSQL%%%%DATADIR%%/mysql/acc-create.sql
235 	%%MYSQL%%%%DATADIR%%/mysql/alias_db-create.sql
236 	%%MYSQL%%%%DATADIR%%/mysql/auth_db-create.sql
237 	%%MYSQL%%%%DATADIR%%/mysql/avpops-create.sql
238 	%%MYSQL%%%%DATADIR%%/mysql/carrierroute-create.sql
239 	%%MYSQL%%%%DATADIR%%/mysql/cpl-create.sql
240 	%%MYSQL%%%%DATADIR%%/mysql/dialog-create.sql
241 	%%MYSQL%%%%DATADIR%%/mysql/dialplan-create.sql
242 	%%MYSQL%%%%DATADIR%%/mysql/dispatcher-create.sql
243 	%%MYSQL%%%%DATADIR%%/mysql/domain-create.sql
244 	%%MYSQL%%%%DATADIR%%/mysql/domainpolicy-create.sql
245 	%%MYSQL%%%%DATADIR%%/mysql/drouting-create.sql
246 	%%MYSQL%%%%DATADIR%%/mysql/group-create.sql
247 	%%MYSQL%%%%DATADIR%%/mysql/htable-create.sql
248 	%%MYSQL%%%%DATADIR%%/mysql/imc-create.sql
249 	%%MYSQL%%%%DATADIR%%/mysql/lcr-create.sql
250 	%%MYSQL%%%%DATADIR%%/mysql/matrix-create.sql
251 	%%MYSQL%%%%DATADIR%%/mysql/mohqueue-create.sql
252 	%%MYSQL%%%%DATADIR%%/mysql/msilo-create.sql
253 	%%MYSQL%%%%DATADIR%%/mysql/mtree-create.sql
254 	%%MYSQL%%%%DATADIR%%/mysql/pdt-create.sql
255 	%%MYSQL%%%%DATADIR%%/mysql/permissions-create.sql
256 	%%MYSQL%%%%DATADIR%%/mysql/pipelimit-create.sql
257 	%%MYSQL%%%%DATADIR%%/mysql/presence-create.sql
258 	%%MYSQL%%%%DATADIR%%/mysql/purple-create.sql
259 	%%MYSQL%%%%DATADIR%%/mysql/registrar-create.sql
260 	%%MYSQL%%%%DATADIR%%/mysql/rls-create.sql
261 	%%MYSQL%%%%DATADIR%%/mysql/rtpproxy-create.sql
262 	%%MYSQL%%%%DATADIR%%/mysql/sca-create.sql
263 	%%MYSQL%%%%DATADIR%%/mysql/siptrace-create.sql
264 	%%MYSQL%%%%DATADIR%%/mysql/speeddial-create.sql
265 	%%MYSQL%%%%DATADIR%%/mysql/standard-create.sql
266 	%%MYSQL%%%%DATADIR%%/mysql/uac-create.sql
267 	%%MYSQL%%%%DATADIR%%/mysql/uid_auth_db-create.sql
268 	%%MYSQL%%%%DATADIR%%/mysql/uid_avp_db-create.sql
269 	%%MYSQL%%%%DATADIR%%/mysql/uid_domain-create.sql
270 	%%MYSQL%%%%DATADIR%%/mysql/uid_gflags-create.sql
271 	%%MYSQL%%%%DATADIR%%/mysql/uid_uri_db-create.sql
272 	%%MYSQL%%%%DATADIR%%/mysql/uri_db-create.sql
273 	%%MYSQL%%%%DATADIR%%/mysql/userblacklist-create.sql
274 	%%MYSQL%%%%DATADIR%%/mysql/usrloc-create.sql
275 	%%PGSQL%%%%DATADIR%%/postgres/acc-create.sql
276 	%%PGSQL%%%%DATADIR%%/postgres/alias_db-create.sql
277 	%%PGSQL%%%%DATADIR%%/postgres/auth_db-create.sql
278 	%%PGSQL%%%%DATADIR%%/postgres/avpops-create.sql
279 	%%PGSQL%%%%DATADIR%%/postgres/carrierroute-create.sql
280 	%%PGSQL%%%%DATADIR%%/postgres/cpl-create.sql
281 	%%PGSQL%%%%DATADIR%%/postgres/dialog-create.sql
282 	%%PGSQL%%%%DATADIR%%/postgres/dialplan-create.sql
283 	%%PGSQL%%%%DATADIR%%/postgres/dispatcher-create.sql
284 	%%PGSQL%%%%DATADIR%%/postgres/domain-create.sql
285 	%%PGSQL%%%%DATADIR%%/postgres/domainpolicy-create.sql
286 	%%PGSQL%%%%DATADIR%%/postgres/drouting-create.sql
287 	%%PGSQL%%%%DATADIR%%/postgres/group-create.sql
288 	%%PGSQL%%%%DATADIR%%/postgres/htable-create.sql
289 	%%PGSQL%%%%DATADIR%%/postgres/imc-create.sql
290 	%%PGSQL%%%%DATADIR%%/postgres/lcr-create.sql
291 	%%PGSQL%%%%DATADIR%%/postgres/matrix-create.sql
292 	%%PGSQL%%%%DATADIR%%/postgres/msilo-create.sql
293 	%%PGSQL%%%%DATADIR%%/postgres/mtree-create.sql
294 	%%PGSQL%%%%DATADIR%%/postgres/pdt-create.sql
295 	%%PGSQL%%%%DATADIR%%/postgres/permissions-create.sql
296 	%%PGSQL%%%%DATADIR%%/postgres/pipelimit-create.sql
297 	%%PGSQL%%%%DATADIR%%/postgres/presence-create.sql
298 	%%PGSQL%%%%DATADIR%%/postgres/purple-create.sql
299 	%%PGSQL%%%%DATADIR%%/postgres/registrar-create.sql
300 	%%PGSQL%%%%DATADIR%%/postgres/rls-create.sql
301 	%%PGSQL%%%%DATADIR%%/postgres/sca-create.sql
302 	%%PGSQL%%%%DATADIR%%/postgres/siptrace-create.sql
303 	%%PGSQL%%%%DATADIR%%/postgres/speeddial-create.sql
304 	%%PGSQL%%%%DATADIR%%/postgres/standard-create.sql
305 	%%PGSQL%%%%DATADIR%%/postgres/uac-create.sql
306 	%%PGSQL%%%%DATADIR%%/postgres/uid_auth_db-create.sql
307 	%%PGSQL%%%%DATADIR%%/postgres/uid_avp_db-create.sql
308 	%%PGSQL%%%%DATADIR%%/postgres/uid_domain-create.sql
309 	%%PGSQL%%%%DATADIR%%/postgres/uid_gflags-create.sql
310 	%%PGSQL%%%%DATADIR%%/postgres/uid_uri_db-create.sql
311 	%%PGSQL%%%%DATADIR%%/postgres/uri_db-create.sql
312 	%%PGSQL%%%%DATADIR%%/postgres/userblacklist-create.sql
313 	%%PGSQL%%%%DATADIR%%/postgres/usrloc-create.sql
314 	%%PORTDOCS%%%%DOCSDIR%%/AUTHORS
315 	%%PORTDOCS%%%%DOCSDIR%%/INSTALL
316 	%%PORTDOCS%%%%DOCSDIR%%/NEWS
317 	%%PORTDOCS%%%%DOCSDIR%%/README
318 	%%PORTDOCS%%%%DOCSDIR%%/README-MODULES
319 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.acc
320 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.alias_db
321 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.async
322 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.auth
323 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.auth_db
324 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.auth_diameter
325 	%%PORTDOCS%%%%RADIUS%%%%DOCSDIR%%/modules/README.auth_radius
326 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.avp
327 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.avpops
328 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.benchmark
329 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.blst
330 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.call_control
331 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.cfg_db
332 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.cfg_rpc
333 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.cfgutils
334 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.cnxcc
335 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.corex
336 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.counters
337 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.ctl
338 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.db2_ops
339 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.db_cluster
340 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.db_flatstore
341 	%%PORTDOCS%%%%MYSQL%%%%DOCSDIR%%/modules/README.db_mysql
342 	%%PORTDOCS%%%%PGSQL%%%%DOCSDIR%%/modules/README.db_postgres
343 	%%PORTDOCS%%%%UNIXODBC%%%%DOCSDIR%%/modules/README.db_unixodbc
344 	%%PORTDOCS%%%%TLS%%%%DOCSDIR%%/modules/README.tls
345 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.db_text
346 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.debugger
347 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.dialog
348 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.dispatcher
349 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.diversion
350 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.dmq
351 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.domain
352 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.domainpolicy
353 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.drouting
354 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.enum
355 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.exec
356 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.group
357 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.htable
358 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.imc
359 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.ipops
360 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.kex
361 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.malloc_test
362 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.mangler
363 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.matrix
364 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.maxfwd
365 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.mediaproxy
366 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.mi_datagram
367 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.mi_fifo
368 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.mi_rpc
369 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.mohqueue
370 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.mqueue
371 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.msilo
372 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.msrp
373 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.mtree
374 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.nat_traversal
375 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.nathelper
376 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.p_usrloc
377 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.path
378 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.pdb
379 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.pdt
380 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.permissions
381 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.pike
382 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.pipelimit
383 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.prefix_route
384 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.print
385 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.print_lib
386 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.pv
387 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.qos
388 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.ratelimit
389 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.registrar
390 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.rr
391 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.rtimer
392 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.rtpproxy
393 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.rtpproxy-ng
394 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.sanity
395 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.sca
396 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.sdpops
397 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.seas
398 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.sipcapture
399 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.sipt
400 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.siptrace
401 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.siputils
402 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.sl
403 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.sms
404 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.speeddial
405 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.sqlops
406 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.sst
407 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.statistics
408 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.stun
409 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.textops
410 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.textopsx
411 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.timer
412 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.tm
413 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.tmrec
414 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.tmx
415 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.topoh
416 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.uac
417 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.uac_redirect
418 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.uid_auth_db
419 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.uid_avp_db
420 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.uid_domain
421 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.uid_gflags
422 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.uid_uri_db
423 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.uri_db
424 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.userblacklist
425 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.usrloc
426 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.xhttp
427 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.xhttp_rpc
428 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.xlog
429 	%%PORTDOCS%%%%DOCSDIR%%/modules/README.xprint
430 	@dirrmtry etc/kamailio
431 	@dirrm lib/kamailio/kamctl/dbtextdb
432 	@dirrm lib/kamailio/kamctl
433 	@dirrm lib/kamailio/modules
434 	@dirrm lib/kamailio
435 	@dirrm %%DATADIR%%/dbtext/kamailio
436 	@dirrm %%DATADIR%%/dbtext
437 	%%MYSQL%%@dirrm %%DATADIR%%/mysql
438 	%%PGSQL%%@dirrm %%DATADIR%%/postgres
439 	@dirrm %%DATADIR%%
440 	%%PORTDOCS%%@dirrm %%DOCSDIR%%/modules
441 	%%PORTDOCS%%@dirrm %%DOCSDIR%%
442 	man/man5/kamailio.cfg.5.gz
443 	man/man8/kamailio.8.gz
444 	man/man8/kamcmd.8.gz
445 	man/man8/kamctl.8.gz
446 	man/man8/kamdbctl.8.gz

5. The files folder

This folder mostly holds patches to the source files to make the software runnable on FreeBSD. Since the binary interfaces differ among UNIX systems programs frequently need to be patched. Among patches the files folder also contains rc-scripts, i.e. supposing that the program needs one. The concept of rc-scripts has been discussed in another section of my programming pages.

1 	#!/bin/sh
2 	#
3 	# $FreeBSD: net/kamailio/files/kamailio.in
4 	#
5 	# PROVIDE: kamailio
6 	# REQUIRE: LOGIN
7 	# KEYWORD: shutdown
8 	#
9 	# Add the following line to /etc/rc.conf to enable this service
10 	# at system startup:
11 	#
12 	# kamailio_enable (bool): Set to NO by default.
13 	#                         Set it to YES to enable kamailio.
14 	#
15 	
16 	. /etc/rc.subr
17 	
18 	name=kamailio
19 	rcvar=kamailio_enable
20 	
21 	load_rc_config ${name}
22 	
23 	: ${kamailio_enable:=NO}
24 	
25 	command="/usr/local/sbin/kamailio"
26 	required_files="/usr/local/etc/kamailio/kamailio.cfg"
27 	
28 	
29 	run_rc_command $1

This patch makes the berkely-db runnable when the module is compiled.

1 	--- modules/db_berkeley/Makefile.orig   2014-08-06 15:29:51 UTC
2 	+++ modules/db_berkeley/Makefile
3 	@@ -25,7 +25,7 @@
4 	 # extra install for kamailio
5 	 
6 	 install-berkeley-scripts: $(bin_prefix)/$(bin_dir)
7 	-               BERKELEYDBON=yes make -C ../../utils/kamctl/ install-modules
8 	+               BERKELEYDBON=yes $(MAKE) -C ../../utils/kamctl/ install-modules
9 	 
10 	 install-scripts: install-berkeley-scripts

This patch makes the oracle-db runnable when the module is compiled.

1 	--- modules/db_oracle/Makefile.orig     2014-08-06 15:29:51 UTC
2 	+++ modules/db_oracle/Makefile
3 	@@ -71,7 +71,7 @@
4 	 # extra install for kamailio
5 	 
6 	 install-oracle-scripts: $(bin_prefix)/$(bin_dir)
7 	-               ORACLEON=yes make -C ../../utils/kamctl/ install-modules
8 	+               ORACLEON=yes $(MAKE) -C ../../utils/kamctl/ install-modules
9 	 
10 	 install-scripts: install-oracle-scripts

This patch makes the sqlite-db runnable when the module is compiled.

1 	--- modules/db_sqlite/Makefile.orig     2014-08-06 15:29:51 UTC
2 	+++ modules/db_sqlite/Makefile
3 	@@ -23,7 +23,7 @@
4 	 # extra install for kamailio
5 	 
6 	 install-sqlite-scripts: $(bin_prefix)/$(bin_dir)
7 	-               SQLITEON=yes make -C ../../utils/kamctl/ install-modules
8 	+               SQLITEON=yes $(MAKE) -C ../../utils/kamctl/ install-modules
9 	 
10 	 install-scripts: install-sqlite-scripts

This patch compiles the program with transport layer security.

1 	--- modules/tls/Makefile.orig   2014-08-06 15:29:51 UTC
2 	+++ modules/tls/Makefile
3 	@@ -9,6 +9,8 @@
4 	 auto_gen=
5 	 NAME=tls.so
6 	 
7 	+skip_cfg_install?=yes
8 	+
9 	 ifeq ($(CROSS_COMPILE),)
10 	 SSL_BUILDER=$(shell \
11 	        if pkg-config --exists libssl; then \

A patch to one of the programs original Makefiles to fix installation issues.

1 	--- utils/kamctl/Makefile.orig  2014-08-06 15:29:51 UTC
2 	+++ utils/kamctl/Makefile
3 	@@ -3,6 +3,8 @@
4 	 include $(COREPATH)/Makefile.defs
5 	 include $(COREPATH)/config.mak
6 	 
7 	+skip_cfg_install?=yes
8 	+
9 	 all:
10 	                @echo "No compilation needed for kamctl"
11 	 
12 	@@ -15,7 +17,8 @@
13 	                $(INSTALL_TOUCH)   $(cfg_prefix)/$(cfg_dir)/kamctlrc.sample
14 	                $(INSTALL_CFG) kamctlrc \
15 	                        $(cfg_prefix)/$(cfg_dir)/kamctlrc.sample
16 	-               if [ ! -f $(cfg_prefix)/$(cfg_dir)/kamctlrc ]; then \
17 	+               if [ -z "${skip_cfg_install}" -a \
18 	+                       ! -f $(cfg_prefix)/$(cfg_dir)/kamctlrc ]; then \
19 	                        mv -f $(cfg_prefix)/$(cfg_dir)/kamctlrc.sample \
20 	                                $(cfg_prefix)/$(cfg_dir)/kamctlrc; \
21 	                fi


This is what the port looked like when I left the project and turned it over to the FreeBSD team.



References:

The link to Kamailio on the FreeBSD pages

The manpage for the make utility

The Porters Handbook - A guide to how porting is done.

The ports section from the FreeBSD Handbook