@@ -5,6 +5,9 @@ PYTHON ?= python
55DESTDIR ?=
66SIGN ?=
77PREFIX ?= /usr/local
8+ STAGINGSERVER ?= iojs-www
9+
10+ OSTYPE := $(shell uname -s | tr '[A-Z]' '[a-z]')
811
912# Determine EXEEXT
1013EXEEXT := $(shell $(PYTHON ) -c \
@@ -56,15 +59,15 @@ uninstall:
5659 $(PYTHON ) tools/install.py $@ ' $(DESTDIR)' ' $(PREFIX)'
5760
5861clean :
59- -rm -rf out/Makefile $(NODE_EXE ) $(NODE_G_EXE ) out/$(BUILDTYPE ) /$(NODE_EXE ) blog.html email.md
62+ -rm -rf out/Makefile $(NODE_EXE ) $(NODE_G_EXE ) out/$(BUILDTYPE ) /$(NODE_EXE )
6063 @if [ -d out ]; then find out/ -name ' *.o' -o -name ' *.a' | xargs rm -rf; fi
6164 -rm -rf node_modules
6265
6366distclean :
6467 -rm -rf out
6568 -rm -f config.gypi icu_config.gypi
6669 -rm -f config.mk
67- -rm -rf $(NODE_EXE ) $(NODE_G_EXE ) blog.html email.md
70+ -rm -rf $(NODE_EXE ) $(NODE_G_EXE )
6871 -rm -rf node_modules
6972 -rm -rf deps/icu
7073 -rm -rf deps/icu4c* .tgz deps/icu4c* .zip deps/icu-tmp
@@ -196,14 +199,49 @@ docclean:
196199
197200RAWVER =$(shell $(PYTHON ) tools/getnodeversion.py)
198201VERSION =v$(RAWVER )
202+
203+ # For nightly builds, you must set DISTTYPE to "nightly", "next-nightly" or
204+ # "custom". For the nightly and next-nightly case, you need to set DATESTRING
205+ # and COMMIT in order to properly name the build.
206+ # For the rc case you need to set CUSTOMTAG to an appropriate CUSTOMTAG number
207+
208+ ifndef DISTTYPE
209+ DISTTYPE =release
210+ endif
211+ ifeq ($(DISTTYPE ) ,release)
199212FULLVERSION =$(VERSION )
213+ else # ifeq ($(DISTTYPE),release)
214+ ifeq ($(DISTTYPE ) ,custom)
215+ ifndef CUSTOMTAG
216+ $(error CUSTOMTAG is not set for DISTTYPE=custom)
217+ endif # ifndef CUSTOMTAG
218+ TAG =$(CUSTOMTAG )
219+ else # ifeq ($(DISTTYPE),custom)
220+ ifndef DATESTRING
221+ $(error DATESTRING is not set for nightly)
222+ endif # ifndef DATESTRING
223+ ifndef COMMIT
224+ $(error COMMIT is not set for nightly)
225+ endif # ifndef COMMIT
226+ ifneq ($(DISTTYPE ) ,nightly)
227+ ifneq ($(DISTTYPE ) ,next-nightly)
228+ $(error DISTTYPE is not release, custom, nightly or next-nightly)
229+ endif # ifneq ($(DISTTYPE),next-nightly)
230+ endif # ifneq ($(DISTTYPE),nightly)
231+ TAG =$(DISTTYPE )$(DATESTRING )$(COMMIT )
232+ endif # ifeq ($(DISTTYPE),custom)
233+ FULLVERSION =$(VERSION ) -$(TAG )
234+ endif # ifeq ($(DISTTYPE),release)
235+
236+ DISTTYPEDIR ?= $(DISTTYPE )
200237RELEASE =$(shell sed -ne 's/\#define NODE_VERSION_IS_RELEASE \([01]\) /\1/p' src/node_version.h)
201238PLATFORM =$(shell uname | tr '[:upper:]' '[:lower:]')
202239NPMVERSION =v$(shell cat deps/npm/package.json | grep '"version"' | sed 's/^[^:]* : "\([^"]* \) ",.*/\1/')
240+
203241ifeq ($(findstring x86_64,$(shell uname -m) ) ,x86_64)
204242DESTCPU ?= x64
205243else
206- DESTCPU ?= ia32
244+ DESTCPU ?= x86
207245endif
208246ifeq ($(DESTCPU ) ,x64)
209247ARCH =x64
@@ -214,26 +252,24 @@ else
214252ARCH =x86
215253endif
216254endif
217- ifdef NIGHTLY
218- TAG = nightly-$(NIGHTLY )
219- FULLVERSION =$(VERSION ) -$(TAG )
255+
256+ # enforce "x86" over "ia32" as the generally accepted way of referring to 32-bit intel
257+ ifeq ($(ARCH ) ,ia32)
258+ override ARCH =x86
220259endif
260+ ifeq ($(DESTCPU ) ,ia32)
261+ override DESTCPU =x86
262+ endif
263+
221264TARNAME =iojs-$(FULLVERSION )
222265TARBALL =$(TARNAME ) .tar
223266BINARYNAME =$(TARNAME ) -$(PLATFORM ) -$(ARCH )
224267BINARYTAR =$(BINARYNAME ) .tar
268+ # OSX doesn't have xz installed by default, http://macpkg.sourceforge.net/
225269XZ =$(shell which xz > /dev/null 2>&1; echo $$? )
226270XZ_COMPRESSION ?= 9
227- PKG =out/ $(TARNAME ) .pkg
271+ PKG =$(TARNAME ) .pkg
228272PACKAGEMAKER ?= /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
229-
230- PKGSRC =iojs-$(DESTCPU ) -$(RAWVER ) .tgz
231- ifdef NIGHTLY
232- PKGSRC =iojs-$(DESTCPU ) -$(RAWVER ) -$(TAG ) .tgz
233- endif
234-
235- dist : doc $(TARBALL ) $(PKG )
236-
237273PKGDIR =out/dist-osx
238274
239275release-only :
@@ -248,7 +284,7 @@ release-only:
248284 echo " " >&2 ; \
249285 exit 1 ; \
250286 fi
251- @if [ " $( NIGHTLY ) " != " " -o " $( RELEASE) " = " 1" ]; then \
287+ @if [ " $( DISTTYPE ) " != " release " -o " $( RELEASE) " = " 1" ]; then \
252288 exit 0; \
253289 else \
254290 echo " " >&2 ; \
@@ -258,29 +294,28 @@ release-only:
258294 exit 1 ; \
259295 fi
260296
261- pkg : $(PKG )
262-
263297$(PKG ) : release-only
264298 rm -rf $(PKGDIR )
265299 rm -rf out/deps out/Release
266- $(PYTHON ) ./configure --dest-cpu=ia32 --tag=$(TAG )
267- $(MAKE ) install V=$(V ) DESTDIR=$(PKGDIR ) /32
268- rm -rf out/deps out/Release
269300 $(PYTHON ) ./configure --dest-cpu=x64 --tag=$(TAG )
270301 $(MAKE ) install V=$(V ) DESTDIR=$(PKGDIR )
271- SIGN=" $( APP_SIGN) " PKGDIR=" $( PKGDIR) " bash tools/osx-codesign.sh
272- lipo $(PKGDIR ) /32/usr/local/bin/iojs \
273- $(PKGDIR ) /usr/local/bin/iojs \
274- -output $(PKGDIR ) /usr/local/bin/iojs-universal \
275- -create
276- mv $(PKGDIR ) /usr/local/bin/iojs-universal $(PKGDIR ) /usr/local/bin/iojs
277- rm -rf $(PKGDIR ) /32
278- cat tools/osx-pkg.pmdoc/index.xml.tmpl | sed -e ' s|__iojsversion__|' $(FULLVERSION ) ' |g' | sed -e ' s|__npmversion__|' $(NPMVERSION ) ' |g' > tools/osx-pkg.pmdoc/index.xml
302+ SIGN=" $( CODESIGN_CERT) " PKGDIR=" $( PKGDIR) " bash tools/osx-codesign.sh
303+ cat tools/osx-pkg.pmdoc/index.xml.tmpl \
304+ | sed -E " s/\\ {iojsversion\\ }/$( FULLVERSION) /g" \
305+ | sed -E " s/\\ {npmversion\\ }/$( NPMVERSION) /g" \
306+ > tools/osx-pkg.pmdoc/index.xml
279307 $(PACKAGEMAKER ) \
280- --id " org.nodejs.Node " \
308+ --id " org.iojs.pkg " \
281309 --doc tools/osx-pkg.pmdoc \
282310 --out $(PKG )
283- SIGN=" $( INT_SIGN) " PKG=" $( PKG) " bash tools/osx-productsign.sh
311+ SIGN=" $( PRODUCTSIGN_CERT) " PKG=" $( PKG) " bash tools/osx-productsign.sh
312+
313+ pkg : $(PKG )
314+
315+ pkg-upload : pkg
316+ ssh $(STAGINGSERVER ) " mkdir -p staging/$( DISTTYPEDIR) /$( FULLVERSION) "
317+ scp -p iojs-$(FULLVERSION ) .pkg $(STAGINGSERVER ) :staging/$(DISTTYPEDIR ) /$(FULLVERSION ) /iojs-$(FULLVERSION ) .pkg
318+ ssh $(STAGINGSERVER ) " touch staging/$( DISTTYPEDIR) /$( FULLVERSION) /iojs-$( FULLVERSION) .pkg.done"
284319
285320$(TARBALL ) : release-only $(NODE_EXE ) doc
286321 git checkout-index -a -f --prefix=$(TARNAME ) /
@@ -303,6 +338,20 @@ endif
303338
304339tar : $(TARBALL )
305340
341+ tar-upload : tar
342+ ssh $(STAGINGSERVER ) " mkdir -p staging/$( DISTTYPEDIR) /$( FULLVERSION) "
343+ scp -p iojs-$(FULLVERSION ) .tar.gz $(STAGINGSERVER ) :staging/$(DISTTYPEDIR ) /$(FULLVERSION ) /iojs-$(FULLVERSION ) .tar.gz
344+ ssh $(STAGINGSERVER ) " touch staging/$( DISTTYPEDIR) /$( FULLVERSION) /iojs-$( FULLVERSION) .tar.gz.done"
345+ ifeq ($(XZ ) , 0)
346+ scp -p iojs-$(FULLVERSION).tar.xz $(STAGINGSERVER):staging/$(DISTTYPEDIR)/$(FULLVERSION)/iojs-$(FULLVERSION).tar.xz
347+ ssh $(STAGINGSERVER) "touch staging/$(DISTTYPEDIR)/$(FULLVERSION)/iojs-$(FULLVERSION).tar.xz.done"
348+ endif
349+
350+ doc-upload : tar
351+ ssh $(STAGINGSERVER ) " mkdir -p staging/$( DISTTYPEDIR) /$( FULLVERSION) "
352+ scp -r out/doc/ $(STAGINGSERVER ) :staging/$(DISTTYPEDIR ) /$(FULLVERSION ) /
353+ ssh $(STAGINGSERVER ) " touch staging/$( DISTTYPEDIR) /$( FULLVERSION) /doc.done"
354+
306355$(BINARYTAR ) : release-only
307356 rm -rf $(BINARYNAME )
308357 rm -rf out/deps out/Release
@@ -321,18 +370,14 @@ endif
321370
322371binary : $(BINARYTAR )
323372
324- $(PKGSRC ) : release-only
325- rm -rf dist out
326- $(PYTHON ) configure --prefix=/ \
327- --dest-cpu=$(DESTCPU ) --tag=$(TAG ) $(CONFIG_FLAGS )
328- $(MAKE ) install DESTDIR=dist
329- (cd dist; find * -type f | sort) > packlist
330- pkg_info -X pkg_install | \
331- egrep ' ^(MACHINE_ARCH|OPSYS|OS_VERSION|PKGTOOLS_VERSION)' > build-info
332- pkg_create -B build-info -c tools/pkgsrc/comment -d tools/pkgsrc/description \
333- -f packlist -I /opt/local -p dist -U $(PKGSRC )
334-
335- pkgsrc : $(PKGSRC )
373+ binary-upload : binary
374+ ssh $(STAGINGSERVER ) " mkdir -p staging/$( DISTTYPEDIR) /$( FULLVERSION) "
375+ scp -p iojs-$(FULLVERSION ) -$(OSTYPE ) -$(ARCH ) .tar.gz $(STAGINGSERVER ) :staging/$(DISTTYPEDIR ) /$(FULLVERSION ) /iojs-$(FULLVERSION ) -$(OSTYPE ) -$(ARCH ) .tar.gz
376+ ssh $(STAGINGSERVER ) " touch staging/$( DISTTYPEDIR) /$( FULLVERSION) /iojs-$( FULLVERSION) -$( OSTYPE) -$( ARCH) .tar.gz.done"
377+ ifeq ($(XZ ) , 0)
378+ scp -p iojs-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.xz $(STAGINGSERVER):staging/$(DISTTYPEDIR)/$(FULLVERSION)/iojs-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.xz
379+ ssh $(STAGINGSERVER) "touch staging/$(DISTTYPEDIR)/$(FULLVERSION)/iojs-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.xz.done"
380+ endif
336381
337382haswrk =$(shell which wrk > /dev/null 2>&1; echo $$? )
338383wrk :
0 commit comments