/*
    nanossl.me -- Mocana NanoSSL Component
 */

Me.load({ 
    targets: {
        nanossl: {
            description: 'Mocana NanoSSL',
            config: function (target) {
                if (me.options.gen) {
                    return {
                        path: target.withpath || '/usr/src/nanossl',
                        libraries: [ 'ssls' ],
                        libpaths: [ '$(ME_COM_NANOSSL_PATH)/bin' ],
                        includes: [ '$(ME_COM_NANOSSL_PATH)/src' ]
                    }
                }
                let search = getComponentSearch(target, 'nanossl', 'bin')
                let lib = probe('libssls.' + me.ext.lib, {fullpath: true, search: search}).absolute
                let path = lib.dirname
                let incdir = probe('common/moptions.h', {search: [path.join('src')]}).absolute
                return {
                    path:      path,
                    includes:  [ incdir ]
                    libpaths:  [ path ]
                    libraries: [ 'ssls' ]
                    imports:   [ lib ]
                }
            },
            ifdef:     [ 'ssl' ],
            conflicts: [ 'est', 'matrixssl', 'openssl' ],
        },
    },
})
