Skip to content

Commit 2dd710e

Browse files
committed
build: Sign pkg installer for OS X
This makes the installer work on Mountain Lion.
1 parent 37537d5 commit 2dd710e

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
BUILDTYPE ?= Release
44
PYTHON ?= python
55
DESTDIR ?=
6+
SIGN ?=
67

78
# Default to verbose builds.
89
# To do quiet/pretty builds, run `make V=` to set V to an empty string,
@@ -210,16 +211,18 @@ $(PKG):
210211
rm -rf out/deps out/Release
211212
./configure --prefix=$(PKGDIR)/usr/local --without-snapshot --dest-cpu=x64
212213
$(MAKE) install V=$(V)
214+
SIGN="$(SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
213215
lipo $(PKGDIR)/32/usr/local/bin/node \
214216
$(PKGDIR)/usr/local/bin/node \
215217
-output $(PKGDIR)/usr/local/bin/node-universal \
216218
-create
217219
mv $(PKGDIR)/usr/local/bin/node-universal $(PKGDIR)/usr/local/bin/node
218220
rm -rf $(PKGDIR)/32
219221
$(packagemaker) \
220-
--id "org.nodejs.NodeJS-$(VERSION)" \
222+
--id "org.nodejs.Node" \
221223
--doc tools/osx-pkg.pmdoc \
222224
--out $(PKG)
225+
SIGN="$(SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
223226

224227
$(TARBALL): node doc
225228
@if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \

tools/osx-codesign.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -x
4+
set -e
5+
6+
if ! [ -n "$SIGN" ] && [ $STEP -eq 1 ]; then
7+
echo "No SIGN environment var. Skipping codesign." >&2
8+
exit 0
9+
fi
10+
11+
codesign -s "$SIGN" "$PKGDIR"/usr/local/bin/node
12+
codesign -s "$SIGN" "$PKGDIR"/32/usr/local/bin/node

tools/osx-productsign.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -x
4+
set -e
5+
6+
if ! [ -n "$SIGN" ]; then
7+
echo "No SIGN environment var. Skipping codesign." >&2
8+
exit 0
9+
fi
10+
11+
productsign --sign "$SIGN" "$PKG" "$PKG"-SIGNED
12+
mv "$PKG"-SIGNED "$PKG"

0 commit comments

Comments
 (0)