Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] build: use productbuild to build .pkg files #7097

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ ipch/
/tools/msvs/npm.wixobj
/tools/msvs/genfiles/
/tools/osx-pkg.pmdoc/index.xml
/tools/osx-pkg/resources/welcome.rtf
/tools/osx-pkg/resources/LICENSE
/tools/osx-pkg/resources/**/welcome.rtf
*node*.pkg
/test/addons/??_*/
email.md
deps/v8-*
Expand Down
33 changes: 25 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -469,14 +469,31 @@ $(PKG): release-only
$(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
$(MAKE) install V=$(V) DESTDIR=$(PKGDIR)
SIGN="$(CODESIGN_CERT)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
cat tools/osx-pkg.pmdoc/index.xml.tmpl \
| sed -E "s/\\{nodeversion\\}/$(FULLVERSION)/g" \
| sed -E "s/\\{npmversion\\}/$(NPMVERSION)/g" \
> tools/osx-pkg.pmdoc/index.xml
$(PACKAGEMAKER) \
--id "org.nodejs.pkg" \
--doc tools/osx-pkg.pmdoc \
--out $(PKG)
FULLVERSION="$(FULLVERSION)" NPMVERSION="$(NPMVERSION)" tools/osx-pkg/copy_langs.sh

cp LICENSE tools/osx-pkg/resources/LICENSE

pkgbuild \
--root $(PKGDIR) \
--identifier org.nodejs.node.pkg \
--version 1 \
--install-location / \
org.nodejs.node.pkg

pkgbuild \
--root deps/npm \
--identifier org.nodejs.npm.pkg \
--version 1 \
--install-location / \
--scripts tools/osx-pkg/scripts \
org.nodejs.npm.pkg

productbuild \
--distribution tools/osx-pkg/node.xml \
--resources tools/osx-pkg/resources \
--package-path tools/osx-pkg \
$(PKG)

SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" bash tools/osx-productsign.sh

pkg: $(PKG)
Expand Down
5 changes: 0 additions & 5 deletions tools/osx-pkg-postinstall.sh

This file was deleted.

1 change: 0 additions & 1 deletion tools/osx-pkg.pmdoc/01local-contents.xml

This file was deleted.

25 changes: 0 additions & 25 deletions tools/osx-pkg.pmdoc/01local.xml

This file was deleted.

1 change: 0 additions & 1 deletion tools/osx-pkg.pmdoc/02npm-contents.xml

This file was deleted.

24 changes: 0 additions & 24 deletions tools/osx-pkg.pmdoc/02npm.xml

This file was deleted.

55 changes: 0 additions & 55 deletions tools/osx-pkg.pmdoc/index.xml.tmpl

This file was deleted.

18 changes: 18 additions & 0 deletions tools/osx-pkg/copy_langs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e
set -x

FULLVERSION="$FULLVERSION"
NPMVERSION="$NPMVERSION"

for dir in tools/osx-pkg/languages/*; do
if [[ -d "$dir" ]]; then
d=$(basename "$dir")
mkdir -p tools/osx-pkg/resources/"$d"
cat "$dir/welcome.rtf.tmpl" \
| sed -E "s/\\{nodeversion\\}/$FULLVERSION/g" \
| sed -E "s/\\{npmversion\\}/$NPMVERSION/g" \
> tools/osx-pkg/resources/"$d"/welcome.rtf
fi
done
6 changes: 6 additions & 0 deletions tools/osx-pkg/languages/en.lproj/welcome.rtf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\fs26 \cf0 This package will install Node.js {nodeversion} and npm {npmversion} into /usr/local/.}
26 changes: 26 additions & 0 deletions tools/osx-pkg/node.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="2">
<pkg-ref id="org.nodejs.node.pkg"/>
<pkg-ref id="org.nodejs.npm.pkg"/>
<title>Node.js</title>
<welcome file="welcome.rtf" mime-type="text/rtf"/>
<conclusion file="conclusion.rtf" mime-type="text/rtf"/>
<allowed-os-versions>
<os-version min="10.7.0"/>
</allowed-os-versions>
<license file="LICENSE"/>
<background file="osx_installer_logo.png" alignment="topleft" mime-type="image/png"/>
<options customize="allow" require-scripts="false"/>
<choices-outline>
<line choice="org.nodejs.node.pkg"/>
<line choice="org.nodejs.npm.pkg"/>
</choices-outline>
<choice id="org.nodejs.node.pkg" visible="true" title="Node.js" starts_selected="true" starts_enabled="true" starts_visible="true">
<pkg-ref id="org.nodejs.node.pkg"/>
</choice>
<pkg-ref id="org.nodejs.node.pkg" version="1" onConclusion="none">org.nodejs.node.pkg</pkg-ref>
<choice id="org.nodejs.npm.pkg" visible="true" title="npm" starts_selected="true" starts_enabled="true" starts_visible="true">
<pkg-ref id="org.nodejs.npm.pkg"/>
</choice>
<pkg-ref id="org.nodejs.npm.pkg" version="1" onConclusion="none">org.nodejs.npm.pkg</pkg-ref>
</installer-gui-script>
14 changes: 14 additions & 0 deletions tools/osx-pkg/resources/conclusion.rtf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\fs26 \cf0 Node.js was installed at\
\
/usr/local/bin/node\
\
npm was installed at\
\
/usr/local/bin/npm\
\
Make sure that /usr/local/bin is in your $PATH.}
Binary file added tools/osx-pkg/resources/osx_installer_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions tools/osx-pkg/scripts/postinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

cd /usr/local/bin
ln -sf ../lib/node_modules/npm/bin/npm-cli.js npm
4 changes: 4 additions & 0 deletions tools/osx-pkg/scripts/preflight
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

[[ -d /usr/local/lib/node_modules/npm ]] \
&& rm -rf /usr/local/lib/node_modules/npm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yessss!!!!