diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35d8d9e71..a4bce90bb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Change Log
+## v0.24.1 [(2019-02-11)](https://github.com/nodegit/nodegit/releases/tag/v0.24.1)
+
+[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.24.0...v0.24.1)
+
+#### Summary of changes
+- Fix Electron 4 builds
+
## v0.24.0 [(2019-01-16)](https://github.com/nodegit/nodegit/releases/tag/v0.24.0)
[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.23.0...v0.24.0)
diff --git a/appveyor.yml b/appveyor.yml
index 34f73e23d..368e911e8 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -58,5 +58,6 @@ build: off
branches:
only:
+ - /backport\/.*/
- master
- v0.3
diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp
index dc0e203e7..ac9de517f 100644
--- a/generate/templates/templates/binding.gyp
+++ b/generate/templates/templates/binding.gyp
@@ -1,21 +1,13 @@
{
- "conditions": [
- ["(OS=='win' and node_root_dir.split('\\\\')[-1].startswith('iojs')) or (OS=='mac' and node_root_dir.split('/')[-1].startswith('iojs'))", {
- "variables": {
- "is_electron%": "1",
- }
- }, {
- "variables": {
- "is_electron%": "0",
- }
- }]
- ],
+ "variables": {
+ "is_electron%": " arr[arr.length - 1];
+const [, , nodeRootDir] = process.argv;
+
+let isElectron = last(nodeRootDir.split(path.sep)).startsWith("iojs");
+
+if (!isElectron) {
+ try {
+ // Not ideal, would love it if there were a full featured gyp package to do this operation instead.
+ const { variables: { built_with_electron } } = JSON5.parse(
+ fs.readFileSync(
+ path.resolve(nodeRootDir, "include", "node", "config.gypi"),
+ "utf8"
+ )
+ );
+
+ if (built_with_electron) {
+ isElectron = true;
+ }
+ } catch (e) {}
+}
+
+process.stdout.write(isElectron ? "1" : "0");
diff --git a/vendor/libgit2.gyp b/vendor/libgit2.gyp
index 11904835e..835a73c71 100644
--- a/vendor/libgit2.gyp
+++ b/vendor/libgit2.gyp
@@ -7,6 +7,7 @@
"library%": "static_library",
"openssl_enable_asm%": 0, # only supported with the Visual Studio 2012 (VC11) toolchain.
"gcc_version%": 0,
+ "is_electron%": "