diff --git a/Makefile b/Makefile
index b3685e1479dac8..5a320c2a4129ae 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,14 @@ DESTDIR ?=
SIGN ?=
PREFIX ?= /usr/local
FLAKY_TESTS ?= run
+STAGINGSERVER ?= node-www
+OSTYPE := $(shell uname -s | tr '[A-Z]' '[a-z]')
+
+# Flags for packaging.
+BUILD_DOWNLOAD_FLAGS ?= --download=all
+BUILD_INTL_FLAGS ?= --with-intl=small-icu
+BUILD_RELEASE_FLAGS ?= $(BUILD_DOWNLOAD_FLAGS) $(BUILD_INTL_FLAGS)
NODE ?= ./node
# Default to verbose builds.
@@ -251,9 +258,45 @@ run-ci:
RAWVER=$(shell $(PYTHON) tools/getnodeversion.py)
VERSION=v$(RAWVER)
+
+# For nightly builds, you must set DISTTYPE to "nightly", "next-nightly" or
+# "custom". For the nightly and next-nightly case, you need to set DATESTRING
+# and COMMIT in order to properly name the build.
+# For the rc case you need to set CUSTOMTAG to an appropriate CUSTOMTAG number
+
+ifndef DISTTYPE
+DISTTYPE=release
+endif
+ifeq ($(DISTTYPE),release)
+FULLVERSION=$(VERSION)
+else # ifeq ($(DISTTYPE),release)
+ifeq ($(DISTTYPE),custom)
+ifndef CUSTOMTAG
+$(error CUSTOMTAG is not set for DISTTYPE=custom)
+endif # ifndef CUSTOMTAG
+TAG=$(CUSTOMTAG)
+else # ifeq ($(DISTTYPE),custom)
+ifndef DATESTRING
+$(error DATESTRING is not set for nightly)
+endif # ifndef DATESTRING
+ifndef COMMIT
+$(error COMMIT is not set for nightly)
+endif # ifndef COMMIT
+ifneq ($(DISTTYPE),nightly)
+ifneq ($(DISTTYPE),next-nightly)
+$(error DISTTYPE is not release, custom, nightly or next-nightly)
+endif # ifneq ($(DISTTYPE),next-nightly)
+endif # ifneq ($(DISTTYPE),nightly)
+TAG=$(DISTTYPE)$(DATESTRING)$(COMMIT)
+endif # ifeq ($(DISTTYPE),custom)
+FULLVERSION=$(VERSION)-$(TAG)
+endif # ifeq ($(DISTTYPE),release)
+
+DISTTYPEDIR ?= $(DISTTYPE)
+RELEASE=$(shell sed -ne 's/\#define NODE_VERSION_IS_RELEASE \([01]\)/\1/p' src/node_version.h)
NODE_DOC_VERSION=$(VERSION)
-RELEASE=$(shell $(PYTHON) tools/getnodeisrelease.py)
-PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]')
+NPMVERSION=v$(shell cat deps/npm/package.json | grep '"version"' | sed 's/^[^:]*: "\([^"]*\)",.*/\1/')
+
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
DESTCPU ?= x64
else
@@ -268,31 +311,28 @@ else
ARCH=x86
endif
endif
-TARNAME=node-$(VERSION)
-ifdef NIGHTLY
-TAG = nightly-$(NIGHTLY)
-TARNAME=node-$(VERSION)-$(TAG)
-endif
-TARBALL=$(TARNAME).tar.gz
-BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
-BINARYTAR=$(BINARYNAME).tar.gz
-PKG=out/$(TARNAME).pkg
-PACKAGEMAKER ?= /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
-PKGSRC=nodejs-$(DESTCPU)-$(RAWVER).tgz
-ifdef NIGHTLY
-PKGSRC=nodejs-$(DESTCPU)-$(RAWVER)-$(TAG).tgz
+# enforce "x86" over "ia32" as the generally accepted way of referring to 32-bit intel
+ifeq ($(ARCH),ia32)
+override ARCH=x86
+endif
+ifeq ($(DESTCPU),ia32)
+override DESTCPU=x86
endif
-dist: doc $(TARBALL) $(PKG)
-
+TARNAME=node-$(FULLVERSION)
+TARBALL=$(TARNAME).tar
+BINARYNAME=$(TARNAME)-$(OSTYPE)-$(ARCH)
+BINARYTAR=$(BINARYNAME).tar
+PKG=$(TARNAME).pkg
+PACKAGEMAKER ?= /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
PKGDIR=out/dist-osx
release-only:
@if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
exit 0 ; \
else \
- echo "" >&2 ; \
+ echo "" >&2 ; \
echo "The git repository is not clean." >&2 ; \
echo "Please commit changes before building release tarball." >&2 ; \
echo "" >&2 ; \
@@ -300,29 +340,33 @@ release-only:
echo "" >&2 ; \
exit 1 ; \
fi
- @if [ "$(NIGHTLY)" != "" -o "$(RELEASE)" = "1" ]; then \
+ @if [ "$(DISTTYPE)" != "release" -o "$(RELEASE)" = "1" ]; then \
exit 0; \
else \
- echo "" >&2 ; \
+ echo "" >&2 ; \
echo "#NODE_VERSION_IS_RELEASE is set to $(RELEASE)." >&2 ; \
- echo "Did you remember to update src/node_version.cc?" >&2 ; \
- echo "" >&2 ; \
+ echo "Did you remember to update src/node_version.h?" >&2 ; \
+ echo "" >&2 ; \
exit 1 ; \
fi
-pkg: $(PKG)
-
$(PKG): release-only
rm -rf $(PKGDIR)
rm -rf out/deps out/Release
- $(PYTHON) ./configure --download=all --with-intl=small-icu \
- --without-snapshot --dest-cpu=ia32 --tag=$(TAG)
+ $(PYTHON) ./configure \
+ --dest-cpu=ia32 \
+ --tag=$(TAG) \
+ --without-snapshot \
+ $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
$(MAKE) install V=$(V) DESTDIR=$(PKGDIR)/32
rm -rf out/deps out/Release
- $(PYTHON) ./configure --download=all --with-intl=small-icu \
- --without-snapshot --dest-cpu=x64 --tag=$(TAG)
+ $(PYTHON) ./configure \
+ --dest-cpu=x64 \
+ --tag=$(TAG) \
+ --without-snapshot \
+ $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
$(MAKE) install V=$(V) DESTDIR=$(PKGDIR)
- SIGN="$(APP_SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
+ SIGN="$(CODESIGN_CERT)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
lipo $(PKGDIR)/32/usr/local/bin/node \
$(PKGDIR)/usr/local/bin/node \
-output $(PKGDIR)/usr/local/bin/node-universal \
@@ -333,7 +377,15 @@ $(PKG): release-only
--id "org.nodejs.Node" \
--doc tools/osx-pkg.pmdoc \
--out $(PKG)
- SIGN="$(INT_SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
+ SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" bash tools/osx-productsign.sh
+
+pkg: $(PKG)
+
+pkg-upload: pkg
+ ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
+ chmod 664 node-$(FULLVERSION).pkg
+ scp -p node-$(FULLVERSION).pkg $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION).pkg
+ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION).pkg.done"
$(TARBALL): release-only node doc
git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
@@ -349,6 +401,39 @@ $(TARBALL): release-only node doc
tar: $(TARBALL)
+tar-upload: tar
+ ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
+ chmod 664 node-$(FULLVERSION).tar.gz
+ scp -p node-$(FULLVERSION).tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION).tar.gz
+ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION).tar.gz.done"
+
+doc-upload: tar
+ ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
+ chmod -R ug=rw-x+X,o=r+X out/doc/
+ scp -pr out/doc/ $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs/
+ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs.done"
+
+$(TARBALL)-headers: config.gypi release-only
+ $(PYTHON) ./configure \
+ --prefix=/ \
+ --dest-cpu=$(DESTCPU) \
+ --tag=$(TAG) \
+ $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
+ HEADERS_ONLY=1 $(PYTHON) tools/install.py install '$(TARNAME)' '/'
+ find $(TARNAME)/ -type l | xargs rm # annoying on windows
+ tar -cf $(TARNAME)-headers.tar $(TARNAME)
+ rm -rf $(TARNAME)
+ gzip -c -f -9 $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.gz
+ rm $(TARNAME)-headers.tar
+
+tar-headers: $(TARBALL)-headers
+
+tar-headers-upload: tar-headers
+ ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
+ chmod 664 $(TARNAME)-headers.tar.gz
+ scp -p $(TARNAME)-headers.tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-headers.tar.gz
+ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-headers.tar.gz.done"
+
$(BINARYTAR): release-only
rm -rf $(BINARYNAME)
rm -rf out/deps out/Release
@@ -364,6 +449,35 @@ $(BINARYTAR): release-only
binary: $(BINARYTAR)
+binary-upload-arch: binary
+ ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
+ chmod 664 node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz
+ scp -p node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz
+ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz.done"
+
+ifeq ($(OSTYPE),darwin)
+binary-upload:
+ $(MAKE) binary-upload-arch \
+ DESTCPU=ia32 \
+ ARCH=x86 \
+ DISTTYPE=$(DISTTYPE) \
+ DATESTRING=$(DATESTRING) \
+ COMMIT=$(COMMIT) \
+ CUSTOMTAG=$(CUSTOMTAG) \
+ CONFIG_FLAGS=$(CONFIG_FLAGS)
+ $(MAKE) binary-upload-arch \
+ DESTCPU=x64 \
+ ARCH=x64 \
+ DISTTYPE=$(DISTTYPE) \
+ DATESTRING=$(DATESTRING) \
+ COMMIT=$(COMMIT) \
+ CUSTOMTAG=$(CUSTOMTAG) \
+ CONFIG_FLAGS=$(CONFIG_FLAGS)
+else
+binary-upload: binary-upload-arch
+endif
+
+
$(PKGSRC): release-only
rm -rf dist out
$(PYTHON) configure --prefix=/ --without-snapshot --download=all \
@@ -378,11 +492,6 @@ $(PKGSRC): release-only
pkgsrc: $(PKGSRC)
-dist-upload: $(TARBALL) $(PKG)
- ssh node@nodejs.org mkdir -p web/nodejs.org/dist/$(VERSION)
- scp $(TARBALL) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARBALL)
- scp $(PKG) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARNAME).pkg
-
wrkclean:
$(MAKE) -C tools/wrk/ clean
rm tools/wrk/wrk
diff --git a/configure b/configure
index 252b5bfa82c8bb..7ad946eaf80770 100755
--- a/configure
+++ b/configure
@@ -267,6 +267,11 @@ parser.add_option('--with-icu-source',
dest='with_icu_source',
help='Intl mode: optional local path to icu/ dir, or path/URL of icu source archive.')
+parser.add_option('--download-path',
+ dest='download_path',
+ default=os.path.join(root_dir, 'deps'),
+ help='Download directory [default: %default]')
+
parser.add_option('--with-perfctr',
action='store_true',
dest='with_perfctr',
@@ -517,6 +522,10 @@ def configure_node(o):
host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()
target_arch = options.dest_cpu or host_arch
+ # ia32 is preferred by the build tools (GYP) over x86 even if we prefer the latter
+ # the Makefile resets this to x86 afterward
+ if target_arch == 'x86':
+ target_arch = 'ia32'
o['variables']['host_arch'] = host_arch
o['variables']['target_arch'] = target_arch
@@ -762,11 +771,15 @@ def configure_intl(o):
]
def icu_download(path):
# download ICU, if needed
+ if not os.access(options.download_path, os.W_OK):
+ print 'Error: cannot write to desired download path. ' \
+ 'Either create it or verify permissions.'
+ sys.exit(1)
for icu in icus:
url = icu['url']
md5 = icu['md5']
local = url.split('/')[-1]
- targetfile = os.path.join(root_dir, 'deps', local)
+ targetfile = os.path.join(options.download_path, local)
if not os.path.isfile(targetfile):
if nodedownload.candownload(auto_downloads, "icu"):
nodedownload.retrievefile(url, targetfile)
diff --git a/src/node_version.h b/src/node_version.h
index cbc0476cc97e3b..fceab2f29504ed 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -28,25 +28,31 @@
#define NODE_VERSION_IS_RELEASE 0
-#ifndef NODE_TAG
-# define NODE_TAG ""
-#endif
-
#ifndef NODE_STRINGIFY
#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)
#define NODE_STRINGIFY_HELPER(n) #n
#endif
-#if NODE_VERSION_IS_RELEASE
-# define NODE_VERSION_STRING NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \
- NODE_STRINGIFY(NODE_MINOR_VERSION) "." \
- NODE_STRINGIFY(NODE_PATCH_VERSION) \
- NODE_TAG
+#ifndef NODE_TAG
+# if NODE_VERSION_IS_RELEASE
+# define NODE_TAG ""
+# else
+# define NODE_TAG "-pre"
+# endif
#else
+// NODE_TAG is passed without quotes when rc.exe is run from msbuild
+# define NODE_EXE_VERSION NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \
+ NODE_STRINGIFY(NODE_MINOR_VERSION) "." \
+ NODE_STRINGIFY(NODE_PATCH_VERSION) \
+ NODE_STRINGIFY(NODE_TAG)
+#endif
+
# define NODE_VERSION_STRING NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \
NODE_STRINGIFY(NODE_MINOR_VERSION) "." \
NODE_STRINGIFY(NODE_PATCH_VERSION) \
- NODE_TAG "-pre"
+ NODE_TAG
+#ifndef NODE_EXE_VERSION
+# define NODE_EXE_VERSION NODE_VERSION_STRING
#endif
#define NODE_VERSION "v" NODE_VERSION_STRING
diff --git a/tools/msvs/msi/nodemsi.wixproj b/tools/msvs/msi/nodemsi.wixproj
index 8d17a6cfb4a76c..fabd34d8a964ad 100644
--- a/tools/msvs/msi/nodemsi.wixproj
+++ b/tools/msvs/msi/nodemsi.wixproj
@@ -6,7 +6,7 @@
3.5
{1d808ff0-b5a9-4be9-859d-b334b6f48be2}
2.0
- node-v$(NodeVersion)-$(Platform)
+ node-v$(FullVersion)-$(Platform)
Package
True
$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets
@@ -14,25 +14,25 @@
0.0.0.0
- ..\..\..\$(Configuration)\
+ ..\..\..\
obj\$(Configuration)\
- Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFilesFolder
+ Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFilesFolder
- ..\..\..\$(Configuration)\
+ ..\..\..\
obj\$(Configuration)\
- Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFilesFolder
+ Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFilesFolder
- ..\..\..\$(Configuration)\
+ ..\..\..\
obj\$(Configuration)\
- Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFiles64Folder
+ Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFiles64Folder
en-US
- ..\..\..\$(Configuration)\
+ ..\..\..\
obj\$(Configuration)\
- Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFiles64Folder
+ Debug;ProductVersion=$(NodeVersion);FullVersion=$(FullVersion);DistTypeDir=$(DistTypeDir);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFiles64Folder
True
diff --git a/tools/msvs/msi/product.wxs b/tools/msvs/msi/product.wxs
index 3c3eb685bcca67..5aa3a7ebfac039 100755
--- a/tools/msvs/msi/product.wxs
+++ b/tools/msvs/msi/product.wxs
@@ -4,7 +4,7 @@
-
+
@@ -23,7 +23,7 @@
+ DowngradeErrorMessage="A later version of Node.js is already installed. Setup will now exit."/>
diff --git a/tools/osx-codesign.sh b/tools/osx-codesign.sh
index 65a8d48b8ab2a5..d5f276624deff4 100644
--- a/tools/osx-codesign.sh
+++ b/tools/osx-codesign.sh
@@ -3,7 +3,7 @@
set -x
set -e
-if ! [ -n "$SIGN" ] && [ $STEP -eq 1 ]; then
+if [ "X$SIGN" == "X" ]; then
echo "No SIGN environment var. Skipping codesign." >&2
exit 0
fi
diff --git a/tools/osx-productsign.sh b/tools/osx-productsign.sh
index 4834c9bbb8769c..491e3fde62f0b4 100644
--- a/tools/osx-productsign.sh
+++ b/tools/osx-productsign.sh
@@ -3,7 +3,7 @@
set -x
set -e
-if ! [ -n "$SIGN" ]; then
+if [ "X$SIGN" == "X" ]; then
echo "No SIGN environment var. Skipping codesign." >&2
exit 0
fi
diff --git a/vcbuild.bat b/vcbuild.bat
index 6615ff9e70f377..983bb9f5356d3b 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -13,11 +13,8 @@ if /i "%1"=="/?" goto help
@rem Process arguments.
set config=Release
-set msiplatform=x86
set target=Build
-set target_arch=ia32
-set debug_arg=
-set nosnapshot_arg=
+set target_arch=x86
set noprojgen=
set nobuild=
set nosign=
@@ -30,23 +27,22 @@ set upload=
set jslint=
set buildnodeweak=
set noetw=
-set noetw_arg=
set noetw_msi_arg=
set noperfctr=
-set noperfctr_arg=
set noperfctr_msi_arg=
set i18n_arg=
set download_arg=
set build_release=
set flaky_tests_arg=
+set configure_flags=
:next-arg
if "%1"=="" goto args-done
if /i "%1"=="debug" set config=Debug&goto arg-ok
if /i "%1"=="release" set config=Release&goto arg-ok
if /i "%1"=="clean" set target=Clean&goto arg-ok
-if /i "%1"=="ia32" set target_arch=ia32&goto arg-ok
-if /i "%1"=="x86" set target_arch=ia32&goto arg-ok
+if /i "%1"=="ia32" set target_arch=x86&goto arg-ok
+if /i "%1"=="x86" set target_arch=x86&goto arg-ok
if /i "%1"=="x64" set target_arch=x64&goto arg-ok
if /i "%1"=="noprojgen" set noprojgen=1&goto arg-ok
if /i "%1"=="nobuild" set nobuild=1&goto arg-ok
@@ -64,7 +60,6 @@ if /i "%1"=="test-gc" set test=test-gc&set buildnodeweak=1&goto arg-ok
if /i "%1"=="test-all" set test=test-all&set buildnodeweak=1&goto arg-ok
if /i "%1"=="test-ci" set test=test-ci&set nosnapshot=1&goto arg-ok
if /i "%1"=="test" set test=test&set jslint=1&goto arg-ok
-@rem Include small-icu support with MSI installer
if /i "%1"=="msi" set msi=1&set licensertf=1&set download_arg="--download=all"&set i18n_arg=small-icu&goto arg-ok
if /i "%1"=="upload" set upload=1&goto arg-ok
if /i "%1"=="jslint" set jslint=1&goto arg-ok
@@ -83,7 +78,6 @@ shift
goto next-arg
:args-done
-if defined upload goto upload
if defined build_release (
set nosnapshot=1
@@ -94,17 +88,23 @@ if defined build_release (
set i18n_arg=small-icu
)
-if "%config%"=="Debug" set debug_arg=--debug
-if "%target_arch%"=="x64" set msiplatform=x64
-if defined nosnapshot set nosnapshot_arg=--without-snapshot
-if defined noetw set noetw_arg=--without-etw& set noetw_msi_arg=/p:NoETW=1
-if defined noperfctr set noperfctr_arg=--without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1
+if "%config%"=="Debug" set configure_flags=%configure_flags% --debug
+if defined nosnapshot set configure_flags=%configure_flags% --without-snapshot
+if defined noetw set configure_flags=%configure_flags% --without-etw& set noetw_msi_arg=/p:NoETW=1
+if defined noperfctr set configure_flags=%configure_flags% --without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1
-if "%i18n_arg%"=="full-icu" set i18n_arg=--with-intl=full-icu
-if "%i18n_arg%"=="small-icu" set i18n_arg=--with-intl=small-icu
-if "%i18n_arg%"=="intl-none" set i18n_arg=--with-intl=none
+if "%i18n_arg%"=="full-icu" set configure_flags=%configure_flags% --with-intl=full-icu
+if "%i18n_arg%"=="small-icu" set configure_flags=%configure_flags% --with-intl=small-icu
+if "%i18n_arg%"=="intl-none" set configure_flags=%configure_flags% --with-intl=none
-if defined NIGHTLY set TAG=nightly-%NIGHTLY%
+if defined config_flags set configure_flags=%configure_flags% %config_flags%
+
+if not exist "%~dp0deps\icu" goto no-depsicu
+if "%target%"=="Clean" echo deleting %~dp0deps\icu
+if "%target%"=="Clean" rmdir /S /Q %~dp0deps\icu
+:no-depsicu
+
+call :getnodeversion || exit /b 1
@rem Set environment for msbuild
@@ -211,7 +211,8 @@ goto run
if defined noprojgen goto msbuild
@rem Generate the VS project.
-python configure %download_arg% %i18n_arg% %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG%
+echo configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG%
+python configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG%
if errorlevel 1 goto create-msvs-files-failed
if not exist node.sln goto create-msvs-files-failed
echo Project files generated.
@@ -228,7 +229,7 @@ if errorlevel 1 goto exit
@rem Skip signing if the `nosign` option was specified.
if defined nosign goto licensertf
-signtool sign /a /d "Node.js" /t http://timestamp.globalsign.com/scripts/timestamp.dll Release\node.exe
+signtool sign /a /d "node" /t http://timestamp.globalsign.com/scripts/timestamp.dll Release\node.exe
if errorlevel 1 echo Failed to sign exe&goto exit
:licensertf
@@ -241,20 +242,42 @@ if errorlevel 1 echo Failed to generate license.rtf&goto exit
:msi
@rem Skip msi generation if not requested
if not defined msi goto run
-call :getnodeversion
-
-if not defined NIGHTLY goto msibuild
-set NODE_VERSION=%NODE_VERSION%.%NIGHTLY%
:msibuild
-echo Building node-%NODE_VERSION%
-msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build /p:PlatformToolset=%PLATFORM_TOOLSET% /p:GypMsvsVersion=%GYP_MSVS_VERSION% /p:Configuration=%config% /p:Platform=%msiplatform% /p:NodeVersion=%NODE_VERSION% %noetw_msi_arg% %noperfctr_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
+echo Building node-v%FULLVERSION%-%target_arch%.msi
+msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build /p:PlatformToolset=%PLATFORM_TOOLSET% /p:GypMsvsVersion=%GYP_MSVS_VERSION% /p:Configuration=%config% /p:Platform=%target_arch% /p:NodeVersion=%NODE_VERSION% /p:FullVersion=%FULLVERSION% /p:DistTypeDir=%DISTTYPEDIR% %noetw_msi_arg% %noperfctr_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
if errorlevel 1 goto exit
-if defined nosign goto run
-signtool sign /a /d "Node.js" /t http://timestamp.globalsign.com/scripts/timestamp.dll Release\node-v%NODE_VERSION%-%msiplatform%.msi
+if defined nosign goto upload
+signtool sign /a /d "node" /t http://timestamp.globalsign.com/scripts/timestamp.dll node-v%FULLVERSION%-%target_arch%.msi
if errorlevel 1 echo Failed to sign msi&goto exit
+:upload
+@rem Skip upload if not requested
+if not defined upload goto run
+if not defined SSHCONFIG (
+ echo SSHCONFIG is not set for upload
+ exit /b 1
+)
+if not defined STAGINGSERVER set STAGINGSERVER=node-www
+if "%target_arch%"=="x64" set staging_dir=nodejs/%DISTTYPEDIR%/v%FULLVERSION%/x64
+if "%target_arch%"=="x86" set staging_dir=nodejs/%DISTTYPEDIR%/v%FULLVERSION%/
+echo Uploading to %STAGINGSERVER%:%staging_dir%
+ssh -F %SSHCONFIG% %STAGINGSERVER% "mkdir -p %staging_dir%"
+scp -F %SSHCONFIG% Release\node.exe %STAGINGSERVER%:%staging_dir%/node.exe
+scp -F %SSHCONFIG% Release\node.lib %STAGINGSERVER%:%staging_dir%/node.lib
+scp -F %SSHCONFIG% Release\node.pdb %STAGINGSERVER%:%staging_dir%/node.pdb
+scp -F %SSHCONFIG% Release\node.exp %STAGINGSERVER%:%staging_dir%/node.exp
+scp -F %SSHCONFIG% Release\openssl-cli.exe %STAGINGSERVER%:%staging_dir%/openssl-cli.exe
+scp -F %SSHCONFIG% Release\openssl-cli.pdb %STAGINGSERVER%:%staging_dir%/openssl-cli.pdb
+scp -F %SSHCONFIG% node-v%FULLVERSION%-%target_arch%.msi %STAGINGSERVER%:%staging_dir%/
+if "%target_arch%"=="x64" (
+ ssh -F %SSHCONFIG% %STAGINGSERVER% "touch %staging_dir%.done && chmod -R ug=rw-x+X,o=r+X %staging_dir%*"
+)
+if "%target_arch%"=="x86" (
+ ssh -F %SSHCONFIG% %STAGINGSERVER% "touch %staging_dir%/node-v%FULLVERSION%-%target_arch%.msi.done %staging_dir%/node.exe.done %staging_dir%/node.lib.done %staging_dir%/node.pdb.done %staging_dir%/node.exp.done %staging_dir%/openssl-cli.exe.done %staging_dir%/openssl-cli.pdb.done && chmod -R ug=rw-x+X,o=r+X %staging_dir%/node.* %staging_dir%/openssl-cli.* %staging_dir%/node-v%FULLVERSION%-%target_arch%.msi* && chmod -R ug=rw-x+X,o=r+X %staging_dir%"
+)
+
:run
@rem Run tests if requested.
if "%test%"=="" goto jslint
@@ -293,17 +316,6 @@ goto jslint
echo Failed to create vc project files.
goto exit
-:upload
-echo uploading .exe .msi .pdb to nodejs.org
-call :getnodeversion
-@echo on
-ssh node@nodejs.org mkdir -p web/nodejs.org/dist/v%NODE_VERSION%
-scp Release\node.msi node@nodejs.org:~/web/nodejs.org/dist/v%NODE_VERSION%/node-v%NODE_VERSION%.msi
-scp Release\node.exe node@nodejs.org:~/web/nodejs.org/dist/v%NODE_VERSION%/node.exe
-scp Release\node.pdb node@nodejs.org:~/web/nodejs.org/dist/v%NODE_VERSION%/node.pdb
-@echo off
-goto exit
-
:jslint
if not defined jslint goto exit
echo running jslint
@@ -330,6 +342,46 @@ rem ***************
:getnodeversion
set NODE_VERSION=
+set TAG=
+set FULLVERSION=
+
for /F "usebackq tokens=*" %%i in (`python "%~dp0tools\getnodeversion.py"`) do set NODE_VERSION=%%i
-if not defined NODE_VERSION echo Cannot determine current version of node.js & exit /b 1
+if not defined NODE_VERSION (
+ echo Cannot determine current version of Node.js
+ exit /b 1
+)
+
+if not defined DISTTYPE set DISTTYPE=release
+if "%DISTTYPE%"=="release" (
+ set FULLVERSION=%NODE_VERSION%
+ goto exit
+)
+if "%DISTTYPE%"=="custom" (
+ if not defined CUSTOMTAG (
+ echo "CUSTOMTAG is not set for DISTTYPE=custom"
+ exit /b 1
+ )
+ set TAG=%CUSTOMTAG%
+)
+if not "%DISTTYPE%"=="custom" (
+ if not defined DATESTRING (
+ echo "DATESTRING is not set for nightly"
+ exit /b 1
+ )
+ if not defined COMMIT (
+ echo "COMMIT is not set for nightly"
+ exit /b 1
+ )
+ if not "%DISTTYPE%"=="nightly" (
+ if not "%DISTTYPE%"=="next-nightly" (
+ echo "DISTTYPE is not release, custom, nightly or next-nightly"
+ exit /b 1
+ )
+ )
+ set TAG=%DISTTYPE%%DATESTRING%%COMMIT%
+)
+set FULLVERSION=%NODE_VERSION%-%TAG%
+
+:exit
+if not defined DISTTYPEDIR set DISTTYPEDIR=%DISTTYPE%
goto :EOF