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 generation #776

Closed
wants to merge 12 commits into from
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ ipch/
/dist-osx
/npm.wxs
/tools/msvs/npm.wixobj
/tools/osx-pkg.pmdoc/index.xml
/test/addons/doc-*/
email.md
deps/v8-*
Expand Down Expand Up @@ -77,3 +76,10 @@ deps/zlib/zlib.target.mk
tools/faketime
icu_config.gypi
test.tap

# mac installer files
/tools/osx-pkg/osx-pkg-out.pkgproj
/tools/osx-pkg/strings/LICENSE.txt
/tools/osx-pkg/strings/**/*.out.rtf
/tools/osx-pkg/scripts/iojs-create-node-symlink
/tools/osx-pkg/scripts/iojs-run-uninstall
33 changes: 23 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PYTHON ?= python
DESTDIR ?=
SIGN ?=
PREFIX ?= /usr/local
NO_SYMLINK ?= false

# Determine EXEEXT
EXEEXT := $(shell $(PYTHON) -c \
Expand Down Expand Up @@ -50,7 +51,7 @@ config.gypi: configure
fi

install: all
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)' '$(NO_SYMLINK)'

uninstall:
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
Expand Down Expand Up @@ -219,7 +220,7 @@ BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
BINARYTAR=$(BINARYNAME).tar
XZ=$(shell which xz > /dev/null 2>&1; echo $$?)
PKG=out/$(TARNAME).pkg
packagemaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
packagesbuild=/usr/local/bin/packagesbuild

PKGSRC=iojs-$(DESTCPU)-$(RAWVER).tgz
ifdef NIGHTLY
Expand Down Expand Up @@ -252,28 +253,40 @@ release-only:
exit 1 ; \
fi

pre-pkg:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be added to .PHONY?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tellnes Good catch. Fixed, thanks!

touch tools/osx-pkg/scripts/iojs-create-node-symlink # empty file for symlink step
touch tools/osx-pkg/scripts/iojs-run-uninstall # empty file for uninstall step
cp LICENSE tools/osx-pkg/strings/LICENSE.txt
cat tools/osx-pkg/osx-pkg.pkgproj | \
sed -e 's|__iojsversion__|'$(FULLVERSION)'|g' | \
sed -e 's|introduction.rtf|introduction.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|__iojsversion__|'$(FULLVERSION)'|g' | \
sed -e 's|__npmversion__|'$(NPMVERSION)'|g' > \
$(dir)introduction.out.rtf; \
)

pkg: $(PKG)

$(PKG): release-only
$(PKG): release-only pre-pkg
rm -rf $(PKGDIR)
rm -rf out/deps out/Release
$(PYTHON) ./configure --dest-cpu=ia32 --tag=$(TAG)
$(MAKE) install V=$(V) DESTDIR=$(PKGDIR)/32
rm -rf out/deps out/Release
$(PYTHON) ./configure --dest-cpu=x64 --tag=$(TAG)
$(MAKE) install V=$(V) DESTDIR=$(PKGDIR)
$(MAKE) install V=$(V) DESTDIR=$(PKGDIR) NO_SYMLINK=true
SIGN="$(APP_SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
lipo $(PKGDIR)/32/usr/local/bin/iojs \
$(PKGDIR)/usr/local/bin/iojs \
-output $(PKGDIR)/usr/local/bin/iojs-universal \
-create
mv $(PKGDIR)/usr/local/bin/iojs-universal $(PKGDIR)/usr/local/bin/iojs
rm -rf $(PKGDIR)/32
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
$(packagemaker) \
--id "org.nodejs.Node" \
--doc tools/osx-pkg.pmdoc \
--out $(PKG)
$(packagesbuild) tools/osx-pkg/osx-pkg-out.pkgproj
SIGN="$(INT_SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh

$(TARBALL): release-only $(NODE_EXE) doc
Expand Down Expand Up @@ -402,4 +415,4 @@ cpplint:

lint: jslint cpplint

.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install install-includes install-bin all staticlib dynamiclib test test-all test-addons build-addons website-upload pkg blog blogclean tar binary release-only bench-http-simple bench-idle bench-all bench bench-misc bench-array bench-buffer bench-net bench-http bench-fs bench-tls
.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install install-includes install-bin all staticlib dynamiclib test test-all test-addons build-addons website-upload pre-pkg pkg blog blogclean tar binary release-only bench-http-simple bench-idle bench-all bench bench-misc bench-array bench-buffer bench-net bench-http bench-fs bench-tls
7 changes: 5 additions & 2 deletions tools/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
install_path = None # base target directory (DESTDIR + PREFIX from Makefile)
target_defaults = None
variables = None
no_symlink = False

def abspath(*args):
path = os.path.join(*args)
Expand Down Expand Up @@ -132,7 +133,7 @@ def files(action):
exeext = '.exe' if is_windows else ''
action(['out/Release/iojs' + exeext], 'bin/iojs' + exeext)

if not is_windows:
if not is_windows and not no_symlink:
# Install iojs -> node compatibility symlink.
link_target = 'bin/node'
link_path = abspath(install_path, link_target)
Expand Down Expand Up @@ -186,14 +187,16 @@ def files(action):
], 'include/node/')

def run(args):
global node_prefix, install_path, target_defaults, variables
global node_prefix, install_path, target_defaults, variables, no_symlink

# chdir to the project's top-level directory
os.chdir(abspath(os.path.dirname(__file__), '..'))

conf = load_config()
variables = conf['variables']
target_defaults = conf['target_defaults']
# argv[4] is a variable representing whether a symlink should be made
no_symlink = len(args) > 4 and args[4] == 'true'

# argv[2] is a custom install prefix for packagers (think DESTDIR)
# argv[3] is a custom install prefix (think PREFIX)
Expand Down
4 changes: 2 additions & 2 deletions tools/osx-codesign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ if ! [ -n "$SIGN" ] && [ $STEP -eq 1 ]; then
exit 0
fi

codesign -s "$SIGN" "$PKGDIR"/usr/local/bin/node
codesign -s "$SIGN" "$PKGDIR"/32/usr/local/bin/node
codesign -s "$SIGN" "$PKGDIR"/usr/local/bin/iojs
codesign -s "$SIGN" "$PKGDIR"/32/usr/local/bin/iojs
1 change: 0 additions & 1 deletion tools/osx-pkg.pmdoc/01local-contents.xml

This file was deleted.

1 change: 0 additions & 1 deletion 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.

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

This file was deleted.

21 changes: 0 additions & 21 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 io.js 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
`__iojsversion__` or `__npmversion__`, as these are automatically replaced
by the build step with the io.js and npm versions, respectively.
4. In the root `io.js` 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