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

Refactor mac installer (built on #2571) #5656

Closed
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,9 @@ test.tap
# Xcode workspaces and project folders
*.xcodeproj
*.xcworkspace

# mac installer files
/tools/osx-pkg/osx-pkg-out.pkgproj
/tools/osx-pkg/strings/license.rtf
/tools/osx-pkg/strings/**/*.out.rtf
/tools/osx-pkg/scripts/nodejs-run-uninstall
41 changes: 29 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ BINARYTAR=$(BINARYNAME).tar
XZ=$(shell which xz > /dev/null 2>&1; echo $$?)
XZ_COMPRESSION ?= 9
PKG=$(TARNAME).pkg
PACKAGEMAKER ?= /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
PACKAGESBUILD ?= /usr/local/bin/packagesbuild
PKGDIR=out/dist-osx

release-only:
Expand Down Expand Up @@ -464,6 +464,26 @@ release-only:
exit 1 ; \
fi

pre-pkg:
touch tools/osx-pkg/scripts/nodejs-run-uninstall # empty file for uninstall step
$(NODE) tools/license2rtf.js < LICENSE > tools/osx-pkg/strings/license.rtf
cat tools/osx-pkg/osx-pkg.pkgproj | \
sed -e 's|__nodeversion__|'$(FULLVERSION)'|g' \
-e 's|introduction.rtf|introduction.out.rtf|g' \
-e 's|summary.rtf|summary.out.rtf|g' > \
tools/osx-pkg/osx-pkg-out.pkgproj
$(foreach dir, \
$(shell echo tools/osx-pkg/strings/*/), \
cat $(dir)introduction.rtf | \
sed -e 's|__nodeversion__|'$(FULLVERSION)'|g' | \
sed -e 's|__npmversion__|'$(NPMVERSION)'|g' > \
$(dir)introduction.out.rtf && \
cat $(dir)summary.rtf | \
sed -e 's|__nodeversion__|'$(FULLVERSION)'|g' | \
sed -e 's|__npmversion__|'$(NPMVERSION)'|g' > \
$(dir)summary.out.rtf; \
)

$(PKG): release-only
rm -rf $(PKGDIR)
rm -rf out/deps out/Release
Expand All @@ -472,16 +492,13 @@ $(PKG): release-only
--tag=$(TAG) \
--release-urlbase=$(RELEASE_URLBASE) \
$(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)
$(MAKE) all V=$(V)
NODE_INSTALL_NODE_ONLY=1 $(PYTHON) tools/install.py install '$(PKGDIR)/node' '$(PREFIX)'
NODE_INSTALL_HEADERS_ONLY=1 $(PYTHON) tools/install.py install '$(PKGDIR)/node' '$(PREFIX)'
Copy link
Contributor

Choose a reason for hiding this comment

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

no different than NODE_INSTALL_NODE_ONLY?

NODE_INSTALL_NPM_ONLY=1 $(PYTHON) tools/install.py install '$(PKGDIR)/npm' '$(PREFIX)'
$(MAKE) pre-pkg V=$(V)
SIGN="$(CODESIGN_CERT)" PKGDIR="$(PKGDIR)/node" bash tools/osx-codesign.sh
$(PACKAGESBUILD) tools/osx-pkg/osx-pkg-out.pkgproj
SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" bash tools/osx-productsign.sh

pkg: $(PKG)
Expand Down Expand Up @@ -542,7 +559,7 @@ $(TARBALL)-headers: release-only
--tag=$(TAG) \
--release-urlbase=$(RELEASE_URLBASE) \
$(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
HEADERS_ONLY=1 $(PYTHON) tools/install.py install '$(TARNAME)' '/'
NODE_INSTALL_HEADERS_ONLY=1 $(PYTHON) tools/install.py install '$(TARNAME)' '/'
find $(TARNAME)/ -type l | xargs rm -f
tar -cf $(TARNAME)-headers.tar $(TARNAME)
rm -rf $(TARNAME)
Expand Down
27 changes: 16 additions & 11 deletions tools/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def try_unlink(path):

def try_symlink(source_path, link_path):
print 'symlinking %s -> %s' % (source_path, link_path)
try_mkdir_r(os.path.dirname(link_path))
try_unlink(link_path)
os.symlink(source_path, link_path)

Expand Down Expand Up @@ -106,6 +107,18 @@ def subdir_files(path, dest, action):
action(files, subdir + '/')

def files(action):
if os.environ.get('NODE_INSTALL_HEADERS_ONLY'):
header_files(action)
elif os.environ.get('NODE_INSTALL_NODE_ONLY'):
node_files(action)
elif os.environ.get('NODE_INSTALL_NPM_ONLY'):
npm_files(action)
else:
node_files(action)
header_files(action)
if 'true' == variables.get('node_install_headers'): npm_files(action)

def node_files(action):
is_windows = sys.platform == 'win32'

exeext = '.exe' if is_windows else ''
Expand All @@ -124,11 +137,7 @@ def files(action):
else:
action(['doc/node.1'], 'share/man/man1/')

if 'true' == variables.get('node_install_npm'): npm_files(action)

headers(action)

def headers(action):
def header_files(action):
action([
'common.gypi',
'config.gypi',
Expand Down Expand Up @@ -184,12 +193,8 @@ def run(args):

cmd = args[1] if len(args) > 1 else 'install'

if os.environ.get('HEADERS_ONLY'):
if cmd == 'install': return headers(install)
if cmd == 'uninstall': return headers(uninstall)
else:
if cmd == 'install': return files(install)
if cmd == 'uninstall': return files(uninstall)
if cmd == 'install': return files(install)
if cmd == 'uninstall': return files(uninstall)

raise RuntimeError('Bad command: %s\n' % cmd)

Expand Down
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.

46 changes: 46 additions & 0 deletions tools/osx-pkg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## osx-pkg

### Build

Prerequisites:

* Packages: http://s.sudre.free.fr/Software/Packages/about.html

In the root folder:

```bash
make pkg
```

### Localization

There are two files that can be localized in the OS X installer: the
introduction, and the summary.

1. Make sure you've installed Packages:
http://s.sudre.free.fr/Software/Packages/about.html
2. Duplicate the `strings/en` folder for reference, and rename the folder to
the language you are localizing (ex. `fr`, `ru`, etc.)
3. Translate `introduction.rtf` and `summary.rtf`. Do not modify the words
`__nodeversion__` or `__npmversion__`, as these are automatically replaced
by the build step with the Node.js and npm versions, respectively.
4. In the root folder, run `make pre-pkg`. This will generate the
files needed for Packages.
5. Open `tools/osx-pkg/osx-pkg.pkgproj` in Packages. (Not
`osx-pkg-out.pkgproj`, as this is a generated file)
6. In Packages, go to the Presentation tab, and if not already selected,
choose "Introduction" from the dropdown on the right-hand side.
![packages preview](https://s3.amazonaws.com/f.cl.ly/items/3q160p2r1X1B3i2N1W42/Screen%20Shot%202015-02-09%20at%207.26.09%20PM.png)
7. Press the "+" at the bottom right. This will add a new language entry. Click
on the flag, and choose which language you are localizing.
8. Click on the column next to the flag, and ensure "Relative to Project" is
selected. It's a rectangle with the letter "R" inside of it.
9. Click on the last column, which will currently have a dash in it, and
press "Choose...".
10. Locate the `introduction.rtf` file you translated, and choose it.
Don't worry about the `introduction.out.rtf` file, as this is an autogenerated
file, and is dealt with when compiling.
11. In the dropdown that says "Introduction" at the top, choose "Conclusion"
and repeat this process for the `conclusion.rtf` file.
12. Save the project, and commit your changes. The generated files are
automatically ignored by Git, so you don't have to worry about accidentally committing them in.
Loading