/* goahead-openssl.me -- OpenSSL Component for GoAhead */ require ejs.version Me.load({ targets: { openssl: { description: 'OpenSSL Support', config: function (target) { let os = me.platform.os let version = (me.settings.openssl || {}).version || '1.0' if (me.options.gen) { let result = { /* Static configuration to work for standard installations under /usr/lib and /usr/include and in a custom user directory. */ includes: [ me.dir.inc ], } if (os != 'windows') { result.defines = ['ME_COM_OPENSSL_PATH=/path/to/openssl'] result.includes.push('$(ME_COM_OPENSSL_PATH)/include') result.libpaths = ['$(ME_COM_OPENSSL_PATH)'] result.libraries = [ 'ssl', 'crypto' ] } else if (Version(version).acceptable('<1.1')) { result.defines = ['ME_COM_OPENSSL_PATH=/path/to/openssl'] result.includes.push('$(ME_COM_OPENSSL_PATH)/inc32') result.libpaths = ['$(ME_COM_OPENSSL_PATH)/out32'] result.libraries = ['gdi32.lib', 'libeay32.lib', 'ssleay32.lib'] } else { result.defines = ['ME_COM_OPENSSL_PATH=/path/to/openssl'] result.includes.push('$(ME_COM_OPENSSL_PATH)/include') result.libpaths = ['$(ME_COM_OPENSSL_PATH)'] result.libraries = [ 'libssl', 'libcrypto' ] } return result } let lib, libraries, libpaths, imports, includes, path let search = getComponentSearch(target, 'openssl') if (me.platform.os == 'windows') { search = search.map(function(p:Path) p) + search.map(function(p:Path) p.join('out32')) + search.map(function(p:Path) p.join('out32dll')) lib = probe('libeay32.lib', {fullpath: true, search: search, nopath: true, nothrow: true}) if (!lib) { lib = probe('libssl.lib', {fullpath: true, search: search, nopath: true}) libraries = [ 'gdi32', 'libssl', 'libcrypto' ] imports = [ lib.parent.join('libssl.lib'), lib.parent.join('libcrypto.lib') ] /* Need to import the DLLs for OpenSSL >= 1.1.1 */ let isearch = [ lib.dirname.join('include') ] inc = probe('openssl/ssl.h', {search: isearch}) includes = [ inc ] path = lib.dirname.parent } else { libraries = [ 'gdi32', 'libeay32', 'ssleay32' ] imports = [ lib.parent.join('libeay32.lib'), lib.parent.join('ssleay32.lib') ] if (lib.dirname == 'out32dll') { imports += [ lib.parent.join('libeay32.dll'), lib.parent.join('ssleay32.dll') ] } path = lib.dirname.parent includes = [ probe('openssl/ssl.h', {search: [path.join('inc32')]}) ] } libpaths = [ lib.parent ] } else { let opt = {fullpath: true, search: search, nopath: true} let inc, lib if ((lib = probe('libcrypto.' + me.ext.shobj, blend({nothrow: true}, opt))) != null) { let isearch = [ lib.dirname.join('include') ] if (!me.platform.cross) { isearch.push('/usr/include') } inc = probe('openssl/ssl.h', {search: isearch, nothrow: true}) } if (!lib || !inc) { lib = probe('libcrypto.' + me.ext.lib, opt) let isearch = [ lib.dirname.join('include') ] if (!me.platform.cross) { isearch.push('/usr/include') } inc = probe('openssl/ssl.h', {search: isearch}) } includes = [ inc ] libraries = [ 'ssl', 'crypto' ] libpaths = [ lib.parent ] imports = lib.parent.files('libssl.*' + lib.extension + '*') + lib.parent.files('libcrypto.*' + lib.extension + '*') path = lib.dirname } includes.push(me.dir.inc) return { location: path, imports: imports, includes: includes, libpaths: libpaths, libraries, libraries, } }, ifdef: [ 'ssl' ], conflicts: [ 'mbedtls', 'matrixssl', 'nanossl' ], depends: [ 'libgoahead-openssl' ], }, 'libgoahead-openssl': { description: 'GoAhead OpenSSL Interface', type: 'lib', static: true, path: '${BIN}/libgoahead-openssl${ARLIB}', ifdef: [ 'openssl' ], sources: [ '*.c' ], postresolve: ` let target = me.target let openssl = me.targets.openssl target.includes += openssl.includes target.libpaths += openssl.libpaths target.libraries += openssl.libraries if (me.platform.os == 'macosx') { target.compiler.push('-Wno-deprecated-declarations') } ` } } })