# This is free and unencumbered software released into the public # domain. To the extent possible under law, the author of this file # waives all copyright and related or neighboring rights to it. .DELETE_ON_ERROR: include $(dir $(realpath $(lastword $(MAKEFILE_LIST))))programs.mk node-webkit-platforms := \ osx-x64.zip osx-ia32.zip \ linux-x64.tar.gz linux-ia32.tar.gz \ win-ia32.zip node-webkit-pattern := \ $(addprefix node-webkit-v%-,$(node-webkit-platforms)) # These are like 30MB, don't download them every time. .PRECIOUS: $(node-webkit-pattern) $(node-webkit-pattern): mkdir -p $(@D) wget -O $@ http://dl.node-webkit.org/v$(*F)/$(@F) || ($(RM) $@ && exit 1) node-webkit-version ?= 0.10.2 node-webkit-prefix ?= node-webkit/ node-webkit-directx = $(addprefix $(node-webkit-prefix),d3dcompiler_43.dll d3dcompiler_46.dll) node-webkit = $(node-webkit-prefix)node-webkit-v$(firstword $(value node-webkit-version-$1) $(node-webkit-version))-$1 node-webkit-archives = \ $(foreach p,$(node-webkit-platforms),$(call node-webkit,$(p))) define node-webkit-package-osx $(RM) $@ $(RM) -r $(@:.zip=) $(UNZIP) -d $(@D) $2 mv $(@D)/$(notdir $(2:.zip=)) $(@:.zip=) tools/generate-osx-app $(@:.zip=) $1 $(RM) $(@:.zip=)/nwsnapshot mv $(@:.zip=)/credits.html $(@:.zip=)/node-webkit\ credits.html cd $(@D) && $(ZIP) -r $(@F) $(@F:.zip=) $(RM) -r $(@:.zip=) endef %-osx-ia32.zip: %.nw $(call node-webkit,osx-ia32.zip) $(call node-webkit-package-osx,$<,$(word 2,$^)) %-osx-x64.zip: %.nw $(call node-webkit,osx-x64.zip) $(call node-webkit-package-osx,$<,$(word 2,$^)) define node-webkit-package-linux $(RM) $@ $(RM) -r $(@:.tar.gz=) tar -C $(@D) -xzf $2 mkdir -p $(@:.tar.gz=) mv $(@D)/$(notdir $(2:.tar.gz=)) $(@:.tar.gz=)/nw cp -a $1 $(@:.tar.gz=)/nw/package.nw cp -a tools/nw-linux-wrapper $(@:.tar.gz=)/`echo $(notdir $1) | sed -E 's/_.+//'` $(RM) $(@:.tar.gz=)/nw/nwsnapshot mv $(@:.tar.gz=)/nw/credits.html $(@:.tar.gz=)/nw/node-webkit\ credits.html tar -czf $@ -C $(@D) $(@F:.tar.gz=) $(RM) -r $(@:.tar.gz=) endef %-linux-ia32.tar.gz: %.nw $(call node-webkit,linux-ia32.tar.gz) $(call node-webkit-package-linux,$<,$(word 2,$^)) %-linux-x64.tar.gz: %.nw $(call node-webkit,linux-x64.tar.gz) $(call node-webkit-package-linux,$<,$(word 2,$^)) WINE ?= wine node-webkit-icon = $(shell $(UNZIP) -p $1 package.json | grep -Eo '"[^"]+.ico"' -m 1) define node-webkit-package-win $(RM) $@ $(RM) -r $(@:.zip=) if $(UNZIP) -l $2 credits.html > /dev/null; then $(UNZIP) -d $(@D)/$(notdir $(2:.zip=)) $2; else $(UNZIP) -d $(@D) $2; fi mv $(@D)/$(notdir $(2:.zip=)) $(@:.zip=) $(RM) $(@:.zip=)/nwsnapshot.exe $(UNZIP) -p $< $(call node-webkit-icon,$<) > $(@D)/icon.ico $(WINE) tools/rcedit.exe $(@:.zip=)/nw.exe --set-icon $(@D)/icon.ico $(RM) $(@D)/icon.ico mv $(@:.zip=)/credits.html $(@:.zip=)/node-webkit\ credits.html cp -a $< $(@:.zip=)/package.nw cp -a $(node-webkit-directx) $(@:.zip=) mv $(@:.zip=)/nw.exe $(@:.zip=)/`echo $(notdir $1) | sed -E 's/_.+/.exe/'` cd $(@D) && $(ZIP) -r $(@F) $(@F:.zip=) $(RM) -r $(@:.zip=) endef %-win-ia32.zip: %.nw $(call node-webkit,win-ia32.zip) $(node-webkit-directx) $(call node-webkit-package-win,$<,$(word 2,$^)) $(node-webkit-directx): wget -O $@ 'https://github.com/cefsharp/cef-binary/raw/1e51255cf77d267899bf7834768b8774affaad2d/cef_binary_3.y.z_windows32/Release/'$(notdir $@) $(node-webkit-prefix)dxwebsetup.exe: wget -O $@ http://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe