From 4a0faed8b6680e259e7aeaac03cf5e70781e7dc5 Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Tue, 16 Oct 2018 10:28:28 -0700 Subject: [PATCH 1/8] Prework: Move openssl_distributions file into `vendor/static_config` --- generate/templates/templates/binding.gyp | 2 +- utils/README.md | 6 +++--- utils/acquireOpenSSL.js | 2 +- utils/configureLibssh2.js | 1 + utils/discoverOpenSSLDistros.js | 2 +- vendor/{ => static_config}/openssl_distributions.json | 0 6 files changed, 7 insertions(+), 6 deletions(-) rename vendor/{ => static_config}/openssl_distributions.json (100%) diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index a332fc74c..dbe70ab5c 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -39,7 +39,7 @@ "actions": [{ "action_name": "acquire", "action": ["node", "utils/acquireOpenSSL.js"], - "inputs": ["vendor/openssl_distributions.json"], + "inputs": ["vendor/static_config/openssl_distributions.json"], "outputs": ["vendor/openssl"], "message": "Acquiring OpensSL binaries and headers" }] diff --git a/utils/README.md b/utils/README.md index ce679f8ef..1773e9979 100644 --- a/utils/README.md +++ b/utils/README.md @@ -11,10 +11,10 @@ * Mac: clang-8.1 or clang-9. * Windows: vs12, vs14, vs15 - The discovered distributions are written into `vendor/openssl_distributions.json`. This script does not need to be run unless you are updating the version of OpenSSL to build against. + The discovered distributions are written into `vendor/static_config/openssl_distributions.json`. This script does not need to be run unless you are updating the version of OpenSSL to build against. - ### acquireOpenSSL - Download the OpenSSL binaries and headers applicable to the current OS for the latest compiler version (clang-9/vs14). Uses links from `vendor/openssl_distributions.json`. + ## acquireOpenSSL + Download the OpenSSL binaries and headers applicable to the current OS for the latest compiler version (clang-9/vs14). Uses links from `vendor/static_config/openssl_distributions.json`. TODO: * Make the script pull the debug versions if node-gyp is building in debug mode diff --git a/utils/acquireOpenSSL.js b/utils/acquireOpenSSL.js index 2dc54780c..1c1ca29df 100644 --- a/utils/acquireOpenSSL.js +++ b/utils/acquireOpenSSL.js @@ -7,7 +7,7 @@ const tar = require("tar-fs"); const zlib = require("zlib"); const vendorPath = path.resolve(__dirname, "..", "vendor"); -const distrosFilePath = path.join(vendorPath, "openssl_distributions.json"); +const distrosFilePath = path.join(vendorPath, "static_config", "openssl_distributions.json"); const extractPath = path.join(vendorPath, "openssl"); const getOSName = () => { diff --git a/utils/configureLibssh2.js b/utils/configureLibssh2.js index 401cb5fc9..8ac7af2e9 100644 --- a/utils/configureLibssh2.js +++ b/utils/configureLibssh2.js @@ -7,6 +7,7 @@ var rooted = function (dir) { }; module.exports = function retrieveExternalDependencies() { + // Do not configure on Windows if (process.platform === "win32") { return Promise.resolve(""); } diff --git a/utils/discoverOpenSSLDistros.js b/utils/discoverOpenSSLDistros.js index f0f6bc94e..a6cd7cc5c 100644 --- a/utils/discoverOpenSSLDistros.js +++ b/utils/discoverOpenSSLDistros.js @@ -171,7 +171,7 @@ const discoverDistributions = (treeHtml) => { ); } -const outputPath = path.resolve(__dirname, "..", "vendor", "openssl_distributions.json"); +const outputPath = path.resolve(__dirname, "..", "vendor", "static_config", "openssl_distributions.json"); request(getDistributionsRootURL()) .then(discoverDistributions) .then(R.filter(R.identity)) diff --git a/vendor/openssl_distributions.json b/vendor/static_config/openssl_distributions.json similarity index 100% rename from vendor/openssl_distributions.json rename to vendor/static_config/openssl_distributions.json From 9c0c98301e1114f74b56893a27a32200444d9441 Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Tue, 16 Oct 2018 10:36:23 -0700 Subject: [PATCH 2/8] Ensure `static_config` directory exists before writing openssl_distributions.json --- utils/discoverOpenSSLDistros.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/discoverOpenSSLDistros.js b/utils/discoverOpenSSLDistros.js index a6cd7cc5c..5a413a8e6 100644 --- a/utils/discoverOpenSSLDistros.js +++ b/utils/discoverOpenSSLDistros.js @@ -171,10 +171,14 @@ const discoverDistributions = (treeHtml) => { ); } +const writeFile = (distributions) => + fse.ensureDir(path.dirname(outputPath)) + .then(fse.writeFile(outputPath, JSON.stringify(distributions, null, 2))); + const outputPath = path.resolve(__dirname, "..", "vendor", "static_config", "openssl_distributions.json"); request(getDistributionsRootURL()) .then(discoverDistributions) .then(R.filter(R.identity)) .then(R.sortBy(R.prop(0))) .then(R.fromPairs) - .then(distributions => fse.writeFile(outputPath, JSON.stringify(distributions, null, 2))); + .then(writeFile); From c268b63fa9be042b9775038e357b3a6472f2aba8 Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Tue, 16 Oct 2018 12:58:16 -0700 Subject: [PATCH 3/8] Move `libssh2/win32` directory to `vendor/static_config` --- vendor/{ => static_config}/libssh2/win32/GNUmakefile | 0 vendor/{ => static_config}/libssh2/win32/Makefile.Watcom | 0 vendor/{ => static_config}/libssh2/win32/config.mk | 0 vendor/{ => static_config}/libssh2/win32/libssh2.dsp | 0 vendor/{ => static_config}/libssh2/win32/libssh2.dsw | 0 vendor/{ => static_config}/libssh2/win32/libssh2.rc | 0 vendor/{ => static_config}/libssh2/win32/libssh2_config.h | 0 vendor/{ => static_config}/libssh2/win32/msvcproj.foot | 0 vendor/{ => static_config}/libssh2/win32/msvcproj.head | 0 vendor/{ => static_config}/libssh2/win32/rules.mk | 0 vendor/{ => static_config}/libssh2/win32/test/GNUmakefile | 0 vendor/{ => static_config}/libssh2/win32/tests.dsp | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename vendor/{ => static_config}/libssh2/win32/GNUmakefile (100%) rename vendor/{ => static_config}/libssh2/win32/Makefile.Watcom (100%) rename vendor/{ => static_config}/libssh2/win32/config.mk (100%) rename vendor/{ => static_config}/libssh2/win32/libssh2.dsp (100%) rename vendor/{ => static_config}/libssh2/win32/libssh2.dsw (100%) rename vendor/{ => static_config}/libssh2/win32/libssh2.rc (100%) rename vendor/{ => static_config}/libssh2/win32/libssh2_config.h (100%) rename vendor/{ => static_config}/libssh2/win32/msvcproj.foot (100%) rename vendor/{ => static_config}/libssh2/win32/msvcproj.head (100%) rename vendor/{ => static_config}/libssh2/win32/rules.mk (100%) rename vendor/{ => static_config}/libssh2/win32/test/GNUmakefile (100%) rename vendor/{ => static_config}/libssh2/win32/tests.dsp (100%) diff --git a/vendor/libssh2/win32/GNUmakefile b/vendor/static_config/libssh2/win32/GNUmakefile similarity index 100% rename from vendor/libssh2/win32/GNUmakefile rename to vendor/static_config/libssh2/win32/GNUmakefile diff --git a/vendor/libssh2/win32/Makefile.Watcom b/vendor/static_config/libssh2/win32/Makefile.Watcom similarity index 100% rename from vendor/libssh2/win32/Makefile.Watcom rename to vendor/static_config/libssh2/win32/Makefile.Watcom diff --git a/vendor/libssh2/win32/config.mk b/vendor/static_config/libssh2/win32/config.mk similarity index 100% rename from vendor/libssh2/win32/config.mk rename to vendor/static_config/libssh2/win32/config.mk diff --git a/vendor/libssh2/win32/libssh2.dsp b/vendor/static_config/libssh2/win32/libssh2.dsp similarity index 100% rename from vendor/libssh2/win32/libssh2.dsp rename to vendor/static_config/libssh2/win32/libssh2.dsp diff --git a/vendor/libssh2/win32/libssh2.dsw b/vendor/static_config/libssh2/win32/libssh2.dsw similarity index 100% rename from vendor/libssh2/win32/libssh2.dsw rename to vendor/static_config/libssh2/win32/libssh2.dsw diff --git a/vendor/libssh2/win32/libssh2.rc b/vendor/static_config/libssh2/win32/libssh2.rc similarity index 100% rename from vendor/libssh2/win32/libssh2.rc rename to vendor/static_config/libssh2/win32/libssh2.rc diff --git a/vendor/libssh2/win32/libssh2_config.h b/vendor/static_config/libssh2/win32/libssh2_config.h similarity index 100% rename from vendor/libssh2/win32/libssh2_config.h rename to vendor/static_config/libssh2/win32/libssh2_config.h diff --git a/vendor/libssh2/win32/msvcproj.foot b/vendor/static_config/libssh2/win32/msvcproj.foot similarity index 100% rename from vendor/libssh2/win32/msvcproj.foot rename to vendor/static_config/libssh2/win32/msvcproj.foot diff --git a/vendor/libssh2/win32/msvcproj.head b/vendor/static_config/libssh2/win32/msvcproj.head similarity index 100% rename from vendor/libssh2/win32/msvcproj.head rename to vendor/static_config/libssh2/win32/msvcproj.head diff --git a/vendor/libssh2/win32/rules.mk b/vendor/static_config/libssh2/win32/rules.mk similarity index 100% rename from vendor/libssh2/win32/rules.mk rename to vendor/static_config/libssh2/win32/rules.mk diff --git a/vendor/libssh2/win32/test/GNUmakefile b/vendor/static_config/libssh2/win32/test/GNUmakefile similarity index 100% rename from vendor/libssh2/win32/test/GNUmakefile rename to vendor/static_config/libssh2/win32/test/GNUmakefile diff --git a/vendor/libssh2/win32/tests.dsp b/vendor/static_config/libssh2/win32/tests.dsp similarity index 100% rename from vendor/libssh2/win32/tests.dsp rename to vendor/static_config/libssh2/win32/tests.dsp From 0fe23f37ca65042ddce1a456c1b5be6515927bde Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Tue, 16 Oct 2018 13:01:04 -0700 Subject: [PATCH 4/8] Add static configured libssh2 header for MacOS --- .../libssh2/darwin/libssh2_config.h | 262 ++++++++++++++++++ 1 file changed, 262 insertions(+) create mode 100644 vendor/static_config/libssh2/darwin/libssh2_config.h diff --git a/vendor/static_config/libssh2/darwin/libssh2_config.h b/vendor/static_config/libssh2/darwin/libssh2_config.h new file mode 100644 index 000000000..eb3228e6c --- /dev/null +++ b/vendor/static_config/libssh2/darwin/libssh2_config.h @@ -0,0 +1,262 @@ +/* src/libssh2_config.h. Generated from libssh2_config.h.in by configure. */ +/* src/libssh2_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the declaration of `SecureZeroMemory', and to 0 if + you don't. */ +/* #undef HAVE_DECL_SECUREZEROMEMORY */ + +/* disabled non-blocking sockets */ +/* #undef HAVE_DISABLED_NONBLOCKING */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the `EVP_aes_128_ctr' function. */ +#define HAVE_EVP_AES_128_CTR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* use FIONBIO for non-blocking sockets */ +/* #undef HAVE_FIONBIO */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* use ioctlsocket() for non-blocking sockets */ +/* #undef HAVE_IOCTLSOCKET */ + +/* use Ioctlsocket() for non-blocking sockets */ +/* #undef HAVE_IOCTLSOCKET_CASE */ + +/* Define if you have the bcrypt library. */ +/* #undef HAVE_LIBBCRYPT */ + +/* Define if you have the crypt32 library. */ +/* #undef HAVE_LIBCRYPT32 */ + +/* Define if you have the gcrypt library. */ +/* #undef HAVE_LIBGCRYPT */ + +/* Define if you have the mbedtls library. */ +/* #undef HAVE_LIBMBEDTLS */ + +/* Define if you have the ssl library. */ +#define HAVE_LIBSSL 1 + +/* Define if you have the z library. */ +#define HAVE_LIBZ 1 + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NTDEF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NTSTATUS_H */ + +/* use O_NONBLOCK for non-blocking sockets */ +#define HAVE_O_NONBLOCK 1 + +/* Define to 1 if you have the `poll' function. */ +/* #undef HAVE_POLL */ + +/* Define to 1 if you have the select function. */ +#define HAVE_SELECT 1 + +/* use SO_NONBLOCK for non-blocking sockets */ +/* #undef HAVE_SO_NONBLOCK */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WS2TCPIP_H */ + +/* to make a symbol visible */ +/* #undef LIBSSH2_API */ + +/* Enable clearing of memory before being freed */ +/* #undef LIBSSH2_CLEAR_MEMORY */ + +/* Enable "none" cipher -- NOT RECOMMENDED */ +/* #undef LIBSSH2_CRYPT_NONE */ + +/* Enable newer diffie-hellman-group-exchange-sha1 syntax */ +#define LIBSSH2_DH_GEX_NEW 1 + +/* Compile in zlib support */ +#define LIBSSH2_HAVE_ZLIB 1 + +/* Use libgcrypt */ +/* #undef LIBSSH2_LIBGCRYPT */ + +/* Enable "none" MAC -- NOT RECOMMENDED */ +/* #undef LIBSSH2_MAC_NONE */ + +/* Use mbedtls */ +/* #undef LIBSSH2_MBEDTLS */ + +/* Use OpenSSL */ +#define LIBSSH2_OPENSSL 1 + +/* Use Windows CNG */ +/* #undef LIBSSH2_WINCNG */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +/* #undef NEED_REENTRANT */ + +/* Name of package */ +#define PACKAGE "libssh2" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "libssh2-devel@cool.haxx.se" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libssh2" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libssh2 -" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libssh2" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "-" + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "-" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ From a09613ca950516fbe9db03854b3e4eee684307e3 Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Tue, 16 Oct 2018 13:01:47 -0700 Subject: [PATCH 5/8] Copy Windows / Darwin static configuration files into `libssh` as configure step --- .gitignore | 2 ++ utils/configureLibssh2.js | 42 +++++++++++++++++++++------------------ vendor/libgit2.gyp | 11 ++++++++-- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 3d571d1c7..d55d0ae72 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,8 @@ /vendor/libssh2/example/stamp-h2 /vendor/libssh2/libssh2.pc /vendor/libssh2/libtool +/vendor/libssh2/darwin/ +/vendor/libssh2/win32/ /vendor/libssh2/src/.deps/ /vendor/libssh2/src/Makefile /vendor/libssh2/src/libssh2_config.h diff --git a/utils/configureLibssh2.js b/utils/configureLibssh2.js index 8ac7af2e9..e64933206 100644 --- a/utils/configureLibssh2.js +++ b/utils/configureLibssh2.js @@ -1,32 +1,33 @@ var cp = require("child_process"); +var fse = require('fs-extra'); var path = require("path"); -var rooted = function (dir) { - var fullPath = path.join(__dirname, "..", dir); - var escapedPathForShell = fullPath.replace(/ /g, "\\ "); - return escapedPathForShell; -}; + +const libssh2VendorDirectory = path.resolve(__dirname, "..", "vendor", "libssh2"); +const libssh2ConfigureScript = path.join(libssh2VendorDirectory, "configure"); +const libssh2StaticConfigDirectory = path.resolve(__dirname, "..", "vendor", "static_config", "libssh2"); module.exports = function retrieveExternalDependencies() { - // Do not configure on Windows - if (process.platform === "win32") { - return Promise.resolve(""); + console.info("[nodegit] Configuring libssh2."); + + // Copy Windows / Mac preconfigured files + if (process.platform === "win32" || process.platform === "darwin") { + return fse.copy( + path.join(libssh2StaticConfigDirectory, process.platform), + path.join(libssh2VendorDirectory, process.platform) + ); } + // Run the `configure` script on Linux return new Promise(function(resolve, reject) { - console.info("[nodegit] Configuring libssh2."); + var opensslDir = process.argv[2]; var isElectron = process.argv[3] === "1"; var opensslIncludes = isElectron ? path.join(opensslDir, "includes") : opensslDir; var newEnv = {}; - - // For some magic reason, MacOS fails to build if we copy over the current environment variables, but Linux - // builds fail if we DON'T copy over the current environment variables - if (process.platform !== "darwin") { - Object.keys(process.env).forEach(function(key) { - newEnv[key] = process.env[key]; - }); - } + Object.keys(process.env).forEach(function(key) { + newEnv[key] = process.env[key]; + }); newEnv.CPPFLAGS = newEnv.CPPFLAGS || ""; newEnv.CPPFLAGS += ` -I${opensslIncludes}`; @@ -38,8 +39,11 @@ module.exports = function retrieveExternalDependencies() { } cp.exec( - rooted("vendor/libssh2/configure") + maybeLibsslPrefix, - {cwd: rooted("vendor/libssh2/"), env: newEnv}, + libssh2ConfigureScript + maybeLibsslPrefix, + { + cwd: libssh2VendorDirectory, + env: newEnv + }, function(err, stdout, stderr) { if (err) { console.error(err); diff --git a/vendor/libgit2.gyp b/vendor/libgit2.gyp index 6593372cc..bf80fd8a9 100644 --- a/vendor/libgit2.gyp +++ b/vendor/libgit2.gyp @@ -537,9 +537,16 @@ ] }, "conditions": [ - ["OS=='mac' and node_root_dir.split('/')[-1].startswith('iojs')", { + ["OS=='mac'", { "include_dirs": [ - "openssl/include" + "libssh2/darwin" + ], + "conditions": [ + ["node_root_dir.split('/')[-1].startswith('iojs')", { + "include_dirs": [ + "openssl/include", + ] + }] ] }], ["OS=='win'", { From 3945596a9bb3616abf571df7ecd1c7c8842f2f0f Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Tue, 16 Oct 2018 13:55:12 -0700 Subject: [PATCH 6/8] Don't no-op configureLibssh2 on Windows anymore. --- utils/configureLibssh2.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/utils/configureLibssh2.js b/utils/configureLibssh2.js index e64933206..a7e3459e9 100644 --- a/utils/configureLibssh2.js +++ b/utils/configureLibssh2.js @@ -60,10 +60,5 @@ module.exports = function retrieveExternalDependencies() { // Called on the command line if (require.main === module) { - if (process.platform === "win32") { - console.log("nothing to do"); - } - else { - module.exports(); - } + module.exports(); } From b29ab0153dabc0659b927ee5a39f2fb1db448db3 Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Wed, 17 Oct 2018 09:36:02 -0700 Subject: [PATCH 7/8] Move `static_config/win32` back into `vendor/libssh2` --- .gitignore | 1 - .../libssh2/win32/GNUmakefile | 0 .../libssh2/win32/Makefile.Watcom | 0 .../libssh2/win32/config.mk | 0 .../libssh2/win32/libssh2.dsp | 0 .../libssh2/win32/libssh2.dsw | 0 .../libssh2/win32/libssh2.rc | 0 vendor/libssh2/win32/libssh2_config.h | 46 +++++++++++++++++++ .../libssh2/win32/msvcproj.foot | 0 .../libssh2/win32/msvcproj.head | 0 .../libssh2/win32/rules.mk | 0 .../libssh2/win32/test/GNUmakefile | 0 .../libssh2/win32/tests.dsp | 0 13 files changed, 46 insertions(+), 1 deletion(-) rename vendor/{static_config => }/libssh2/win32/GNUmakefile (100%) rename vendor/{static_config => }/libssh2/win32/Makefile.Watcom (100%) rename vendor/{static_config => }/libssh2/win32/config.mk (100%) rename vendor/{static_config => }/libssh2/win32/libssh2.dsp (100%) rename vendor/{static_config => }/libssh2/win32/libssh2.dsw (100%) rename vendor/{static_config => }/libssh2/win32/libssh2.rc (100%) create mode 100644 vendor/libssh2/win32/libssh2_config.h rename vendor/{static_config => }/libssh2/win32/msvcproj.foot (100%) rename vendor/{static_config => }/libssh2/win32/msvcproj.head (100%) rename vendor/{static_config => }/libssh2/win32/rules.mk (100%) rename vendor/{static_config => }/libssh2/win32/test/GNUmakefile (100%) rename vendor/{static_config => }/libssh2/win32/tests.dsp (100%) diff --git a/.gitignore b/.gitignore index d55d0ae72..f9512044f 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,6 @@ /vendor/libssh2/libssh2.pc /vendor/libssh2/libtool /vendor/libssh2/darwin/ -/vendor/libssh2/win32/ /vendor/libssh2/src/.deps/ /vendor/libssh2/src/Makefile /vendor/libssh2/src/libssh2_config.h diff --git a/vendor/static_config/libssh2/win32/GNUmakefile b/vendor/libssh2/win32/GNUmakefile similarity index 100% rename from vendor/static_config/libssh2/win32/GNUmakefile rename to vendor/libssh2/win32/GNUmakefile diff --git a/vendor/static_config/libssh2/win32/Makefile.Watcom b/vendor/libssh2/win32/Makefile.Watcom similarity index 100% rename from vendor/static_config/libssh2/win32/Makefile.Watcom rename to vendor/libssh2/win32/Makefile.Watcom diff --git a/vendor/static_config/libssh2/win32/config.mk b/vendor/libssh2/win32/config.mk similarity index 100% rename from vendor/static_config/libssh2/win32/config.mk rename to vendor/libssh2/win32/config.mk diff --git a/vendor/static_config/libssh2/win32/libssh2.dsp b/vendor/libssh2/win32/libssh2.dsp similarity index 100% rename from vendor/static_config/libssh2/win32/libssh2.dsp rename to vendor/libssh2/win32/libssh2.dsp diff --git a/vendor/static_config/libssh2/win32/libssh2.dsw b/vendor/libssh2/win32/libssh2.dsw similarity index 100% rename from vendor/static_config/libssh2/win32/libssh2.dsw rename to vendor/libssh2/win32/libssh2.dsw diff --git a/vendor/static_config/libssh2/win32/libssh2.rc b/vendor/libssh2/win32/libssh2.rc similarity index 100% rename from vendor/static_config/libssh2/win32/libssh2.rc rename to vendor/libssh2/win32/libssh2.rc diff --git a/vendor/libssh2/win32/libssh2_config.h b/vendor/libssh2/win32/libssh2_config.h new file mode 100644 index 000000000..b6af97806 --- /dev/null +++ b/vendor/libssh2/win32/libssh2_config.h @@ -0,0 +1,46 @@ +#ifndef LIBSSH2_CONFIG_H +#define LIBSSH2_CONFIG_H + +#ifndef WIN32 +#define WIN32 +#endif +#ifndef _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif /* _CRT_SECURE_NO_DEPRECATE */ +#include +#include +#include + +#ifdef __MINGW32__ +#define HAVE_UNISTD_H +#define HAVE_INTTYPES_H +#define HAVE_SYS_TIME_H +#define HAVE_GETTIMEOFDAY +#endif /* __MINGW32__ */ + +#define LIBSSH2_OPENSSL +#define HAVE_WINSOCK2_H +#define HAVE_IOCTLSOCKET +#define HAVE_SELECT + +#ifdef _MSC_VER +#if _MSC_VER < 1900 +#define snprintf _snprintf +#if _MSC_VER < 1500 +#define vsnprintf _vsnprintf +#endif +#define strdup _strdup +#define strncasecmp _strnicmp +#define strcasecmp _stricmp +#endif +#else +#ifndef __MINGW32__ +#define strncasecmp strnicmp +#define strcasecmp stricmp +#endif /* __MINGW32__ */ +#endif /* _MSC_VER */ + +/* Enable newer diffie-hellman-group-exchange-sha1 syntax */ +#define LIBSSH2_DH_GEX_NEW 1 + +#endif /* LIBSSH2_CONFIG_H */ diff --git a/vendor/static_config/libssh2/win32/msvcproj.foot b/vendor/libssh2/win32/msvcproj.foot similarity index 100% rename from vendor/static_config/libssh2/win32/msvcproj.foot rename to vendor/libssh2/win32/msvcproj.foot diff --git a/vendor/static_config/libssh2/win32/msvcproj.head b/vendor/libssh2/win32/msvcproj.head similarity index 100% rename from vendor/static_config/libssh2/win32/msvcproj.head rename to vendor/libssh2/win32/msvcproj.head diff --git a/vendor/static_config/libssh2/win32/rules.mk b/vendor/libssh2/win32/rules.mk similarity index 100% rename from vendor/static_config/libssh2/win32/rules.mk rename to vendor/libssh2/win32/rules.mk diff --git a/vendor/static_config/libssh2/win32/test/GNUmakefile b/vendor/libssh2/win32/test/GNUmakefile similarity index 100% rename from vendor/static_config/libssh2/win32/test/GNUmakefile rename to vendor/libssh2/win32/test/GNUmakefile diff --git a/vendor/static_config/libssh2/win32/tests.dsp b/vendor/libssh2/win32/tests.dsp similarity index 100% rename from vendor/static_config/libssh2/win32/tests.dsp rename to vendor/libssh2/win32/tests.dsp From 23b98da63bedd322286f93b2ebb064f28d1aaae8 Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Wed, 17 Oct 2018 09:37:41 -0700 Subject: [PATCH 8/8] Copy libssh2 config headers straight into `vendor/libssh2` --- .gitignore | 1 - utils/configureLibssh2.js | 2 +- vendor/libgit2.gyp | 13 ++----------- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index f9512044f..3d571d1c7 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,6 @@ /vendor/libssh2/example/stamp-h2 /vendor/libssh2/libssh2.pc /vendor/libssh2/libtool -/vendor/libssh2/darwin/ /vendor/libssh2/src/.deps/ /vendor/libssh2/src/Makefile /vendor/libssh2/src/libssh2_config.h diff --git a/utils/configureLibssh2.js b/utils/configureLibssh2.js index a7e3459e9..3ee8cd933 100644 --- a/utils/configureLibssh2.js +++ b/utils/configureLibssh2.js @@ -13,7 +13,7 @@ module.exports = function retrieveExternalDependencies() { if (process.platform === "win32" || process.platform === "darwin") { return fse.copy( path.join(libssh2StaticConfigDirectory, process.platform), - path.join(libssh2VendorDirectory, process.platform) + path.join(libssh2VendorDirectory, "src") ); } diff --git a/vendor/libgit2.gyp b/vendor/libgit2.gyp index bf80fd8a9..11904835e 100644 --- a/vendor/libgit2.gyp +++ b/vendor/libgit2.gyp @@ -537,16 +537,9 @@ ] }, "conditions": [ - ["OS=='mac'", { + ["OS=='mac' and node_root_dir.split('/')[-1].startswith('iojs')", { "include_dirs": [ - "libssh2/darwin" - ], - "conditions": [ - ["node_root_dir.split('/')[-1].startswith('iojs')", { - "include_dirs": [ - "openssl/include", - ] - }] + "openssl/include", ] }], ["OS=='win'", { @@ -568,7 +561,6 @@ ], "include_dirs": [ "libssh2/src", - "libssh2/win32", "libssh2/include" ], "defines!": [ @@ -577,7 +569,6 @@ "direct_dependent_settings": { "include_dirs": [ "libssh2/src", - "libssh2/win32", "libssh2/include" ] }