diff --git a/ui (gen4)/Makefile b/ui (gen4)/Makefile index b0e5905f..72bac49c 100755 --- a/ui (gen4)/Makefile +++ b/ui (gen4)/Makefile @@ -49,7 +49,7 @@ LOGS := *.log NODE_DIR=node_modules BUILD_DIR=build CHROME_APP_BUILD_DIR=build/Chrome-App/ImageGrid.Viewer -WIN_BUILD_DIR=build/Win +WIN_BUILD_DIR=build/Win64 MAC_BUILD_DIR=build/MacOSX MAC_10_6_BUILD_DIR=build/MacOSX-10.6 LINUX_IA32_BUILD_DIR=build/Linux-ia32 @@ -57,15 +57,15 @@ LINUX_X64_BUILD_DIR=build/Linux-x64 ANDROID_BUILD_DIR=build/Android IOS_BUILD_DIR=build/iOS -DIST_DIR=dist +DIST_DIR=./dist # XXX add version -WIN_DIST_ZIP=$(DIST_DIR)/$(APP_NAME)-win32.zip +WIN_DIST_ZIP=$(DIST_DIR)/$(APP_NAME)-win64.zip MAC_DIST_ZIP=$(DIST_DIR)/$(APP_NAME)-osx.zip MAC_10_6_DIST_ZIP=$(DIST_DIR)/$(APP_NAME)-osx10.6.zip -APP_ZIP=$(BUILD_DIR)/app.zip +APP_ZIP=$(BUILD_DIR)/package.nw @@ -82,8 +82,8 @@ minify: $(JS_MIN_FILES) # build dependencies... # XXX can make auto-create directories??? -$(NODE_DIR): - mkdir -p $(NODE_DIR) +$(NODE_DIR): node-deps + $(BUILD_DIR): mkdir -p $(BUILD_DIR) $(CHROME_APP_BUILD_DIR): @@ -107,10 +107,12 @@ $(DIST_DIR): mkdir -p $(DIST_DIR) -$(APP_ZIP): $(CSS_FILES) $(BUILD_DIR) $(NODE_DIR) node-deps +$(APP_ZIP): $(CSS_FILES) $(BUILD_DIR) $(NODE_DIR) $(NW_PROJECT_FILE) \ + $(JS_FILES) $(CSS_FILES) $(HTML_FILES) zip -r $(APP_ZIP) $(NW_PROJECT_FILE) $(JS_FILES) $(CSS_FILES) \ $(HTML_FILES) $(LIB_DIR) $(EXT_LIB_DIR) $(FEATURES_DIR) \ - $(CSS_DIR) $(NODE_DIR) + $(CSS_DIR) \ + $(NODE_DIR)/app-module-path zip: $(APP_ZIP) @@ -152,27 +154,10 @@ chrome-app: $(APP_ZIP) $(CHROME_APP_BUILD_DIR) # this needs to be OS independent... chrome --pack-extension=$(CHROME_APP_BUILD_DIR) --pack-extension-key=$(CHROME_APP_KEY) -# nwjs win32 -win32: $(APP_ZIP) $(WIN_BUILD_DIR) - unzip -u targets/nwjs/nwjs-*-win-ia32.zip \ - -d $(WIN_BUILD_DIR) - mv $(WIN_BUILD_DIR)/nwjs*win-ia32/* $(WIN_BUILD_DIR)/ - rm -rf $(WIN_BUILD_DIR)/nwjs*/ - cat $(APP_ZIP) >> $(WIN_BUILD_DIR)/nw.exe - mv $(WIN_BUILD_DIR)/nw.exe $(WIN_BUILD_DIR)/$(APP_NAME).exe - chmod +x $(WIN_BUILD_DIR)/*.{exe,dll} - rm -f $(WIN_BUILD_DIR)/nwsnapshot.exe \ - $(WIN_BUILD_DIR)/credits.html -win32-dist: win32 $(DIST_DIR) - # XXX include vips... - # XXX build and include gid, buldcache... - # XXX include scripts/utils... - zip -r $(WIN_DIST_ZIP) $(WIN_BUILD_DIR) - - - -# nwjs win32 +# nwjs win64 +# XXX include exiftool... +# XXX include scripts/utils??? win64: $(APP_ZIP) $(WIN_BUILD_DIR) unzip -u targets/nwjs/nwjs-*-win-x64.zip \ -d $(WIN_BUILD_DIR) @@ -181,109 +166,28 @@ win64: $(APP_ZIP) $(WIN_BUILD_DIR) cat $(APP_ZIP) >> $(WIN_BUILD_DIR)/nw.exe mv $(WIN_BUILD_DIR)/nw.exe $(WIN_BUILD_DIR)/$(APP_NAME).exe chmod +x $(WIN_BUILD_DIR)/*.{exe,dll} + cp -vR \ + $(NODE_DIR) $(WIN_BUILD_DIR) + # cleanup nwjs-sdk... rm -f $(WIN_BUILD_DIR)/nwsnapshot.exe \ + $(WIN_BUILD_DIR)/payload.exe \ + $(WIN_BUILD_DIR)/chromedriver.exe \ + $(WIN_BUILD_DIR)/nwjc.exe \ $(WIN_BUILD_DIR)/credits.html win64-dist: win64 $(DIST_DIR) - # XXX include vips... - # XXX build and include gid, buldcache... - # XXX include scripts/utils... zip -r $(WIN_DIST_ZIP) $(WIN_BUILD_DIR) -win64-ext: - ./targets/nwjs-shell-builder/nwjs-build.sh \ - --src=./ \ - --output-dir=./build/ \ - --name=ImageGrid.Viewer \ - --target="3" \ - --version="1.0.0" \ - --nw=0.14.3 \ - --build - - -# nwjs mac -# XXX BUG: rebuilding without cleaning will mess up folders... -# XXX this is for 10.7+ -osx: $(APP_ZIP) $(MAC_BUILD_DIR) Info.plist - unzip -u $(wildcard targets/nwjs/nwjs-*-osx-ia32.zip) \ - -d $(MAC_BUILD_DIR) - cp $(APP_ZIP) $(MAC_BUILD_DIR)/nwjs.app/Contents/Resources/app.nw - # XXX not sure if this is needed... - chmod +x $(MAC_BUILD_DIR)/nwjs.app/Contents/Resources/app.nw - # XXX there is something wrong with the updated Info.plist, need to investigate... - cp Info.plist $(MAC_BUILD_DIR)/nwjs.app/Contents/ - mv $(MAC_BUILD_DIR)/nwjs.app $(MAC_BUILD_DIR)/$(APP_NAME).app - # XXX TODO: add real credits... - rm -f $(MAC_BUILD_DIR)/nwsnapshot \ - $(MAC_BUILD_DIR)/credits.html - -# XXX this is almost identical to osx... -# XXX BUG: rebuilding without cleaning will mess up folders... -osx-10.6: $(APP_ZIP) $(MAC_10_6_BUILD_DIR) Info.plist - unzip -u $(wildcard targets/nwjs/nwjs-*-osx10.6-ia32.zip) \ - -d $(MAC_10_6_BUILD_DIR) - cp $(APP_ZIP) $(MAC_10_6_BUILD_DIR)/nwjs.app/Contents/Resources/app.nw - # XXX not sure if this is needed... - chmod +x $(MAC_10_6_BUILD_DIR)/nwjs.app/Contents/Resources/app.nw - # XXX there is something wrong with the updated Info.plist, need to investigate... - cp Info.plist $(MAC_10_6_BUILD_DIR)/nwjs.app/Contents/ - mv $(MAC_10_6_BUILD_DIR)/nwjs.app $(MAC_10_6_BUILD_DIR)/$(APP_NAME).app - # XXX TODO: add real credits... - rm -f $(MAC_10_6_BUILD_DIR)/nwsnapshot \ - $(MAC_10_6_BUILD_DIR)/credits.html - - - -osx-dist: osx $(DIST_DIR) - zip -r $(MAC_DIST_ZIP) $(MAC_BUILD_DIR) - -osx-10.6-dist: osx $(DIST_DIR) - zip -r $(MAC_10_6_DIST_ZIP) $(MAC_10_6_BUILD_DIR) - - - -# nwjs linux-ia32 -linux-ia32: $(APP_ZIP) $(LINUX_IA32_BUILD_DIR) - tar --strip-components 1 \ - -xzf $(wildcard targets/nwjs/nwjs-*-linux-ia32.tar.gz) \ - -C $(LINUX_IA32_BUILD_DIR) - cat $(APP_ZIP) >> $(LINUX_IA32_BUILD_DIR)/nw - mv $(LINUX_IA32_BUILD_DIR)/nw $(LINUX_IA32_BUILD_DIR)/$(APP_NAME) - chmod +x $(LINUX_IA32_BUILD_DIR)/* - rm -f $(LINUX_IA32_BUILD_DIR)/nwsnapshot \ - $(LINUX_IA32_BUILD_DIR)/credits.html - -linux-ia32-dist: linux-ia32 $(DIST_DIR) - # XXX use tar -czf ... - zip -r $(LINUX_IA32_BUILD_DIR) $(LINUX_IA32_BUILD_DIR) - - - -# nwjs linux-x64 -linux-x64: $(APP_ZIP) $(LINUX_X64_BUILD_DIR) - tar --strip-components 1 \ - -xzf $(wildcard targets/nwjs/nwjs-*-linux-x64.tar.gz) \ - -C $(LINUX_X64_BUILD_DIR) - cat $(APP_ZIP) >> $(LINUX_X64_BUILD_DIR)/nw - mv $(LINUX_X64_BUILD_DIR)/nw $(LINUX_X64_BUILD_DIR)/$(APP_NAME) - chmod +x $(LINUX_X64_BUILD_DIR)/* - rm -f $(LINUX_X64_BUILD_DIR)/nwsnapshot \ - $(LINUX_X64_BUILD_DIR)/credits.html - -linux-x64-dist: linux-x64 $(DIST_DIR) - # XXX use tar -czf ... - zip -r $(LINUX_X64_BUILD_DIR) $(LINUX_X64_BUILD_DIR) - - - +# XXX OSX +# XXX Linux # XXX android... # XXX iOS... -all: win64 win32 osx osx-10.6 linux-ia32 linux-x64 +all: win64 -dist: win64-dist win32-dist osx-dist +dist: win64-dist #********************************************************************** diff --git a/ui (gen4)/index.html b/ui (gen4)/index.html index 4e9ccbf0..8b5b3528 100755 --- a/ui (gen4)/index.html +++ b/ui (gen4)/index.html @@ -252,10 +252,12 @@ typeof(require) != 'undefined' && require('nw.gui').Window.get().showDevTools() + diff --git a/ui (gen4)/package.json b/ui (gen4)/package.json index 42f487f3..484e1ab7 100755 --- a/ui (gen4)/package.json +++ b/ui (gen4)/package.json @@ -17,6 +17,7 @@ "page-cache": true }, "dependencies": { + "app-module-path": "^1.0.6", "commander": "^2.9.0", "exiftool": "0.0.3", "flickrapi": "^0.3.28", diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index 1c67d0a6..ffac3c7b 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -11,6 +11,17 @@ window.nodejs = (typeof(process) === 'object' && process.features.uv) : null +// Add node_modules path outside of the packed nwjs code... +// +// This keeps the large node module set outside the zip thus speeding +// up the loading process significantly... +if(window.process || global.process && process.__nwjs){ + var path = require('path') + require('app-module-path') + .addPath(path.dirname(process.execPath) + '/node_modules/') +} + + // XXX for some reason requirejs does not fall back to node's require... if(nodejs){ var requirejs = require('requirejs')