@@ -8,7 +8,7 @@ var rootPath = path.join(__dirname, "..");
88
99function printStandardLibError ( ) {
1010 console . log (
11- "[ERROR] Seems like the latest libstdc++ is missing on your system!"
11+ "[nodegit] ERROR - the latest libstdc++ is missing on your system!"
1212 ) ;
1313 console . log ( "" ) ;
1414 console . log ( "On Ubuntu you can install it using:" ) ;
@@ -19,14 +19,40 @@ function printStandardLibError() {
1919}
2020
2121module . exports = function install ( ) {
22+ if ( buildFlags . isGitRepo ) {
23+ // If we're building NodeGit from a git repo we aren't going to do any
24+ // cleaning up
25+ return Promise . resolve ( ) ;
26+ }
27+
2228 return exec ( "node dist/nodegit.js" )
29+ . catch ( function ( e ) {
30+ if ( ~ e . toString ( ) . indexOf ( "Module version mismatch" ) ) {
31+ console . warn (
32+ "[nodegit] WARN - NodeGit was built for a different version of node."
33+ ) ;
34+ console . warn (
35+ "If you are building NodeGit for electron/nwjs you can " +
36+ "ignore this warning."
37+ ) ;
38+ }
39+ else {
40+ throw e ;
41+ }
42+ } )
2343 . then ( function ( ) {
2444 // Is we're using NodeGit from a package manager then let's clean up after
2545 // ourselves when we install successfully.
2646 if ( ! buildFlags . mustBuild ) {
27- fse . removeSync ( path . join ( rootPath , "vendor" ) ) ;
28- fse . removeSync ( path . join ( rootPath , "src" ) ) ;
29- fse . removeSync ( path . join ( rootPath , "include" ) ) ;
47+ // We can't remove the source files yet because apparently the
48+ // "standard workflow" for native node moduels in Electron/nwjs is to
49+ // build them for node and then nah eff that noise let's rebuild them
50+ // again for the actual platform! Hurray!!! When that madness is dead
51+ // we can clean up the source which is a serious amount of data.
52+ // fse.removeSync(path.join(rootPath, "vendor"));
53+ // fse.removeSync(path.join(rootPath, "src"));
54+ // fse.removeSync(path.join(rootPath, "include"));
55+
3056 fse . removeSync ( path . join ( rootPath , "build/Release/*.a" ) ) ;
3157 fse . removeSync ( path . join ( rootPath , "build/Release/obj.target" ) ) ;
3258 }
@@ -39,11 +65,14 @@ if (require.main === module) {
3965 . catch ( function ( e ) {
4066 console . error ( "[nodegit] ERROR - Could not finish postinstall" ) ;
4167
42- if ( process . pladtform !== "linux" && ~ e . indexOf ( "libstdc++" ) ) {
68+ if (
69+ process . pladtform === "linux" &&
70+ ~ e . toString ( ) . indexOf ( "libstdc++" )
71+ ) {
4372 printStandardLibError ( ) ;
4473 }
4574 else {
46- console . error ( e ) ;
75+ console . log ( e ) ;
4776 }
4877
4978 process . exit ( 1 ) ;
0 commit comments