[I've been working through making kamailio build on NetBSD -- thanks for
merging my recent PR with two small fixes.]
In src/Makefile.defs, there is a setting of LOCALBASE, which is
basically a case statement by OS. A few examples:
Linux /usr/local presuambly the tradition /usr/local per autucoonf
FreeBSD /usr/local hijacked by ports system - not traditional /usr/local
NetBSD /usr/pkg pkgsrc puts things here (local is still local)
There is a need for two separate prefixes when building something like
this:
where the software being built should be installed: basically like
--prefix=/foo in autoconf
where things that the software depends on should be found, sort of
what autoconf would use for --with-bar=/baz, so that /baz/include is
added to CPPFLAGS and "-L/baz/lib -R/baz/lib" to LDFLAGS.
I needed to add the C_INCLUDES as
ifeq ($(OS), netbsd)
C_INCLUDES+= -I$(LOCALBASE)/include
since otherwise a libxml2 header is not found (and with the above it
builds fine):
gcc -fPIC -DPIC -g -funroll-loops -Wcast-align -m64 -minline-all-stringops -falign-loops
-ftree-vectorize -fno-strict-overflow -mtune=generic -Wall
-DNAME='"kamailio"' -DVERSION='"5.4.0-dev3"'
-DARCH='"x86_64"' -DOS='netbsd_'
-DOS_QUOTED='"netbsd"' -DCOMPILER='"gcc 5.5.0"'
-D__CPU_x86_64 -D__OS_netbsd -DVERSIONVAL=5004000
-DCFG_DIR='"/usr/pkg/etc/kamailio/"'
-DSHARE_DIR='"/usr/pkg/share/kamailio/"'
-DRUN_DIR='"/var/run/kamailio/"' -DPKG_MALLOC -DSHM_MMAP -DDNS_IP_HACK
-DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER
-DUSE_DST_BLACKLIST -DUSE_NAPTR -DWITH_XAVP -DMEM_JOIN_FREE -DF_MALLOC -DQ_MALLOC
-DTLSF_MALLOC -DDBG_SR_MEMORY -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS
-DMALLOC_STATS -DUSE_SCTP -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024
-DCC_GCC_LIKE_ASM -DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_MSGHDR_MSG_CONTROL
-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM -DHAVE_SELECT -I/usr/pkg/include/libxml2
-I/usr/include -DMOD_NAME='"ims_registrar_pcscf"' -c notify.c -o
notify.o -MMD -MP
notify.c:38:36: fatal error: libxml2/libxml/globals.h: No such file or directory
Of course, on Linux this issue is usually avoided because everything is
installed with --prefix=/usr which is in te default search path.
So my questions are:
Is LOCALBASE supposed to be where kamailio is built into?
(If so, then /usr/pkg seems like a wrong default on NetBSD, following
the autoconf /usr/local norm, even though pkgsrc builds would pass in
/usr/pkg.)
Or is it where dependencies are?
(If so, why isn't LOCALBASE/include put in cflags?)
If dependencies are supposed to be someplace else, what's the
mechanism to look for them? C_INCLUDES is set to empty, so I can't
pass that in. Shouldn't the plan be explained in INSTALL (and sorry
if I missed it)?
Even a very brief clue would be appreciated, so I can align my changes
with the overall intent.
Thanks,
Greg