Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddie Cameron committed Jul 17, 2020
0 parents commit 57b8473
Show file tree
Hide file tree
Showing 17 changed files with 1,350 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .this-is-the-repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This is just a dummy file so script can tell whether it's being run from
inside the Git repo or from an installed location.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020 Eddie Cameron

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
PACKAGE_TARNAME = notarize-app

prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
datarootdir = ${prefix}/share
datadir = ${datarootdir}
libdir = ${prefix}/lib

INSTALL = install
INSTALL_PROGRAM = $(INSTALL)

.PHONY: install uninstall

install: notarize-app
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) $(PACKAGE_TARNAME) $(DESTDIR)$(bindir)/$(PACKAGE_TARNAME)
$(INSTALL) -d $(DESTDIR)$(datadir)/$(PACKAGE_TARNAME)
cp -R support $(DESTDIR)$(datadir)/$(PACKAGE_TARNAME)
$(INSTALL) -d $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)
cp -R lib/create-dmg $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)

uninstall:
rm -f $(DESTDIR)$(bindir)/$(PACKAGE_TARNAME)
rm -rf $(DESTDIR)$(datadir)/$(PACKAGE_TARNAME)
rm -rf $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)
108 changes: 108 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# app-notarizer
===============
Notarizes OSX apps built outside of Xcode, and optionally packages them into .dmgs for easy distribution.

## About
This tool was made to make notarizing Unity3D .apps easier. It should still work with other .apps, and I'll try fixing errors to keep it general, but Unity games are what I test it on.
You do need a Mac running a recent version of Xcode, and an up to date, paid, Apple developer account. Please direct complaints to Apple, there's no reason this shouldn't be possible on older Macs and without paying Apple.
Big thanks to the maintainers of [create-dmg](https://github.com/create-dmg/create-dmg/blob/master/README.md), and to @dpid for this great gist guide to notarizing Unity builds (the manual way) https://gist.github.com/dpid/270bdb6c1011fe07211edf431b2d0fe4
If you run into trouble, read that guide (and maybe the comments) in detail, a lot of common issues are discussed.

## Install

- Download or clone repo, then run:
```sh
make install
```

## How 2 Use
```sh
app-notarizer [options] <folder containing .app, or blank to use current directory>
```

By default, app-notarizer looks for a .app in the given folder, signs it, along with any libraries inside it, then notarizes it and uploads to Apple.
Optionally, it can also package the .app along with any other files in the same folder into a .dmg.

#### Credentials
app-notarizer needs to be given credentials to your Apple developer account the first time you run it. It stores them in `~/.app-notarizer.conf` so you don't have to keep looking them up. You need to provide these options:
- Developer ID certificate (--cert)
This is what the build is code signed against. Make sure you have a "Developer ID Certificate" on your developer account, and install it to your mac. You need its full name, which can be found in Keychain Access under certificates, eg: "Developer ID Application: YourName (xxxxxxxxx)"

- Password (--pwd)
You need to generate an app specific password for the tool to get access to your developer account. Create at https://appleid.apple.com under 'Security'.

- Username (--username)
Your Apple ID

- Provider shortname (--provider)
This is generally your apple team id, but if that doesn't work, you'll need your 'Provider Short Name', which can be found by running
```sh
xcrun iTMSTransporter -m provider -u YourAppleIDUsername -p apps-peci-ficp-word
```

#### Notarization Options
- Entitlements (--entitlements)
By default, the tool uses a bare bones entitlements file to support a minimal Unity3d Mono build (with entitlements `disable-library-validation`, and `disable-executable-page-protection`). If you need more (or less), you can provide a path to your own entitlements file, in the standard format https://developer.apple.com/documentation/bundleresources/entitlements

- Replacement Mono library (--replace-mono-lib)
This is a hack to allow notarization of older Unity mono builds, which include a mono library that is built against a too-old version of OSX. This lets you provide a path to a replacement, working, mono framework. If you aren't making a unity 5.x app, you don't need to worry about this. If you are, read this: https://asmaloney.com/2020/03/howto/notarizing-older-unity-games-on-macos/

#### DMG options
If you plan to distribute your app as a DMG, it must also be notarized. Add the (--make-dmg) flag to make a basic "Drag to applications folder" DMG, with the following options:
- DMG name (--dmg-name)
The name of the output dmg file (without .dmg). Defaults to the same as the .app if not provided

- Window size (--window)
The width and height of the dmg window when mounted

- Background (--background)
Path to an image to show as the background to the mounted dmg in finder. Defaults to a rather handsome arrow

- App icon position (--icon-position)
X and Y position of the .app's icon in the DMG. Defaults to the left hand side of the handsome arrow

- Application shortcut position (--app-drop-link)
X and Y position of the shortcut to the /Applications folder in the dmg. Defaults to the, oh yes, the right side of the handsome arrow

## Options
```sh
Creates, signs, and notarizes a .app into a DMG
Usage: notarize-app [options] <src folder to make into dmg (containing .app & any other files)>

Options:
== Apple Notarization Credientials ==
--cert <certificate name>
name of Developer ID certificate eg: "Developer ID Application: My Name (CODECODE)" (required)
--username <username>
username on apple developer account (email) (required)
--pwd <pwd>
one-time password generated from appleid site (xxxx-yyyy-zzzz) (required)
--provider <provider_shortname>
the provider short-name on your apple account. Often, but not always, the same as your team id (required)

== Notarization Options ==
--entitlements <file.entitlements>
path to non-default entitlements file
--replace-mono-lib <path_to_lib_folder>
provide a patched mono framework for Unity 5 (replaces MonoEmbedRuntime under .app/Contents/Frameworks)

== DMG Packaging ==
If none of these options are set, a DMG will not be made, and only the .app will be signed
--make-dmg
add this flag to make a dmg package with default options
--dmg-name <name (without .dmg)>
name of the dmg package. Defaults to the same filename as the .app
--window <x> <y>
size of the DMG window
--background <file_name>
image file to use as background of DMG window
--icon-position <x> <y>
position of app icon in DMG window
--app-drop-link <x> <y>
make a drop link to Applications, at location x,y

-h, --help
display this help screen

==============
``
2 changes: 2 additions & 0 deletions lib/create-dmg/.this-is-the-create-dmg-repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This is just a dummy file so create-dmg can tell whether it's being run from
inside the Git repo or from an installed location.
22 changes: 22 additions & 0 deletions lib/create-dmg/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2008-2014 Andrey Tarantsov
Copyright (c) 2020 Andrew Janke

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
33 changes: 33 additions & 0 deletions lib/create-dmg/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Makefile for Cowsay

PACKAGE_TARNAME = create-dmg

prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
datarootdir = ${prefix}/share
datadir = ${datarootdir}
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
sysconfdir = ${prefix}/etc
mandir=${datarootdir}/man
srcdir = .

SHELL = /bin/sh
INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = ${INSTALL} -m 644

.PHONY: install uninstall

install: create-dmg
$(INSTALL) -d $(DESTDIR)$(prefix)
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) create-dmg $(DESTDIR)$(bindir)/create-dmg
$(INSTALL) -d $(DESTDIR)$(datadir)/$(PACKAGE_TARNAME)
cp -R support $(DESTDIR)$(datadir)/$(PACKAGE_TARNAME)
cp -R examples $(DESTDIR)$(datadir)/$(PACKAGE_TARNAME)
cp -R tests $(DESTDIR)$(datadir)/$(PACKAGE_TARNAME)

uninstall:
rm -f $(DESTDIR)$(bindir)/create-dmg
rm -rf $(DESTDIR)$(datadir)/$(PACKAGE_TARNAME)
115 changes: 115 additions & 0 deletions lib/create-dmg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
create-dmg
==========

A shell script to build fancy DMGs.

Status and contribution policy
------------------------------

Create-dmg is maintained thanks to the contributors who send pull requests.
As of May 2020, [Andrew Janke](https://github.com/apjanke) is the primary maintainer, and (since September 2018) [@aonez](https://github.com/aonez) has helped with the maintenance.
The project home page is <https://github.com/create-dmg/create-dmg>.

We will merge any pull request that adds something useful and does not break existing things.

If you're an active user and want to be a maintainer, or just want to chat, please ping us on Gitter at [gitter.im/create-dmg/Lobby](https://gitter.im/create-dmg/Lobby), or [email Andrew directly]([email protected]).

Create-dmg was originally created by [Andrey Tarantsov](https://github.com/andreyvit).

Installation
------------

- You can install this script using [Homebrew](https://brew.sh):

```sh
brew install create-dmg
```

- You can download the [latest release](https://github.com/create-dmg/create-dmg/releases/latest) and install it from there:

```sh
make install
```

- You can also clone the entire repository and run it locally from there:

```sh
git clone https://github.com/create-dmg/create-dmg.git
```

Usage
-----

```sh
create-dmg [options ...] <output_name.dmg> <source_folder>
```

All contents of source\_folder will be copied into the disk image.

**Options:**

- **--volname \<name\>:** set volume name (displayed in the Finder sidebar and window title)
- **--volicon \<icon.icns\>:** set volume icon
- **--background \<pic.png\>:** set folder background image (provide png, gif, jpg)
- **--window-pos \<x\> \<y\>:** set position the folder window
- **--window-size \<width\> \<height\>:** set size of the folder window
- **--text-size \<text_size\>:** set window text size (10-16)
- **--icon-size \<icon_size\>:** set window icons size (up to 128)
- **--icon \<file_name\> \<x\> \<y\>:** set position of the file's icon
- **--hide-extension \<file_name\>:** hide the extension of file
- **--custom-icon \<file_name|custom_icon|sample_file\> \<x\> \<y\>:** set position and -tom icon
- **--app-drop-link \<x\> \<y\>:** make a drop link to Applications, at location x, y
- **--ql-drop-link \<x\> \<y\>:** make a drop link to /Library/QuickLook, at location x, y
- **--eula \<eula_file\>:** attach a license file to the dmg
- **--rez \<rez_path\>:** specify custom path to Rez tool used to include license file
- **--no-internet-enable:** disable automatic mount&copy
- **--format:** specify the final image format (default is UDZO)
- **--add-file \<target_name\> \<file|folder\> \<x\> \<y\>:** add additional file or folder (can be used multiple times)
- **--disk-image-size \<x\>:** set the disk image size manually to x MB
- **--hdiutil-verbose:** execute hdiutil in verbose mode
- **--hdiutil-quiet:** execute hdiutil in quiet mode
- **--sandbox-safe:** execute hdiutil with sandbox compatibility, do not bless and do not execute the cosmetic AppleScript
- **--version:** show tool version number
- **-h, --help:** display the help

Example
-------

```sh
#!/bin/sh
test -f Application-Installer.dmg && rm Application-Installer.dmg
create-dmg \
--volname "Application Installer" \
--volicon "application_icon.icns" \
--background "installer_background.png" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "Application.app" 200 190 \
--hide-extension "Application.app" \
--app-drop-link 600 185 \
"Application-Installer.dmg" \
"source_folder/"
```

See the `examples` folder in the source tree for more examples.

Requirements
------------

Nothing except a standard installation of macOS/OS X is required.

We think this works in OS X 10.6 Snow Leopard and later.

We'd like to keep it working in as many versions as possible, but unfortunately, we just don't have test boxes running old versions of OS X adequate to make this happen. Development and testing mostly happens in the last 3-5 years' worth of macOS releases; as of 2020, this means macOS 10.12 and later.

But if you find a bug in an older version, go ahead and report it! We'll try to work with you to get it fixed.

If you're running OS X 10.5 or later, you're SOL. That's just too hard to deal with in 2020. ;)

Alternatives
------------

- [node-appdmg](https://github.com/LinusU/node-appdmg)
- [dmgbuild](https://pypi.python.org/pypi/dmgbuild)
- see the [StackOverflow question](http://stackoverflow.com/questions/96882/how-do-i-create-a-nice-looking-dmg-for-mac-os-x-using-command-line-tools)
Loading

0 comments on commit 57b8473

Please sign in to comment.