# Copyright 2018 Julian Ospald <hasufell@posteo.de>
# Distributed under the terms of the GNU General Public License v2

require python [ blacklist=3 has_bin=false multibuild=false ]
require github [ user=haiwen tag="v${PV}" ]
require autotools [ supported_autoconf=[ 2.5 ] supported_automake=[ 1.15 ] ]
require vala [ vala_dep=true ]

SUMMARY="Ccnet is a framework for writing networked applications in C"
=""

LICENCES="GPL-2" # has openssl linking exception
SLOT="0"
PLATFORMS="~amd64 ~x86"
MYOPTIONS="
    ( providers: libressl openssl ) [[ number-selected = exactly-one ]]
"

DEPENDENCIES="
    build:
        virtual/pkg-config
    build+run:
        dev-db/sqlite:3
        dev-libs/glib:2
        dev-libs/jansson
        dev-libs/libevent
        net-libs/libsearpc[python_abis:*(-)?]
        providers:libressl? ( dev-libs/libressl:= )
        providers:openssl?  ( dev-libs/openssl )
"

BUGS_TO="hasufell@posteo.de"

DEFAULT_SRC_PREPARE_PATCHES=(
    "${FILES}"/fix-libressl-build.patch
)

src_prepare() {
    default
    edo sed -i -e "s/(DESTDIR)//" libccnet.pc.in
    edo sed -i -e 's/valac /${VALAC} /' lib/Makefile.am
    eautoreconf
}