Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Apr 2016 02:13:51 -0500
From:      "Matthew D. Fuller" <fullermd@over-yonder.net>
To:        abi <abi@abinet.ru>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: Making a port - debugging cmake check_include_file
Message-ID:  <20160424071351.GQ83618@over-yonder.net>
In-Reply-To: <571BF713.4040607@abinet.ru>
References:  <571BE034.9070200@abinet.ru> <20160423215530.GP83618@over-yonder.net> <571BF713.4040607@abinet.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Apr 24, 2016 at 01:28:35AM +0300 I heard the voice of
abi, and lo! it spake thus:
> Thanks!
> If speak about general purpose solution, acceptable by upstream, I should
> 1. make cmake variable like INCLUDE_DIR_EXTRA
> 2. if set, include it contents.
> 3. add default value if platform is FreeBSD
> Am I right?

I'd say it depends on how much work you wanna put in, and how
interested upstream is.


The pkgconfig path is fairly simple.  In a quick test:

    include(FindPkgConfig)
    pkg_check_modules(LIBV4L1 libv4l1)
    if(LIBV4L1_FOUND)
        include_directories(${LIBV4L1_INCLUDE_DIRS})
    endif()

seems to set things right here (I assume from the libv4l1-videodev.h
that it wants v4l_1_ rather than v4l_2_).  That may be trivially
upstreamable, since it should just quietly have no effect in the cases
where v4l isn't in pkgconf, and DTRT when it is.  Of course, it won't
work if a system doesn't have pkg-config installed, so unless you
wanted to add that as a build dep (it _is_ pretty tiny, but it's an
extra dep), you couldn't assume it was there on the system.


A somewhat more verbose solution that passes more control to the port
level would be to patch in a block like

    if(EXTRA_INCDIRS)
        foreach(dir ${EXTRA_INCDIRS})
            include_directories(${dir})
        endforeach()
    endif()

relatively early into the CMakeLists.txt and then add $LOCALBASE into
the cmake command with something like

    CMAKE_ARGS+=-DEXTRA_INCDIRS="${LOCALBASE}"

in the port Makefile (untested).  Aside from potential need to redo
the patch if the CMakeLists.txt changes between releases, that doesn't
really need any upstream involvement at all, it can just be carried in
the port.  OTOH, it's probably not too objectionable (possibly with
tweaks to variable naming) to upstream either.



-- 
Matthew Fuller     (MF4839)   |  fullermd@over-yonder.net
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160424071351.GQ83618>